@grok/agent-sdk 0.4.0 → 0.5.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.
- package/dist/channels/match-ready/index.d.ts +4 -0
- package/dist/channels/match-ready/index.d.ts.map +1 -0
- package/dist/channels/match-ready/index.js +2 -0
- package/dist/channels/match-ready/match-ready-channel.d.ts +5 -0
- package/dist/channels/match-ready/match-ready-channel.d.ts.map +1 -0
- package/dist/channels/match-ready/match-ready-channel.js +42 -0
- package/dist/channels/match-ready/types.d.ts +25 -0
- package/dist/channels/match-ready/types.d.ts.map +1 -0
- package/dist/channels/match-ready/types.js +1 -0
- package/dist/docs/404.html +2 -2
- package/dist/docs/assets/{app.BSH__xV4.js → app.CYdjweqP.js} +4 -4
- package/dist/docs/assets/changelog.md.BMrJ5WxW.js +1 -0
- package/dist/docs/assets/changelog.md.BMrJ5WxW.lean.js +1 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.dUaE1f8e.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.Cadl7A0k.js → VPLocalSearchBox.CRATKS9J.js} +1 -1
- package/dist/docs/assets/chunks/{arc.K7t9nNY6.js → arc.BxM78ISR.js} +1 -1
- package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.SlHEknkX.js → architectureDiagram-Q4EWVU46.Bi6MuKaU.js} +1 -1
- package/dist/docs/assets/chunks/{baseUniq.DJLRMLkz.js → baseUniq.L47qqpDG.js} +1 -1
- package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.Bs6XxFpe.js → blockDiagram-DXYQGD6D.kHFF2FK5.js} +1 -1
- package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.CyLg6Ovc.js → c4Diagram-AHTNJAMY.BTW85ll3.js} +1 -1
- package/dist/docs/assets/chunks/channel.ljJtQtBi.js +1 -0
- package/dist/docs/assets/chunks/{chunk-4BX2VUAB.DTQ4TinT.js → chunk-4BX2VUAB.Bbh3_48g.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-4TB4RGXK.Es84IgcH.js → chunk-4TB4RGXK.WeAmK3fK.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-55IACEB6.Clm3cGPQ.js → chunk-55IACEB6.DTdUiVHf.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-EDXVE4YY.DE4CRkS5.js → chunk-EDXVE4YY.n5XzANDz.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-FMBD7UC4.Bf8HCvqp.js → chunk-FMBD7UC4.D51eewCb.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-OYMX7WX6.eub-7nSx.js → chunk-OYMX7WX6.BrY0U7ZV.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-QZHKN3VN.WyP9VAS_.js → chunk-QZHKN3VN.B0OA4aFV.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-YZCP3GAM.LO9ohhDE.js → chunk-YZCP3GAM.Djt3Mjft.js} +1 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.BZ3Uc-XU.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.BZ3Uc-XU.js +1 -0
- package/dist/docs/assets/chunks/clone.BDtbEo69.js +1 -0
- package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.D5za6aH0.js → cose-bilkent-S5V4N54A.DiMcA6Q8.js} +1 -1
- package/dist/docs/assets/chunks/{dagre-KV5264BT.Dq1daUru.js → dagre-KV5264BT.BGqI4vrS.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-5BDNPKRD.j1YL5BKS.js → diagram-5BDNPKRD.bDqFuMoH.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.Bi1aLdhC.js → diagram-G4DWMVQ6.Y0sxaXRU.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-MMDJMWI5.BOzMEkAr.js → diagram-MMDJMWI5.Bg43b0yi.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-TYMM5635.Dx2FVhCr.js → diagram-TYMM5635.DCfVasEC.js} +1 -1
- package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.DI4TNkye.js → erDiagram-SMLLAGMA.C72GaD16.js} +1 -1
- package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.C58Z9uPK.js → flowDiagram-DWJPFMVM.DxRQj7pP.js} +1 -1
- package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.DXSpW809.js → ganttDiagram-T4ZO3ILL.DiLZy5Q4.js} +1 -1
- package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.B955oaFl.js → gitGraphDiagram-UUTBAWPF.DL8XkRvh.js} +1 -1
- package/dist/docs/assets/chunks/{graph.BQXhKtxS.js → graph.3Xub80xJ.js} +1 -1
- package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.Dozj_-Gm.js → infoDiagram-42DDH7IO.O3lGaspu.js} +1 -1
- package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.D2140OzH.js → ishikawaDiagram-UXIWVN3A.w-pCiQzn.js} +1 -1
- package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.DrqrMhCk.js → journeyDiagram-VCZTEJTY.Cg_oBs9j.js} +1 -1
- package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.Dv-LTrlw.js → kanban-definition-6JOO6SKY.BpfMGPwn.js} +1 -1
- package/dist/docs/assets/chunks/{layout.CGtHp49X.js → layout.CtwXs__p.js} +1 -1
- package/dist/docs/assets/chunks/{linear.CHZLYB52.js → linear.NmCskOrP.js} +1 -1
- package/dist/docs/assets/chunks/{min.D4Vt3eIy.js → min.DpQtsLKs.js} +1 -1
- package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.BBfpYTea.js → mindmap-definition-QFDTVHPH.B-P-aKVp.js} +1 -1
- package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.BVYvElmY.js → pieDiagram-DEJITSTG.BfjjqK7j.js} +1 -1
- package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.C6Gc2mdY.js → quadrantDiagram-34T5L4WZ.BTzHo53F.js} +1 -1
- package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.DWa8b4cn.js → requirementDiagram-MS252O5E.DIT2FIKr.js} +1 -1
- package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.Bi-g4ajv.js → sankeyDiagram-XADWPNL6.NK1wCsgt.js} +1 -1
- package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.DlU3vVN9.js → sequenceDiagram-FGHM5R23.D9oElkvo.js} +1 -1
- package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.CeqJRqnU.js → stateDiagram-FHFEXIEX.IPksnixH.js} +1 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.CbhzVsQE.js +1 -0
- package/dist/docs/assets/chunks/{theme.DGq7D4tt.js → theme.CgKu7tr3.js} +2 -2
- package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.Cqf2kjq9.js → timeline-definition-GMOUNBTQ.CuAtJapY.js} +1 -1
- package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.BeOpE_lM.js → vennDiagram-DHZGUBPP.B87nNW9E.js} +1 -1
- package/dist/docs/assets/chunks/wardley-RL74JXVD.BFIVMaoi.js +162 -0
- package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.BXS65dAC.js → wardleyDiagram-NUSXRM2D.BELjSq8w.js} +1 -1
- package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.haEiSxqc.js → xychartDiagram-5P7HB3ND.5zN5ZGsz.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.BSNp2uJ7.js → reference_agent-config.md.Bbqf0lgS.js} +11 -3
- package/dist/docs/assets/{reference_agent-config.md.BSNp2uJ7.lean.js → reference_agent-config.md.Bbqf0lgS.lean.js} +1 -1
- package/dist/docs/assets/{reference_schedules.md.Dd8_d0WG.js → reference_schedules.md.RhQ9ZLo1.js} +3 -3
- package/dist/docs/assets/{reference_tools.md.B2OaR1Nb.js → reference_tools.md.BhqW6neF.js} +4 -2
- package/dist/docs/assets/{reference_tools.md.B2OaR1Nb.lean.js → reference_tools.md.BhqW6neF.lean.js} +1 -1
- package/dist/docs/building-with-agents.html +35 -35
- package/dist/docs/changelog.html +36 -36
- package/dist/docs/changelog.md +31 -7
- package/dist/docs/deployment.html +35 -35
- package/dist/docs/evals.html +35 -35
- package/dist/docs/guides/agent-to-agent.html +35 -35
- package/dist/docs/guides/bitbucket.html +35 -35
- package/dist/docs/guides/cloud-agents.html +35 -35
- package/dist/docs/guides/convert-automation.html +35 -35
- package/dist/docs/guides/github.html +35 -35
- package/dist/docs/guides/gitlab.html +35 -35
- package/dist/docs/guides/improve.html +35 -35
- package/dist/docs/guides/jev.html +35 -35
- package/dist/docs/guides/mcp-oauth.html +35 -35
- package/dist/docs/guides/migrate.html +35 -35
- package/dist/docs/guides/opentelemetry.html +35 -35
- package/dist/docs/guides/pagerduty.html +35 -35
- package/dist/docs/guides/slack.html +35 -35
- package/dist/docs/guides/webhooks.html +35 -35
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +35 -35
- package/dist/docs/index.html +35 -35
- package/dist/docs/llms-full.txt +113 -11
- package/dist/docs/quickstart.html +35 -35
- package/dist/docs/reference/access.html +35 -35
- package/dist/docs/reference/agent-config.html +45 -37
- package/dist/docs/reference/agent-config.md +70 -4
- package/dist/docs/reference/artifacts.html +35 -35
- package/dist/docs/reference/channels.html +35 -35
- package/dist/docs/reference/cli.html +35 -35
- package/dist/docs/reference/connections.html +35 -35
- package/dist/docs/reference/evals.html +35 -35
- package/dist/docs/reference/extensions.html +35 -35
- package/dist/docs/reference/hooks.html +35 -35
- package/dist/docs/reference/http-api.html +35 -35
- package/dist/docs/reference/instructions.html +35 -35
- package/dist/docs/reference/limits.html +35 -35
- package/dist/docs/reference/memory.html +35 -35
- package/dist/docs/reference/playground.html +35 -35
- package/dist/docs/reference/project-layout.html +35 -35
- package/dist/docs/reference/schedules.html +38 -38
- package/dist/docs/reference/sessions.html +35 -35
- package/dist/docs/reference/skills.html +35 -35
- package/dist/docs/reference/subagents.html +35 -35
- package/dist/docs/reference/tools.html +39 -37
- package/dist/docs/reference/tools.md +12 -0
- package/dist/docs/templates/agentic-owners.html +35 -35
- package/dist/docs/templates/reviews.html +35 -35
- package/dist/docs/troubleshooting.html +35 -35
- package/dist/filesystem.d.ts +10 -97
- package/dist/filesystem.d.ts.map +1 -1
- package/dist/filesystem.js +28 -290
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/internal/continuation-channel.d.ts +3 -3
- package/dist/internal/continuation-channel.js +3 -3
- package/dist/internal/continuation-identity.d.ts +6 -5
- package/dist/internal/continuation-identity.d.ts.map +1 -1
- package/dist/internal/continuation-identity.js +17 -2
- package/dist/internal/direct-file-tools.d.ts +21 -0
- package/dist/internal/direct-file-tools.d.ts.map +1 -0
- package/dist/internal/direct-file-tools.js +60 -0
- package/dist/internal/discovery/agent.d.ts.map +1 -1
- package/dist/internal/discovery/agent.js +71 -66
- package/dist/internal/filesystem/walk.d.ts +4 -52
- package/dist/internal/filesystem/walk.d.ts.map +1 -1
- package/dist/internal/filesystem/walk.js +4 -190
- package/dist/internal/hosted-managed-automation.js +1 -1
- package/dist/internal/otel/http.d.ts +2 -1
- package/dist/internal/otel/http.d.ts.map +1 -1
- package/dist/internal/otel/http.js +2 -3
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +22 -40
- package/dist/internal/session-engine.d.ts +33 -19
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +170 -251
- package/dist/internal/tool-paths.d.ts +8 -0
- package/dist/internal/tool-paths.d.ts.map +1 -0
- package/dist/internal/tool-paths.js +12 -0
- package/dist/internal/workspace-tree.d.ts +27 -0
- package/dist/internal/workspace-tree.d.ts.map +1 -0
- package/dist/internal/workspace-tree.js +106 -0
- package/dist/playground/assets/index-D0-FHg1x.css +1 -0
- package/dist/playground/assets/index-D5SLKUy6.js +62 -0
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +41 -23
- package/dist/types.d.ts.map +1 -1
- package/docs/changelog.md +31 -7
- package/docs/reference/agent-config.md +70 -4
- package/docs/reference/tools.md +12 -0
- package/package.json +9 -14
- package/skills/deploy/SKILL.md +1 -1
- package/dist/docs/assets/changelog.md.b6H_ea44.js +0 -1
- package/dist/docs/assets/changelog.md.b6H_ea44.lean.js +0 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.CiRGcfZg.js +0 -1
- package/dist/docs/assets/chunks/channel.CVTdqYx0.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.CsJJyx6-.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.CsJJyx6-.js +0 -1
- package/dist/docs/assets/chunks/clone.Dk8KvtOB.js +0 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.DE0BnUZh.js +0 -1
- package/dist/docs/assets/chunks/wardley-RL74JXVD.FMQXA-6q.js +0 -162
- package/dist/executors.d.ts +0 -11
- package/dist/executors.d.ts.map +0 -1
- package/dist/executors.js +0 -21
- package/dist/internal/filesystem/format.d.ts +0 -28
- package/dist/internal/filesystem/format.d.ts.map +0 -1
- package/dist/internal/filesystem/format.js +0 -209
- package/dist/internal/filesystem/nearest.d.ts +0 -15
- package/dist/internal/filesystem/nearest.d.ts.map +0 -1
- package/dist/internal/filesystem/nearest.js +0 -90
- package/dist/internal/filesystem/scratch.d.ts +0 -60
- package/dist/internal/filesystem/scratch.d.ts.map +0 -1
- package/dist/internal/filesystem/scratch.js +0 -187
- package/dist/internal/filesystem/sdk-schemas.d.ts +0 -29
- package/dist/internal/filesystem/sdk-schemas.d.ts.map +0 -1
- package/dist/internal/filesystem/sdk-schemas.js +0 -148
- package/dist/internal/filesystem/subagent-inherit.d.ts +0 -39
- package/dist/internal/filesystem/subagent-inherit.d.ts.map +0 -1
- package/dist/internal/filesystem/subagent-inherit.js +0 -96
- package/dist/internal/filesystem/tools.d.ts +0 -59
- package/dist/internal/filesystem/tools.d.ts.map +0 -1
- package/dist/internal/filesystem/tools.js +0 -634
- package/dist/internal/otel/propagation.d.ts +0 -7
- package/dist/internal/otel/propagation.d.ts.map +0 -1
- package/dist/internal/otel/propagation.js +0 -15
- package/dist/internal/sdk-subagent-inherit-support.d.ts +0 -9
- package/dist/internal/sdk-subagent-inherit-support.d.ts.map +0 -1
- package/dist/internal/sdk-subagent-inherit-support.js +0 -90
- package/dist/playground/assets/index-Bno25Cg0.css +0 -1
- package/dist/playground/assets/index-SGKsaznh.js +0 -62
- /package/dist/docs/assets/{reference_schedules.md.Dd8_d0WG.lean.js → reference_schedules.md.RhQ9ZLo1.lean.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-schemas.d.ts","sourceRoot":"","sources":["../../../src/internal/filesystem/sdk-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAmB5B,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,OAE1B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,OAM7B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,OAI3B,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,OAO9B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,OAE5B,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAI/B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,OAG1B,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,OAO7B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,OAe1B,CAAC;AAuCH,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,OAK7B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,CAAC,CAAC,OAGxB,CAAC;AAgBH,eAAO,MAAM,WAAW,EAAE,CAAC,CAAC,OAI3B,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,OAKhC,CAAC;AAEH,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,OAM7B,CAAC"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Advertised native-tool schemas. These are the `@cursor/sdk`
|
|
3
|
-
* tool-call types (`@anysphere/cursor-sdk-shared/tool-call-types`)
|
|
4
|
-
* reconstructed here so `@grok/agent-sdk` does not take an unpublished
|
|
5
|
-
* workspace dependency. The contract test pins JSON-schema equality
|
|
6
|
-
* against the SDK originals.
|
|
7
|
-
*
|
|
8
|
-
* Runtime aliases (`contents` → `fileText`, `old_string` → `oldText`)
|
|
9
|
-
* live on the `defineTool` input schema, not on these objects. The args
|
|
10
|
-
* objects are strict so their input JSON Schema keeps
|
|
11
|
-
* `additionalProperties: false`.
|
|
12
|
-
*/
|
|
13
|
-
import * as z from "zod/v4";
|
|
14
|
-
const simpleError = z.object({
|
|
15
|
-
message: z.string(),
|
|
16
|
-
});
|
|
17
|
-
function resultSchema(success) {
|
|
18
|
-
return z.discriminatedUnion("status", [
|
|
19
|
-
z.object({
|
|
20
|
-
status: z.literal("success"),
|
|
21
|
-
value: success,
|
|
22
|
-
}),
|
|
23
|
-
z.object({
|
|
24
|
-
status: z.literal("error"),
|
|
25
|
-
error: simpleError,
|
|
26
|
-
}),
|
|
27
|
-
]);
|
|
28
|
-
}
|
|
29
|
-
export const sdkReadArgs = z.strictObject({
|
|
30
|
-
path: z.string(),
|
|
31
|
-
});
|
|
32
|
-
export const sdkReadResult = resultSchema(z.object({
|
|
33
|
-
content: z.string(),
|
|
34
|
-
totalLines: z.number(),
|
|
35
|
-
fileSize: z.number(),
|
|
36
|
-
}));
|
|
37
|
-
export const sdkWriteArgs = z.strictObject({
|
|
38
|
-
path: z.string(),
|
|
39
|
-
fileText: z.string(),
|
|
40
|
-
returnFileContentAfterWrite: z.boolean().optional(),
|
|
41
|
-
});
|
|
42
|
-
export const sdkWriteResult = resultSchema(z.object({
|
|
43
|
-
path: z.string(),
|
|
44
|
-
linesCreated: z.number(),
|
|
45
|
-
fileSize: z.number(),
|
|
46
|
-
fileContentAfterWrite: z.string().optional(),
|
|
47
|
-
}));
|
|
48
|
-
export const sdkDeleteArgs = z.strictObject({
|
|
49
|
-
path: z.string(),
|
|
50
|
-
});
|
|
51
|
-
export const sdkDeleteResult = resultSchema(z.object({
|
|
52
|
-
fileSize: z.number(),
|
|
53
|
-
}));
|
|
54
|
-
export const sdkGlobArgs = z.strictObject({
|
|
55
|
-
targetDirectory: z.string().optional(),
|
|
56
|
-
globPattern: z.string(),
|
|
57
|
-
});
|
|
58
|
-
export const sdkGlobResult = resultSchema(z.object({
|
|
59
|
-
files: z.array(z.string()),
|
|
60
|
-
totalFiles: z.number(),
|
|
61
|
-
clientTruncated: z.boolean(),
|
|
62
|
-
ripgrepTruncated: z.boolean(),
|
|
63
|
-
}));
|
|
64
|
-
export const sdkGrepArgs = z.strictObject({
|
|
65
|
-
pattern: z.string(),
|
|
66
|
-
path: z.string().optional(),
|
|
67
|
-
glob: z.string().optional(),
|
|
68
|
-
outputMode: z.string().optional(),
|
|
69
|
-
contextBefore: z.number().optional(),
|
|
70
|
-
contextAfter: z.number().optional(),
|
|
71
|
-
context: z.number().optional(),
|
|
72
|
-
caseInsensitive: z.boolean().optional(),
|
|
73
|
-
type: z.string().optional(),
|
|
74
|
-
headLimit: z.number().optional(),
|
|
75
|
-
offset: z.number().optional(),
|
|
76
|
-
multiline: z.boolean().optional(),
|
|
77
|
-
sort: z.string().optional(),
|
|
78
|
-
sortAscending: z.boolean().optional(),
|
|
79
|
-
});
|
|
80
|
-
const grepContentMatch = z.object({
|
|
81
|
-
file: z.string(),
|
|
82
|
-
lineNumber: z.number().optional(),
|
|
83
|
-
line: z.string(),
|
|
84
|
-
beforeContext: z.array(z.string()).optional(),
|
|
85
|
-
afterContext: z.array(z.string()).optional(),
|
|
86
|
-
});
|
|
87
|
-
const grepFileCount = z.object({
|
|
88
|
-
file: z.string(),
|
|
89
|
-
count: z.number(),
|
|
90
|
-
});
|
|
91
|
-
const grepUnion = z.discriminatedUnion("type", [
|
|
92
|
-
z.object({
|
|
93
|
-
type: z.literal("content"),
|
|
94
|
-
output: z.object({
|
|
95
|
-
matches: z.array(grepContentMatch),
|
|
96
|
-
totalMatches: z.number(),
|
|
97
|
-
}),
|
|
98
|
-
}),
|
|
99
|
-
z.object({
|
|
100
|
-
type: z.literal("files"),
|
|
101
|
-
output: z.object({
|
|
102
|
-
files: z.array(z.string()),
|
|
103
|
-
count: z.number(),
|
|
104
|
-
}),
|
|
105
|
-
}),
|
|
106
|
-
z.object({
|
|
107
|
-
type: z.literal("count"),
|
|
108
|
-
output: z.object({
|
|
109
|
-
counts: z.array(grepFileCount),
|
|
110
|
-
total: z.number(),
|
|
111
|
-
}),
|
|
112
|
-
}),
|
|
113
|
-
]);
|
|
114
|
-
export const sdkGrepResult = resultSchema(z.object({
|
|
115
|
-
workspaceResults: z.record(z.string(), grepUnion).optional(),
|
|
116
|
-
activeEditorResult: grepUnion.optional(),
|
|
117
|
-
}));
|
|
118
|
-
export const sdkLsArgs = z.strictObject({
|
|
119
|
-
path: z.string(),
|
|
120
|
-
ignore: z.array(z.string()).optional(),
|
|
121
|
-
});
|
|
122
|
-
const lsDirectoryTreeNodeFile = z.object({
|
|
123
|
-
name: z.string(),
|
|
124
|
-
});
|
|
125
|
-
// Not z.lazy: the advertised schema stays inline, with no `$defs` reference.
|
|
126
|
-
const lsDirectoryTreeNode = z.object({
|
|
127
|
-
absPath: z.string(),
|
|
128
|
-
childrenDirs: z.array(z.unknown()),
|
|
129
|
-
childrenFiles: z.array(lsDirectoryTreeNodeFile),
|
|
130
|
-
childrenWereProcessed: z.boolean(),
|
|
131
|
-
fullSubtreeExtensionCounts: z.record(z.string(), z.number()),
|
|
132
|
-
numFiles: z.number(),
|
|
133
|
-
});
|
|
134
|
-
export const sdkLsResult = resultSchema(z.object({
|
|
135
|
-
directoryTreeRoot: lsDirectoryTreeNode,
|
|
136
|
-
}));
|
|
137
|
-
/** StrReplace is SDK `edit` plus the str-replace args the model actually sends. */
|
|
138
|
-
export const sdkStrReplaceArgs = z.strictObject({
|
|
139
|
-
path: z.string(),
|
|
140
|
-
oldText: z.string(),
|
|
141
|
-
newText: z.string(),
|
|
142
|
-
replaceAll: z.boolean().optional(),
|
|
143
|
-
});
|
|
144
|
-
export const sdkEditResult = resultSchema(z.object({
|
|
145
|
-
linesAdded: z.number().optional(),
|
|
146
|
-
linesRemoved: z.number().optional(),
|
|
147
|
-
diffString: z.string().optional(),
|
|
148
|
-
}));
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task-child inherit for an authored virtual root.
|
|
3
|
-
*
|
|
4
|
-
* The SDK calls `resourceProviderOptions` once per child session id,
|
|
5
|
-
* including nested `Task` grandchildren, and reuses that result for the
|
|
6
|
-
* child runtime. Each id gets its own {@link childOverlayFs} over the
|
|
7
|
-
* session union (authored tree plus `/tmp` scratch), so a child write
|
|
8
|
-
* cannot clobber the parent or a sibling. The FileSystem handle is not
|
|
9
|
-
* placed on the SDK request.
|
|
10
|
-
*
|
|
11
|
-
* Native executor overrides load on the first child. A static import
|
|
12
|
-
* would pull workspace-only packages into every CLI start. The published
|
|
13
|
-
* package omits that module; children then keep shell suppressed and
|
|
14
|
-
* reach the same overlay through synthesized file tools.
|
|
15
|
-
*/
|
|
16
|
-
import type { LocalSubagentInherit, LocalSubagentResourceProviderFields } from "@cursor/sdk";
|
|
17
|
-
import { type FileSystem } from "../../filesystem.js";
|
|
18
|
-
/**
|
|
19
|
-
* Structural view of the checkout-only executor module. Naming that module
|
|
20
|
-
* in a type query would pull it into `tsc -p tsconfig.build.json` even
|
|
21
|
-
* though the build config excludes it, and the published program cannot
|
|
22
|
-
* see its workspace-only imports.
|
|
23
|
-
*/
|
|
24
|
-
type ChildToolExecutor = NonNullable<LocalSubagentResourceProviderFields["overrideReadExecutor"]>;
|
|
25
|
-
interface FileSystemExecutorModule {
|
|
26
|
-
createFileSystemReadExecutor(root: FileSystem): ChildToolExecutor;
|
|
27
|
-
createFileSystemWriteExecutor(root: FileSystem): ChildToolExecutor;
|
|
28
|
-
createFileSystemGrepExecutor(root: FileSystem): ChildToolExecutor;
|
|
29
|
-
createFileSystemLsExecutor(root: FileSystem): ChildToolExecutor;
|
|
30
|
-
}
|
|
31
|
-
export interface RootSubagentBinding {
|
|
32
|
-
readonly inherit: LocalSubagentInherit;
|
|
33
|
-
/** Overlay for a Task child. Do not pass the parent session id. */
|
|
34
|
-
fileSystemForSession(sessionId: string): FileSystem;
|
|
35
|
-
}
|
|
36
|
-
export declare function createRootSubagentInherit(parent: FileSystem): RootSubagentBinding;
|
|
37
|
-
export declare function resourceFieldsForChild(overlay: FileSystem, executors: FileSystemExecutorModule | undefined): LocalSubagentResourceProviderFields;
|
|
38
|
-
export {};
|
|
39
|
-
//# sourceMappingURL=subagent-inherit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-inherit.d.ts","sourceRoot":"","sources":["../../../src/internal/filesystem/subagent-inherit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mCAAmC,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;;;GAKG;AACH,KAAK,iBAAiB,GAAG,WAAW,CAAC,mCAAmC,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAElG,UAAU,wBAAwB;IAChC,4BAA4B,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC;IAClE,6BAA6B,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC;IACnE,4BAA4B,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC;IAClE,0BAA0B,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC;CACjE;AAUD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC;IACvC,mEAAmE;IACnE,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC;CACrD;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,UAAU,GAAG,mBAAmB,CAcjF;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,wBAAwB,GAAG,SAAS,GAC9C,mCAAmC,CAWrC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task-child inherit for an authored virtual root.
|
|
3
|
-
*
|
|
4
|
-
* The SDK calls `resourceProviderOptions` once per child session id,
|
|
5
|
-
* including nested `Task` grandchildren, and reuses that result for the
|
|
6
|
-
* child runtime. Each id gets its own {@link childOverlayFs} over the
|
|
7
|
-
* session union (authored tree plus `/tmp` scratch), so a child write
|
|
8
|
-
* cannot clobber the parent or a sibling. The FileSystem handle is not
|
|
9
|
-
* placed on the SDK request.
|
|
10
|
-
*
|
|
11
|
-
* Native executor overrides load on the first child. A static import
|
|
12
|
-
* would pull workspace-only packages into every CLI start. The published
|
|
13
|
-
* package omits that module; children then keep shell suppressed and
|
|
14
|
-
* reach the same overlay through synthesized file tools.
|
|
15
|
-
*/
|
|
16
|
-
import { childOverlayFs } from "../../filesystem.js";
|
|
17
|
-
/**
|
|
18
|
-
* Widened to `string` on purpose. A string-literal dynamic import is still
|
|
19
|
-
* a static dependency, so the published declaration build would compile the
|
|
20
|
-
* excluded executor module. Node and the test runner resolve this relative
|
|
21
|
-
* to this file.
|
|
22
|
-
*/
|
|
23
|
-
const FILE_SYSTEM_EXECUTORS_SPECIFIER = "../../filesystem-executors.js";
|
|
24
|
-
export function createRootSubagentInherit(parent) {
|
|
25
|
-
const overlays = new Map();
|
|
26
|
-
return {
|
|
27
|
-
inherit: {
|
|
28
|
-
reportedWorkspacePath: "/",
|
|
29
|
-
resourceProviderOptions: async (context) => {
|
|
30
|
-
const overlay = childOverlayFor(overlays, parent, context.sessionId);
|
|
31
|
-
return resourceFieldsForChild(overlay, await loadFileSystemExecutors());
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
fileSystemForSession(sessionId) {
|
|
35
|
-
return childOverlayFor(overlays, parent, sessionId);
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
export function resourceFieldsForChild(overlay, executors) {
|
|
40
|
-
if (executors === undefined) {
|
|
41
|
-
return { suppressDefaultShellExecutor: true };
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
overrideReadExecutor: executors.createFileSystemReadExecutor(overlay),
|
|
45
|
-
overrideWriteExecutor: executors.createFileSystemWriteExecutor(overlay),
|
|
46
|
-
overrideGrepExecutor: executors.createFileSystemGrepExecutor(overlay),
|
|
47
|
-
overrideLsExecutor: executors.createFileSystemLsExecutor(overlay),
|
|
48
|
-
suppressDefaultShellExecutor: true,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
async function loadFileSystemExecutors() {
|
|
52
|
-
try {
|
|
53
|
-
const loaded = await import(FILE_SYSTEM_EXECUTORS_SPECIFIER);
|
|
54
|
-
if (!isFileSystemExecutorModule(loaded)) {
|
|
55
|
-
throw new Error("filesystem executors module is missing its factories");
|
|
56
|
-
}
|
|
57
|
-
return loaded;
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
if (isMissingModule(error)) {
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
throw error;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function isFileSystemExecutorModule(value) {
|
|
67
|
-
if (typeof value !== "object" || value === null) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
const candidate = value;
|
|
71
|
-
return (typeof candidate.createFileSystemReadExecutor === "function" &&
|
|
72
|
-
typeof candidate.createFileSystemWriteExecutor === "function" &&
|
|
73
|
-
typeof candidate.createFileSystemGrepExecutor === "function" &&
|
|
74
|
-
typeof candidate.createFileSystemLsExecutor === "function");
|
|
75
|
-
}
|
|
76
|
-
function isMissingModule(error) {
|
|
77
|
-
if (typeof error !== "object" || error === null) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
if ("code" in error && error.code === "ERR_MODULE_NOT_FOUND") {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
return "cause" in error && isMissingModule(error.cause);
|
|
84
|
-
}
|
|
85
|
-
function childOverlayFor(overlays, parent, sessionId) {
|
|
86
|
-
if (sessionId === undefined || sessionId === "") {
|
|
87
|
-
return childOverlayFs(parent);
|
|
88
|
-
}
|
|
89
|
-
const existing = overlays.get(sessionId);
|
|
90
|
-
if (existing !== undefined) {
|
|
91
|
-
return existing;
|
|
92
|
-
}
|
|
93
|
-
const created = childOverlayFs(parent);
|
|
94
|
-
overlays.set(sessionId, created);
|
|
95
|
-
return created;
|
|
96
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Native file tools synthesized from a bound {@link FileSystem}.
|
|
3
|
-
*
|
|
4
|
-
* Advertised name / input / output match `@cursor/sdk` tool-call types.
|
|
5
|
-
* Each tool is a `defineTool` whose runtime `inputSchema` accepts those
|
|
6
|
-
* fields plus the native aliases the harness still sends.
|
|
7
|
-
*/
|
|
8
|
-
import { type FileSystem, type FileSystemToolName } from "../../filesystem.js";
|
|
9
|
-
import type { DiscoveredTool } from "../../types.js";
|
|
10
|
-
export declare const SYNTHESIZED_FILE_SYSTEM_TOOL_NAMES: readonly ["Read", "LS", "Glob", "Grep", "Write", "StrReplace", "Delete"];
|
|
11
|
-
export type SynthesizedFileSystemToolName = (typeof SYNTHESIZED_FILE_SYSTEM_TOOL_NAMES)[number];
|
|
12
|
-
export declare function isSynthesizedFileSystemToolName(name: string): boolean;
|
|
13
|
-
export declare function rootFileToolsFromAuthored(tools: readonly string[] | undefined): FileSystemToolName[] | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Host-default file-tool filter. Omitted `tools` keeps the default
|
|
16
|
-
* seven-tool set (`undefined`). A listed allowlist is closed: names that
|
|
17
|
-
* are not FileSystem methods synthesize nothing, so agents that already
|
|
18
|
-
* replaced natives with authored VFS tools (`tools: ["updateTodos"]` plus
|
|
19
|
-
* `agent/tools/Delete.ts`) do not also get host-disk Delete.
|
|
20
|
-
*
|
|
21
|
-
* Authored `root` still uses {@link rootFileToolsFromAuthored}, where a
|
|
22
|
-
* no-file-name allowlist means the default-on file layer.
|
|
23
|
-
*/
|
|
24
|
-
export declare function hostFileToolsFromAuthored(tools: readonly string[] | undefined): FileSystemToolName[] | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Names July will actually synthesize for this agent. Discovery reserves
|
|
27
|
-
* only this set, not every FileSystem alias.
|
|
28
|
-
*/
|
|
29
|
-
export declare function synthesizedFileSystemToolNames(options: {
|
|
30
|
-
hasRoot: boolean;
|
|
31
|
-
tools?: readonly string[];
|
|
32
|
-
}): readonly SynthesizedFileSystemToolName[];
|
|
33
|
-
/**
|
|
34
|
-
* Canonical tool a name and payload will run. Legacy `edit` with
|
|
35
|
-
* `fileText` or `contents` is Write. Every other `edit` payload is StrReplace.
|
|
36
|
-
*/
|
|
37
|
-
export declare function resolvedFileSystemToolName(name: string, input?: Record<string, unknown>): FileSystemToolName | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* True when a direct call may run this file-tool alias. The set is the
|
|
40
|
-
* same one a turn synthesizes from `tools`.
|
|
41
|
-
*/
|
|
42
|
-
export declare function isDirectFileToolAdmitted(options: {
|
|
43
|
-
toolName: string;
|
|
44
|
-
input: unknown;
|
|
45
|
-
hasRoot: boolean;
|
|
46
|
-
tools?: readonly string[];
|
|
47
|
-
}): boolean;
|
|
48
|
-
/** Look up the `defineTool` factory for a native or allowlist name. */
|
|
49
|
-
export declare function fileSystemTool(root: FileSystem, name: string, input?: Record<string, unknown>): DiscoveredTool | undefined;
|
|
50
|
-
/** Validate and run the same tool a turn or `callTool` would. */
|
|
51
|
-
export declare function runFileSystemTool(root: FileSystem, name: string, input?: Record<string, unknown>): Promise<unknown>;
|
|
52
|
-
/**
|
|
53
|
-
* Run `fn` with synthesized file tools bound to `root`. Task children use
|
|
54
|
-
* this so Read/Write/Delete hit their overlay instead of the parent tree
|
|
55
|
-
* the tools were built against.
|
|
56
|
-
*/
|
|
57
|
-
export declare function runWithFileSystem<T>(root: FileSystem, fn: () => Promise<T>): Promise<T>;
|
|
58
|
-
export declare function synthesizeFileSystemTools(root: FileSystem, filter?: readonly FileSystemToolName[]): DiscoveredTool[];
|
|
59
|
-
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/internal/filesystem/tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,kBAAkB,EAWxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,cAAc,EAA6B,MAAM,gBAAgB,CAAC;AA8BhF,eAAO,MAAM,kCAAkC,YAC7C,MAAM,EACN,IAAI,EACJ,MAAM,EACN,MAAM,EACN,OAAO,EACP,YAAY,EACZ,QAAQ,CACA,CAAC;AAEX,MAAM,MAAM,6BAA6B,GAAG,CAAC,OAAO,kCAAkC,CAAC,CAAC,MAAM,CAAC,CAAC;AAIhG,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMrE;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACnC,kBAAkB,EAAE,GAAG,SAAS,CAmBlC;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GACnC,kBAAkB,EAAE,GAAG,SAAS,CAKlC;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE;IACtD,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,GAAG,SAAS,6BAA6B,EAAE,CAQ3C;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAClC,kBAAkB,GAAG,SAAS,CAKhC;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3B,GAAG,OAAO,CAUV;AAqjBD,uEAAuE;AACvE,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAClC,cAAc,GAAG,SAAS,CAM5B;AAED,iEAAiE;AACjE,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAClC,OAAO,CAAC,OAAO,CAAC,CAelB;AAID;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEvF;AA8BD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,UAAU,EAChB,MAAM,CAAC,EAAE,SAAS,kBAAkB,EAAE,GACrC,cAAc,EAAE,CAQlB"}
|