@maincode-ai/matilda-code 0.20.0 → 0.20.1
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/bundled/mainy/docs/features/headless.md +37 -0
- package/bundled/mainy/docs/features/mcp.md +3 -3
- package/chunks/{agent-N5H7ZVZN.js → agent-CE34X462.js} +1 -1
- package/chunks/{agent-headless-LBLAX66M.js → agent-headless-CNI7H4BU.js} +1 -1
- package/chunks/{anthropicContentGenerator-DKMAJXYA.js → anthropicContentGenerator-ATLOKYPR.js} +1 -1
- package/chunks/chunk-3YLXGE6T.js +8 -0
- package/chunks/{chunk-GTR4V2PV.js → chunk-DC7LAFZZ.js} +1 -1
- package/chunks/chunk-DHBNZZZO.js +95 -0
- package/chunks/{chunk-KP6BLFQS.js → chunk-GIIMOLLN.js} +1 -1
- package/chunks/chunk-IMYUVCF7.js +27 -0
- package/chunks/{chunk-3KCDX6MY.js → chunk-ISW2QC5B.js} +1 -1
- package/chunks/{chunk-RO6LKQPB.js → chunk-J56KRT6Z.js} +458 -458
- package/chunks/chunk-OCXGNAAT.js +8 -0
- package/chunks/{chunk-Z7OHKQ7V.js → chunk-OQVITNHW.js} +1 -1
- package/chunks/{chunk-QT4UNNZ4.js → chunk-SKBC2YV2.js} +4 -4
- package/chunks/{chunk-XXZH7C44.js → chunk-SS5WUOSJ.js} +1 -1
- package/chunks/chunk-T75X5DJI.js +101 -0
- package/chunks/{chunk-TRM7SXZ5.js → chunk-WUQZ3WFM.js} +1 -1
- package/chunks/chunk-XJDC3ZQZ.js +8 -0
- package/chunks/{computer-use-LG4QQFMP.js → computer-use-4533FJAL.js} +1 -1
- package/chunks/contextCommand-M7LA5BRD.js +3 -0
- package/chunks/edit-U4P4JWQ6.js +38 -0
- package/chunks/{enter-worktree-OIP2B3NM.js → enter-worktree-CUDNIQNH.js} +1 -1
- package/chunks/enterPlanMode-SUTLQUZO.js +18 -0
- package/chunks/{exit-worktree-VN5I5XWV.js → exit-worktree-72O3N4X4.js} +1 -1
- package/chunks/{exitPlanMode-HE6EEGTO.js → exitPlanMode-ZP75YCUK.js} +14 -14
- package/chunks/geminiContentGenerator-KPR5Q3XX.js +8 -0
- package/chunks/{glob-EGOAJNOQ.js → glob-V7YUXA6Z.js} +1 -1
- package/chunks/{grep-JYHW6SSG.js → grep-WOVNDJPG.js} +1 -1
- package/chunks/{matildaAgentContentGenerator-AKNRQW6A.js → matildaAgentContentGenerator-Y5CHD2WJ.js} +1 -1
- package/chunks/matildaContentGenerator-F2DTT47Z.js +8 -0
- package/chunks/matildaOAuth2-LKOMJUC6.js +3 -0
- package/chunks/{monitor-IDNOTNUP.js → monitor-G7G765XR.js} +1 -1
- package/chunks/{notebook-edit-4VBYBZFJ.js → notebook-edit-QK7K5ALF.js} +1 -1
- package/chunks/{openaiContentGenerator-WTRQK5RJ.js → openaiContentGenerator-XLDE2S4K.js} +1 -1
- package/chunks/ripGrep-W5JZVWA4.js +3 -0
- package/chunks/{scheduler-AOKJEAXJ.js → scheduler-C7N3Q67S.js} +1 -1
- package/chunks/{serve-2JJY265V.js → serve-WDV5Q7R4.js} +1 -1
- package/chunks/shell-IEGVNM6S.js +3 -0
- package/chunks/src-Y3JZTLKR.js +3 -0
- package/chunks/{team-create-Z6636NPD.js → team-create-OPP7B3G2.js} +1 -1
- package/chunks/{update-goal-DH2TEYYU.js → update-goal-6WDBMJ2I.js} +1 -1
- package/chunks/{web-fetch-5F7C7MXU.js → web-fetch-QP42GV23.js} +1 -1
- package/chunks/{web-search-W2FYCGK5.js → web-search-FURCBRRK.js} +1 -1
- package/chunks/{workflow-M7KXXDO6.js → workflow-B3DRPVNT.js} +2 -2
- package/chunks/write-file-T7MBHX53.js +11 -0
- package/cli.js +476 -456
- package/package.json +2 -2
- package/chunks/chunk-7VGUNT5L.js +0 -8
- package/chunks/chunk-CLUEFPSU.js +0 -8
- package/chunks/chunk-CYTN3WRM.js +0 -101
- package/chunks/chunk-IB7TWUWM.js +0 -90
- package/chunks/chunk-LLQVLTPB.js +0 -27
- package/chunks/contextCommand-7KHYFQ6G.js +0 -3
- package/chunks/edit-U4PMKZYZ.js +0 -38
- package/chunks/enterPlanMode-6LZSSWFT.js +0 -17
- package/chunks/geminiContentGenerator-GWGLIDJJ.js +0 -8
- package/chunks/matildaContentGenerator-MXP3V2UQ.js +0 -8
- package/chunks/matildaOAuth2-2IUZAZEO.js +0 -3
- package/chunks/ripGrep-DOB57AMM.js +0 -3
- package/chunks/shell-WFONAKPV.js +0 -3
- package/chunks/src-IHYMMU26.js +0 -3
- package/chunks/write-file-O4DJX4LP.js +0 -11
|
@@ -51,12 +51,16 @@ matilda --continue -p "Run the tests again and summarize failures"
|
|
|
51
51
|
|
|
52
52
|
# Resume a specific session ID directly (no UI)
|
|
53
53
|
matilda --resume 123e4567-e89b-12d3-a456-426614174000 -p "Apply the follow-up refactor"
|
|
54
|
+
|
|
55
|
+
# Start a fresh session with a caller-chosen ID (must be a valid UUID)
|
|
56
|
+
matilda --session-id 123e4567-e89b-12d3-a456-426614174000 -p "Start a tracked run"
|
|
54
57
|
```
|
|
55
58
|
|
|
56
59
|
> [!note]
|
|
57
60
|
>
|
|
58
61
|
> - Session data is project-scoped JSONL under `~/.matilda/projects/<sanitized-cwd>/chats`.
|
|
59
62
|
> - Restores conversation history, tool outputs, and chat-compression checkpoints before sending the new prompt.
|
|
63
|
+
> - `--session-id` must be a valid UUID (e.g. from `uuidgen`). Non-UUID values are rejected at parse time.
|
|
60
64
|
|
|
61
65
|
## Customize the Main Session Prompt
|
|
62
66
|
|
|
@@ -110,6 +114,17 @@ Response format:
|
|
|
110
114
|
The capital of France is Paris.
|
|
111
115
|
```
|
|
112
116
|
|
|
117
|
+
For long-horizon / redirected runs, assistant text is **streamed to stdout as
|
|
118
|
+
it arrives** (not held until the process exits). Tool starts are reported on
|
|
119
|
+
**stderr** as `[tool] <name>` so progress is visible without contaminating the
|
|
120
|
+
final answer:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
matilda -p "Implement the full TASK.md" --max-wall-time 10m --bogan \
|
|
124
|
+
> out.txt 2> progress.txt
|
|
125
|
+
# progress.txt will show [tool] lines while out.txt grows with the answer
|
|
126
|
+
```
|
|
127
|
+
|
|
113
128
|
### JSON Output
|
|
114
129
|
|
|
115
130
|
Returns structured data as a JSON array. All messages are buffered and output together when the session completes. This format is ideal for programmatic processing and automation scripts.
|
|
@@ -174,6 +189,28 @@ Stream-JSON format emits JSON messages immediately as they occur during executio
|
|
|
174
189
|
matilda -p "Explain TypeScript" --output-format stream-json
|
|
175
190
|
```
|
|
176
191
|
|
|
192
|
+
### Dual output (`--json-file` / `--json-fd`)
|
|
193
|
+
|
|
194
|
+
Headless runs can also emit a **sidecar** stream of structured JSON events
|
|
195
|
+
while keeping the primary `--output-format` on stdout. This is useful for
|
|
196
|
+
long-horizon / CI monitoring without switching the main output to stream-json.
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# Text answer on stdout; full event stream on disk
|
|
200
|
+
matilda -p "Implement the feature in TASK.md" \
|
|
201
|
+
--output-format text \
|
|
202
|
+
--json-file ./logs/events.jsonl \
|
|
203
|
+
--max-wall-time 10m \
|
|
204
|
+
--bogan
|
|
205
|
+
|
|
206
|
+
# Tail progress while the run is in flight
|
|
207
|
+
tail -f ./logs/events.jsonl
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
- Works in both interactive (TUI) and headless modes.
|
|
211
|
+
- Parent directories for `--json-file` are created when missing.
|
|
212
|
+
- Mutually exclusive with `--json-fd`.
|
|
213
|
+
|
|
177
214
|
Output (streaming as events occur):
|
|
178
215
|
|
|
179
216
|
```json
|
|
@@ -229,7 +229,7 @@ matilda mcp add --transport sse oauth-server https://api.example.com/sse/ \
|
|
|
229
229
|
|
|
230
230
|
The OAuth flow requires a redirect URI where the authorization provider sends the authentication code.
|
|
231
231
|
|
|
232
|
-
- **Local development**: By default, Matilda Code uses `http://localhost:7777/
|
|
232
|
+
- **Local development**: By default, Matilda Code uses `http://localhost:7777/callback`. This works when running Matilda Code on your local machine with a local browser.
|
|
233
233
|
|
|
234
234
|
- **Remote/cloud deployments**: When running Matilda Code on remote servers, cloud IDEs, or web terminals, the default `localhost` redirect will NOT work. You MUST configure `--oauth-redirect-uri` to point to a publicly accessible URL that can receive the OAuth callback.
|
|
235
235
|
|
|
@@ -273,7 +273,7 @@ OAuth configuration properties:
|
|
|
273
273
|
| `authorizationUrl` | OAuth authorization endpoint (string, auto-discovered if omitted) |
|
|
274
274
|
| `tokenUrl` | OAuth token endpoint (string, auto-discovered if omitted) |
|
|
275
275
|
| `scopes` | Required OAuth scopes (array of strings) |
|
|
276
|
-
| `redirectUri` | Custom redirect URI (string). **Critical for remote deployments**. Defaults to `http://localhost:7777/
|
|
276
|
+
| `redirectUri` | Custom redirect URI (string). **Critical for remote deployments**. Defaults to `http://localhost:7777/callback` |
|
|
277
277
|
| `tokenParamName` | Query parameter name for tokens in SSE URLs (string) |
|
|
278
278
|
| `audiences` | Audiences the token is valid for (array of strings) |
|
|
279
279
|
|
|
@@ -409,7 +409,7 @@ matilda mcp add [options] <name> <commandOrUrl> [args...]
|
|
|
409
409
|
| `--exclude-tools` | A comma-separated list of tools to exclude. | none | `--exclude-tools mytool` |
|
|
410
410
|
| `--oauth-client-id` | OAuth client ID for MCP server authentication. | — | `--oauth-client-id your-client-id` |
|
|
411
411
|
| `--oauth-client-secret` | OAuth client secret for MCP server authentication. | — | `--oauth-client-secret your-client-secret` |
|
|
412
|
-
| `--oauth-redirect-uri` | OAuth redirect URI for authentication callback. | `http://localhost:7777/
|
|
412
|
+
| `--oauth-redirect-uri` | OAuth redirect URI for authentication callback. | `http://localhost:7777/callback` | `--oauth-redirect-uri https://your-server.com/oauth/callback` |
|
|
413
413
|
| `--oauth-authorization-url` | OAuth authorization URL. | — | `--oauth-authorization-url https://provider.example.com/authorize` |
|
|
414
414
|
| `--oauth-token-url` | OAuth token URL. | — | `--oauth-token-url https://provider.example.com/token` |
|
|
415
415
|
| `--oauth-scopes` | OAuth scopes (comma-separated). | — | `--oauth-scopes scope1,scope2` |
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{Af as
|
|
3
|
+
import{Af as b,Bf as c,Cf as d,Df as e,Ef as f,zf as a}from"./chunk-J56KRT6Z.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-GIIMOLLN.js";import"./chunk-RBG4ERTN.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-SS5WUOSJ.js";import"./chunk-47XR7IMP.js";import"./chunk-QEI3OETI.js";import"./chunk-QKYGQLWC.js";import"./chunk-MNGFXISD.js";import"./chunk-4R2OFVPK.js";import"./chunk-RNKDFE2S.js";import"./chunk-EMWHQSMS.js";import"./chunk-S4K76QPI.js";import"./chunk-T75X5DJI.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-2XZIKUB6.js";import"./chunk-XYA3SFGC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-XJDC3ZQZ.js";import"./chunk-CFBZKYFB.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import"./chunk-5U3A6KMU.js";import"./chunk-IMYUVCF7.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-IOCF4XSR.js";import"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{f as AgentTool,b as TOOL_REGISTRY_REBUILT,e as createApprovalModeOverride,c as hasRebuiltToolRegistry,d as rebuildToolRegistryOnOverride,a as resolveSubagentApprovalMode};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{$e as
|
|
3
|
+
import{$e as b,_e as a,af as c}from"./chunk-J56KRT6Z.js";import"./chunk-TZIDSCTF.js";import"./chunk-FUNLOUYI.js";import"./chunk-R3H6IWFK.js";import"./chunk-OMZ5SGMK.js";import"./chunk-GIIMOLLN.js";import"./chunk-RBG4ERTN.js";import"./chunk-TXMXCR7D.js";import"./chunk-YULUB745.js";import"./chunk-LQWORCPO.js";import"./chunk-TISQNFB5.js";import"./chunk-SS5WUOSJ.js";import"./chunk-47XR7IMP.js";import"./chunk-QEI3OETI.js";import"./chunk-QKYGQLWC.js";import"./chunk-MNGFXISD.js";import"./chunk-4R2OFVPK.js";import"./chunk-RNKDFE2S.js";import"./chunk-EMWHQSMS.js";import"./chunk-S4K76QPI.js";import"./chunk-T75X5DJI.js";import"./chunk-4F4DA5UI.js";import"./chunk-DC7LAFZZ.js";import"./chunk-2XZIKUB6.js";import"./chunk-XYA3SFGC.js";import"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import"./chunk-XJDC3ZQZ.js";import"./chunk-CFBZKYFB.js";import"./chunk-WVY2P6WH.js";import"./chunk-UIRBHC5X.js";import"./chunk-UY2R3ZQ4.js";import"./chunk-NDR7ZFUA.js";import"./chunk-5U3A6KMU.js";import"./chunk-IMYUVCF7.js";import"./chunk-XKDGRW3K.js";import"./chunk-ESSYHTAZ.js";import"./chunk-3YLXGE6T.js";import"./chunk-IOCF4XSR.js";import"./chunk-QWBNNEV2.js";import"./chunk-G7R2XEEF.js";import"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import"./chunk-GZPNIYVZ.js";import"./chunk-OWGSC52X.js";export{c as AgentHeadless,a as ContextState,b as templateString};
|
package/chunks/{anthropicContentGenerator-DKMAJXYA.js → anthropicContentGenerator-ATLOKYPR.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{a as Sr,b as kr}from"./chunk-QN6Y6NPA.js";import{a as R,b as rt,c as we,d as An}from"./chunk-4Q2SNBUH.js";import{a as Tn}from"./chunk-QCIDUZV6.js";import{c as xn,f as _e}from"./chunk-S4K76QPI.js";import{a as tt,b as _n,e as nt,j as wn,o as Sn,q as kn}from"./chunk-XYA3SFGC.js";import{b as Z,e as et}from"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{e as Cn}from"./chunk-CLUEFPSU.js";import"./chunk-7VGUNT5L.js";import{Y as bn}from"./chunk-QWBNNEV2.js";import{a as wr}from"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as c}from"./chunk-GZPNIYVZ.js";import{a as Ze,d as be,f as qt}from"./chunk-OWGSC52X.js";var Bn=be((eo,On)=>{"use strict";c();var vr=Ze("util"),Ir=wr();On.exports=function(r){if(typeof r=="number")return r;var e=Ir(r);if(e===void 0){var t=new Error(vr.format("humanize-ms(%j) result undefined",r));console.warn(t.stack)}return e}});var ct=be((no,Ln)=>{"use strict";c();Ln.exports={CURRENT_ID:Symbol("agentkeepalive#currentId"),CREATE_ID:Symbol("agentkeepalive#createId"),INIT_SOCKET:Symbol("agentkeepalive#initSocket"),CREATE_HTTPS_CONNECTION:Symbol("agentkeepalive#createHttpsConnection"),SOCKET_CREATED_TIME:Symbol("agentkeepalive#socketCreatedTime"),SOCKET_NAME:Symbol("agentkeepalive#socketName"),SOCKET_REQUEST_COUNT:Symbol("agentkeepalive#socketRequestCount"),SOCKET_REQUEST_FINISHED_COUNT:Symbol("agentkeepalive#socketRequestFinishedCount")}});var Jt=be((so,Dn)=>{"use strict";c();var Fr=Ze("http").Agent,$t=Bn(),E=Ze("util").debuglog("agentkeepalive"),{INIT_SOCKET:qn,CURRENT_ID:ut,CREATE_ID:jn,SOCKET_CREATED_TIME:Nn,SOCKET_NAME:P,SOCKET_REQUEST_COUNT:v,SOCKET_REQUEST_FINISHED_COUNT:q}=ct(),Ht=1,Gt=parseInt(process.version.split(".",1)[0].substring(1));Gt>=11&&Gt<=12?Ht=2:Gt>=13&&(Ht=3);function Se(r){console.log("[agentkeepalive:deprecated] %s",r)}var Kt=class extends Fr{constructor(e){e=e||{},e.keepAlive=e.keepAlive!==!1,e.freeSocketTimeout===void 0&&(e.freeSocketTimeout=4e3),e.keepAliveTimeout&&(Se("options.keepAliveTimeout is deprecated, please use options.freeSocketTimeout instead"),e.freeSocketTimeout=e.keepAliveTimeout,delete e.keepAliveTimeout),e.freeSocketKeepAliveTimeout&&(Se("options.freeSocketKeepAliveTimeout is deprecated, please use options.freeSocketTimeout instead"),e.freeSocketTimeout=e.freeSocketKeepAliveTimeout,delete e.freeSocketKeepAliveTimeout),e.timeout===void 0&&(e.timeout=Math.max(e.freeSocketTimeout*2,8e3)),e.timeout=$t(e.timeout),e.freeSocketTimeout=$t(e.freeSocketTimeout),e.socketActiveTTL=e.socketActiveTTL?$t(e.socketActiveTTL):0,super(e),this[ut]=0,this.createSocketCount=0,this.createSocketCountLastCheck=0,this.createSocketErrorCount=0,this.createSocketErrorCountLastCheck=0,this.closeSocketCount=0,this.closeSocketCountLastCheck=0,this.errorSocketCount=0,this.errorSocketCountLastCheck=0,this.requestCount=0,this.requestCountLastCheck=0,this.timeoutSocketCount=0,this.timeoutSocketCountLastCheck=0,this.on("free",t=>{let n=this.calcSocketTimeout(t);n>0&&t.timeout!==n&&t.setTimeout(n)})}get freeSocketKeepAliveTimeout(){return Se("agent.freeSocketKeepAliveTimeout is deprecated, please use agent.options.freeSocketTimeout instead"),this.options.freeSocketTimeout}get timeout(){return Se("agent.timeout is deprecated, please use agent.options.timeout instead"),this.options.timeout}get socketActiveTTL(){return Se("agent.socketActiveTTL is deprecated, please use agent.options.socketActiveTTL instead"),this.options.socketActiveTTL}calcSocketTimeout(e){let t=this.options.freeSocketTimeout,n=this.options.socketActiveTTL;if(n){let s=Date.now()-e[Nn],o=n-s;if(o<=0)return o;t&&o<t&&(t=o)}if(t)return e.freeSocketTimeout||e.freeSocketKeepAliveTimeout||t}keepSocketAlive(e){let t=super.keepSocketAlive(e);if(!t)return t;let n=this.calcSocketTimeout(e);return typeof n>"u"?!0:n<=0?(E("%s(requests: %s, finished: %s) free but need to destroy by TTL, request count %s, diff is %s",e[P],e[v],e[q],n),!1):(e.timeout!==n&&e.setTimeout(n),!0)}reuseSocket(...e){super.reuseSocket(...e);let t=e[0],n=e[1];n.reusedSocket=!0;let s=this.options.timeout;ke(t)!==s&&(t.setTimeout(s),E("%s reset timeout to %sms",t[P],s)),t[v]++,E("%s(requests: %s, finished: %s) reuse on addRequest, timeout %sms",t[P],t[v],t[q],ke(t))}[jn](){let e=this[ut]++;return this[ut]===Number.MAX_SAFE_INTEGER&&(this[ut]=0),e}[qn](e,t){t.timeout&&(ke(e)||e.setTimeout(t.timeout)),this.options.keepAlive&&e.setNoDelay(!0),this.createSocketCount++,this.options.socketActiveTTL&&(e[Nn]=Date.now()),e[P]=`sock[${this[jn]()}#${t._agentKey}]`.split("-----BEGIN",1)[0],e[v]=1,e[q]=0,Or(this,e,t)}createConnection(e,t){let n=!1,s=(i,a)=>{if(!n){if(n=!0,i)return this.createSocketErrorCount++,t(i);this[qn](a,e),t(i,a)}},o=super.createConnection(e,s);return o&&s(null,o),o}get statusChanged(){let e=this.createSocketCount!==this.createSocketCountLastCheck||this.createSocketErrorCount!==this.createSocketErrorCountLastCheck||this.closeSocketCount!==this.closeSocketCountLastCheck||this.errorSocketCount!==this.errorSocketCountLastCheck||this.timeoutSocketCount!==this.timeoutSocketCountLastCheck||this.requestCount!==this.requestCountLastCheck;return e&&(this.createSocketCountLastCheck=this.createSocketCount,this.createSocketErrorCountLastCheck=this.createSocketErrorCount,this.closeSocketCountLastCheck=this.closeSocketCount,this.errorSocketCountLastCheck=this.errorSocketCount,this.timeoutSocketCountLastCheck=this.timeoutSocketCount,this.requestCountLastCheck=this.requestCount),e}getCurrentStatus(){return{createSocketCount:this.createSocketCount,createSocketErrorCount:this.createSocketErrorCount,closeSocketCount:this.closeSocketCount,errorSocketCount:this.errorSocketCount,timeoutSocketCount:this.timeoutSocketCount,requestCount:this.requestCount,freeSockets:Wt(this.freeSockets),sockets:Wt(this.sockets),requests:Wt(this.requests)}}};function ke(r){return r.timeout||r._idleTimeout}function Or(r,e,t){E("%s create, timeout %sms",e[P],ke(e));function n(){if(!e._httpMessage&&e[v]===1)return;e[q]++,r.requestCount++,E("%s(requests: %s, finished: %s) free",e[P],e[v],e[q]);let u=r.getName(t);e.writable&&r.requests[u]&&r.requests[u].length&&(e[v]++,E("%s(requests: %s, finished: %s) will be reuse on agent free event",e[P],e[v],e[q]))}e.on("free",n);function s(u){E("%s(requests: %s, finished: %s) close, isError: %s",e[P],e[v],e[q],u),r.closeSocketCount++}e.on("close",s);function o(){let u=e.listeners("timeout").length,l=ke(e),m=e._httpMessage,f=m&&m.listeners("timeout").length||0;E("%s(requests: %s, finished: %s) timeout after %sms, listeners %s, defaultTimeoutListenerCount %s, hasHttpRequest %s, HttpRequest timeoutListenerCount %s",e[P],e[v],e[q],l,u,Ht,!!m,f),E.enabled&&E("timeout listeners: %s",e.listeners("timeout").map(g=>g.name).join(", ")),r.timeoutSocketCount++;let _=r.getName(t);if(r.freeSockets[_]&&r.freeSockets[_].indexOf(e)!==-1)e.destroy(),r.removeSocket(e,t),E("%s is free, destroy quietly",e[P]);else if(f===0){let g=new Error("Socket timeout");g.code="ERR_SOCKET_TIMEOUT",g.timeout=l,e.destroy(g),r.removeSocket(e,t),E("%s destroy with timeout error",e[P])}}e.on("timeout",o);function i(u){let l=e.listeners("error").length;E("%s(requests: %s, finished: %s) error: %s, listenerCount: %s",e[P],e[v],e[q],u,l),r.errorSocketCount++,l===1&&(E("%s emit uncaught error event",e[P]),e.removeListener("error",i),e.emit("error",u))}e.on("error",i);function a(){E("%s(requests: %s, finished: %s) agentRemove",e[P],e[v],e[q]),e.removeListener("close",s),e.removeListener("error",i),e.removeListener("free",n),e.removeListener("timeout",o),e.removeListener("agentRemove",a)}e.on("agentRemove",a)}Dn.exports=Kt;function Wt(r){let e={};for(let t in r)e[t]=r[t].length;return e}});var Gn=be((io,$n)=>{"use strict";c();var Xt=Ze("https").Agent,Br=Jt(),{INIT_SOCKET:Lr,CREATE_HTTPS_CONNECTION:Un}=ct(),Ce=class extends Br{constructor(e){super(e),this.defaultPort=443,this.protocol="https:",this.maxCachedSessions=this.options.maxCachedSessions,this.maxCachedSessions===void 0&&(this.maxCachedSessions=100),this._sessionCache={map:{},list:[]}}createConnection(e,t){let n=this[Un](e,t);return this[Lr](n,e),n}};Ce.prototype[Un]=Xt.prototype.createConnection;["getName","_getSession","_cacheSession","_evictSession"].forEach(function(r){typeof Xt.prototype[r]=="function"&&(Ce.prototype[r]=Xt.prototype[r])});$n.exports=Ce});var Hn=be((co,xe)=>{"use strict";c();var Wn=Jt();xe.exports=Wn;xe.exports.HttpAgent=Wn;xe.exports.HttpsAgent=Gn();xe.exports.constants=ct()});c();c();c();c();c();var ee="0.36.3";c();c();c();var En=!1,te,jt,Cr,xr,Tr,Pn,Ar,st,Nt,Rn,Dt,ot,Mn;function vn(r,e={auto:!1}){if(En)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${r.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(te)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${r.kind}'\` after \`import '@anthropic-ai/sdk/shims/${te}'\``);En=e.auto,te=r.kind,jt=r.fetch,Cr=r.Request,xr=r.Response,Tr=r.Headers,Pn=r.FormData,Ar=r.Blob,st=r.File,Nt=r.ReadableStream,Rn=r.getMultipartRequestOptions,Dt=r.getDefaultAgent,ot=r.fileFromPath,Mn=r.isFsReadStream}c();var J=qt(Sr(),1);c();c();import{inspect as Rr}from"util";c();var In=r=>r instanceof rt;c();import{deprecate as Pr}from"util";var Fn=Pr(()=>{},'Constructor "entries" argument is not spec-compliant and will be removed in next major release.');var B=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},it,L,Ut,at=class{constructor(e){it.add(this),L.set(this,new Map),e&&(Fn(),e.forEach(({name:t,value:n,fileName:s})=>this.append(t,n,s)))}static[(L=new WeakMap,it=new WeakSet,Symbol.hasInstance)](e){return!!(e&&R(e.constructor)&&e[Symbol.toStringTag]==="FormData"&&R(e.append)&&R(e.set)&&R(e.get)&&R(e.getAll)&&R(e.has)&&R(e.delete)&&R(e.entries)&&R(e.values)&&R(e.keys)&&R(e[Symbol.iterator])&&R(e.forEach))}append(e,t,n){B(this,it,"m",Ut).call(this,{name:e,fileName:n,append:!0,rawValue:t,argsLength:arguments.length})}set(e,t,n){B(this,it,"m",Ut).call(this,{name:e,fileName:n,append:!1,rawValue:t,argsLength:arguments.length})}get(e){let t=B(this,L,"f").get(String(e));return t?t[0]:null}getAll(e){let t=B(this,L,"f").get(String(e));return t?t.slice():[]}has(e){return B(this,L,"f").has(String(e))}delete(e){B(this,L,"f").delete(String(e))}*keys(){for(let e of B(this,L,"f").keys())yield e}*entries(){for(let e of this.keys()){let t=this.getAll(e);for(let n of t)yield[e,n]}}*values(){for(let[,e]of this)yield e}[(Ut=function({name:t,rawValue:n,append:s,fileName:o,argsLength:i}){let a=s?"append":"set";if(i<2)throw new TypeError(`Failed to execute '${a}' on 'FormData': 2 arguments required, but only ${i} present.`);t=String(t);let u;if(An(n))u=o===void 0?n:new we([n],o,{type:n.type,lastModified:n.lastModified});else if(In(n))u=new we([n],o===void 0?"blob":o,{type:n.type});else{if(o)throw new TypeError(`Failed to execute '${a}' on 'FormData': parameter 2 is not of type 'Blob'.`);u=String(n)}let l=B(this,L,"f").get(t);if(!l)return void B(this,L,"f").set(t,[u]);if(!s)return void B(this,L,"f").set(t,[u]);l.push(u)},Symbol.iterator)](){return this.entries()}forEach(e,t){for(let[n,s]of this)e.call(t,s,n,this)}get[Symbol.toStringTag](){return"FormData"}[Rr.custom](){return this[Symbol.toStringTag]}};var Zt=qt(Hn(),1),Vn=qt(kr(),1);import{ReadStream as Wr}from"node:fs";c();c();c();var Kn="abcdefghijklmnopqrstuvwxyz0123456789";function qr(){let r=16,e="";for(;r--;)e+=Kn[Math.random()*Kn.length<<0];return e}var Jn=qr;c();var jr=r=>Object.prototype.toString.call(r).slice(8,-1).toLowerCase();function Nr(r){if(jr(r)!=="object")return!1;let e=Object.getPrototypeOf(r);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}var zt=Nr;c();var Dr=r=>String(r).replace(/\r|\n/g,(e,t,n)=>e==="\r"&&n[t+1]!==`
|
|
3
|
+
import{a as Sr,b as kr}from"./chunk-QN6Y6NPA.js";import{a as R,b as rt,c as we,d as An}from"./chunk-4Q2SNBUH.js";import{a as Tn}from"./chunk-QCIDUZV6.js";import{c as xn,f as _e}from"./chunk-S4K76QPI.js";import{a as tt,b as _n,e as nt,j as wn,o as Sn,q as kn}from"./chunk-XYA3SFGC.js";import{b as Z,e as et}from"./chunk-4J6DC24J.js";import"./chunk-LJR4RZZ2.js";import"./chunk-U347OO7S.js";import{f as Cn}from"./chunk-XJDC3ZQZ.js";import{Y as bn}from"./chunk-QWBNNEV2.js";import{a as wr}from"./chunk-OA56BXPD.js";import"./chunk-FWDMPRKU.js";import{b as c}from"./chunk-GZPNIYVZ.js";import{a as Ze,d as be,f as qt}from"./chunk-OWGSC52X.js";var Bn=be((eo,On)=>{"use strict";c();var vr=Ze("util"),Ir=wr();On.exports=function(r){if(typeof r=="number")return r;var e=Ir(r);if(e===void 0){var t=new Error(vr.format("humanize-ms(%j) result undefined",r));console.warn(t.stack)}return e}});var ct=be((no,Ln)=>{"use strict";c();Ln.exports={CURRENT_ID:Symbol("agentkeepalive#currentId"),CREATE_ID:Symbol("agentkeepalive#createId"),INIT_SOCKET:Symbol("agentkeepalive#initSocket"),CREATE_HTTPS_CONNECTION:Symbol("agentkeepalive#createHttpsConnection"),SOCKET_CREATED_TIME:Symbol("agentkeepalive#socketCreatedTime"),SOCKET_NAME:Symbol("agentkeepalive#socketName"),SOCKET_REQUEST_COUNT:Symbol("agentkeepalive#socketRequestCount"),SOCKET_REQUEST_FINISHED_COUNT:Symbol("agentkeepalive#socketRequestFinishedCount")}});var Jt=be((so,Dn)=>{"use strict";c();var Fr=Ze("http").Agent,$t=Bn(),E=Ze("util").debuglog("agentkeepalive"),{INIT_SOCKET:qn,CURRENT_ID:ut,CREATE_ID:jn,SOCKET_CREATED_TIME:Nn,SOCKET_NAME:P,SOCKET_REQUEST_COUNT:v,SOCKET_REQUEST_FINISHED_COUNT:q}=ct(),Ht=1,Gt=parseInt(process.version.split(".",1)[0].substring(1));Gt>=11&&Gt<=12?Ht=2:Gt>=13&&(Ht=3);function Se(r){console.log("[agentkeepalive:deprecated] %s",r)}var Kt=class extends Fr{constructor(e){e=e||{},e.keepAlive=e.keepAlive!==!1,e.freeSocketTimeout===void 0&&(e.freeSocketTimeout=4e3),e.keepAliveTimeout&&(Se("options.keepAliveTimeout is deprecated, please use options.freeSocketTimeout instead"),e.freeSocketTimeout=e.keepAliveTimeout,delete e.keepAliveTimeout),e.freeSocketKeepAliveTimeout&&(Se("options.freeSocketKeepAliveTimeout is deprecated, please use options.freeSocketTimeout instead"),e.freeSocketTimeout=e.freeSocketKeepAliveTimeout,delete e.freeSocketKeepAliveTimeout),e.timeout===void 0&&(e.timeout=Math.max(e.freeSocketTimeout*2,8e3)),e.timeout=$t(e.timeout),e.freeSocketTimeout=$t(e.freeSocketTimeout),e.socketActiveTTL=e.socketActiveTTL?$t(e.socketActiveTTL):0,super(e),this[ut]=0,this.createSocketCount=0,this.createSocketCountLastCheck=0,this.createSocketErrorCount=0,this.createSocketErrorCountLastCheck=0,this.closeSocketCount=0,this.closeSocketCountLastCheck=0,this.errorSocketCount=0,this.errorSocketCountLastCheck=0,this.requestCount=0,this.requestCountLastCheck=0,this.timeoutSocketCount=0,this.timeoutSocketCountLastCheck=0,this.on("free",t=>{let n=this.calcSocketTimeout(t);n>0&&t.timeout!==n&&t.setTimeout(n)})}get freeSocketKeepAliveTimeout(){return Se("agent.freeSocketKeepAliveTimeout is deprecated, please use agent.options.freeSocketTimeout instead"),this.options.freeSocketTimeout}get timeout(){return Se("agent.timeout is deprecated, please use agent.options.timeout instead"),this.options.timeout}get socketActiveTTL(){return Se("agent.socketActiveTTL is deprecated, please use agent.options.socketActiveTTL instead"),this.options.socketActiveTTL}calcSocketTimeout(e){let t=this.options.freeSocketTimeout,n=this.options.socketActiveTTL;if(n){let s=Date.now()-e[Nn],o=n-s;if(o<=0)return o;t&&o<t&&(t=o)}if(t)return e.freeSocketTimeout||e.freeSocketKeepAliveTimeout||t}keepSocketAlive(e){let t=super.keepSocketAlive(e);if(!t)return t;let n=this.calcSocketTimeout(e);return typeof n>"u"?!0:n<=0?(E("%s(requests: %s, finished: %s) free but need to destroy by TTL, request count %s, diff is %s",e[P],e[v],e[q],n),!1):(e.timeout!==n&&e.setTimeout(n),!0)}reuseSocket(...e){super.reuseSocket(...e);let t=e[0],n=e[1];n.reusedSocket=!0;let s=this.options.timeout;ke(t)!==s&&(t.setTimeout(s),E("%s reset timeout to %sms",t[P],s)),t[v]++,E("%s(requests: %s, finished: %s) reuse on addRequest, timeout %sms",t[P],t[v],t[q],ke(t))}[jn](){let e=this[ut]++;return this[ut]===Number.MAX_SAFE_INTEGER&&(this[ut]=0),e}[qn](e,t){t.timeout&&(ke(e)||e.setTimeout(t.timeout)),this.options.keepAlive&&e.setNoDelay(!0),this.createSocketCount++,this.options.socketActiveTTL&&(e[Nn]=Date.now()),e[P]=`sock[${this[jn]()}#${t._agentKey}]`.split("-----BEGIN",1)[0],e[v]=1,e[q]=0,Or(this,e,t)}createConnection(e,t){let n=!1,s=(i,a)=>{if(!n){if(n=!0,i)return this.createSocketErrorCount++,t(i);this[qn](a,e),t(i,a)}},o=super.createConnection(e,s);return o&&s(null,o),o}get statusChanged(){let e=this.createSocketCount!==this.createSocketCountLastCheck||this.createSocketErrorCount!==this.createSocketErrorCountLastCheck||this.closeSocketCount!==this.closeSocketCountLastCheck||this.errorSocketCount!==this.errorSocketCountLastCheck||this.timeoutSocketCount!==this.timeoutSocketCountLastCheck||this.requestCount!==this.requestCountLastCheck;return e&&(this.createSocketCountLastCheck=this.createSocketCount,this.createSocketErrorCountLastCheck=this.createSocketErrorCount,this.closeSocketCountLastCheck=this.closeSocketCount,this.errorSocketCountLastCheck=this.errorSocketCount,this.timeoutSocketCountLastCheck=this.timeoutSocketCount,this.requestCountLastCheck=this.requestCount),e}getCurrentStatus(){return{createSocketCount:this.createSocketCount,createSocketErrorCount:this.createSocketErrorCount,closeSocketCount:this.closeSocketCount,errorSocketCount:this.errorSocketCount,timeoutSocketCount:this.timeoutSocketCount,requestCount:this.requestCount,freeSockets:Wt(this.freeSockets),sockets:Wt(this.sockets),requests:Wt(this.requests)}}};function ke(r){return r.timeout||r._idleTimeout}function Or(r,e,t){E("%s create, timeout %sms",e[P],ke(e));function n(){if(!e._httpMessage&&e[v]===1)return;e[q]++,r.requestCount++,E("%s(requests: %s, finished: %s) free",e[P],e[v],e[q]);let u=r.getName(t);e.writable&&r.requests[u]&&r.requests[u].length&&(e[v]++,E("%s(requests: %s, finished: %s) will be reuse on agent free event",e[P],e[v],e[q]))}e.on("free",n);function s(u){E("%s(requests: %s, finished: %s) close, isError: %s",e[P],e[v],e[q],u),r.closeSocketCount++}e.on("close",s);function o(){let u=e.listeners("timeout").length,l=ke(e),m=e._httpMessage,f=m&&m.listeners("timeout").length||0;E("%s(requests: %s, finished: %s) timeout after %sms, listeners %s, defaultTimeoutListenerCount %s, hasHttpRequest %s, HttpRequest timeoutListenerCount %s",e[P],e[v],e[q],l,u,Ht,!!m,f),E.enabled&&E("timeout listeners: %s",e.listeners("timeout").map(g=>g.name).join(", ")),r.timeoutSocketCount++;let _=r.getName(t);if(r.freeSockets[_]&&r.freeSockets[_].indexOf(e)!==-1)e.destroy(),r.removeSocket(e,t),E("%s is free, destroy quietly",e[P]);else if(f===0){let g=new Error("Socket timeout");g.code="ERR_SOCKET_TIMEOUT",g.timeout=l,e.destroy(g),r.removeSocket(e,t),E("%s destroy with timeout error",e[P])}}e.on("timeout",o);function i(u){let l=e.listeners("error").length;E("%s(requests: %s, finished: %s) error: %s, listenerCount: %s",e[P],e[v],e[q],u,l),r.errorSocketCount++,l===1&&(E("%s emit uncaught error event",e[P]),e.removeListener("error",i),e.emit("error",u))}e.on("error",i);function a(){E("%s(requests: %s, finished: %s) agentRemove",e[P],e[v],e[q]),e.removeListener("close",s),e.removeListener("error",i),e.removeListener("free",n),e.removeListener("timeout",o),e.removeListener("agentRemove",a)}e.on("agentRemove",a)}Dn.exports=Kt;function Wt(r){let e={};for(let t in r)e[t]=r[t].length;return e}});var Gn=be((io,$n)=>{"use strict";c();var Xt=Ze("https").Agent,Br=Jt(),{INIT_SOCKET:Lr,CREATE_HTTPS_CONNECTION:Un}=ct(),Ce=class extends Br{constructor(e){super(e),this.defaultPort=443,this.protocol="https:",this.maxCachedSessions=this.options.maxCachedSessions,this.maxCachedSessions===void 0&&(this.maxCachedSessions=100),this._sessionCache={map:{},list:[]}}createConnection(e,t){let n=this[Un](e,t);return this[Lr](n,e),n}};Ce.prototype[Un]=Xt.prototype.createConnection;["getName","_getSession","_cacheSession","_evictSession"].forEach(function(r){typeof Xt.prototype[r]=="function"&&(Ce.prototype[r]=Xt.prototype[r])});$n.exports=Ce});var Hn=be((co,xe)=>{"use strict";c();var Wn=Jt();xe.exports=Wn;xe.exports.HttpAgent=Wn;xe.exports.HttpsAgent=Gn();xe.exports.constants=ct()});c();c();c();c();c();var ee="0.36.3";c();c();c();var En=!1,te,jt,Cr,xr,Tr,Pn,Ar,st,Nt,Rn,Dt,ot,Mn;function vn(r,e={auto:!1}){if(En)throw new Error(`you must \`import '@anthropic-ai/sdk/shims/${r.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(te)throw new Error(`can't \`import '@anthropic-ai/sdk/shims/${r.kind}'\` after \`import '@anthropic-ai/sdk/shims/${te}'\``);En=e.auto,te=r.kind,jt=r.fetch,Cr=r.Request,xr=r.Response,Tr=r.Headers,Pn=r.FormData,Ar=r.Blob,st=r.File,Nt=r.ReadableStream,Rn=r.getMultipartRequestOptions,Dt=r.getDefaultAgent,ot=r.fileFromPath,Mn=r.isFsReadStream}c();var J=qt(Sr(),1);c();c();import{inspect as Rr}from"util";c();var In=r=>r instanceof rt;c();import{deprecate as Pr}from"util";var Fn=Pr(()=>{},'Constructor "entries" argument is not spec-compliant and will be removed in next major release.');var B=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},it,L,Ut,at=class{constructor(e){it.add(this),L.set(this,new Map),e&&(Fn(),e.forEach(({name:t,value:n,fileName:s})=>this.append(t,n,s)))}static[(L=new WeakMap,it=new WeakSet,Symbol.hasInstance)](e){return!!(e&&R(e.constructor)&&e[Symbol.toStringTag]==="FormData"&&R(e.append)&&R(e.set)&&R(e.get)&&R(e.getAll)&&R(e.has)&&R(e.delete)&&R(e.entries)&&R(e.values)&&R(e.keys)&&R(e[Symbol.iterator])&&R(e.forEach))}append(e,t,n){B(this,it,"m",Ut).call(this,{name:e,fileName:n,append:!0,rawValue:t,argsLength:arguments.length})}set(e,t,n){B(this,it,"m",Ut).call(this,{name:e,fileName:n,append:!1,rawValue:t,argsLength:arguments.length})}get(e){let t=B(this,L,"f").get(String(e));return t?t[0]:null}getAll(e){let t=B(this,L,"f").get(String(e));return t?t.slice():[]}has(e){return B(this,L,"f").has(String(e))}delete(e){B(this,L,"f").delete(String(e))}*keys(){for(let e of B(this,L,"f").keys())yield e}*entries(){for(let e of this.keys()){let t=this.getAll(e);for(let n of t)yield[e,n]}}*values(){for(let[,e]of this)yield e}[(Ut=function({name:t,rawValue:n,append:s,fileName:o,argsLength:i}){let a=s?"append":"set";if(i<2)throw new TypeError(`Failed to execute '${a}' on 'FormData': 2 arguments required, but only ${i} present.`);t=String(t);let u;if(An(n))u=o===void 0?n:new we([n],o,{type:n.type,lastModified:n.lastModified});else if(In(n))u=new we([n],o===void 0?"blob":o,{type:n.type});else{if(o)throw new TypeError(`Failed to execute '${a}' on 'FormData': parameter 2 is not of type 'Blob'.`);u=String(n)}let l=B(this,L,"f").get(t);if(!l)return void B(this,L,"f").set(t,[u]);if(!s)return void B(this,L,"f").set(t,[u]);l.push(u)},Symbol.iterator)](){return this.entries()}forEach(e,t){for(let[n,s]of this)e.call(t,s,n,this)}get[Symbol.toStringTag](){return"FormData"}[Rr.custom](){return this[Symbol.toStringTag]}};var Zt=qt(Hn(),1),Vn=qt(kr(),1);import{ReadStream as Wr}from"node:fs";c();c();c();var Kn="abcdefghijklmnopqrstuvwxyz0123456789";function qr(){let r=16,e="";for(;r--;)e+=Kn[Math.random()*Kn.length<<0];return e}var Jn=qr;c();var jr=r=>Object.prototype.toString.call(r).slice(8,-1).toLowerCase();function Nr(r){if(jr(r)!=="object")return!1;let e=Object.getPrototypeOf(r);return e==null?!0:(e.constructor&&e.constructor.toString())===Object.toString()}var zt=Nr;c();var Dr=r=>String(r).replace(/\r|\n/g,(e,t,n)=>e==="\r"&&n[t+1]!==`
|
|
4
4
|
`||e===`
|
|
5
5
|
`&&n[t-1]!=="\r"?`\r
|
|
6
6
|
`:e),Vt=Dr;c();var Ur=r=>String(r).replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/"/g,"%22"),Qt=Ur;c();c();var $r=r=>typeof r=="function",U=$r;var ne=r=>!!(r&&typeof r=="object"&&U(r.constructor)&&r[Symbol.toStringTag]==="File"&&U(r.stream)&&r.name!=null&&r.size!=null&&r.lastModified!=null);c();var Xn=r=>!!(r&&U(r.constructor)&&r[Symbol.toStringTag]==="FormData"&&U(r.append)&&U(r.getAll)&&U(r.entries)&&U(r[Symbol.iterator]));var Te=function(r,e,t,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(r,t):s?s.value=t:e.set(r,t),t},w=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},lt,K,Ae,ft,Ee,re,Pe,Re,ht,Yt,Gr={enableAdditionalHeaders:!1},dt=class{constructor(e,t,n){if(lt.add(this),K.set(this,`\r
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Force strict mode and setup for ESM
|
|
2
|
+
"use strict";
|
|
3
|
+
import{b as o}from"./chunk-GZPNIYVZ.js";o();var i=["www-browser"];function a(r){let s=r.replace(/\\/g,"/").split("/").pop();return!!s&&i.includes(s)}function p(r={}){let e=process.env.BROWSER?.trim()?.match(/^\S+/)?.[0];if(!r.ignoreBrowserBlocklist&&process.platform!=="win32"&&e&&a(e)||process.env.CI||process.env.DEBIAN_FRONTEND==="noninteractive")return!1;let n=!!process.env.SSH_CONNECTION;return!(process.platform==="linux"&&!["DISPLAY","WAYLAND_DISPLAY","MIR_SOCKET"].some(t=>!!process.env[t])||n&&process.platform!=="linux")}export{a,p as b};
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2025 Google LLC
|
|
7
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Force strict mode and setup for ESM
|
|
2
2
|
"use strict";
|
|
3
|
-
import{b as
|
|
3
|
+
import{b as i}from"./chunk-GZPNIYVZ.js";i();var m="MATILDA_API_KEY";var g="matilda-code-1.0",u="Matilda",_="https://matilda.maincode.com/api/v1/code";var A={id:"matilda",label:"Matilda",description:"Connect to the Matilda Core code API endpoint",protocol:"openai",baseUrl:_,envKey:m,models:[{id:g,displayName:u,contextWindowSize:1048576,description:"Matilda Code model",generationConfig:{openAIRequestProfile:"matilda-code",timeout:6e5,samplingParams:{max_tokens:65536,chat_template_kwargs:{enable_thinking:!0}},schemaCompliance:"openapi_30",splitToolMedia:!0,customHeaders:{"User-Agent":"MatildaCode/0.1"}}}],modelNamePrefix:"",documentationUrl:"https://matilda.maincode.help/welcome/external-api",uiGroup:"third-party"};function h(o){return o.trim().replace(/\/+$/,"").replace(/\/api\/v1(?:\/code)?$/i,"")}async function f(o){let{baseUrl:n,email:s,password:d,signal:l}=o,r=h(n),p=`${r}/api/auth/login`,t;try{t=await fetch(p,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s,password:d}),signal:l})}catch(a){let c=a instanceof Error?a.message:String(a);throw new Error(`Could not reach Matilda at ${r}: ${c}`)}if(t.status===401)throw new Error("Invalid email or password.");if(!t.ok)throw new Error(`Matilda sign-in failed (HTTP ${t.status}). Please try again.`);let e;try{e=await t.json()}catch{throw new Error("Matilda sign-in returned an unreadable response.")}if(!e||typeof e.token!="string"||e.token.length===0)throw new Error("Matilda sign-in did not return a token.");return{token:e.token,refreshToken:typeof e.refreshToken=="string"?e.refreshToken:void 0,userId:typeof e.userId=="string"?e.userId:void 0,email:typeof e.email=="string"?e.email:void 0,displayName:typeof e.displayName=="string"?e.displayName:void 0}}export{m as a,g as b,u as c,_ as d,A as e,h as f,f as g};
|
|
4
4
|
/**
|
|
5
5
|
* @license
|
|
6
6
|
* Copyright 2026 Matilda Team
|