@github-tools/sdk 1.2.0 → 1.4.0

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.
@@ -0,0 +1,55 @@
1
+ import { n as resolveInstructions, t as createGithubAgent } from "./agents-D9aKsd_7.mjs";
2
+ import { createGithubTools } from "./index.mjs";
3
+ import { DurableAgent } from "@workflow/ai/agent";
4
+
5
+ //#region src/workflow.ts
6
+ /**
7
+ * Create a pre-configured durable GitHub agent powered by Vercel Workflow SDK's `DurableAgent`.
8
+ *
9
+ * Each tool call runs as a durable step with automatic retries and observability.
10
+ * Must be used inside a `"use workflow"` function.
11
+ *
12
+ * **Note:** `requireApproval` is accepted for forward-compatibility but is currently
13
+ * ignored by `DurableAgent` — the Workflow SDK does not yet support interactive tool
14
+ * approval. All tools execute immediately without user confirmation.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import { createDurableGithubAgent } from '@github-tools/sdk/workflow'
19
+ * import { getWritable } from 'workflow'
20
+ * import type { ModelMessage, UIMessageChunk } from 'ai'
21
+ *
22
+ * async function chatWorkflow(messages: ModelMessage[], token: string) {
23
+ * "use workflow"
24
+ * const agent = createDurableGithubAgent({
25
+ * model: 'anthropic/claude-sonnet-4.6',
26
+ * token,
27
+ * preset: 'code-review',
28
+ * })
29
+ * const writable = getWritable<UIMessageChunk>()
30
+ * await agent.stream({ messages, writable })
31
+ * }
32
+ * ```
33
+ */
34
+ function createDurableGithubAgent({ model, token, preset, requireApproval, instructions, additionalInstructions, ...agentOptions }) {
35
+ const tools = createGithubTools({
36
+ token,
37
+ requireApproval,
38
+ preset
39
+ });
40
+ const resolvedModel = typeof model === "string" || typeof model === "function" ? model : () => Promise.resolve(model);
41
+ return new DurableAgent({
42
+ ...agentOptions,
43
+ model: resolvedModel,
44
+ tools,
45
+ instructions: resolveInstructions({
46
+ preset,
47
+ instructions,
48
+ additionalInstructions
49
+ })
50
+ });
51
+ }
52
+
53
+ //#endregion
54
+ export { createDurableGithubAgent, createGithubAgent, createGithubTools };
55
+ //# sourceMappingURL=workflow.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.mjs","names":[],"sources":["../src/workflow.ts"],"sourcesContent":["import { DurableAgent } from '@workflow/ai/agent'\nimport type { CompatibleLanguageModel } from '@workflow/ai/agent'\nimport { createGithubTools } from './index'\nimport { resolveInstructions } from './agents'\nimport type { GithubToolPreset, ApprovalConfig } from './index'\n\nexport type CreateDurableGithubAgentOptions = {\n model: string | CompatibleLanguageModel | (() => Promise<CompatibleLanguageModel>)\n /**\n * GitHub personal access token.\n * Falls back to `process.env.GITHUB_TOKEN` when omitted.\n */\n token?: string\n preset?: GithubToolPreset | GithubToolPreset[]\n requireApproval?: ApprovalConfig\n instructions?: string\n additionalInstructions?: string\n /** Maximum number of LLM calls before stopping. Unlimited by default. */\n maxSteps?: number\n temperature?: number\n}\n\n/**\n * Create a pre-configured durable GitHub agent powered by Vercel Workflow SDK's `DurableAgent`.\n *\n * Each tool call runs as a durable step with automatic retries and observability.\n * Must be used inside a `\"use workflow\"` function.\n *\n * **Note:** `requireApproval` is accepted for forward-compatibility but is currently\n * ignored by `DurableAgent` — the Workflow SDK does not yet support interactive tool\n * approval. All tools execute immediately without user confirmation.\n *\n * @example\n * ```ts\n * import { createDurableGithubAgent } from '@github-tools/sdk/workflow'\n * import { getWritable } from 'workflow'\n * import type { ModelMessage, UIMessageChunk } from 'ai'\n *\n * async function chatWorkflow(messages: ModelMessage[], token: string) {\n * \"use workflow\"\n * const agent = createDurableGithubAgent({\n * model: 'anthropic/claude-sonnet-4.6',\n * token,\n * preset: 'code-review',\n * })\n * const writable = getWritable<UIMessageChunk>()\n * await agent.stream({ messages, writable })\n * }\n * ```\n */\nexport function createDurableGithubAgent({\n model,\n token,\n preset,\n requireApproval,\n instructions,\n additionalInstructions,\n ...agentOptions\n}: CreateDurableGithubAgentOptions) {\n const tools = createGithubTools({ token, requireApproval, preset })\n\n const resolvedModel = typeof model === 'string' || typeof model === 'function'\n ? model\n : () => Promise.resolve(model)\n\n return new DurableAgent({\n ...agentOptions,\n model: resolvedModel,\n tools,\n instructions: resolveInstructions({ preset, instructions, additionalInstructions }),\n })\n}\n\nexport { createGithubTools, createGithubAgent } from './index'\nexport type { GithubTools, GithubToolsOptions, GithubToolPreset, GithubWriteToolName, ApprovalConfig } from './index'\nexport type { CreateGithubAgentOptions } from './agents'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAgB,yBAAyB,EACvC,OACA,OACA,QACA,iBACA,cACA,wBACA,GAAG,gBAC+B;CAClC,MAAM,QAAQ,kBAAkB;EAAE;EAAO;EAAiB;EAAQ,CAAC;CAEnE,MAAM,gBAAgB,OAAO,UAAU,YAAY,OAAO,UAAU,aAChE,cACM,QAAQ,QAAQ,MAAM;AAEhC,QAAO,IAAI,aAAa;EACtB,GAAG;EACH,OAAO;EACP;EACA,cAAc,oBAAoB;GAAE;GAAQ;GAAc;GAAwB,CAAC;EACpF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@github-tools/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "GitHub tools for the Vercel AI SDK, wrap GitHub's API as AI SDK tools ready to plug into any agent",
5
5
  "author": "HugoRCD <hugo.richard@vercel.com",
6
6
  "repository": {
@@ -13,11 +13,17 @@
13
13
  "url": "https://github.com/vercel-labs/github-tools/issues"
14
14
  },
15
15
  "type": "module",
16
- "sideEffects": false,
16
+ "sideEffects": [
17
+ "./dist/agents-*.mjs"
18
+ ],
17
19
  "exports": {
18
20
  ".": {
19
21
  "types": "./dist/index.d.mts",
20
22
  "import": "./dist/index.mjs"
23
+ },
24
+ "./workflow": {
25
+ "types": "./dist/workflow.d.mts",
26
+ "import": "./dist/workflow.mjs"
21
27
  }
22
28
  },
23
29
  "main": "./dist/index.mjs",
@@ -31,7 +37,9 @@
31
37
  "ai-sdk",
32
38
  "github",
33
39
  "tools",
34
- "agent"
40
+ "agent",
41
+ "workflow",
42
+ "durable"
35
43
  ],
36
44
  "license": "MIT",
37
45
  "dependencies": {
@@ -39,7 +47,17 @@
39
47
  },
40
48
  "peerDependencies": {
41
49
  "ai": "^6.0.97",
42
- "zod": "^4.3.6"
50
+ "zod": "^4.3.6",
51
+ "workflow": "^4.2.0-beta.76",
52
+ "@workflow/ai": "^4.1.0-beta.60"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "workflow": {
56
+ "optional": true
57
+ },
58
+ "@workflow/ai": {
59
+ "optional": true
60
+ }
43
61
  },
44
62
  "devDependencies": {
45
63
  "@types/node": "^24.10.13",