mastracode 0.17.3-alpha.2 → 0.18.0-alpha.10
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/CHANGELOG.md +128 -0
- package/README.md +46 -1
- package/dist/agents/memory.d.ts.map +1 -1
- package/dist/agents/model.d.ts +2 -1
- package/dist/agents/model.d.ts.map +1 -1
- package/dist/agents/prompts/build.d.ts +1 -1
- package/dist/agents/prompts/build.d.ts.map +1 -1
- package/dist/agents/prompts/index.d.ts.map +1 -1
- package/dist/agents/prompts/tool-guidance.d.ts.map +1 -1
- package/dist/agents/subagents/execute.d.ts.map +1 -1
- package/dist/agents/thread-caveman-state.d.ts +16 -0
- package/dist/agents/thread-caveman-state.d.ts.map +1 -0
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/providers/github-copilot.d.ts +100 -0
- package/dist/auth/providers/github-copilot.d.ts.map +1 -0
- package/dist/auth/providers/openai-codex.d.ts +23 -0
- package/dist/auth/providers/openai-codex.d.ts.map +1 -1
- package/dist/auth/storage.d.ts.map +1 -1
- package/dist/{chunk-FXESWZUH.js → chunk-3HVTKC7D.js} +749 -13
- package/dist/chunk-3HVTKC7D.js.map +1 -0
- package/dist/{chunk-RYAKKVIH.cjs → chunk-462LTARS.cjs} +3898 -3164
- package/dist/chunk-462LTARS.cjs.map +1 -0
- package/dist/{chunk-OBFBUWOR.cjs → chunk-AWYGW5ZV.cjs} +12 -4
- package/dist/chunk-AWYGW5ZV.cjs.map +1 -0
- package/dist/{chunk-ZYG7WE7V.js → chunk-BNPMW477.js} +181 -660
- package/dist/chunk-BNPMW477.js.map +1 -0
- package/dist/{chunk-6FHOMZRJ.js → chunk-DDGP3I2M.js} +4056 -3322
- package/dist/chunk-DDGP3I2M.js.map +1 -0
- package/dist/{chunk-BHK3OFI3.cjs → chunk-GVEGYH6O.cjs} +253 -735
- package/dist/chunk-GVEGYH6O.cjs.map +1 -0
- package/dist/{chunk-BYQZSMN2.js → chunk-HXMGEATX.js} +387 -39
- package/dist/chunk-HXMGEATX.js.map +1 -0
- package/dist/{chunk-P6EKFEJB.cjs → chunk-KEOJCX6A.cjs} +757 -15
- package/dist/chunk-KEOJCX6A.cjs.map +1 -0
- package/dist/{chunk-A3S5I2HC.cjs → chunk-LTIU3ZZQ.cjs} +389 -38
- package/dist/chunk-LTIU3ZZQ.cjs.map +1 -0
- package/dist/{chunk-JP7WKMD4.js → chunk-TTAAM2XR.js} +12 -4
- package/dist/chunk-TTAAM2XR.js.map +1 -0
- package/dist/cli.cjs +19 -19
- package/dist/cli.js +4 -4
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/onboarding/onboarding-inline.d.ts +5 -5
- package/dist/onboarding/onboarding-inline.d.ts.map +1 -1
- package/dist/onboarding/packs.d.ts +1 -0
- package/dist/onboarding/packs.d.ts.map +1 -1
- package/dist/onboarding/settings.d.ts +11 -0
- package/dist/onboarding/settings.d.ts.map +1 -1
- package/dist/permissions-EDE3D2DA.js +3 -0
- package/dist/{permissions-RFLEFJHS.js.map → permissions-EDE3D2DA.js.map} +1 -1
- package/dist/permissions-GWY37IEK.cjs +40 -0
- package/dist/{permissions-YLP5R74I.cjs.map → permissions-GWY37IEK.cjs.map} +1 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/providers/github-copilot.d.ts +58 -0
- package/dist/providers/github-copilot.d.ts.map +1 -0
- package/dist/schema.d.ts +2 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/storage-BN3ZW6AZ.cjs +24 -0
- package/dist/{storage-EKR4Y5CN.cjs.map → storage-BN3ZW6AZ.cjs.map} +1 -1
- package/dist/storage-RM6K3ZZH.js +3 -0
- package/dist/{storage-RE6JEE73.js.map → storage-RM6K3ZZH.js.map} +1 -1
- package/dist/tui/command-dispatch.d.ts.map +1 -1
- package/dist/tui/commands/api-keys.d.ts.map +1 -1
- package/dist/tui/commands/browser.d.ts.map +1 -1
- package/dist/tui/commands/clone.d.ts.map +1 -1
- package/dist/tui/commands/custom-providers.d.ts.map +1 -1
- package/dist/tui/commands/goal.d.ts +23 -0
- package/dist/tui/commands/goal.d.ts.map +1 -0
- package/dist/tui/commands/index.d.ts +1 -0
- package/dist/tui/commands/index.d.ts.map +1 -1
- package/dist/tui/commands/login.d.ts.map +1 -1
- package/dist/tui/commands/mcp.d.ts.map +1 -1
- package/dist/tui/commands/memory-gateway.d.ts.map +1 -1
- package/dist/tui/commands/models-pack.d.ts.map +1 -1
- package/dist/tui/commands/new.d.ts.map +1 -1
- package/dist/tui/commands/observability.d.ts.map +1 -1
- package/dist/tui/commands/om.d.ts.map +1 -1
- package/dist/tui/commands/resource.d.ts.map +1 -1
- package/dist/tui/commands/sandbox.d.ts.map +1 -1
- package/dist/tui/commands/settings.d.ts.map +1 -1
- package/dist/tui/commands/subagents.d.ts.map +1 -1
- package/dist/tui/commands/think.d.ts.map +1 -1
- package/dist/tui/commands/thread-tag-dir.d.ts.map +1 -1
- package/dist/tui/commands/threads.d.ts.map +1 -1
- package/dist/tui/commands/update.d.ts.map +1 -1
- package/dist/tui/components/ask-question-dialog.d.ts +4 -0
- package/dist/tui/components/ask-question-dialog.d.ts.map +1 -1
- package/dist/tui/components/ask-question-inline.d.ts +1 -0
- package/dist/tui/components/ask-question-inline.d.ts.map +1 -1
- package/dist/tui/components/custom-editor.d.ts.map +1 -1
- package/dist/tui/components/goal-cycles-dialog.d.ts +22 -0
- package/dist/tui/components/goal-cycles-dialog.d.ts.map +1 -0
- package/dist/tui/components/help-overlay.d.ts.map +1 -1
- package/dist/tui/components/judge-display.d.ts +12 -0
- package/dist/tui/components/judge-display.d.ts.map +1 -0
- package/dist/tui/components/om-settings.d.ts +2 -0
- package/dist/tui/components/om-settings.d.ts.map +1 -1
- package/dist/tui/components/plan-approval-inline.d.ts +3 -0
- package/dist/tui/components/plan-approval-inline.d.ts.map +1 -1
- package/dist/tui/components/system-reminder.d.ts +4 -0
- package/dist/tui/components/system-reminder.d.ts.map +1 -1
- package/dist/tui/components/task-progress.d.ts +3 -3
- package/dist/tui/components/task-progress.d.ts.map +1 -1
- package/dist/tui/event-dispatch.d.ts.map +1 -1
- package/dist/tui/goal-input-lock.d.ts +6 -0
- package/dist/tui/goal-input-lock.d.ts.map +1 -0
- package/dist/tui/goal-manager.d.ts +57 -0
- package/dist/tui/goal-manager.d.ts.map +1 -0
- package/dist/tui/handlers/agent-lifecycle.d.ts.map +1 -1
- package/dist/tui/handlers/message.d.ts.map +1 -1
- package/dist/tui/handlers/prompts.d.ts +0 -4
- package/dist/tui/handlers/prompts.d.ts.map +1 -1
- package/dist/tui/handlers/tool.d.ts +1 -0
- package/dist/tui/handlers/tool.d.ts.map +1 -1
- package/dist/tui/handlers/types.d.ts +5 -3
- package/dist/tui/handlers/types.d.ts.map +1 -1
- package/dist/tui/mastra-tui.d.ts +2 -1
- package/dist/tui/mastra-tui.d.ts.map +1 -1
- package/dist/tui/modal-question.d.ts +18 -0
- package/dist/tui/modal-question.d.ts.map +1 -0
- package/dist/tui/overlay.d.ts +12 -0
- package/dist/tui/overlay.d.ts.map +1 -0
- package/dist/tui/prompt-api-key.d.ts.map +1 -1
- package/dist/tui/render-messages.d.ts +3 -3
- package/dist/tui/render-messages.d.ts.map +1 -1
- package/dist/tui/setup.d.ts.map +1 -1
- package/dist/tui/state.d.ts +12 -3
- package/dist/tui/state.d.ts.map +1 -1
- package/dist/tui/status-line.d.ts.map +1 -1
- package/dist/tui.cjs +19 -19
- package/dist/tui.js +2 -2
- package/dist/utils/gateway-sync.d.ts +12 -16
- package/dist/utils/gateway-sync.d.ts.map +1 -1
- package/dist/utils/slash-command-loader.d.ts +2 -0
- package/dist/utils/slash-command-loader.d.ts.map +1 -1
- package/dist/utils/token-estimator.d.ts.map +1 -1
- package/package.json +15 -14
- package/dist/chunk-6FHOMZRJ.js.map +0 -1
- package/dist/chunk-A3S5I2HC.cjs.map +0 -1
- package/dist/chunk-BHK3OFI3.cjs.map +0 -1
- package/dist/chunk-BYQZSMN2.js.map +0 -1
- package/dist/chunk-FXESWZUH.js.map +0 -1
- package/dist/chunk-JP7WKMD4.js.map +0 -1
- package/dist/chunk-OBFBUWOR.cjs.map +0 -1
- package/dist/chunk-P6EKFEJB.cjs.map +0 -1
- package/dist/chunk-RYAKKVIH.cjs.map +0 -1
- package/dist/chunk-ZYG7WE7V.js.map +0 -1
- package/dist/permissions-RFLEFJHS.js +0 -3
- package/dist/permissions-YLP5R74I.cjs +0 -40
- package/dist/storage-EKR4Y5CN.cjs +0 -24
- package/dist/storage-RE6JEE73.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,133 @@
|
|
|
1
1
|
# mastracode
|
|
2
2
|
|
|
3
|
+
## 0.18.0-alpha.10
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added GitHub Copilot OAuth login (`/login` → GitHub Copilot) so anyone with an active Copilot subscription can use Mastra Code without separate OpenAI or Anthropic keys. The flow uses the standard GitHub device code OAuth, supports GitHub Enterprise hosts, and automatically refreshes the short-lived Copilot bearer token. ([#16129](https://github.com/mastra-ai/mastra/pull/16129))
|
|
8
|
+
|
|
9
|
+
A new **GitHub Copilot** mode pack is selectable from the onboarding wizard and `/models`. The built-in defaults are:
|
|
10
|
+
- _plan_: `github-copilot/gemini-2.5-pro`
|
|
11
|
+
- _build_: `github-copilot/gpt-4.1`
|
|
12
|
+
- _fast_: `github-copilot/grok-code-fast-1`
|
|
13
|
+
|
|
14
|
+
After login, the available Copilot models are fetched live from the `/models` endpoint, filtered to picker-enabled, non-policy-disabled entries, and cached for 10 minutes. Mastra Code now uses the generic OpenAI-compatible AI SDK adapter pointed directly at GitHub Copilot's API instead of rewriting OpenAI provider URLs, and applies Gemini-compatible tool schemas for Copilot Gemini models.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Fixed plan approval so accepting a plan can switch modes after the waiting plan tool resolves, clears stale abort state before starting the approved goal, and injects the goal trigger directly instead of queueing a follow-up. ([#16340](https://github.com/mastra-ai/mastra/pull/16340))
|
|
19
|
+
|
|
20
|
+
- Delegate gateway sync to `@mastra/core`'s `GatewayRegistry.syncGateways`, removing duplicated provider-fetch, type-generation, and atomic-write logic so mastracode stays in sync with core registry behavior. ([#16332](https://github.com/mastra-ai/mastra/pull/16332))
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`7c275a8`](https://github.com/mastra-ai/mastra/commit/7c275a810595e1a6c41ccc39720531ab65734700), [`890b24c`](https://github.com/mastra-ai/mastra/commit/890b24cc7d32ed6aa4dfe253e54dc6bf4099f690), [`0f48ebf`](https://github.com/mastra-ai/mastra/commit/0f48ebfc7ac7897b2092a189f45751924cf56d1c), [`9d71101`](https://github.com/mastra-ai/mastra/commit/9d71101921decb5b8d45734b6a91b6b740c7d465), [`f180e49`](https://github.com/mastra-ai/mastra/commit/f180e4990e71b04c9a475b523584071712f0048f), [`9260e01`](https://github.com/mastra-ai/mastra/commit/9260e015276fb1b500f7878ee452b47476bf1583), [`2f6c54e`](https://github.com/mastra-ai/mastra/commit/2f6c54e17c041cac1def54baaa6b771647836414), [`e06a159`](https://github.com/mastra-ai/mastra/commit/e06a1598ca07a6c3778aefc2a2d288363c6294ff), [`c50ebc3`](https://github.com/mastra-ai/mastra/commit/c50ebc34da71044558315735e69bfb94fcfb74bf), [`db34bc6`](https://github.com/mastra-ai/mastra/commit/db34bc6fb36cf125bda0c46be4d3fdc774b70cc4), [`33767a0`](https://github.com/mastra-ai/mastra/commit/33767a0e3762beeb33dab03b1608b6d5f405fc94)]:
|
|
23
|
+
- @mastra/core@1.33.0-alpha.8
|
|
24
|
+
- @mastra/libsql@1.10.1-alpha.2
|
|
25
|
+
- @mastra/memory@1.18.0-alpha.3
|
|
26
|
+
- @mastra/pg@1.10.1-alpha.1
|
|
27
|
+
- @mastra/schema-compat@1.2.10-alpha.0
|
|
28
|
+
- @mastra/observability@1.12.0-alpha.2
|
|
29
|
+
- @mastra/mcp@1.7.0
|
|
30
|
+
|
|
31
|
+
## 0.18.0-alpha.9
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- Improved MastraCode task tracking so agents keep stable task IDs in prompts and update one task at a time while working. ([#16254](https://github.com/mastra-ai/mastra/pull/16254))
|
|
36
|
+
|
|
37
|
+
MastraCode now preserves Harness task IDs in state, includes those IDs in the current task list prompt, and replays structured task snapshots from full thread history when a thread reloads. The TUI keeps successful task updates quiet, shows task-tool failures inline, avoids duplicate completed-task summaries, and restores replayed tasks through the Harness display-state API.
|
|
38
|
+
|
|
39
|
+
MastraCode also documents the structured `task_check` result fields in agent guidance and keeps streaming `task_write` input typed separately from normalized task state.
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Updated dependencies [[`6742347`](https://github.com/mastra-ai/mastra/commit/6742347d71955d7639adc9ddf6ff8282de7ee3ba), [`7b0ad1f`](https://github.com/mastra-ai/mastra/commit/7b0ad1f5c53dc118c6da12ae82ae2587037dc2b8), [`62666c3`](https://github.com/mastra-ai/mastra/commit/62666c367eaeac3941ead454b1d38810cc855721), [`4af2160`](https://github.com/mastra-ai/mastra/commit/4af2160322f4718cac421930cce85641e9512389), [`b2fd6be`](https://github.com/mastra-ai/mastra/commit/b2fd6beef989f5e463c9a33d8a6c20ac1800e011), [`136c959`](https://github.com/mastra-ai/mastra/commit/136c9592fb0eeb0cd212f28629d8a29b7557a2fc), [`00106be`](https://github.com/mastra-ai/mastra/commit/00106bede59b81e5b0e9cd6aad8d3b5dbc336387), [`4df7cc7`](https://github.com/mastra-ai/mastra/commit/4df7cc79342fd065fe7fdeef93c094db14b12bcd), [`aca3121`](https://github.com/mastra-ai/mastra/commit/aca31211233dac25459f140ea4fcfb3a5af64c18), [`7b0ad1f`](https://github.com/mastra-ai/mastra/commit/7b0ad1f5c53dc118c6da12ae82ae2587037dc2b8), [`9cdf38e`](https://github.com/mastra-ai/mastra/commit/9cdf38e58506e1109c8b38f97cd7770978a4218e), [`990851e`](https://github.com/mastra-ai/mastra/commit/990851edcb0e30be5c2c18b6532f1a876cc2d335), [`6068a6c`](https://github.com/mastra-ai/mastra/commit/6068a6c42950fad3ebfc92346417896ba60803d2), [`00106be`](https://github.com/mastra-ai/mastra/commit/00106bede59b81e5b0e9cd6aad8d3b5dbc336387), [`e2a079c`](https://github.com/mastra-ai/mastra/commit/e2a079cc3755b1895f7bd5dc36e9be81b11c7c22), [`f70160c`](https://github.com/mastra-ai/mastra/commit/f70160c53c366e71e1d8dde2c6aeaf1b62fb77e6), [`534a456`](https://github.com/mastra-ai/mastra/commit/534a456a25e4df1e5407e7e632f4cb3b1fa14f9d), [`36bae07`](https://github.com/mastra-ai/mastra/commit/36bae07c0e70b1b3006f2fd20830e8883dcbd066)]:
|
|
44
|
+
- @mastra/core@1.33.0-alpha.7
|
|
45
|
+
- @mastra/libsql@1.10.1-alpha.1
|
|
46
|
+
- @mastra/observability@1.12.0-alpha.1
|
|
47
|
+
- @mastra/memory@1.18.0-alpha.2
|
|
48
|
+
|
|
49
|
+
## 0.18.0-alpha.8
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- Replace `js-tiktoken` with `tokenx` for MastraCode web search and extract result truncation to reduce bundle size while preserving lightweight token-estimated output limits. ([#16326](https://github.com/mastra-ai/mastra/pull/16326))
|
|
54
|
+
|
|
55
|
+
- Made caveman-style observations opt-in. Observations and reflections now default to standard prose; turn caveman style back on via `/om` → "Caveman observations". The setting persists per thread, restores when Mastra Code starts, and new threads inherit the last selected value. ([#16275](https://github.com/mastra-ai/mastra/pull/16275))
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [[`b560d6f`](https://github.com/mastra-ai/mastra/commit/b560d6f88b9b904b15c10f75c949eb145bc27684), [`36b3bbf`](https://github.com/mastra-ai/mastra/commit/36b3bbf5a8d59f7e23d47e29340e76c681b4929c), [`b275631`](https://github.com/mastra-ai/mastra/commit/b275631dc10541a482b2e2d4a3e3cfa843bd5fa1)]:
|
|
58
|
+
- @mastra/core@1.33.0-alpha.6
|
|
59
|
+
- @mastra/memory@1.17.6-alpha.1
|
|
60
|
+
|
|
61
|
+
## 0.18.0-alpha.7
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- Updated dependencies [[`a68d854`](https://github.com/mastra-ai/mastra/commit/a68d854bf3d042bef7d5e2f6b7d35e311673888b), [`00ef282`](https://github.com/mastra-ai/mastra/commit/00ef2826034d006b984b3f19cd33ba0bba14d6c6)]:
|
|
66
|
+
- @mastra/duckdb@1.3.1-alpha.0
|
|
67
|
+
- @mastra/observability@1.12.0-alpha.0
|
|
68
|
+
|
|
69
|
+
## 0.18.0-alpha.6
|
|
70
|
+
|
|
71
|
+
### Minor Changes
|
|
72
|
+
|
|
73
|
+
- Added `/goal` to Mastra Code, a persistent autonomous task loop similar to the goal modes in Codex and Hermes Agent. ([#16065](https://github.com/mastra-ai/mastra/pull/16065))
|
|
74
|
+
|
|
75
|
+
A user can start a goal with `/goal <objective>`. Mastra Code saves that objective to the current thread, runs the normal assistant turn, then asks a separate judge model whether the goal is `done`, should `continue`, or is `waiting` on an explicit user checkpoint. When the judge says to continue, Mastra Code feeds the judge feedback back into the conversation and keeps working until the goal is complete, paused, cleared, or reaches the configured attempt limit.
|
|
76
|
+
|
|
77
|
+
Use `/judge` to configure the default judge model and max attempts used by future goals.
|
|
78
|
+
|
|
79
|
+
Approved plans can be selected as a goal from the inline plan approval UI, slash commands can opt into `/goal/<command>` with top-level `goal: true`, and skills can opt into goal commands with `metadata.goal: true`. `/goal` objectives can also span multiple lines.
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- Fixed OpenAI Codex login when the default callback port is already in use. The login flow now falls back to the Codex-supported fallback port and shows a clear warning when both supported callback ports are unavailable. ([#16294](https://github.com/mastra-ai/mastra/pull/16294))
|
|
84
|
+
|
|
85
|
+
- Updated dependencies [[`bae019e`](https://github.com/mastra-ai/mastra/commit/bae019ecb6694da96909f7ec7b9eb3a0a33aa887), [`33f5061`](https://github.com/mastra-ai/mastra/commit/33f5061cd1c0335020c3faae61ce96de822854fa), [`99869ec`](https://github.com/mastra-ai/mastra/commit/99869ecb1f2aa6dfcc44fa4e843e5ee0344efa64), [`d86f031`](https://github.com/mastra-ai/mastra/commit/d86f031eb6b0b2570145afafea664e59bf688962)]:
|
|
86
|
+
- @mastra/core@1.33.0-alpha.5
|
|
87
|
+
|
|
88
|
+
## 0.18.0-alpha.5
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- dependencies updates: ([#16126](https://github.com/mastra-ai/mastra/pull/16126))
|
|
93
|
+
- Updated dependency [`@ai-sdk/anthropic@^3.0.74` ↗︎](https://www.npmjs.com/package/@ai-sdk/anthropic/v/3.0.74) (from `^3.0.71`, in `dependencies`)
|
|
94
|
+
- Updated dependency [`@ai-sdk/openai@^3.0.58` ↗︎](https://www.npmjs.com/package/@ai-sdk/openai/v/3.0.58) (from `^3.0.53`, in `dependencies`)
|
|
95
|
+
- Updated dependency [`ai@^6.0.174` ↗︎](https://www.npmjs.com/package/ai/v/6.0.174) (from `^6.0.168`, in `dependencies`)
|
|
96
|
+
- Updated dependencies [[`9f17410`](https://github.com/mastra-ai/mastra/commit/9f1741080def23d42ee50b39887a385ae316a3c6), [`c6eb39e`](https://github.com/mastra-ai/mastra/commit/c6eb39ea6dca381c6563cb240237fbe608e02f93), [`900d086`](https://github.com/mastra-ai/mastra/commit/900d086bb737b9cf2fcf68f11b0389b801a2738c), [`4c0e286`](https://github.com/mastra-ai/mastra/commit/4c0e28637c9cfb4f416549b55e97ebfa13319dfc), [`25184ff`](https://github.com/mastra-ai/mastra/commit/25184ffaf1293ec95119426eb1a1f8d38831b96c), [`25184ff`](https://github.com/mastra-ai/mastra/commit/25184ffaf1293ec95119426eb1a1f8d38831b96c), [`aebde9c`](https://github.com/mastra-ai/mastra/commit/aebde9cfacf56592c6b6350cae721740fe090b8a)]:
|
|
97
|
+
- @mastra/core@1.33.0-alpha.4
|
|
98
|
+
- @mastra/libsql@1.10.1-alpha.0
|
|
99
|
+
- @mastra/pg@1.10.1-alpha.0
|
|
100
|
+
|
|
101
|
+
## 0.18.0-alpha.4
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- Updated dependencies [[`087e413`](https://github.com/mastra-ai/mastra/commit/087e4133e5d6efa36619e9556c16750e4179c047), [`087e413`](https://github.com/mastra-ai/mastra/commit/087e4133e5d6efa36619e9556c16750e4179c047), [`087e413`](https://github.com/mastra-ai/mastra/commit/087e4133e5d6efa36619e9556c16750e4179c047)]:
|
|
106
|
+
- @mastra/core@1.33.0-alpha.3
|
|
107
|
+
|
|
108
|
+
## 0.18.0-alpha.3
|
|
109
|
+
|
|
110
|
+
### Minor Changes
|
|
111
|
+
|
|
112
|
+
- You can now pass a `memory` option to `createMastraCode()` to override the default memory instance or factory. This gives you a supported way to plug in custom memory behavior without depending on Mastra Code's default setup. ([#13891](https://github.com/mastra-ai/mastra/pull/13891))
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
import { createMastraCode } from 'mastracode';
|
|
116
|
+
|
|
117
|
+
const mastraCode = await createMastraCode({
|
|
118
|
+
memory: myCustomMemory,
|
|
119
|
+
});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Patch Changes
|
|
123
|
+
|
|
124
|
+
- Fixed setup, settings, selectors, and non-chat configuration prompts so they open as neutral overlays with stable modal sizing, while keeping active chat interactions inline. ([#16274](https://github.com/mastra-ai/mastra/pull/16274))
|
|
125
|
+
|
|
126
|
+
- Enabled `ProviderHistoryCompat` by default for MastraCode agents. MastraCode now applies provider-boundary prompt compatibility fixes before model requests and keeps the existing API-error recovery path for provider validation errors. ([#16176](https://github.com/mastra-ai/mastra/pull/16176))
|
|
127
|
+
|
|
128
|
+
- Updated dependencies [[`d1fdbd0`](https://github.com/mastra-ai/mastra/commit/d1fdbd012add5623cb7e6b7f882b605ab358bbb4), [`d91ebe2`](https://github.com/mastra-ai/mastra/commit/d91ebe28ee065d8f2ed6df741c3c07f58d359529)]:
|
|
129
|
+
- @mastra/core@1.33.0-alpha.2
|
|
130
|
+
|
|
3
131
|
## 0.17.3-alpha.2
|
|
4
132
|
|
|
5
133
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ Learn more in the [documentation](https://code.mastra.ai/) and [announcement pos
|
|
|
13
13
|
- **OAuth login**: Authenticate with Anthropic (Claude Max) and OpenAI (ChatGPT Plus/Codex)
|
|
14
14
|
- **Persistent conversations**: Threads are saved per-project and resume automatically
|
|
15
15
|
- **Coding tools**: View files, edit code, run shell commands
|
|
16
|
+
- **Goals**: Pursue longer-running objectives with configurable judge models and goal-enabled commands/skills
|
|
16
17
|
- **Plan persistence**: Approved plans are saved as markdown files for future reference
|
|
17
18
|
- **Token tracking**: Monitor usage with persistent token counts per thread
|
|
18
19
|
- **Beautiful TUI**: Polished terminal interface with streaming responses
|
|
@@ -89,6 +90,8 @@ Select a suggestion with arrow keys and press Tab to insert it.
|
|
|
89
90
|
| `/subagents` | Configure subagent model defaults |
|
|
90
91
|
| `/om` | Configure Observational Memory models |
|
|
91
92
|
| `/think` | Set thinking level (Anthropic) |
|
|
93
|
+
| `/judge` | Configure the default judge model and max attempts for goals |
|
|
94
|
+
| `/goal` | Start or manage an autonomous goal |
|
|
92
95
|
| `/skills` | List available skills |
|
|
93
96
|
| `/diff` | Show modified files or git diff |
|
|
94
97
|
| `/name` | Rename current thread |
|
|
@@ -108,6 +111,48 @@ Select a suggestion with arrow keys and press Tab to insert it.
|
|
|
108
111
|
| `/help` | Show available commands |
|
|
109
112
|
| `/exit` | Exit the TUI |
|
|
110
113
|
|
|
114
|
+
### Goals
|
|
115
|
+
|
|
116
|
+
Use `/goal <objective>` to have Mastra Code keep working toward an objective across turns. Goals use a judge model to decide whether the goal is complete, should continue, or should wait for an explicit user checkpoint. Configure defaults with `/judge`.
|
|
117
|
+
|
|
118
|
+
Goal objectives can span multiple lines:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
/goal Fix the failing release checks
|
|
122
|
+
and open a PR when everything passes.
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
When a plan is submitted with `submit_plan`, the inline approval UI also includes **Use as /goal**. That saves/approves the plan and starts a goal using the plan text as the objective.
|
|
126
|
+
|
|
127
|
+
Custom slash commands can opt into goal mode with top-level frontmatter:
|
|
128
|
+
|
|
129
|
+
```md
|
|
130
|
+
---
|
|
131
|
+
name: pr-triage
|
|
132
|
+
description: Triage open PRs
|
|
133
|
+
goal: true
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
Inspect every open PR before pair-reviewing candidates.
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Run goal-enabled commands with `/goal/<command-name>`. The processed command content becomes the goal objective, so `$ARGUMENTS` and other command template features still apply.
|
|
140
|
+
|
|
141
|
+
Skills can opt into goal mode with skill metadata:
|
|
142
|
+
|
|
143
|
+
```md
|
|
144
|
+
---
|
|
145
|
+
name: review-prs
|
|
146
|
+
description: Review pull requests
|
|
147
|
+
metadata:
|
|
148
|
+
goal: true
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
Review PRs until all relevant candidates have been categorized.
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Run goal-enabled skills with `/goal/<skill-name>`. Skill instructions become the goal objective; any extra arguments are included as context.
|
|
155
|
+
|
|
111
156
|
### Keyboard shortcuts
|
|
112
157
|
|
|
113
158
|
| Shortcut | Action |
|
|
@@ -179,7 +224,7 @@ export MASTRACODE_DISABLE_CAFFEINATE=1
|
|
|
179
224
|
|
|
180
225
|
### Plan persistence
|
|
181
226
|
|
|
182
|
-
When you approve a plan (via `submit_plan`), it is saved as a markdown file in the app data directory:
|
|
227
|
+
When you approve a plan (via `submit_plan`) or choose **Use as /goal** from the inline plan approval UI, it is saved as a markdown file in the app data directory:
|
|
183
228
|
|
|
184
229
|
- **macOS**: `~/Library/Application Support/mastracode/plans/<resourceId>/`
|
|
185
230
|
- **Linux**: `~/.local/share/mastracode/plans/<resourceId>/`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/agents/memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/agents/memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAuExC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,YAAY,IAC3E,oBAAoB;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,YA0D/D"}
|
package/dist/agents/model.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ import { createOpenAI } from '@ai-sdk/openai';
|
|
|
3
3
|
import { ModelRouterLanguageModel } from '@mastra/core/llm';
|
|
4
4
|
import type { RequestContext } from '@mastra/core/request-context';
|
|
5
5
|
import { opencodeClaudeMaxProvider } from '../providers/claude-max.js';
|
|
6
|
+
import { githubCopilotProvider } from '../providers/github-copilot.js';
|
|
6
7
|
import { openaiCodexProvider } from '../providers/openai-codex.js';
|
|
7
8
|
import type { ThinkingLevel } from '../providers/openai-codex.js';
|
|
8
|
-
type ResolvedModel = ReturnType<typeof openaiCodexProvider> | ReturnType<typeof opencodeClaudeMaxProvider> | ModelRouterLanguageModel | ReturnType<ReturnType<typeof createAnthropic>> | ReturnType<ReturnType<typeof createOpenAI>>;
|
|
9
|
+
type ResolvedModel = ReturnType<typeof openaiCodexProvider> | ReturnType<typeof opencodeClaudeMaxProvider> | ReturnType<typeof githubCopilotProvider> | ModelRouterLanguageModel | ReturnType<ReturnType<typeof createAnthropic>> | ReturnType<ReturnType<typeof createOpenAI>>;
|
|
9
10
|
export declare function remapOpenAIModelForCodexOAuth(modelId: string): string;
|
|
10
11
|
/**
|
|
11
12
|
* Resolve the Anthropic API key.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/agents/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAsC,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAInE,OAAO,EAGL,yBAAyB,EAE1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAIL,mBAAmB,EAEpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/agents/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAsC,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAChG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAInE,OAAO,EAGL,yBAAyB,EAE1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAIL,mBAAmB,EAEpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAgBlE,KAAK,aAAa,GACd,UAAU,CAAC,OAAO,mBAAmB,CAAC,GACtC,UAAU,CAAC,OAAO,yBAAyB,CAAC,GAC5C,UAAU,CAAC,OAAO,qBAAqB,CAAC,GACxC,wBAAwB,GACxB,UAAU,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,GAC9C,UAAU,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC;AAsBhD,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAoBrE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAQvD;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,SAAS,CAQpD;AA0BD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,aAAa,CAAC,EAAE,aAAa,CAAC;IAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,cAAc,CAAA;CAAE,GACzG,aAAa,CA2Jf;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,cAAc,EAAE,EAAE;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,GAAG,aAAa,CAWrG"}
|
|
@@ -8,5 +8,5 @@ import type { PromptContext } from './index.js';
|
|
|
8
8
|
* knows exactly what to implement.
|
|
9
9
|
*/
|
|
10
10
|
export declare function buildModePromptFn(ctx: PromptContext): string;
|
|
11
|
-
export declare const buildModePrompt = "\n# Build Mode\n\nYou are in BUILD mode. You have full access to all tools and can read, write, edit, and execute commands.\n\n## Working Style\n\n**For simple tasks** (typo fixes, small edits, single-file changes):\n- Just do it. No need to explain your plan first.\n\n**For non-trivial tasks** (3+ files, architectural decisions, unclear requirements):\n- Use
|
|
11
|
+
export declare const buildModePrompt = "\n# Build Mode\n\nYou are in BUILD mode. You have full access to all tools and can read, write, edit, and execute commands.\n\n## Working Style\n\n**For simple tasks** (typo fixes, small edits, single-file changes):\n- Just do it. No need to explain your plan first.\n\n**For non-trivial tasks** (3+ files, architectural decisions, unclear requirements):\n- Use the available task-management tools to create and update your task list\n- Work on ONE step at a time \u2014 complete it and verify it works before moving on\n- If multiple approaches are plausible and the choice would materially affect scope, behavior, or risk, stop and ask the user\n\n## The Implementation Loop\n\nFor each change you make:\n\n1. **Understand** \u2014 Read the relevant code. Check how similar things are done elsewhere.\n2. **Implement** \u2014 Make the change. Follow existing patterns and conventions.\n3. **Verify** \u2014 Test that it works. Don't assume \u2014 actually run it.\n4. **Prove** \u2014 Proactively prove that the change is good, makes sense in context, is a positive contribution, and works fully. The burden of proof is on YOU.\n5. **Clean up** \u2014 Ensure no broken code, no debug statements, no half-done features.\n\nOnly move to the next change after the current one is verified and proved to be working.\n\n## Verification is Required\n\nBefore considering any task complete:\n- Run relevant tests (check package.json for test scripts)\n- For TypeScript, run `tsc --noEmit` to catch type errors\n- If there are no automated tests, manually verify the behavior works as expected\n- Confirm the result makes sense in the codebase and improves the requested behavior\n- Use available task-checking tools to ensure all tracked tasks are done\n\n**Don't mark something as done until you've verified and proved it actually works.**\n\n## Error Recovery\n\nWhen something breaks:\n1. Read the full error output carefully \u2014 don't guess\n2. Find the root cause, not just the symptom\n3. Fix it properly \u2014 no casts or suppressions to hide errors\n4. Re-run to confirm the fix\n5. If progress is blocked after reasonable attempts, briefly explain the blocker, what you've tried, and the next best option\n\n## Git in Build Mode\n\n- Before committing, verify the code compiles and passes lint\n- Use descriptive branch names: `feat/...`, `fix/...`, `refactor/...`\n";
|
|
12
12
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/build.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAiB5D;AAED,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/build.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAiB5D;AAED,eAAO,MAAM,eAAe,00EAmD3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAK3C,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAK3C,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAepE,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAQD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CA+D1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-guidance.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/tool-guidance.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,UAAU,mBAAmB;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"tool-guidance.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/tool-guidance.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,UAAU,mBAAmB;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CA6M3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/agents/subagents/execute.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/agents/subagents/execute.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,eAAO,MAAM,eAAe,EAAE,eAqC7B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Harness } from '@mastra/core/harness';
|
|
2
|
+
/**
|
|
3
|
+
* Wires the `cavemanObservations` toggle into harness thread events so it
|
|
4
|
+
* persists per-thread and new threads inherit the most recent value.
|
|
5
|
+
*
|
|
6
|
+
* This is intentionally implemented in mastracode rather than core: the toggle
|
|
7
|
+
* is a mastracode-specific OM concept, so persistence stays scoped to the host.
|
|
8
|
+
*/
|
|
9
|
+
export declare function attachCavemanThreadStatePersistence(harness: Harness<Record<string, unknown>>): void;
|
|
10
|
+
/**
|
|
11
|
+
* Eagerly restores `cavemanObservations` for the currently-selected thread.
|
|
12
|
+
* Called once at TUI startup after the initial thread is selected, since the
|
|
13
|
+
* subscription set up later misses the startup `thread_changed` event.
|
|
14
|
+
*/
|
|
15
|
+
export declare function restoreCavemanForCurrentThread(harness: Harness<Record<string, unknown>>): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=thread-caveman-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thread-caveman-state.d.ts","sourceRoot":"","sources":["../../src/agents/thread-caveman-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,sBAAsB,CAAC;AA0CnE;;;;;;GAMG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CASnG;AAED;;;;GAIG;AACH,wBAAsB,8BAA8B,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAI7G"}
|
package/dist/auth/index.d.ts
CHANGED
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Copilot OAuth flow
|
|
3
|
+
*
|
|
4
|
+
* Inspired by:
|
|
5
|
+
* - pi-mono: https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/utils/oauth/github-copilot.ts
|
|
6
|
+
* - opencode: https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/plugin/github-copilot/copilot.ts
|
|
7
|
+
*
|
|
8
|
+
* Storage layout in AuthStorage:
|
|
9
|
+
* - `refresh` holds the long-lived GitHub OAuth access token (used to mint Copilot tokens).
|
|
10
|
+
* - `access` holds the short-lived Copilot bearer token (~30 minutes).
|
|
11
|
+
* - `expires` is the Copilot bearer expiry (ms epoch, with a 5-minute safety buffer).
|
|
12
|
+
* - `enterpriseUrl` is the GitHub Enterprise hostname, or undefined for github.com.
|
|
13
|
+
*/
|
|
14
|
+
import type { OAuthCredentials, OAuthProviderInterface } from '../types.js';
|
|
15
|
+
export type GitHubCopilotCredentials = OAuthCredentials & {
|
|
16
|
+
enterpriseUrl?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const COPILOT_USER_AGENT = "GitHubCopilotChat/0.35.0";
|
|
19
|
+
/** Headers that Copilot endpoints expect from a VS Code-like client. */
|
|
20
|
+
export declare const COPILOT_HEADERS: {
|
|
21
|
+
readonly 'User-Agent': "GitHubCopilotChat/0.35.0";
|
|
22
|
+
readonly 'Editor-Version': "vscode/1.107.0";
|
|
23
|
+
readonly 'Editor-Plugin-Version': "copilot-chat/0.35.0";
|
|
24
|
+
readonly 'Copilot-Integration-Id': "vscode-chat";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Normalize a user-entered Enterprise URL/domain into a hostname (e.g. `company.ghe.com`).
|
|
28
|
+
* Returns null for an empty input or an unparseable URL.
|
|
29
|
+
*/
|
|
30
|
+
export declare function normalizeDomain(input: string): string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Resolve the Copilot API base URL.
|
|
33
|
+
* Prefers the `proxy-ep` parsed from the bearer token, then falls back to enterprise/individual defaults.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getGitHubCopilotBaseUrl(token?: string, enterpriseDomain?: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Refresh the short-lived Copilot bearer token using the long-lived GitHub OAuth token.
|
|
38
|
+
*
|
|
39
|
+
* `refreshToken` here is the GitHub OAuth access token; the Copilot endpoint returns a
|
|
40
|
+
* fresh bearer token (`token`) and absolute expiry (`expires_at`, seconds since epoch).
|
|
41
|
+
*/
|
|
42
|
+
export declare function refreshGitHubCopilotToken(refreshToken: string, enterpriseDomain?: string, signal?: AbortSignal): Promise<GitHubCopilotCredentials>;
|
|
43
|
+
/**
|
|
44
|
+
* Login with GitHub Copilot OAuth (device-code flow).
|
|
45
|
+
*
|
|
46
|
+
* Prompts for an optional GitHub Enterprise URL/domain, performs the device-code flow,
|
|
47
|
+
* then exchanges the GitHub OAuth token for a Copilot bearer token.
|
|
48
|
+
*/
|
|
49
|
+
export declare function loginGitHubCopilot(options: {
|
|
50
|
+
onAuth: (url: string, instructions?: string) => void;
|
|
51
|
+
onPrompt: (prompt: {
|
|
52
|
+
message: string;
|
|
53
|
+
placeholder?: string;
|
|
54
|
+
allowEmpty?: boolean;
|
|
55
|
+
}) => Promise<string>;
|
|
56
|
+
onProgress?: (message: string) => void;
|
|
57
|
+
signal?: AbortSignal;
|
|
58
|
+
}): Promise<GitHubCopilotCredentials>;
|
|
59
|
+
/**
|
|
60
|
+
* Filtered, normalized entry from the Copilot `/models` API.
|
|
61
|
+
*
|
|
62
|
+
* The full API payload includes a lot of capability metadata; we only keep the bits
|
|
63
|
+
* we need to expose models in `listAvailableModels()` and route requests sensibly.
|
|
64
|
+
*/
|
|
65
|
+
export type CopilotModelEntry = {
|
|
66
|
+
/** Stable model id (e.g. `claude-sonnet-4.5`, `gpt-4.1`). */
|
|
67
|
+
id: string;
|
|
68
|
+
/** Human-readable display name (e.g. `Claude Sonnet 4.5`). */
|
|
69
|
+
name: string;
|
|
70
|
+
/** Vendor field from the API (e.g. `Anthropic`, `OpenAI`). */
|
|
71
|
+
vendor: string;
|
|
72
|
+
/**
|
|
73
|
+
* Endpoints the model exposes (e.g. `/chat/completions`, `/responses`, `/v1/messages`).
|
|
74
|
+
* Empty when the API didn't return `supported_endpoints` for this entry.
|
|
75
|
+
*/
|
|
76
|
+
supportedEndpoints: string[];
|
|
77
|
+
/** True when `supported_endpoints` includes `/v1/messages` (Anthropic-shaped Copilot model). */
|
|
78
|
+
isAnthropicShaped: boolean;
|
|
79
|
+
/** True when `capabilities.supports.vision` is true. */
|
|
80
|
+
supportsVision: boolean;
|
|
81
|
+
/** True when the model supports tool calling. */
|
|
82
|
+
supportsToolCalls: boolean;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Fetch the Copilot model list available to the current subscription.
|
|
86
|
+
*
|
|
87
|
+
* Hits `${baseURL}/models` with the Copilot bearer token, filters to
|
|
88
|
+
* `model_picker_enabled === true && policy.state !== 'disabled'`, and returns
|
|
89
|
+
* a normalized list. Mirrors opencode's filtering rules.
|
|
90
|
+
*
|
|
91
|
+
* Inspired by:
|
|
92
|
+
* - opencode: https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/plugin/github-copilot/models.ts
|
|
93
|
+
*/
|
|
94
|
+
export declare function fetchCopilotModels(opts: {
|
|
95
|
+
baseUrl: string;
|
|
96
|
+
bearerToken: string;
|
|
97
|
+
signal?: AbortSignal;
|
|
98
|
+
}): Promise<CopilotModelEntry[]>;
|
|
99
|
+
export declare const githubCopilotOAuthProvider: OAuthProviderInterface;
|
|
100
|
+
//# sourceMappingURL=github-copilot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-copilot.d.ts","sourceRoot":"","sources":["../../../src/auth/providers/github-copilot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAuB,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEjG,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG;IACxD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAMF,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAE7D,wEAAwE;AACxE,eAAO,MAAM,eAAe;;;;;CAKlB,CAAC;AAyBX;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS5D;AA0BD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAOzF;AA0JD;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,YAAY,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,MAAM,EACzB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,wBAAwB,CAAC,CAsCnC;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE;IAChD,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,QAAQ,EAAE,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACvG,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA+BpC;AAED;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAC;IACX,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,gGAAgG;IAChG,iBAAiB,EAAE,OAAO,CAAC;IAC3B,wDAAwD;IACxD,cAAc,EAAE,OAAO,CAAC;IACxB,iDAAiD;IACjD,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA8D/B;AAED,eAAO,MAAM,0BAA0B,EAAE,sBAqBxC,CAAC"}
|
|
@@ -8,6 +8,24 @@
|
|
|
8
8
|
* It is only intended for CLI use, not browser environments.
|
|
9
9
|
*/
|
|
10
10
|
import type { OAuthCredentials, OAuthPrompt, OAuthProviderInterface } from '../types.js';
|
|
11
|
+
declare function createAuthorizationFlow(redirectUri: string, state: string, originator?: string): Promise<{
|
|
12
|
+
verifier: string;
|
|
13
|
+
url: string;
|
|
14
|
+
}>;
|
|
15
|
+
type OAuthServerInfo = {
|
|
16
|
+
redirectUri: string;
|
|
17
|
+
warning?: string;
|
|
18
|
+
close: () => void;
|
|
19
|
+
cancelWait: () => void;
|
|
20
|
+
waitForCode: () => Promise<{
|
|
21
|
+
code: string;
|
|
22
|
+
} | null>;
|
|
23
|
+
};
|
|
24
|
+
type CallbackPorts = {
|
|
25
|
+
defaultPort: number;
|
|
26
|
+
fallbackPort: number;
|
|
27
|
+
};
|
|
28
|
+
declare function startLocalOAuthServer(state: string, ports?: CallbackPorts): Promise<OAuthServerInfo>;
|
|
11
29
|
/**
|
|
12
30
|
* Login with OpenAI Codex OAuth
|
|
13
31
|
*
|
|
@@ -29,9 +47,14 @@ export declare function loginOpenAICodex(options: {
|
|
|
29
47
|
onManualCodeInput?: () => Promise<string>;
|
|
30
48
|
originator?: string;
|
|
31
49
|
}): Promise<OAuthCredentials>;
|
|
50
|
+
export declare const __testing: {
|
|
51
|
+
createAuthorizationFlow: typeof createAuthorizationFlow;
|
|
52
|
+
startLocalOAuthServer: typeof startLocalOAuthServer;
|
|
53
|
+
};
|
|
32
54
|
/**
|
|
33
55
|
* Refresh OpenAI Codex OAuth token
|
|
34
56
|
*/
|
|
35
57
|
export declare function refreshOpenAICodexToken(refreshToken: string): Promise<OAuthCredentials>;
|
|
36
58
|
export declare const openaiCodexOAuthProvider: OAuthProviderInterface;
|
|
59
|
+
export {};
|
|
37
60
|
//# sourceMappingURL=openai-codex.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-codex.d.ts","sourceRoot":"","sources":["../../../src/auth/providers/openai-codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"openai-codex.d.ts","sourceRoot":"","sources":["../../../src/auth/providers/openai-codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyBH,OAAO,KAAK,EAAE,gBAAgB,EAAuB,WAAW,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAyK9G,iBAAe,uBAAuB,CACpC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,MAAa,GACxB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAgB5C;AAED,KAAK,eAAe,GAAG;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;CACrD,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAkDF,iBAAe,qBAAqB,CAClC,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,aAAoC,GAC1C,OAAO,CAAC,eAAe,CAAC,CA4E1B;AASD;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,MAAM,EAAE,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC/D,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA4G5B;AAED,eAAO,MAAM,SAAS;;;CAGrB,CAAC;AAEF;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiB7F;AAED,eAAO,MAAM,wBAAwB,EAAE,sBAqBtC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/auth/storage.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/auth/storage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EACV,cAAc,EAEd,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAOnE,CAAC;AASF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,eAAe,GAAG,sBAAsB,GAAG,SAAS,CAExF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,sBAAsB,EAAE,CAE5D;AAED;;GAEG;AACH,qBAAa,WAAW;IAGV,OAAO,CAAC,QAAQ;IAF5B,OAAO,CAAC,IAAI,CAAuB;gBAEf,QAAQ,GAAE,MAA2C;IAIzE;;OAEG;IACH,MAAM,IAAI,IAAI;IAYd;;OAEG;IACH,OAAO,CAAC,IAAI;IASZ;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAIjD;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,GAAG,IAAI;IAKvD;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAK9B;;OAEG;IACH,IAAI,IAAI,MAAM,EAAE;IAIhB;;OAEG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI9B;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAKrC;;;OAGG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAK1C;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKrD;;;OAGG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAOrE;;;;OAIG;IACH,wBAAwB,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,IAAI;IAWnF;;OAEG;IACG,KAAK,CAAC,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAUvF;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAI9B;;OAEG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CA8BjE"}
|