linearStandupmain.tsx9 matches
5758export async function exec(interval: Interval) {
59const apiKey = Deno.env.get("LINEAR_API_KEY");
60if (!apiKey) {
61console.error("LINEAR_API_KEY not found in environment variables");
62Deno.exit(1);
63}
65const { startDate, endDate } = getYesterdayDateRange();
6667const response = await fetch("https://api.linear.app/graphql", {
68method: "POST",
69headers: {
70"Content-Type": "application/json",
71Authorization: apiKey,
72},
73body: JSON.stringify({
8081if (data.errors) {
82console.error("Error fetching data from Linear API:", data.errors);
83Deno.exit(1);
84}
94}
9596const historyResponse = await fetch("https://api.linear.app/graphql", {
97method: "POST",
98headers: {
99"Content-Type": "application/json",
100Authorization: apiKey,
101},
102body: JSON.stringify({
190}
191192const slackResponse = await fetch("https://slack.com/api/chat.postMessage", {
193method: "POST",
194headers: {
autonomous-valtools.tsx4 matches
77}),
78execute: async ({ query }) => {
79const apiKey = Deno.env.get("EXA_API_KEY");
80const exa = new Exa(apiKey);
81const result = await exa.searchAndContents(query, {
82text: true,
100}),
101execute: async ({ url }) => {
102const apiKey = Deno.env.get("EXA_API_KEY");
103const exa = new Exa(apiKey);
104const result = await exa.getContents([url], { text: true });
105return {
autonomous-valREADME.md9 matches
1# Autonomous Val
2This project demonstrates how to build autonomous agents on Val Town that can be triggered by API calls, cron jobs, etc.
34
89Configure the following variables in your environment:
10- `AGENT_API_KEY` (This is a secure token that you choose to secure the agent.tsx POST endpoint)
11- `OPENAI_API_KEY` (An OpenAI API Key)
12- `EXA_API_KEY` (Optional, though needed if you use the web search tool)
1314## Usage
15Use `demo.tsx` to send objectives to your agent.
1617### API Usage
18To use the API from another client, you can POST authenticated requests to the agent.tsx endpoint:
1920```javascript
30headers: {
31"Content-Type": "application/json",
32"Authorization": `Bearer ${Deno.env.get("AGENT_API_KEY")}`,
33},
34body: JSON.stringify(requestBody),
3738### Streaming Chat
39The API will also work with streaming chat front ends based on the Vercel AI SDK's useChat hook.
4041You just need to pass `streamResults: true` in your API POST request.
4243## Using Other Models
autonomous-valdiagram.tsx1 match
5linkStyle default stroke:#aaaaaa,stroke-width:1.5px
6
7API[API] <--> Agent
8
9subgraph "Agent Runtime"
autonomous-valdemo.tsx5 matches
22objective = formData.get("objective")?.toString() || objective;
2324// Continue with API call using the submitted objective
25} else {
26return new Response("Unsupported content type", { status: 415 });
27}
2829// Make API call with the objective from the form
30const requestBody = {
31messages: [
40headers: {
41"Content-Type": "application/json",
42"Authorization": `Bearer ${Deno.env.get("AGENT_API_KEY")}`,
43},
44body: JSON.stringify(requestBody),
50}
5152// Get the API response data
53const responseData = await response.json();
54console.log("API Response:", responseData);
5556// Return HTML with the results
autonomous-valagent.tsx2 matches
1718export default async function POST(req: Request) {
19if (req.headers.get("Authorization") !== `Bearer ${Deno.env.get("AGENT_API_KEY")}`) {
20return new Response("Unauthorized", { status: 401 });
21}
34const maxSteps = 10;
3536const model = Deno.env.get("ANTHROPIC_API_KEY") ? anthropic("claude-3-7-sonnet-latest") : openai("gpt-4.1");
3738const options = {
asurareleasesbotfile.txt11 matches
264}
265266/*โโโโโโโโโโโโโโโโโโโโ 8 โธ Scraping Logic โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ*/
267function buildChapterObject(
268$: cheerio.CheerioAPI,
269chapterLinkElement: cheerio.Element,
270seriesTitle: string,
305306async function scrapeMainPageForChapterEvents(): Promise<ChapterEventInfo[]> {
307log("Scraping main page for chapter events:", BASE_URL);
308const chapterEvents: ChapterEventInfo[] = [];
309try {
419seriesPageUrl: string,
420): Promise<Pick<ChapterEventInfo, "definitiveSeriesTitle" | "definitiveSeriesImage" | "synopsis">> {
421log("Scraping series page for details:", seriesPageUrl);
422try {
423const { data } = await httpClient.get(seriesPageUrl, { responseType: "text" });
531log(`=== Multi-Event Announcer (Ch1, Season Start/End) to ${PRIMARY_CHAT_ID} then ${SECONDARY_CHAT_ID} ===`);
532try {
533await bot.api.getMe();
534log("Bot token validated.");
535}
640log(`Announcing to PRIMARY (${PRIMARY_CHAT_ID}): ${nameOfManhwa} - Event: ${event.eventType}`);
641if (imageUrl && (event.eventType === EventType.NEW_SERIES || event.eventType === EventType.SEASON_START)) {
642await bot.api.sendPhoto(PRIMARY_CHAT_ID, imageUrl, { caption: messageContent, parse_mode: "HTML" });
643} else {
644await bot.api.sendMessage(PRIMARY_CHAT_ID, messageContent, {
645parse_mode: "HTML",
646disable_web_page_preview: false,
654if (BOT_OWNER_ID) {
655try {
656await bot.api.sendMessage(
657BOT_OWNER_ID,
658`PRIMARY SEND FAIL: ${event.eventType} for ${nameOfManhwa}.\nError: ${e.message.substring(0, 300)}`,
669log(`Reposting to SECONDARY (${SECONDARY_CHAT_ID}): ${nameOfManhwa} - Event: ${event.eventType}`);
670if (imageUrl && (event.eventType === EventType.NEW_SERIES || event.eventType === EventType.SEASON_START)) {
671await bot.api.sendPhoto(SECONDARY_CHAT_ID, imageUrl, { caption: messageContent, parse_mode: "HTML" });
672} else {
673await bot.api.sendMessage(SECONDARY_CHAT_ID, messageContent, {
674parse_mode: "HTML",
675disable_web_page_preview: false,
681if (BOT_OWNER_ID) {
682try {
683await bot.api.sendMessage(
684BOT_OWNER_ID,
685`SECONDARY REPOST FAIL: ${event.eventType} for ${nameOfManhwa} (Primary was OK).\nError: ${
1import { getArticle } from "./_api.ts";
2import { createServer } from "./_server.ts";
3
1import { getArticle, getAuthor } from "./_api.ts";
2import { createServer } from "./_server.ts";
3
graphql-crash-course_api.ts0 matches
1export const getArticle = (id) => ({
2id,
3date: new Date().toISOString(),
4title: "Lorem ipsum",
5body: "Lorem ipsum dolor sit amet",