veryfront 0.1.614 → 0.1.616
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/cli/templates/manifest.d.ts +1 -0
- package/esm/cli/templates/manifest.js +2 -1
- package/esm/deno.d.ts +3 -0
- package/esm/deno.js +4 -1
- package/esm/src/agent/hosted/child-stream-watchdog.d.ts.map +1 -1
- package/esm/src/agent/hosted/child-stream-watchdog.js +47 -29
- package/esm/src/agent/hosted/cloud-prepared-chat-execution-runtime.d.ts +9 -0
- package/esm/src/agent/hosted/cloud-prepared-chat-execution-runtime.d.ts.map +1 -1
- package/esm/src/agent/hosted/cloud-prepared-chat-execution-runtime.js +26 -1
- package/esm/src/agent/hosted/stream-terminal-error.d.ts.map +1 -1
- package/esm/src/agent/hosted/stream-terminal-error.js +44 -0
- package/esm/src/agent/identity-contracts.d.ts +42 -0
- package/esm/src/agent/identity-contracts.d.ts.map +1 -0
- package/esm/src/agent/identity-contracts.js +25 -0
- package/esm/src/agent/index.d.ts +1 -0
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +1 -0
- package/esm/src/chat/message-prep.d.ts.map +1 -1
- package/esm/src/chat/message-prep.js +16 -2
- package/esm/src/integrations/_data.js +1 -1
- package/esm/src/integrations/_tool_summaries.d.ts.map +1 -1
- package/esm/src/integrations/_tool_summaries.js +197 -4
- package/esm/src/integrations/schema.d.ts +8 -0
- package/esm/src/integrations/schema.d.ts.map +1 -1
- package/esm/src/integrations/schema.js +2 -1
- package/esm/src/oauth/providers/base.d.ts +9 -0
- package/esm/src/oauth/providers/base.d.ts.map +1 -1
- package/esm/src/oauth/providers/base.js +23 -3
- package/esm/src/platform/adapters/redis/deno.d.ts +1 -0
- package/esm/src/platform/adapters/redis/deno.d.ts.map +1 -1
- package/esm/src/platform/adapters/redis/deno.js +5 -0
- package/esm/src/platform/adapters/redis/interface.d.ts +5 -0
- package/esm/src/platform/adapters/redis/interface.d.ts.map +1 -1
- package/esm/src/platform/adapters/redis/node.d.ts +1 -0
- package/esm/src/platform/adapters/redis/node.d.ts.map +1 -1
- package/esm/src/platform/adapters/redis/node.js +5 -0
- package/esm/src/platform/adapters/redis/types.d.ts +5 -0
- package/esm/src/platform/adapters/redis/types.d.ts.map +1 -1
- package/esm/src/provider/local/local-engine.d.ts +32 -0
- package/esm/src/provider/local/local-engine.d.ts.map +1 -1
- package/esm/src/provider/local/local-engine.js +66 -9
- package/esm/src/provider/runtime-loader/provider-usage.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader/provider-usage.js +12 -1
- package/esm/src/rendering/rsc/server-renderer/tree-processor.js +5 -5
- package/esm/src/routing/api/api-route-matcher.d.ts.map +1 -1
- package/esm/src/routing/api/api-route-matcher.js +3 -2
- package/esm/src/routing/matchers/decode-param.d.ts +9 -0
- package/esm/src/routing/matchers/decode-param.d.ts.map +1 -0
- package/esm/src/routing/matchers/decode-param.js +17 -0
- package/esm/src/routing/matchers/route-matcher.d.ts.map +1 -1
- package/esm/src/routing/matchers/route-matcher.js +3 -4
- package/esm/src/routing/slug-mapper/dynamic-route-matcher.d.ts.map +1 -1
- package/esm/src/routing/slug-mapper/dynamic-route-matcher.js +8 -2
- package/esm/src/server/node-handler.d.ts.map +1 -1
- package/esm/src/server/node-handler.js +40 -5
- package/esm/src/tool/factory.d.ts.map +1 -1
- package/esm/src/tool/factory.js +4 -3
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/backends/redis/index.d.ts +2 -0
- package/esm/src/workflow/backends/redis/index.d.ts.map +1 -1
- package/esm/src/workflow/backends/redis/index.js +39 -6
- package/esm/src/workflow/executor/dag/index.d.ts.map +1 -1
- package/esm/src/workflow/executor/dag/index.js +30 -5
- package/package.json +5 -1
|
@@ -262,6 +262,7 @@ declare namespace _default {
|
|
|
262
262
|
"tools/add-issue-comment.ts": string;
|
|
263
263
|
"tools/create-issue.ts": string;
|
|
264
264
|
"tools/create-pr.ts": string;
|
|
265
|
+
"tools/get-current-user.ts": string;
|
|
265
266
|
"tools/get-issue.ts": string;
|
|
266
267
|
"tools/get-pr-diff.ts": string;
|
|
267
268
|
"tools/get-pr.ts": string;
|
|
@@ -257,11 +257,12 @@ export default {
|
|
|
257
257
|
"files": {
|
|
258
258
|
"app/api/auth/github/callback/route.ts": "import { createOAuthCallbackHandler, githubConfig } from \"veryfront/oauth\";\nimport { tokenStore } from \"../../../../../lib/token-store.ts\";\nimport { oauthMemoryTokenStore } from \"../../../../../lib/oauth-memory-store.ts\";\n\nconst hybridTokenStore = {\n async getTokens(serviceId: string, userId: string) {\n return tokenStore.getToken(userId, serviceId);\n },\n async setTokens(\n serviceId: string,\n userId: string,\n tokens: { accessToken: string; refreshToken?: string; expiresAt?: number },\n ) {\n await tokenStore.setToken(userId, serviceId, tokens);\n },\n async clearTokens(serviceId: string, userId: string) {\n await tokenStore.revokeToken(userId, serviceId);\n },\n setState(\n state: string,\n meta: {\n userId: string;\n serviceId: string;\n codeVerifier?: string;\n redirectUri?: string;\n scopes?: string[];\n createdAt: number;\n },\n ) {\n return oauthMemoryTokenStore.setState(state, meta);\n },\n consumeState(state: string) {\n return oauthMemoryTokenStore.consumeState(state);\n },\n};\n\nexport const GET = createOAuthCallbackHandler(githubConfig, { tokenStore: hybridTokenStore });\n",
|
|
259
259
|
"app/api/auth/github/route.ts": "import { createOAuthInitHandler, githubConfig } from \"veryfront/oauth\";\nimport { oauthMemoryTokenStore } from \"../../../../../lib/oauth-memory-store.ts\";\nimport { requireUserIdFromRequest } from \"../../../../../lib/user-id.ts\";\n\nfunction getUserId(request: Request): string {\n return requireUserIdFromRequest(request);\n}\n\nexport const GET = createOAuthInitHandler(githubConfig, {\n tokenStore: oauthMemoryTokenStore,\n getUserId,\n});",
|
|
260
|
-
"lib/github-client.ts": "/**\n * GitHub API Client\n *\n * Provides a type-safe interface to GitHub API operations.\n */\n\nimport { getValidToken } from \"./oauth.ts\";\n\nfunction getEnv(key: string): string | undefined {\n // @ts-ignore - Deno global\n if (typeof Deno !== \"undefined\") return Deno.env.get(key);\n\n // @ts-ignore - process global\n if (typeof process !== \"undefined\" && process.env) return process.env[key];\n\n return undefined;\n}\n\nconst GITHUB_API_BASE = \"https://api.github.com\";\n\nexport interface GitHubUser {\n id: number;\n login: string;\n name: string | null;\n type: string;\n html_url: string;\n avatar_url: string;\n company: string | null;\n blog: string;\n location: string | null;\n email: string | null;\n bio: string | null;\n twitter_username: string | null;\n public_repos: number;\n followers: number;\n following: number;\n created_at: string;\n updated_at: string;\n}\n\nexport interface GitHubRepo {\n id: number;\n name: string;\n full_name: string;\n description: string | null;\n private: boolean;\n html_url: string;\n default_branch: string;\n language: string | null;\n stargazers_count: number;\n forks_count: number;\n open_issues_count: number;\n updated_at: string;\n}\n\nexport interface GitHubPullRequest {\n id: number;\n number: number;\n title: string;\n body: string | null;\n state: \"open\" | \"closed\";\n html_url: string;\n user: { login: string; avatar_url: string };\n created_at: string;\n updated_at: string;\n head: { ref: string; sha: string };\n base: { ref: string };\n mergeable: boolean | null;\n additions: number;\n deletions: number;\n changed_files: number;\n draft: boolean;\n labels: Array<{ name: string; color: string }>;\n}\n\nexport interface GitHubIssue {\n id: number;\n number: number;\n title: string;\n body: string | null;\n state: \"open\" | \"closed\";\n html_url: string;\n user: { login: string };\n created_at: string;\n updated_at: string;\n labels: Array<{ name: string; color: string }>;\n assignees: Array<{ login: string }>;\n}\n\nexport interface GitHubCommit {\n sha: string;\n commit: {\n message: string;\n author: { name: string; date: string };\n };\n html_url: string;\n author: { login: string; avatar_url: string } | null;\n}\n\nexport interface GitHubMergeResult {\n sha: string;\n merged: boolean;\n message: string;\n}\n\n/**\n * GitHub OAuth provider configuration\n */\nexport const githubOAuthProvider = {\n name: \"github\",\n authorizationUrl: \"https://github.com/login/oauth/authorize\",\n tokenUrl: \"https://github.com/login/oauth/access_token\",\n clientId: getEnv(\"GITHUB_CLIENT_ID\") ?? \"\",\n clientSecret: getEnv(\"GITHUB_CLIENT_SECRET\") ?? \"\",\n scopes: [\"repo\", \"read:user\", \"read:org\"],\n callbackPath: \"/api/auth/github/callback\",\n};\n\nexport function createGitHubClient(userId: string): {\n listRepos(options?: {\n sort?: \"created\" | \"updated\" | \"pushed\" | \"full_name\";\n perPage?: number;\n type?: \"all\" | \"owner\" | \"public\" | \"private\" | \"member\";\n }): Promise<GitHubRepo[]>;\n getRepo(owner: string, repo: string): Promise<GitHubRepo>;\n listPullRequests(\n owner: string,\n repo: string,\n options?: { state?: \"open\" | \"closed\" | \"all\"; perPage?: number },\n ): Promise<GitHubPullRequest[]>;\n getPullRequest(\n owner: string,\n repo: string,\n pullNumber: number,\n ): Promise<GitHubPullRequest>;\n getPullRequestDiff(\n owner: string,\n repo: string,\n pullNumber: number,\n ): Promise<string>;\n createIssue(\n owner: string,\n repo: string,\n options: {\n title: string;\n body?: string;\n labels?: string[];\n assignees?: string[];\n },\n ): Promise<GitHubIssue>;\n getIssue(\n owner: string,\n repo: string,\n issueNumber: number,\n ): Promise<GitHubIssue>;\n updateIssue(\n owner: string,\n repo: string,\n issueNumber: number,\n options: {\n title?: string;\n body?: string;\n state?: \"open\" | \"closed\";\n labels?: string[];\n assignees?: string[];\n },\n ): Promise<GitHubIssue>;\n addIssueComment(\n owner: string,\n repo: string,\n issueNumber: number,\n body: string,\n ): Promise<\n {\n id: number;\n html_url: string;\n body: string;\n user: { login: string };\n created_at: string;\n }\n >;\n listIssues(\n owner: string,\n repo: string,\n options?: { state?: \"open\" | \"closed\" | \"all\"; perPage?: number },\n ): Promise<GitHubIssue[]>;\n listCommits(\n owner: string,\n repo: string,\n options?: { sha?: string; path?: string; perPage?: number },\n ): Promise<GitHubCommit[]>;\n createPullRequest(\n owner: string,\n repo: string,\n options: {\n title: string;\n body?: string;\n head: string;\n base: string;\n draft?: boolean;\n },\n ): Promise<GitHubPullRequest>;\n mergePullRequest(\n owner: string,\n repo: string,\n pullNumber: number,\n options?: {\n commit_title?: string;\n commit_message?: string;\n merge_method?: \"merge\" | \"squash\" | \"rebase\";\n },\n ): Promise<GitHubMergeResult>;\n getUser(): Promise<{ login: string; name: string; email: string }>;\n getUserByUsername(username: string): Promise<GitHubUser>;\n} {\n async function getAccessToken(): Promise<string> {\n const token = await getValidToken(githubOAuthProvider, userId, \"github\");\n if (!token) {\n throw new Error(\n \"GitHub not connected. Please connect your GitHub account first.\",\n );\n }\n return token;\n }\n\n async function apiRequest<T>(\n endpoint: string,\n options: RequestInit = {},\n ): Promise<T> {\n const accessToken = await getAccessToken();\n\n const response = await fetch(`${GITHUB_API_BASE}${endpoint}`, {\n ...options,\n headers: {\n Authorization: `Bearer ${accessToken}`,\n Accept: \"application/vnd.github+json\",\n \"X-GitHub-Api-Version\": \"2022-11-28\",\n ...options.headers,\n },\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`GitHub API error: ${response.status} - ${error}`);\n }\n\n return response.json() as Promise<T>;\n }\n\n async function apiTextRequest(\n endpoint: string,\n accept: string,\n ): Promise<string> {\n const accessToken = await getAccessToken();\n\n const response = await fetch(`${GITHUB_API_BASE}${endpoint}`, {\n headers: {\n Authorization: `Bearer ${accessToken}`,\n Accept: accept,\n \"X-GitHub-Api-Version\": \"2022-11-28\",\n },\n });\n\n if (!response.ok) throw new Error(`GitHub API error: ${response.status}`);\n\n return response.text();\n }\n\n function toQueryString(params: URLSearchParams): string {\n const query = params.toString();\n return query ? `?${query}` : \"\";\n }\n\n return {\n listRepos(options = {}): Promise<GitHubRepo[]> {\n const params = new URLSearchParams();\n if (options.sort) params.set(\"sort\", options.sort);\n if (options.perPage) params.set(\"per_page\", String(options.perPage));\n if (options.type) params.set(\"type\", options.type);\n\n return apiRequest<GitHubRepo[]>(`/user/repos${toQueryString(params)}`);\n },\n\n getRepo(owner, repo): Promise<GitHubRepo> {\n return apiRequest<GitHubRepo>(`/repos/${owner}/${repo}`);\n },\n\n listPullRequests(owner, repo, options = {}): Promise<GitHubPullRequest[]> {\n const params = new URLSearchParams();\n params.set(\"state\", options.state ?? \"open\");\n if (options.perPage) params.set(\"per_page\", String(options.perPage));\n\n return apiRequest<GitHubPullRequest[]>(\n `/repos/${owner}/${repo}/pulls${toQueryString(params)}`,\n );\n },\n\n getPullRequest(owner, repo, pullNumber): Promise<GitHubPullRequest> {\n return apiRequest<GitHubPullRequest>(\n `/repos/${owner}/${repo}/pulls/${pullNumber}`,\n );\n },\n\n getPullRequestDiff(owner, repo, pullNumber): Promise<string> {\n return apiTextRequest(\n `/repos/${owner}/${repo}/pulls/${pullNumber}`,\n \"application/vnd.github.diff\",\n );\n },\n\n createIssue(owner, repo, options): Promise<GitHubIssue> {\n return apiRequest<GitHubIssue>(`/repos/${owner}/${repo}/issues`, {\n method: \"POST\",\n body: JSON.stringify(options),\n });\n },\n\n getIssue(owner, repo, issueNumber): Promise<GitHubIssue> {\n return apiRequest<GitHubIssue>(\n `/repos/${owner}/${repo}/issues/${issueNumber}`,\n );\n },\n\n updateIssue(owner, repo, issueNumber, options): Promise<GitHubIssue> {\n return apiRequest<GitHubIssue>(\n `/repos/${owner}/${repo}/issues/${issueNumber}`,\n {\n method: \"PATCH\",\n body: JSON.stringify(options),\n },\n );\n },\n\n addIssueComment(owner, repo, issueNumber, body) {\n return apiRequest(\n `/repos/${owner}/${repo}/issues/${issueNumber}/comments`,\n {\n method: \"POST\",\n body: JSON.stringify({ body }),\n },\n );\n },\n\n listIssues(owner, repo, options = {}): Promise<GitHubIssue[]> {\n const params = new URLSearchParams();\n params.set(\"state\", options.state ?? \"open\");\n if (options.perPage) params.set(\"per_page\", String(options.perPage));\n\n return apiRequest<GitHubIssue[]>(\n `/repos/${owner}/${repo}/issues${toQueryString(params)}`,\n );\n },\n\n listCommits(owner, repo, options = {}): Promise<GitHubCommit[]> {\n const params = new URLSearchParams();\n if (options.sha) params.set(\"sha\", options.sha);\n if (options.path) params.set(\"path\", options.path);\n if (options.perPage) params.set(\"per_page\", String(options.perPage));\n\n return apiRequest<GitHubCommit[]>(\n `/repos/${owner}/${repo}/commits${toQueryString(params)}`,\n );\n },\n\n createPullRequest(owner, repo, options): Promise<GitHubPullRequest> {\n return apiRequest<GitHubPullRequest>(`/repos/${owner}/${repo}/pulls`, {\n method: \"POST\",\n body: JSON.stringify(options),\n });\n },\n\n mergePullRequest(owner, repo, pullNumber, options = {}): Promise<GitHubMergeResult> {\n return apiRequest<GitHubMergeResult>(\n `/repos/${owner}/${repo}/pulls/${pullNumber}/merge`,\n {\n method: \"PUT\",\n body: JSON.stringify(options),\n },\n );\n },\n\n getUser(): Promise<{ login: string; name: string; email: string }> {\n return apiRequest(\"/user\");\n },\n\n getUserByUsername(username): Promise<GitHubUser> {\n return apiRequest<GitHubUser>(`/users/${encodeURIComponent(username)}`);\n },\n };\n}\n\nexport type GitHubClient = ReturnType<typeof createGitHubClient>;\n",
|
|
260
|
+
"lib/github-client.ts": "/**\n * GitHub API Client\n *\n * Provides a type-safe interface to GitHub API operations.\n */\n\nimport { getValidToken } from \"./oauth.ts\";\n\nfunction getEnv(key: string): string | undefined {\n // @ts-ignore - Deno global\n if (typeof Deno !== \"undefined\") return Deno.env.get(key);\n\n // @ts-ignore - process global\n if (typeof process !== \"undefined\" && process.env) return process.env[key];\n\n return undefined;\n}\n\nconst GITHUB_API_BASE = \"https://api.github.com\";\n\nexport interface GitHubUser {\n id: number;\n login: string;\n name: string | null;\n type: string;\n html_url: string;\n avatar_url: string;\n company: string | null;\n blog: string;\n location: string | null;\n email: string | null;\n bio: string | null;\n twitter_username: string | null;\n public_repos: number;\n followers: number;\n following: number;\n created_at: string;\n updated_at: string;\n}\n\nexport interface GitHubRepo {\n id: number;\n name: string;\n full_name: string;\n description: string | null;\n private: boolean;\n html_url: string;\n default_branch: string;\n language: string | null;\n stargazers_count: number;\n forks_count: number;\n open_issues_count: number;\n updated_at: string;\n}\n\nexport interface GitHubPullRequest {\n id: number;\n number: number;\n title: string;\n body: string | null;\n state: \"open\" | \"closed\";\n html_url: string;\n user: { login: string; avatar_url: string };\n created_at: string;\n updated_at: string;\n head: { ref: string; sha: string };\n base: { ref: string };\n mergeable: boolean | null;\n additions: number;\n deletions: number;\n changed_files: number;\n draft: boolean;\n labels: Array<{ name: string; color: string }>;\n}\n\nexport interface GitHubIssue {\n id: number;\n number: number;\n title: string;\n body: string | null;\n state: \"open\" | \"closed\";\n html_url: string;\n user: { login: string };\n created_at: string;\n updated_at: string;\n labels: Array<{ name: string; color: string }>;\n assignees: Array<{ login: string }>;\n}\n\nexport interface GitHubCommit {\n sha: string;\n commit: {\n message: string;\n author: { name: string; date: string };\n };\n html_url: string;\n author: { login: string; avatar_url: string } | null;\n}\n\nexport interface GitHubMergeResult {\n sha: string;\n merged: boolean;\n message: string;\n}\n\nexport interface GitHubUser {\n id: number;\n node_id: string;\n login: string;\n name: string | null;\n email: string | null;\n html_url: string;\n avatar_url: string;\n type: string;\n}\n\n/**\n * GitHub OAuth provider configuration\n */\nexport const githubOAuthProvider = {\n name: \"github\",\n authorizationUrl: \"https://github.com/login/oauth/authorize\",\n tokenUrl: \"https://github.com/login/oauth/access_token\",\n clientId: getEnv(\"GITHUB_CLIENT_ID\") ?? \"\",\n clientSecret: getEnv(\"GITHUB_CLIENT_SECRET\") ?? \"\",\n scopes: [\"repo\", \"read:user\", \"read:org\"],\n callbackPath: \"/api/auth/github/callback\",\n};\n\nexport function createGitHubClient(userId: string): {\n listRepos(options?: {\n sort?: \"created\" | \"updated\" | \"pushed\" | \"full_name\";\n perPage?: number;\n type?: \"all\" | \"owner\" | \"public\" | \"private\" | \"member\";\n }): Promise<GitHubRepo[]>;\n getRepo(owner: string, repo: string): Promise<GitHubRepo>;\n listPullRequests(\n owner: string,\n repo: string,\n options?: { state?: \"open\" | \"closed\" | \"all\"; perPage?: number },\n ): Promise<GitHubPullRequest[]>;\n getPullRequest(\n owner: string,\n repo: string,\n pullNumber: number,\n ): Promise<GitHubPullRequest>;\n getPullRequestDiff(\n owner: string,\n repo: string,\n pullNumber: number,\n ): Promise<string>;\n createIssue(\n owner: string,\n repo: string,\n options: {\n title: string;\n body?: string;\n labels?: string[];\n assignees?: string[];\n },\n ): Promise<GitHubIssue>;\n getIssue(\n owner: string,\n repo: string,\n issueNumber: number,\n ): Promise<GitHubIssue>;\n updateIssue(\n owner: string,\n repo: string,\n issueNumber: number,\n options: {\n title?: string;\n body?: string;\n state?: \"open\" | \"closed\";\n labels?: string[];\n assignees?: string[];\n },\n ): Promise<GitHubIssue>;\n addIssueComment(\n owner: string,\n repo: string,\n issueNumber: number,\n body: string,\n ): Promise<\n {\n id: number;\n html_url: string;\n body: string;\n user: { login: string };\n created_at: string;\n }\n >;\n listIssues(\n owner: string,\n repo: string,\n options?: { state?: \"open\" | \"closed\" | \"all\"; perPage?: number },\n ): Promise<GitHubIssue[]>;\n listCommits(\n owner: string,\n repo: string,\n options?: { sha?: string; path?: string; perPage?: number },\n ): Promise<GitHubCommit[]>;\n createPullRequest(\n owner: string,\n repo: string,\n options: {\n title: string;\n body?: string;\n head: string;\n base: string;\n draft?: boolean;\n },\n ): Promise<GitHubPullRequest>;\n mergePullRequest(\n owner: string,\n repo: string,\n pullNumber: number,\n options?: {\n commit_title?: string;\n commit_message?: string;\n merge_method?: \"merge\" | \"squash\" | \"rebase\";\n },\n ): Promise<GitHubMergeResult>;\n getUser(): Promise<GitHubUser>;\n getUserByUsername(username: string): Promise<GitHubUser>;\n} {\n async function getAccessToken(): Promise<string> {\n const token = await getValidToken(githubOAuthProvider, userId, \"github\");\n if (!token) {\n throw new Error(\n \"GitHub not connected. Please connect your GitHub account first.\",\n );\n }\n return token;\n }\n\n async function apiRequest<T>(\n endpoint: string,\n options: RequestInit = {},\n ): Promise<T> {\n const accessToken = await getAccessToken();\n\n const response = await fetch(`${GITHUB_API_BASE}${endpoint}`, {\n ...options,\n headers: {\n Authorization: `Bearer ${accessToken}`,\n Accept: \"application/vnd.github+json\",\n \"X-GitHub-Api-Version\": \"2022-11-28\",\n ...options.headers,\n },\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`GitHub API error: ${response.status} - ${error}`);\n }\n\n return response.json() as Promise<T>;\n }\n\n async function apiTextRequest(\n endpoint: string,\n accept: string,\n ): Promise<string> {\n const accessToken = await getAccessToken();\n\n const response = await fetch(`${GITHUB_API_BASE}${endpoint}`, {\n headers: {\n Authorization: `Bearer ${accessToken}`,\n Accept: accept,\n \"X-GitHub-Api-Version\": \"2022-11-28\",\n },\n });\n\n if (!response.ok) throw new Error(`GitHub API error: ${response.status}`);\n\n return response.text();\n }\n\n function toQueryString(params: URLSearchParams): string {\n const query = params.toString();\n return query ? `?${query}` : \"\";\n }\n\n return {\n listRepos(options = {}): Promise<GitHubRepo[]> {\n const params = new URLSearchParams();\n if (options.sort) params.set(\"sort\", options.sort);\n if (options.perPage) params.set(\"per_page\", String(options.perPage));\n if (options.type) params.set(\"type\", options.type);\n\n return apiRequest<GitHubRepo[]>(`/user/repos${toQueryString(params)}`);\n },\n\n getRepo(owner, repo): Promise<GitHubRepo> {\n return apiRequest<GitHubRepo>(`/repos/${owner}/${repo}`);\n },\n\n listPullRequests(owner, repo, options = {}): Promise<GitHubPullRequest[]> {\n const params = new URLSearchParams();\n params.set(\"state\", options.state ?? \"open\");\n if (options.perPage) params.set(\"per_page\", String(options.perPage));\n\n return apiRequest<GitHubPullRequest[]>(\n `/repos/${owner}/${repo}/pulls${toQueryString(params)}`,\n );\n },\n\n getPullRequest(owner, repo, pullNumber): Promise<GitHubPullRequest> {\n return apiRequest<GitHubPullRequest>(\n `/repos/${owner}/${repo}/pulls/${pullNumber}`,\n );\n },\n\n getPullRequestDiff(owner, repo, pullNumber): Promise<string> {\n return apiTextRequest(\n `/repos/${owner}/${repo}/pulls/${pullNumber}`,\n \"application/vnd.github.diff\",\n );\n },\n\n createIssue(owner, repo, options): Promise<GitHubIssue> {\n return apiRequest<GitHubIssue>(`/repos/${owner}/${repo}/issues`, {\n method: \"POST\",\n body: JSON.stringify(options),\n });\n },\n\n getIssue(owner, repo, issueNumber): Promise<GitHubIssue> {\n return apiRequest<GitHubIssue>(\n `/repos/${owner}/${repo}/issues/${issueNumber}`,\n );\n },\n\n updateIssue(owner, repo, issueNumber, options): Promise<GitHubIssue> {\n return apiRequest<GitHubIssue>(\n `/repos/${owner}/${repo}/issues/${issueNumber}`,\n {\n method: \"PATCH\",\n body: JSON.stringify(options),\n },\n );\n },\n\n addIssueComment(owner, repo, issueNumber, body) {\n return apiRequest(\n `/repos/${owner}/${repo}/issues/${issueNumber}/comments`,\n {\n method: \"POST\",\n body: JSON.stringify({ body }),\n },\n );\n },\n\n listIssues(owner, repo, options = {}): Promise<GitHubIssue[]> {\n const params = new URLSearchParams();\n params.set(\"state\", options.state ?? \"open\");\n if (options.perPage) params.set(\"per_page\", String(options.perPage));\n\n return apiRequest<GitHubIssue[]>(\n `/repos/${owner}/${repo}/issues${toQueryString(params)}`,\n );\n },\n\n listCommits(owner, repo, options = {}): Promise<GitHubCommit[]> {\n const params = new URLSearchParams();\n if (options.sha) params.set(\"sha\", options.sha);\n if (options.path) params.set(\"path\", options.path);\n if (options.perPage) params.set(\"per_page\", String(options.perPage));\n\n return apiRequest<GitHubCommit[]>(\n `/repos/${owner}/${repo}/commits${toQueryString(params)}`,\n );\n },\n\n createPullRequest(owner, repo, options): Promise<GitHubPullRequest> {\n return apiRequest<GitHubPullRequest>(`/repos/${owner}/${repo}/pulls`, {\n method: \"POST\",\n body: JSON.stringify(options),\n });\n },\n\n mergePullRequest(owner, repo, pullNumber, options = {}): Promise<GitHubMergeResult> {\n return apiRequest<GitHubMergeResult>(\n `/repos/${owner}/${repo}/pulls/${pullNumber}/merge`,\n {\n method: \"PUT\",\n body: JSON.stringify(options),\n },\n );\n },\n\n getUser(): Promise<GitHubUser> {\n return apiRequest(\"/user\");\n },\n\n getUserByUsername(username): Promise<GitHubUser> {\n return apiRequest<GitHubUser>(`/users/${encodeURIComponent(username)}`);\n },\n };\n}\n\nexport type GitHubClient = ReturnType<typeof createGitHubClient>;\n",
|
|
261
261
|
"lib/user-id.ts": "import type { ToolExecutionContext } from \"veryfront/tool\";\n\nexport function requireUserIdFromContext(\n context?: ToolExecutionContext,\n): string {\n const userId = context?.userId;\n if (!userId) {\n throw new Error(\"GitHub tool execution requires an authenticated user.\");\n }\n return userId;\n}\n",
|
|
262
262
|
"tools/add-issue-comment.ts": "import { tool } from \"veryfront/tool\";\nimport { defineSchema } from \"veryfront/schemas\";\nimport { createGitHubClient } from \"../../lib/github-client.ts\";\nimport { requireUserIdFromContext } from \"../../lib/user-id.ts\";\n\nexport default tool({\n id: \"add-issue-comment\",\n description: \"Add a comment to a GitHub issue or pull request\",\n inputSchema: defineSchema((v) =>\n v.object({\n repo: v.string().describe(\"Repository in format 'owner/repo'\"),\n issueNumber: v.number().int().positive().describe(\n \"Issue or pull request number\",\n ),\n body: v.string().min(1).describe(\"Comment body (supports Markdown)\"),\n })\n )(),\n execute: async ({ repo, issueNumber, body }, context) => {\n const userId = requireUserIdFromContext(context);\n const [owner, repoName] = repo.split(\"/\");\n if (!owner || !repoName) {\n return { error: \"Invalid repository format. Use 'owner/repo' format.\" };\n }\n\n try {\n const github = createGitHubClient(userId);\n const comment = await github.addIssueComment(\n owner,\n repoName,\n issueNumber,\n body,\n );\n return {\n success: true,\n comment: {\n id: comment.id,\n url: comment.html_url,\n body: comment.body,\n author: comment.user.login,\n createdAt: comment.created_at,\n },\n message: `Comment added to issue #${issueNumber} in ${repo}.`,\n };\n } catch (error) {\n if (error instanceof Error && error.message.includes(\"not connected\")) {\n return {\n error: \"GitHub not connected. Please connect your GitHub account.\",\n connectUrl: \"/api/auth/github\",\n };\n }\n throw error;\n }\n },\n});\n",
|
|
263
263
|
"tools/create-issue.ts": "import { tool } from \"veryfront/tool\";\nimport { defineSchema } from \"veryfront/schemas\";\nimport { createGitHubClient } from \"../../lib/github-client.ts\";\nimport { requireUserIdFromContext } from \"../../lib/user-id.ts\";\n\nexport default tool({\n id: \"create-issue\",\n description: \"Create a new issue in a GitHub repository\",\n inputSchema: defineSchema((v) =>\n v.object({\n repo: v\n .string()\n .describe(\"Repository in format 'owner/repo' (e.g., 'facebook/react')\"),\n title: v.string().min(1).describe(\"Issue title\"),\n body: v\n .string()\n .optional()\n .describe(\"Issue body/description (supports Markdown)\"),\n labels: v.array(v.string()).optional().describe(\n \"Labels to add to the issue\",\n ),\n assignees: v\n .array(v.string())\n .optional()\n .describe(\"GitHub usernames to assign to the issue\"),\n })\n )(),\n execute: async ({ repo, title, body, labels, assignees }, context) => {\n const userId = requireUserIdFromContext(context);\n\n const [owner, repoName] = repo.split(\"/\");\n if (!owner || !repoName) {\n return { error: \"Invalid repository format. Use 'owner/repo' format.\" };\n }\n\n try {\n const github = createGitHubClient(userId);\n const issue = await github.createIssue(owner, repoName, {\n title,\n body,\n labels,\n assignees,\n });\n\n return {\n success: true,\n issue: {\n number: issue.number,\n title: issue.title,\n url: issue.html_url,\n state: issue.state,\n labels: issue.labels.map((l: { name: string }) => l.name),\n assignees: issue.assignees.map((a: { login: string }) => a.login),\n },\n message: `Issue #${issue.number} created successfully in ${repo}.`,\n };\n } catch (error) {\n if (error instanceof Error && error.message.includes(\"not connected\")) {\n return {\n error: \"GitHub not connected. Please connect your GitHub account.\",\n connectUrl: \"/api/auth/github\",\n };\n }\n throw error;\n }\n },\n});\n",
|
|
264
264
|
"tools/create-pr.ts": "import { tool } from \"veryfront/tool\";\nimport { defineSchema } from \"veryfront/schemas\";\nimport { createGitHubClient } from \"../../lib/github-client.ts\";\nimport { requireUserIdFromContext } from \"../../lib/user-id.ts\";\n\nexport default tool({\n id: \"create-pr\",\n description: \"Create a new pull request in a GitHub repository\",\n inputSchema: defineSchema((v) =>\n v.object({\n repo: v\n .string()\n .describe(\"Repository in format 'owner/repo' (e.g., 'facebook/react')\"),\n title: v.string().min(1).describe(\"Pull request title\"),\n head: v\n .string()\n .describe(\n \"Branch to merge from (e.g., 'feature-branch' or 'owner:feature-branch')\",\n ),\n base: v.string().describe(\"Branch to merge into (e.g., 'main')\"),\n body: v\n .string()\n .optional()\n .describe(\"Pull request description (supports Markdown)\"),\n draft: v\n .boolean()\n .default(false)\n .optional()\n .describe(\"Create as a draft pull request\"),\n })\n )(),\n execute: async ({ repo, title, head, base, body, draft }, context) => {\n const userId = requireUserIdFromContext(context);\n const [owner, repoName] = repo.split(\"/\");\n\n if (!owner || !repoName) {\n return { error: \"Invalid repository format. Use 'owner/repo' format.\" };\n }\n\n try {\n const github = createGitHubClient(userId);\n const pr = await github.createPullRequest(owner, repoName, {\n title,\n head,\n base,\n body,\n draft,\n });\n\n return {\n success: true,\n number: pr.number,\n title: pr.title,\n url: pr.html_url,\n state: pr.state,\n isDraft: pr.draft,\n sourceBranch: pr.head.ref,\n targetBranch: pr.base.ref,\n message: `Pull request #${pr.number} created successfully in ${repo}.`,\n };\n } catch (error) {\n if (error instanceof Error && error.message.includes(\"not connected\")) {\n return {\n error: \"GitHub not connected. Please connect your GitHub account.\",\n connectUrl: \"/api/auth/github\",\n };\n }\n throw error;\n }\n },\n});\n",
|
|
265
|
+
"tools/get-current-user.ts": "import { tool } from \"veryfront/tool\";\nimport { defineSchema } from \"veryfront/schemas\";\nimport { createGitHubClient } from \"../../lib/github-client.ts\";\nimport { requireUserIdFromContext } from \"../../lib/user-id.ts\";\n\nexport default tool({\n id: \"get-current-user\",\n description: \"Get the authenticated GitHub user identity\",\n inputSchema: defineSchema((v) => v.object({}))(),\n execute: async (_input, context) => {\n const userId = requireUserIdFromContext(context);\n\n try {\n const github = createGitHubClient(userId);\n const user = await github.getUser();\n\n return {\n user: {\n id: user.id,\n nodeId: user.node_id,\n login: user.login,\n name: user.name ?? null,\n email: user.email ?? null,\n url: user.html_url,\n avatarUrl: user.avatar_url,\n type: user.type,\n },\n };\n } catch (error) {\n if (error instanceof Error && error.message.includes(\"not connected\")) {\n return {\n error: \"GitHub not connected. Please connect your GitHub account.\",\n connectUrl: \"/api/auth/github\",\n };\n }\n throw error;\n }\n },\n});\n",
|
|
265
266
|
"tools/get-issue.ts": "import { tool } from \"veryfront/tool\";\nimport { defineSchema } from \"veryfront/schemas\";\nimport { createGitHubClient } from \"../../lib/github-client.ts\";\nimport { requireUserIdFromContext } from \"../../lib/user-id.ts\";\n\nexport default tool({\n id: \"get-issue\",\n description: \"Get details of a GitHub issue\",\n inputSchema: defineSchema((v) =>\n v.object({\n repo: v.string().describe(\"Repository in format 'owner/repo'\"),\n issueNumber: v.number().int().positive().describe(\"Issue number\"),\n })\n )(),\n execute: async ({ repo, issueNumber }, context) => {\n const userId = requireUserIdFromContext(context);\n const [owner, repoName] = repo.split(\"/\");\n if (!owner || !repoName) {\n return { error: \"Invalid repository format. Use 'owner/repo' format.\" };\n }\n\n try {\n const github = createGitHubClient(userId);\n const issue = await github.getIssue(owner, repoName, issueNumber);\n return {\n issue: {\n number: issue.number,\n title: issue.title,\n body: issue.body,\n state: issue.state,\n url: issue.html_url,\n author: issue.user.login,\n labels: issue.labels.map((label: { name: string }) => label.name),\n assignees: issue.assignees.map((assignee: { login: string }) =>\n assignee.login\n ),\n updatedAt: issue.updated_at,\n },\n };\n } catch (error) {\n if (error instanceof Error && error.message.includes(\"not connected\")) {\n return {\n error: \"GitHub not connected. Please connect your GitHub account.\",\n connectUrl: \"/api/auth/github\",\n };\n }\n throw error;\n }\n },\n});\n",
|
|
266
267
|
"tools/get-pr-diff.ts": "import { tool } from \"veryfront/tool\";\nimport { defineSchema } from \"veryfront/schemas\";\nimport { createGitHubClient } from \"../../lib/github-client.ts\";\nimport { requireUserIdFromContext } from \"../../lib/user-id.ts\";\n\nexport default tool({\n id: \"get-pr-diff\",\n description: \"Get the diff for a pull request to review code changes\",\n inputSchema: defineSchema((v) =>\n v.object({\n repo: v\n .string()\n .describe(\"Repository in format 'owner/repo' (e.g., 'facebook/react')\"),\n prNumber: v.number().int().positive().describe(\"Pull request number\"),\n })\n )(),\n execute: async ({ repo, prNumber }, context) => {\n const userId = requireUserIdFromContext(context);\n\n const [owner, repoName] = repo.split(\"/\");\n if (!owner || !repoName) {\n return { error: \"Invalid repository format. Use 'owner/repo' format.\" };\n }\n\n try {\n const github = createGitHubClient(userId);\n\n const pr = await github.getPullRequest(owner, repoName, prNumber);\n const diff = await github.getPullRequestDiff(owner, repoName, prNumber);\n\n const maxDiffLength = 50000;\n let truncatedDiff = diff;\n\n if (diff.length > maxDiffLength) {\n truncatedDiff = `${\n diff.substring(0, maxDiffLength)\n }\\n\\n... (diff truncated, ${\n diff.length - maxDiffLength\n } characters remaining)`;\n }\n\n return {\n pullRequest: {\n number: pr.number,\n title: pr.title,\n author: pr.user.login,\n url: pr.html_url,\n sourceBranch: pr.head.ref,\n targetBranch: pr.base.ref,\n additions: pr.additions,\n deletions: pr.deletions,\n changedFiles: pr.changed_files,\n isDraft: pr.draft,\n state: pr.state,\n },\n diff: truncatedDiff,\n stats: {\n additions: pr.additions,\n deletions: pr.deletions,\n changedFiles: pr.changed_files,\n },\n message:\n `Retrieved diff for PR #${prNumber} (${pr.additions} additions, ${pr.deletions} deletions across ${pr.changed_files} files).`,\n };\n } catch (error) {\n if (error instanceof Error && error.message.includes(\"not connected\")) {\n return {\n error: \"GitHub not connected. Please connect your GitHub account.\",\n connectUrl: \"/api/auth/github\",\n };\n }\n throw error;\n }\n },\n});\n",
|
|
267
268
|
"tools/get-pr.ts": "import { tool } from \"veryfront/tool\";\nimport { defineSchema } from \"veryfront/schemas\";\nimport { createGitHubClient } from \"../../lib/github-client.ts\";\nimport { requireUserIdFromContext } from \"../../lib/user-id.ts\";\n\nexport default tool({\n id: \"get-pr\",\n description: \"Get details of a specific GitHub pull request\",\n inputSchema: defineSchema((v) =>\n v.object({\n repo: v\n .string()\n .describe(\"Repository in format 'owner/repo' (e.g., 'facebook/react')\"),\n pull_number: v.number().int().positive().describe(\"Pull request number\"),\n })\n )(),\n execute: async ({ repo, pull_number }, context) => {\n const userId = requireUserIdFromContext(context);\n const [owner, repoName] = repo.split(\"/\");\n\n if (!owner || !repoName) {\n return { error: \"Invalid repository format. Use 'owner/repo' format.\" };\n }\n\n try {\n const github = createGitHubClient(userId);\n const pr = await github.getPullRequest(owner, repoName, pull_number);\n\n return {\n number: pr.number,\n title: pr.title,\n body: pr.body,\n state: pr.state,\n isDraft: pr.draft,\n url: pr.html_url,\n author: pr.user.login,\n createdAt: pr.created_at,\n updatedAt: pr.updated_at,\n sourceBranch: pr.head.ref,\n targetBranch: pr.base.ref,\n mergeable: pr.mergeable,\n additions: pr.additions,\n deletions: pr.deletions,\n changedFiles: pr.changed_files,\n labels: pr.labels.map(({ name }) => name),\n };\n } catch (error) {\n if (error instanceof Error && error.message.includes(\"not connected\")) {\n return {\n error: \"GitHub not connected. Please connect your GitHub account.\",\n connectUrl: \"/api/auth/github\",\n };\n }\n throw error;\n }\n },\n});\n",
|
package/esm/deno.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ declare namespace _default {
|
|
|
18
18
|
"./markdown": string;
|
|
19
19
|
"./mdx": string;
|
|
20
20
|
"./agent": string;
|
|
21
|
+
"./agent/identity": string;
|
|
21
22
|
"./agent/testing": string;
|
|
22
23
|
"./agent/conversation-bootstrap": string;
|
|
23
24
|
"./agent/durable": string;
|
|
@@ -94,6 +95,7 @@ declare namespace _default {
|
|
|
94
95
|
"veryfront/sandbox": string;
|
|
95
96
|
"veryfront/embedding": string;
|
|
96
97
|
"veryfront/jobs": string;
|
|
98
|
+
"veryfront/agent/identity": string;
|
|
97
99
|
"veryfront/agent/react": string;
|
|
98
100
|
"veryfront/agent/testing": string;
|
|
99
101
|
"veryfront/agent/middleware": string;
|
|
@@ -157,6 +159,7 @@ declare namespace _default {
|
|
|
157
159
|
"veryfront/extensions/observability": string;
|
|
158
160
|
"#veryfront": string;
|
|
159
161
|
"#veryfront/agent": string;
|
|
162
|
+
"#veryfront/agent/identity": string;
|
|
160
163
|
"#veryfront/agent/react": string;
|
|
161
164
|
"#veryfront/chat/protocol": string;
|
|
162
165
|
"#veryfront/build": string;
|
package/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.616",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"workspace": [
|
|
@@ -46,6 +46,7 @@ export default {
|
|
|
46
46
|
"./markdown": "./src/markdown/index.ts",
|
|
47
47
|
"./mdx": "./src/mdx/index.ts",
|
|
48
48
|
"./agent": "./src/agent/index.ts",
|
|
49
|
+
"./agent/identity": "./src/agent/identity-contracts.ts",
|
|
49
50
|
"./agent/testing": "./src/agent/testing/index.ts",
|
|
50
51
|
"./agent/conversation-bootstrap": "./src/agent/conversation/bootstrap.ts",
|
|
51
52
|
"./agent/durable": "./src/agent/conversation/durable.ts",
|
|
@@ -122,6 +123,7 @@ export default {
|
|
|
122
123
|
"veryfront/sandbox": "./src/sandbox/index.ts",
|
|
123
124
|
"veryfront/embedding": "./src/embedding/index.ts",
|
|
124
125
|
"veryfront/jobs": "./src/jobs/index.ts",
|
|
126
|
+
"veryfront/agent/identity": "./src/agent/identity-contracts.ts",
|
|
125
127
|
"veryfront/agent/react": "./src/agent/react/index.ts",
|
|
126
128
|
"veryfront/agent/testing": "./src/agent/testing/index.ts",
|
|
127
129
|
"veryfront/agent/middleware": "./src/agent/middleware/index.ts",
|
|
@@ -185,6 +187,7 @@ export default {
|
|
|
185
187
|
"veryfront/extensions/observability": "./src/extensions/observability/index.ts",
|
|
186
188
|
"#veryfront": "./src/index.ts",
|
|
187
189
|
"#veryfront/agent": "./src/agent/index.ts",
|
|
190
|
+
"#veryfront/agent/identity": "./src/agent/identity-contracts.ts",
|
|
188
191
|
"#veryfront/agent/react": "./src/agent/react/index.ts",
|
|
189
192
|
"#veryfront/chat/protocol": "./src/chat/protocol.ts",
|
|
190
193
|
"#veryfront/build": "./src/build/index.ts",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"child-stream-watchdog.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/child-stream-watchdog.ts"],"names":[],"mappings":"AAGA,kEAAkE;AAClE,MAAM,MAAM,8BAA8B,GAAG,cAAc,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAEhG,8CAA8C;AAC9C,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,8BAA8B,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wDAAwD;AACxD,qBAAa,iCAAkC,SAAQ,KAAK;IAC1D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,8BAA8B,CAAC;gBAEnC,KAAK,EAAE,8BAA8B;CAUlD;AAED,sDAAsD;AACtD,eAAO,MAAM,iCAAiC,eAAwC,CAAC;AAEvF,sDAAsD;AACtD,wBAAgB,qCAAqC,CAAC,KAAK,EAAE;IAC3D,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qBAAqB,EAAE,MAAM,CAAC;CAC/B,GAAG,8BAA8B,CAmBjC;AAED,oCAAoC;AACpC,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC,GACtC,WAAW,GAAG,SAAS,CASzB;AAED,gDAAgD;AAChD,wBAAuB,gCAAgC,CAAC,CAAC,EAAE,KAAK,EAAE;IAChE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACzB,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;IACvD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,aAAa,CAAC,EAAE,CACd,KAAK,EAAE,8BAA8B,KAClC,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC,SAAS,GAAG,UAAU,CAAC,CAAC;CAC/D,GAAG,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"child-stream-watchdog.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/child-stream-watchdog.ts"],"names":[],"mappings":"AAGA,kEAAkE;AAClE,MAAM,MAAM,8BAA8B,GAAG,cAAc,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAEhG,8CAA8C;AAC9C,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,8BAA8B,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wDAAwD;AACxD,qBAAa,iCAAkC,SAAQ,KAAK;IAC1D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,8BAA8B,CAAC;gBAEnC,KAAK,EAAE,8BAA8B;CAUlD;AAED,sDAAsD;AACtD,eAAO,MAAM,iCAAiC,eAAwC,CAAC;AAEvF,sDAAsD;AACtD,wBAAgB,qCAAqC,CAAC,KAAK,EAAE;IAC3D,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qBAAqB,EAAE,MAAM,CAAC;CAC/B,GAAG,8BAA8B,CAmBjC;AAED,oCAAoC;AACpC,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC,GACtC,WAAW,GAAG,SAAS,CASzB;AAED,gDAAgD;AAChD,wBAAuB,gCAAgC,CAAC,CAAC,EAAE,KAAK,EAAE;IAChE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACzB,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;IACvD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,aAAa,CAAC,EAAE,CACd,KAAK,EAAE,8BAA8B,KAClC,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC,SAAS,GAAG,UAAU,CAAC,CAAC;CAC/D,GAAG,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAgEhC;AAED,kDAAkD;AAClD,wBAAsB,oCAAoC,CAAC,CAAC,EAC1D,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EACvB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,CAAC,GAAG,OAAO,iCAAiC,CAAC,CAkBvD"}
|
|
@@ -46,40 +46,58 @@ export function composeAbortSignals(signals) {
|
|
|
46
46
|
export async function* withHostedChildStreamIdleTimeout(input) {
|
|
47
47
|
const iterator = input.stream[Symbol.asyncIterator]();
|
|
48
48
|
let pendingNext = null;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
continue
|
|
49
|
+
try {
|
|
50
|
+
while (true) {
|
|
51
|
+
throwIfChildRunAborted(input.abortSignal);
|
|
52
|
+
let timeoutId = null;
|
|
53
|
+
const watchdogState = input.getWatchdogState();
|
|
54
|
+
if (!pendingNext) {
|
|
55
|
+
pendingNext = iterator.next();
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
const result = await Promise.race([
|
|
59
|
+
pendingNext,
|
|
60
|
+
new Promise((resolve) => {
|
|
61
|
+
timeoutId = globalThis.setTimeout(() => {
|
|
62
|
+
resolve(HOSTED_CHILD_STREAM_TIMEOUT_TOKEN);
|
|
63
|
+
}, watchdogState.timeoutMs);
|
|
64
|
+
}),
|
|
65
|
+
]);
|
|
66
|
+
if (result === HOSTED_CHILD_STREAM_TIMEOUT_TOKEN) {
|
|
67
|
+
const action = await input.onIdleTimeout?.(watchdogState);
|
|
68
|
+
if (action === "continue") {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
throw new HostedChildStreamIdleTimeoutError(watchdogState);
|
|
72
|
+
}
|
|
73
|
+
pendingNext = null;
|
|
74
|
+
if (result.done) {
|
|
75
|
+
return;
|
|
69
76
|
}
|
|
70
|
-
|
|
77
|
+
yield result.value;
|
|
71
78
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
finally {
|
|
80
|
+
if (timeoutId) {
|
|
81
|
+
globalThis.clearTimeout(timeoutId);
|
|
82
|
+
}
|
|
75
83
|
}
|
|
76
|
-
yield result.value;
|
|
77
84
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
// If we exit while an iterator.next() is still in flight (idle timeout or
|
|
88
|
+
// abort threw before it settled), attach a no-op catch so its eventual
|
|
89
|
+
// rejection — the caller typically aborts the stream — does not surface as
|
|
90
|
+
// an unhandled promise rejection, and settle the underlying iterator.
|
|
91
|
+
if (pendingNext) {
|
|
92
|
+
void pendingNext.catch(() => { });
|
|
82
93
|
}
|
|
94
|
+
// Fire-and-forget: do not await, because a stalled generator's return()
|
|
95
|
+
// chains onto the unsettled next() body and would itself never resolve.
|
|
96
|
+
// Defer the call via Promise.resolve().then(...) so a *synchronous* throw
|
|
97
|
+
// from a custom iterator's return() becomes a rejected promise that the
|
|
98
|
+
// no-op catch swallows — otherwise it would escape this finally and mask
|
|
99
|
+
// the original idle-timeout/abort error (or a normal done return).
|
|
100
|
+
void Promise.resolve().then(() => iterator.return?.()).catch(() => { });
|
|
83
101
|
}
|
|
84
102
|
}
|
|
85
103
|
/** Resolves hosted child promise with timeout. */
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import { type ChatStreamWatchdogOptions } from "../../chat/stream-watchdog.js";
|
|
1
2
|
import type { AgentTraceAttributes } from "./trace-attributes.js";
|
|
2
3
|
import type { HostedChatExecutionRuntimeLogger } from "./chat-execution-runtime.js";
|
|
3
4
|
import type { PreparedHostedChatExecutionRuntimeOptions } from "./prepared-chat-execution.js";
|
|
5
|
+
/** Environment key for hosted chat stream idle timeout. */
|
|
6
|
+
export declare const VERYFRONT_CHAT_STREAM_IDLE_TIMEOUT_ENV = "VERYFRONT_CHAT_STREAM_IDLE_TIMEOUT_MS";
|
|
7
|
+
/** Environment key for hosted chat stream active tool timeout. */
|
|
8
|
+
export declare const VERYFRONT_CHAT_STREAM_TOOL_TIMEOUT_ENV = "VERYFRONT_CHAT_STREAM_TOOL_TIMEOUT_MS";
|
|
9
|
+
type ChatStreamWatchdogEnv = Record<string, string | undefined>;
|
|
10
|
+
/** Resolve Veryfront Cloud chat stream watchdog timeout overrides from environment values. */
|
|
11
|
+
export declare function resolveVeryfrontCloudChatStreamWatchdogOptions(env?: ChatStreamWatchdogEnv): Pick<ChatStreamWatchdogOptions, "idleTimeoutMs" | "toolRunningTimeoutMs">;
|
|
4
12
|
/** Input payload for create Veryfront Cloud prepared hosted chat execution runtime options. */
|
|
5
13
|
export type CreateVeryfrontCloudPreparedHostedChatExecutionRuntimeOptionsInput = {
|
|
6
14
|
apiUrl: string | URL;
|
|
@@ -13,4 +21,5 @@ export type CreateVeryfrontCloudPreparedHostedChatExecutionRuntimeOptionsInput =
|
|
|
13
21
|
};
|
|
14
22
|
/** Options accepted by create Veryfront Cloud prepared hosted chat execution runtime. */
|
|
15
23
|
export declare function createVeryfrontCloudPreparedHostedChatExecutionRuntimeOptions(input: CreateVeryfrontCloudPreparedHostedChatExecutionRuntimeOptionsInput): PreparedHostedChatExecutionRuntimeOptions;
|
|
24
|
+
export {};
|
|
16
25
|
//# sourceMappingURL=cloud-prepared-chat-execution-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-prepared-chat-execution-runtime.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/cloud-prepared-chat-execution-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloud-prepared-chat-execution-runtime.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/cloud-prepared-chat-execution-runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,yBAAyB,EAE/B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,8BAA8B,CAAC;AAE9F,2DAA2D;AAC3D,eAAO,MAAM,sCAAsC,0CAA0C,CAAC;AAC9F,kEAAkE;AAClE,eAAO,MAAM,sCAAsC,0CAA0C,CAAC;AAE9F,KAAK,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAWhE,8FAA8F;AAC9F,wBAAgB,8CAA8C,CAC5D,GAAG,GAAE,qBAGJ,GACA,IAAI,CAAC,yBAAyB,EAAE,eAAe,GAAG,sBAAsB,CAAC,CAQ3E;AAED,+FAA+F;AAC/F,MAAM,MAAM,kEAAkE,GAAG;IAC/E,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC;IACrB,MAAM,EAAE,yCAAyC,CAAC,QAAQ,CAAC,CAAC;IAC5D,MAAM,CAAC,EAAE,gCAAgC,CAAC;IAC1C,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChG,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/E,uBAAuB,CAAC,EAAE,CAAC,UAAU,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACrE,wBAAwB,CAAC,EAAE,yCAAyC,CAAC,0BAA0B,CAAC,CAAC;CAClG,CAAC;AAEF,yFAAyF;AACzF,wBAAgB,6DAA6D,CAC3E,KAAK,EAAE,kEAAkE,GACxE,yCAAyC,CAiB3C"}
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
|
-
import { createChatStreamWatchdog } from "../../chat/stream-watchdog.js";
|
|
2
|
+
import { createChatStreamWatchdog, } from "../../chat/stream-watchdog.js";
|
|
3
|
+
import { getEnv } from "../../platform/compat/process.js";
|
|
3
4
|
import { getVeryfrontCloudProviderFromModelId } from "../../provider/index.js";
|
|
5
|
+
/** Environment key for hosted chat stream idle timeout. */
|
|
6
|
+
export const VERYFRONT_CHAT_STREAM_IDLE_TIMEOUT_ENV = "VERYFRONT_CHAT_STREAM_IDLE_TIMEOUT_MS";
|
|
7
|
+
/** Environment key for hosted chat stream active tool timeout. */
|
|
8
|
+
export const VERYFRONT_CHAT_STREAM_TOOL_TIMEOUT_ENV = "VERYFRONT_CHAT_STREAM_TOOL_TIMEOUT_MS";
|
|
9
|
+
function parsePositiveInteger(value) {
|
|
10
|
+
if (!value) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
const parsed = Number.parseInt(value, 10);
|
|
14
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
|
|
15
|
+
}
|
|
16
|
+
/** Resolve Veryfront Cloud chat stream watchdog timeout overrides from environment values. */
|
|
17
|
+
export function resolveVeryfrontCloudChatStreamWatchdogOptions(env = {
|
|
18
|
+
[VERYFRONT_CHAT_STREAM_IDLE_TIMEOUT_ENV]: getEnv(VERYFRONT_CHAT_STREAM_IDLE_TIMEOUT_ENV),
|
|
19
|
+
[VERYFRONT_CHAT_STREAM_TOOL_TIMEOUT_ENV]: getEnv(VERYFRONT_CHAT_STREAM_TOOL_TIMEOUT_ENV),
|
|
20
|
+
}) {
|
|
21
|
+
const idleTimeoutMs = parsePositiveInteger(env[VERYFRONT_CHAT_STREAM_IDLE_TIMEOUT_ENV]);
|
|
22
|
+
const toolRunningTimeoutMs = parsePositiveInteger(env[VERYFRONT_CHAT_STREAM_TOOL_TIMEOUT_ENV]);
|
|
23
|
+
return {
|
|
24
|
+
...(idleTimeoutMs !== undefined ? { idleTimeoutMs } : {}),
|
|
25
|
+
...(toolRunningTimeoutMs !== undefined ? { toolRunningTimeoutMs } : {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
4
28
|
/** Options accepted by create Veryfront Cloud prepared hosted chat execution runtime. */
|
|
5
29
|
export function createVeryfrontCloudPreparedHostedChatExecutionRuntimeOptions(input) {
|
|
6
30
|
return {
|
|
@@ -11,6 +35,7 @@ export function createVeryfrontCloudPreparedHostedChatExecutionRuntimeOptions(in
|
|
|
11
35
|
traceStream: input.traceStream,
|
|
12
36
|
createRootStreamWatchdog: input.createRootStreamWatchdog ??
|
|
13
37
|
(() => createChatStreamWatchdog({
|
|
38
|
+
...resolveVeryfrontCloudChatStreamWatchdogOptions(),
|
|
14
39
|
setTimeoutFn: dntShim.dntGlobalThis.setTimeout,
|
|
15
40
|
clearTimeoutFn: globalThis.clearTimeout,
|
|
16
41
|
})),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-terminal-error.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/stream-terminal-error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream-terminal-error.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/stream-terminal-error.ts"],"names":[],"mappings":"AAwDA,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAkDF,uCAAuC;AACvC,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,CAErE;AAED,mEAAmE;AACnE,wBAAgB,2CAA2C,CAAC,KAAK,EAAE;IACjE,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9B,GAAG,yBAAyB,CAQ5B;AAED,4DAA4D;AAC5D,wBAAgB,qCAAqC,CAAC,KAAK,EAAE;IAC3D,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE;QAAE,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC;CAC5C,GAAG,OAAO,CAEV"}
|
|
@@ -6,6 +6,46 @@ const EMPTY_RESPONSE_TERMINAL_ERROR_MESSAGE = "Assistant completed without produ
|
|
|
6
6
|
const EXTERNAL_SERVICE_ERROR_CODE = "EXTERNAL_SERVICE_ERROR";
|
|
7
7
|
const EXTERNAL_SERVICE_ERROR_MESSAGE = "LLM provider service error";
|
|
8
8
|
const STREAM_ERROR_TERMINAL_ERROR_CODE = "STREAM_ERROR";
|
|
9
|
+
const STREAM_TIMEOUT_TERMINAL_ERROR_CODE = "STREAM_TIMEOUT";
|
|
10
|
+
function formatTimeoutDuration(input) {
|
|
11
|
+
const minuteMatch = input.match(/after\s+(\d+)\s+minutes?/i);
|
|
12
|
+
if (minuteMatch) {
|
|
13
|
+
const minutes = Number.parseInt(minuteMatch[1] ?? "", 10);
|
|
14
|
+
if (Number.isFinite(minutes) && minutes > 0) {
|
|
15
|
+
return `${minutes} ${minutes === 1 ? "minute" : "minutes"}`;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const millisecondMatch = input.match(/after\s+(\d+)\s*ms/i);
|
|
19
|
+
if (millisecondMatch) {
|
|
20
|
+
const milliseconds = Number.parseInt(millisecondMatch[1] ?? "", 10);
|
|
21
|
+
if (Number.isFinite(milliseconds) && milliseconds > 0) {
|
|
22
|
+
const seconds = Math.round(milliseconds / 1000);
|
|
23
|
+
if (seconds >= 60 && seconds % 60 === 0) {
|
|
24
|
+
const minutes = seconds / 60;
|
|
25
|
+
return `${minutes} ${minutes === 1 ? "minute" : "minutes"}`;
|
|
26
|
+
}
|
|
27
|
+
return `${seconds} ${seconds === 1 ? "second" : "seconds"}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
function getHostedStreamTimeoutTerminalError(error) {
|
|
33
|
+
const message = getUnknownErrorMessage(error).trim();
|
|
34
|
+
const normalized = message.toLowerCase();
|
|
35
|
+
const isTimeout = normalized.includes("stream timed out") ||
|
|
36
|
+
normalized.includes("chat stream idle timeout") ||
|
|
37
|
+
normalized.includes("stream timeout");
|
|
38
|
+
if (!isTimeout) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const duration = formatTimeoutDuration(message);
|
|
42
|
+
return {
|
|
43
|
+
code: STREAM_TIMEOUT_TERMINAL_ERROR_CODE,
|
|
44
|
+
message: duration
|
|
45
|
+
? `This run timed out after ${duration} before the agent finished. Try again to continue, or narrow the request.`
|
|
46
|
+
: "This run timed out before the agent finished. Try again to continue, or narrow the request.",
|
|
47
|
+
};
|
|
48
|
+
}
|
|
9
49
|
function getUnknownErrorMessage(error) {
|
|
10
50
|
if (typeof error === "string") {
|
|
11
51
|
return error;
|
|
@@ -22,6 +62,10 @@ function getHostedStreamTerminalError(streamError) {
|
|
|
22
62
|
if (streamError == null) {
|
|
23
63
|
return null;
|
|
24
64
|
}
|
|
65
|
+
const timeoutError = getHostedStreamTimeoutTerminalError(streamError);
|
|
66
|
+
if (timeoutError) {
|
|
67
|
+
return timeoutError;
|
|
68
|
+
}
|
|
25
69
|
const parsedError = parseProviderError(streamError);
|
|
26
70
|
if (parsedError.code !== EXTERNAL_SERVICE_ERROR_CODE ||
|
|
27
71
|
parsedError.message !== EXTERNAL_SERVICE_ERROR_MESSAGE) {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const AGENT_CATALOG_KINDS: readonly ["template_agent", "installable_agent"];
|
|
2
|
+
export type AgentCatalogKind = (typeof AGENT_CATALOG_KINDS)[number];
|
|
3
|
+
export declare const AGENT_CATALOG_ACTIONS: readonly ["fork", "install"];
|
|
4
|
+
export type AgentCatalogAction = (typeof AGENT_CATALOG_ACTIONS)[number];
|
|
5
|
+
export declare const PROJECT_AGENT_KINDS: readonly ["source_project_agent", "installed_project_agent"];
|
|
6
|
+
export type ProjectAgentKind = (typeof PROJECT_AGENT_KINDS)[number];
|
|
7
|
+
export declare const PROJECT_AGENT_EXECUTION_KINDS: readonly ["source", "installed"];
|
|
8
|
+
export type ProjectAgentExecutionKind = (typeof PROJECT_AGENT_EXECUTION_KINDS)[number];
|
|
9
|
+
export type SourceProjectAgentExecutionIdentity = {
|
|
10
|
+
kind: "source";
|
|
11
|
+
projectId: string;
|
|
12
|
+
agentId: string;
|
|
13
|
+
};
|
|
14
|
+
export type InstalledProjectAgentExecutionIdentity = {
|
|
15
|
+
kind: "installed";
|
|
16
|
+
projectId: string;
|
|
17
|
+
agentId: string;
|
|
18
|
+
catalogEntryId: string;
|
|
19
|
+
agentAccessGrantId: string;
|
|
20
|
+
serviceAccountId: string;
|
|
21
|
+
};
|
|
22
|
+
export type ProjectAgentExecutionIdentity = SourceProjectAgentExecutionIdentity | InstalledProjectAgentExecutionIdentity;
|
|
23
|
+
export type SourceProjectAgentRunSnapshot = {
|
|
24
|
+
kind: "source";
|
|
25
|
+
project_id: string;
|
|
26
|
+
agent_id: string;
|
|
27
|
+
};
|
|
28
|
+
export type InstalledProjectAgentRunSnapshot = {
|
|
29
|
+
kind: "installed";
|
|
30
|
+
project_id: string;
|
|
31
|
+
agent_id: string;
|
|
32
|
+
catalog_entry_id: string;
|
|
33
|
+
agent_access_grant_id: string;
|
|
34
|
+
service_account_id: string;
|
|
35
|
+
};
|
|
36
|
+
export type ProjectAgentRunSnapshot = SourceProjectAgentRunSnapshot | InstalledProjectAgentRunSnapshot;
|
|
37
|
+
export declare function isAgentCatalogKind(value: string): value is AgentCatalogKind;
|
|
38
|
+
export declare function isAgentCatalogAction(value: string): value is AgentCatalogAction;
|
|
39
|
+
export declare function isProjectAgentKind(value: string): value is ProjectAgentKind;
|
|
40
|
+
export declare function isInstalledProjectAgentKind(value: ProjectAgentKind): value is "installed_project_agent";
|
|
41
|
+
export declare function isProjectAgentExecutionKind(value: string): value is ProjectAgentExecutionKind;
|
|
42
|
+
//# sourceMappingURL=identity-contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-contracts.d.ts","sourceRoot":"","sources":["../../../src/src/agent/identity-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,eAAO,MAAM,mBAAmB,kDAGtB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,qBAAqB,8BAA+B,CAAC;AAElE,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,eAAO,MAAM,mBAAmB,8DAGtB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,eAAO,MAAM,6BAA6B,kCAAmC,CAAC;AAE9E,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvF,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GACrC,mCAAmC,GACnC,sCAAsC,CAAC;AAE3C,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAC/B,6BAA6B,GAC7B,gCAAgC,CAAC;AAErC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,gBAAgB,CAE3E;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,GACZ,KAAK,IAAI,kBAAkB,CAE7B;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,gBAAgB,CAE3E;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,gBAAgB,GACtB,KAAK,IAAI,yBAAyB,CAEpC;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,GACZ,KAAK,IAAI,yBAAyB,CAIpC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const AGENT_CATALOG_KINDS = [
|
|
2
|
+
"template_agent",
|
|
3
|
+
"installable_agent",
|
|
4
|
+
];
|
|
5
|
+
export const AGENT_CATALOG_ACTIONS = ["fork", "install"];
|
|
6
|
+
export const PROJECT_AGENT_KINDS = [
|
|
7
|
+
"source_project_agent",
|
|
8
|
+
"installed_project_agent",
|
|
9
|
+
];
|
|
10
|
+
export const PROJECT_AGENT_EXECUTION_KINDS = ["source", "installed"];
|
|
11
|
+
export function isAgentCatalogKind(value) {
|
|
12
|
+
return AGENT_CATALOG_KINDS.includes(value);
|
|
13
|
+
}
|
|
14
|
+
export function isAgentCatalogAction(value) {
|
|
15
|
+
return AGENT_CATALOG_ACTIONS.includes(value);
|
|
16
|
+
}
|
|
17
|
+
export function isProjectAgentKind(value) {
|
|
18
|
+
return PROJECT_AGENT_KINDS.includes(value);
|
|
19
|
+
}
|
|
20
|
+
export function isInstalledProjectAgentKind(value) {
|
|
21
|
+
return value === "installed_project_agent";
|
|
22
|
+
}
|
|
23
|
+
export function isProjectAgentExecutionKind(value) {
|
|
24
|
+
return PROJECT_AGENT_EXECUTION_KINDS.includes(value);
|
|
25
|
+
}
|
package/esm/src/agent/index.d.ts
CHANGED
|
@@ -185,6 +185,7 @@ export { type ConversationRunMirror, type ConversationRunMirrorRetryScheduledSta
|
|
|
185
185
|
export { appendMissingChildRunToolCalls, appendMissingChildRunToolResults, buildChildRunExhaustedStepBudgetErrorMessage, } from "./child-run/final-step-support.js";
|
|
186
186
|
export { formatChildRunStreamPartError, isChildRunAbortError, throwIfChildRunAborted, toChildRunToolInputRecord, } from "./child-run/execution-support.js";
|
|
187
187
|
export { type AgentRuntimeMessage, AgentRuntimeMessageConversionError, type AgentRuntimeMessagePart, convertAgentRuntimeMessagesToProviderMessages, convertProviderMessagesToAgentRuntimeMessages, createToolResultPart, getAgentRuntimeTextPart, getAgentRuntimeToolCallPart, getAgentRuntimeToolResultPart, } from "./runtime/message-adapter.js";
|
|
188
|
+
export { AGENT_CATALOG_ACTIONS, AGENT_CATALOG_KINDS, type AgentCatalogAction, type AgentCatalogKind, type InstalledProjectAgentExecutionIdentity, type InstalledProjectAgentRunSnapshot, isAgentCatalogAction, isAgentCatalogKind, isInstalledProjectAgentKind, isProjectAgentExecutionKind, isProjectAgentKind, PROJECT_AGENT_EXECUTION_KINDS, PROJECT_AGENT_KINDS, type ProjectAgentExecutionIdentity, type ProjectAgentExecutionKind, type ProjectAgentKind, type ProjectAgentRunSnapshot, type SourceProjectAgentExecutionIdentity, type SourceProjectAgentRunSnapshot, } from "./identity-contracts.js";
|
|
188
189
|
export { resolveRuntimeMessageFileUrls, type RuntimeFileUrlResolver, type RuntimeFileUrlResolverInput, } from "./runtime/message-file-url-refresh.js";
|
|
189
190
|
export { prepareAgentRuntimeMessagesFromUiMessages, type PrepareAgentRuntimeMessagesFromUiMessagesOptions, } from "./runtime/message-preparation.js";
|
|
190
191
|
export { type HostedChatExecutionPreparationInput, type HostedChatExecutionPreparationResult, type HostedChatExecutionPreparationRootRunOptions, type HostedChatRuntimeCreationPreparationInput, type HostedChatRuntimeCreationPreparationResult, type HostedChatRuntimeInstructionsInput, type HostedChatRuntimePreparationRootRunContext, type HostedChatRuntimePreparationSteering, type NormalizedHostedChatRequest, type NormalizedHostedChatRequest as NormalizedAgentServiceChatRequest, normalizeParsedHostedChatRequest, normalizeParsedHostedChatRequest as normalizeParsedAgentServiceChatRequest, prepareHostedChatExecution, prepareHostedChatExecution as prepareAgentServiceChatExecution, prepareHostedChatRuntimeCreationOptions, prepareHostedChatRuntimeCreationOptions as prepareAgentServiceChatRuntimeCreationOptions, prepareHostedChatRuntimeMessages, prepareHostedChatRuntimeMessages as prepareAgentServiceChatRuntimeMessages, type PrepareHostedChatRuntimeMessagesOptions, type PrepareHostedChatRuntimeMessagesOptions as PrepareAgentServiceChatRuntimeMessagesOptions, } from "./hosted/chat-preparation.js";
|