@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
package/dist/filesystem.js
CHANGED
|
@@ -1,107 +1,21 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
2
|
import { lstat, mkdir, readdir, readFile, readlink, realpath, rm, stat, writeFile, } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { FileNotFoundError, InvalidGrepPatternError, PathError,
|
|
4
|
+
import { FileNotFoundError, InvalidGrepPatternError, PathError, unionFs, WriteFailedError, } from "@cursor/sdk";
|
|
5
5
|
import { minimatch } from "minimatch";
|
|
6
6
|
import { FileConflictError } from "./files.js";
|
|
7
7
|
import { MEMORY_DIR_NAME } from "./internal/memory-dir.js";
|
|
8
|
+
import { hostPathFromToolPath } from "./internal/tool-paths.js";
|
|
8
9
|
import { isExcludedPath, listFilesFromPaths, statFromFilePaths, } from "./internal/filesystem/walk.js";
|
|
9
10
|
export { childOverlayFs, DeleteNotSupportedError, EditError, emptyFs, FILE_SYSTEM_SCAN_LIMIT, FileNotFoundError, InvalidGrepPatternError, isFileNotFoundError, isInvalidGrepPatternError, NoMountError, overlayFs, PathError, ReadOnlyMountError, readOnlyFs, remapPathError, strReplaceOnFileSystem, tempFs, unionFs, WriteFailedError, } from "@cursor/sdk";
|
|
10
|
-
export const FILE_SYSTEM_TOOL_NAMES = [
|
|
11
|
-
"Read",
|
|
12
|
-
"LS",
|
|
13
|
-
"Glob",
|
|
14
|
-
"Grep",
|
|
15
|
-
"Write",
|
|
16
|
-
"StrReplace",
|
|
17
|
-
"Delete",
|
|
18
|
-
];
|
|
19
|
-
const FILE_SYSTEM_TOOL_NAME_SET = new Set(FILE_SYSTEM_TOOL_NAMES);
|
|
20
|
-
const FILE_SYSTEM_TOOL_ALIASES = {
|
|
21
|
-
read: "Read",
|
|
22
|
-
Read: "Read",
|
|
23
|
-
ls: "LS",
|
|
24
|
-
LS: "LS",
|
|
25
|
-
glob: "Glob",
|
|
26
|
-
Glob: "Glob",
|
|
27
|
-
grep: "Grep",
|
|
28
|
-
Grep: "Grep",
|
|
29
|
-
write: "Write",
|
|
30
|
-
Write: "Write",
|
|
31
|
-
edit: "StrReplace",
|
|
32
|
-
StrReplace: "StrReplace",
|
|
33
|
-
delete: "Delete",
|
|
34
|
-
Delete: "Delete",
|
|
35
|
-
};
|
|
36
|
-
export function canonicalizeFileSystemToolName(name) {
|
|
37
|
-
return FILE_SYSTEM_TOOL_ALIASES[name];
|
|
38
|
-
}
|
|
39
|
-
export function isFileSystemToolName(name) {
|
|
40
|
-
return FILE_SYSTEM_TOOL_NAME_SET.has(name);
|
|
41
|
-
}
|
|
42
|
-
export function isFileSystemToolAlias(name) {
|
|
43
|
-
return canonicalizeFileSystemToolName(name) !== undefined;
|
|
44
|
-
}
|
|
45
|
-
/** Direct `callTool` names that mutate the tree and must wait on a busy turn. */
|
|
46
|
-
export function isMutatingFileSystemTool(name) {
|
|
47
|
-
const canonical = canonicalizeFileSystemToolName(name);
|
|
48
|
-
return canonical === "Write" || canonical === "StrReplace" || canonical === "Delete";
|
|
49
|
-
}
|
|
50
|
-
export function isFileSystemMethodPresent(root, method) {
|
|
51
|
-
return typeof root[method] === "function";
|
|
52
|
-
}
|
|
53
|
-
const ADVERTISED_FILE_SYSTEM_TOOL_NAMES = [
|
|
54
|
-
"Read",
|
|
55
|
-
"LS",
|
|
56
|
-
"Glob",
|
|
57
|
-
"Grep",
|
|
58
|
-
"Write",
|
|
59
|
-
"StrReplace",
|
|
60
|
-
"Delete",
|
|
61
|
-
];
|
|
62
|
-
export function fileSystemToolNames(_root) {
|
|
63
|
-
return [...ADVERTISED_FILE_SYSTEM_TOOL_NAMES];
|
|
64
|
-
}
|
|
65
|
-
function fileSystemMethodForTool(name) {
|
|
66
|
-
switch (name) {
|
|
67
|
-
case "Read":
|
|
68
|
-
return "read";
|
|
69
|
-
case "LS":
|
|
70
|
-
return "list";
|
|
71
|
-
case "Glob":
|
|
72
|
-
return "glob";
|
|
73
|
-
case "Grep":
|
|
74
|
-
return "grep";
|
|
75
|
-
case "Write":
|
|
76
|
-
case "StrReplace":
|
|
77
|
-
return "write";
|
|
78
|
-
case "Delete":
|
|
79
|
-
return "delete";
|
|
80
|
-
default: {
|
|
81
|
-
const unexpected = name;
|
|
82
|
-
return unexpected;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function fileSystemSatisfiesFileTool(root, name) {
|
|
87
|
-
const canonical = canonicalizeFileSystemToolName(name);
|
|
88
|
-
if (canonical === undefined) {
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
const method = fileSystemMethodForTool(canonical);
|
|
92
|
-
return method !== undefined && isFileSystemMethodPresent(root, method);
|
|
93
|
-
}
|
|
94
11
|
export class FileSystemConfigError extends Error {
|
|
95
12
|
constructor(message) {
|
|
96
13
|
super(message);
|
|
97
14
|
this.name = "FileSystemConfigError";
|
|
98
15
|
}
|
|
99
16
|
}
|
|
100
|
-
function allowlistHas(tools, ...names) {
|
|
101
|
-
return tools.some((name) => names.includes(name));
|
|
102
|
-
}
|
|
103
17
|
/**
|
|
104
|
-
* Native semantic-search built-in. Host-
|
|
18
|
+
* Native semantic-search built-in. Host-disk turns disallow it.
|
|
105
19
|
* The name is assembled so a source search for the old spelling does not
|
|
106
20
|
* treat this disallow list as a live tool.
|
|
107
21
|
*/
|
|
@@ -127,87 +41,23 @@ export function assertNoRemovedFileSearchTools(tools) {
|
|
|
127
41
|
}
|
|
128
42
|
throw new FileSystemConfigError(`Semantic search has been removed. Use Grep. \`tools\` lists ${listed.join(", ")}.`);
|
|
129
43
|
}
|
|
130
|
-
export function resolveRootHarnessAllowlist(tools) {
|
|
131
|
-
assertNoRemovedFileSearchTools(tools);
|
|
132
|
-
if (tools === undefined) {
|
|
133
|
-
// File verbs are synthesized from the tree. Web tools are safe under the `/tmp` scratch
|
|
134
|
-
// overlay. Todos are harness conversation state. `task`
|
|
135
|
-
// children inherit filesystem executors and this allowlist.
|
|
136
|
-
// Do not unlock shell.
|
|
137
|
-
return ["webSearch", "webFetch", "updateTodos", "readTodos", "task", "mcp"];
|
|
138
|
-
}
|
|
139
|
-
if (allowlistHas(tools, "shell", "Shell")) {
|
|
140
|
-
throw new FileSystemConfigError('`fs` cannot be combined with `tools` containing `"shell"`. ' +
|
|
141
|
-
"Shell is not a FileSystem method and must not bind the host shell onto a virtual tree.");
|
|
142
|
-
}
|
|
143
|
-
if (allowlistHas(tools, "readLints", "ReadLints")) {
|
|
144
|
-
throw new FileSystemConfigError("`fs` cannot list `readLints`: FileSystem has no diagnostics " +
|
|
145
|
-
"verb, so the host language service would run against the real workspace.");
|
|
146
|
-
}
|
|
147
|
-
const extras = tools.filter((name) => !isFileSystemToolAlias(name));
|
|
148
|
-
return withMcpGrant(extras);
|
|
149
|
-
}
|
|
150
|
-
export function resolveFileSystemTools(options) {
|
|
151
|
-
const harness = resolveRootHarnessAllowlist(options.tools);
|
|
152
|
-
if (options.tools === undefined) {
|
|
153
|
-
return harness;
|
|
154
|
-
}
|
|
155
|
-
const implemented = fileSystemToolNames(options.root);
|
|
156
|
-
const missing = [];
|
|
157
|
-
for (const name of options.tools) {
|
|
158
|
-
if (!fileSystemSatisfiesFileTool(options.root, name)) {
|
|
159
|
-
missing.push(name);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
if (missing.length > 0) {
|
|
163
|
-
throw new FileSystemConfigError(`\`tools\` names FileSystem method(s) that are not implemented: ${missing.join(", ")}. ` +
|
|
164
|
-
`Implemented file tools: ${implemented.length > 0 ? implemented.join(", ") : "(none)"}.`);
|
|
165
|
-
}
|
|
166
|
-
return harness;
|
|
167
|
-
}
|
|
168
44
|
export function withMcpGrant(tools) {
|
|
169
45
|
return tools.includes("mcp") ? [...tools] : [...tools, "mcp"];
|
|
170
46
|
}
|
|
171
47
|
/**
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
|
|
175
|
-
export const REPLACED_NATIVE_FILE_TOOLS = [
|
|
176
|
-
"read",
|
|
177
|
-
"ls",
|
|
178
|
-
"grep",
|
|
179
|
-
"glob",
|
|
180
|
-
"edit",
|
|
181
|
-
"delete",
|
|
182
|
-
removedNativeFileSearchTool(),
|
|
183
|
-
];
|
|
184
|
-
/**
|
|
185
|
-
* Host-default harness options: keep shell / webSearch / sandbox, but
|
|
186
|
-
* hide the native file tools the synthesized FileSystem now owns.
|
|
187
|
-
*
|
|
188
|
-
* Omitted `tools` leaves the SDK default set and only excludes the
|
|
189
|
-
* replaced natives. `[]` stays empty. A non-empty allowlist drops file
|
|
190
|
-
* aliases (those ride synthesized tools) and grants `mcp`.
|
|
48
|
+
* Host-disk harness options. Omitted `tools` keeps the SDK default set
|
|
49
|
+
* without semantic search. `[]` stays empty. A non-empty allowlist
|
|
50
|
+
* grants `mcp`, which carries the agent's own server tools.
|
|
191
51
|
*/
|
|
192
52
|
export function resolveHostHarnessToolOptions(tools) {
|
|
193
53
|
if (tools === undefined) {
|
|
194
|
-
return { disallowedTools: [
|
|
54
|
+
return { disallowedTools: [removedNativeFileSearchTool()] };
|
|
195
55
|
}
|
|
196
56
|
if (tools.length === 0) {
|
|
197
57
|
return { tools: [] };
|
|
198
58
|
}
|
|
199
59
|
assertNoRemovedFileSearchTools(tools);
|
|
200
|
-
return {
|
|
201
|
-
tools: withMcpGrant(tools.filter((name) => !isReplacedHostFileAlias(name))),
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
/** File aliases host-default synthesizes in place of the native tools. */
|
|
205
|
-
function isReplacedHostFileAlias(name) {
|
|
206
|
-
return canonicalizeFileSystemToolName(name) !== undefined;
|
|
207
|
-
}
|
|
208
|
-
/** Decode a {@link FileSystem.read} result as UTF-8 text. */
|
|
209
|
-
export function fileSystemText(content) {
|
|
210
|
-
return typeof content === "string" ? content : Buffer.from(content).toString("utf8");
|
|
60
|
+
return { tools: withMcpGrant(tools) };
|
|
211
61
|
}
|
|
212
62
|
/**
|
|
213
63
|
* Native Read image formats. Magic bytes first, then extension.
|
|
@@ -256,16 +106,6 @@ export function detectImageMimeType(bytes, filePath) {
|
|
|
256
106
|
}
|
|
257
107
|
return undefined;
|
|
258
108
|
}
|
|
259
|
-
export function fileSystemImage(content, path) {
|
|
260
|
-
if (!(content instanceof Uint8Array)) {
|
|
261
|
-
return undefined;
|
|
262
|
-
}
|
|
263
|
-
const mimeType = detectImageMimeType(content, path);
|
|
264
|
-
if (mimeType === undefined) {
|
|
265
|
-
return undefined;
|
|
266
|
-
}
|
|
267
|
-
return { mimeType, bytes: content };
|
|
268
|
-
}
|
|
269
109
|
function compileGrepPattern(pattern, caseInsensitive, path = "/") {
|
|
270
110
|
try {
|
|
271
111
|
return new RegExp(pattern, caseInsensitive === true ? "i" : undefined);
|
|
@@ -303,104 +143,6 @@ async function* limitResults(source, maxResults) {
|
|
|
303
143
|
}
|
|
304
144
|
}
|
|
305
145
|
}
|
|
306
|
-
function grepPushdownLimit(query, opts) {
|
|
307
|
-
// Count and files_with_matches paginate after grouping by file.
|
|
308
|
-
// A line-level cap would hide later files once one file fills the window.
|
|
309
|
-
if (opts.outputMode === "count" || opts.outputMode === "files_with_matches") {
|
|
310
|
-
return query.maxResults;
|
|
311
|
-
}
|
|
312
|
-
const headLimit = opts.headLimit !== undefined && opts.headLimit > 0 ? opts.headLimit : undefined;
|
|
313
|
-
if (headLimit === undefined) {
|
|
314
|
-
return query.maxResults;
|
|
315
|
-
}
|
|
316
|
-
const toolCap = opts.offset + headLimit;
|
|
317
|
-
return query.maxResults === undefined ? toolCap : Math.min(query.maxResults, toolCap);
|
|
318
|
-
}
|
|
319
|
-
function compareGrepResult(left, right) {
|
|
320
|
-
return left.path < right.path
|
|
321
|
-
? -1
|
|
322
|
-
: left.path > right.path
|
|
323
|
-
? 1
|
|
324
|
-
: left.lineNumber - right.lineNumber;
|
|
325
|
-
}
|
|
326
|
-
export async function collectGrepMatches(root, query, opts) {
|
|
327
|
-
const matches = [];
|
|
328
|
-
const offset = opts.offset !== undefined && opts.offset > 0 ? opts.offset : 0;
|
|
329
|
-
const headLimit = opts.headLimit !== undefined && opts.headLimit > 0 ? opts.headLimit : undefined;
|
|
330
|
-
const skippedFiles = new Set();
|
|
331
|
-
const acceptedFiles = new Set();
|
|
332
|
-
let skippedItems = 0;
|
|
333
|
-
let takenItems = 0;
|
|
334
|
-
const pushdown = grepPushdownLimit(query, {
|
|
335
|
-
outputMode: opts.outputMode,
|
|
336
|
-
offset,
|
|
337
|
-
...(opts.headLimit === undefined ? {} : { headLimit: opts.headLimit }),
|
|
338
|
-
});
|
|
339
|
-
const grepQuery = pushdown === undefined ? query : { ...query, maxResults: pushdown };
|
|
340
|
-
for await (const match of root.grep(grepQuery)) {
|
|
341
|
-
if (opts.outputMode === "content") {
|
|
342
|
-
if (skippedItems < offset) {
|
|
343
|
-
skippedItems++;
|
|
344
|
-
continue;
|
|
345
|
-
}
|
|
346
|
-
matches.push(match);
|
|
347
|
-
takenItems++;
|
|
348
|
-
if (headLimit !== undefined && takenItems >= headLimit) {
|
|
349
|
-
break;
|
|
350
|
-
}
|
|
351
|
-
continue;
|
|
352
|
-
}
|
|
353
|
-
if (skippedFiles.has(match.path)) {
|
|
354
|
-
continue;
|
|
355
|
-
}
|
|
356
|
-
if (!acceptedFiles.has(match.path)) {
|
|
357
|
-
if (skippedItems < offset) {
|
|
358
|
-
skippedFiles.add(match.path);
|
|
359
|
-
skippedItems++;
|
|
360
|
-
continue;
|
|
361
|
-
}
|
|
362
|
-
if (headLimit !== undefined && takenItems >= headLimit) {
|
|
363
|
-
break;
|
|
364
|
-
}
|
|
365
|
-
acceptedFiles.add(match.path);
|
|
366
|
-
takenItems++;
|
|
367
|
-
}
|
|
368
|
-
matches.push(match);
|
|
369
|
-
}
|
|
370
|
-
return matches;
|
|
371
|
-
}
|
|
372
|
-
export function shapeGrepUnion(matches, outputMode) {
|
|
373
|
-
if (outputMode === "files_with_matches") {
|
|
374
|
-
const files = [...new Set(matches.map((match) => match.path))];
|
|
375
|
-
return { type: "files", output: { files, count: files.length } };
|
|
376
|
-
}
|
|
377
|
-
if (outputMode === "count") {
|
|
378
|
-
const counts = new Map();
|
|
379
|
-
for (const match of matches) {
|
|
380
|
-
counts.set(match.path, (counts.get(match.path) ?? 0) + 1);
|
|
381
|
-
}
|
|
382
|
-
return {
|
|
383
|
-
type: "count",
|
|
384
|
-
output: {
|
|
385
|
-
counts: [...counts].map(([file, count]) => ({ file, count })),
|
|
386
|
-
total: matches.length,
|
|
387
|
-
},
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
return {
|
|
391
|
-
type: "content",
|
|
392
|
-
output: {
|
|
393
|
-
matches: matches.map((match) => ({
|
|
394
|
-
file: match.path,
|
|
395
|
-
lineNumber: match.lineNumber,
|
|
396
|
-
line: match.line,
|
|
397
|
-
...(match.beforeContext === undefined ? {} : { beforeContext: match.beforeContext }),
|
|
398
|
-
...(match.afterContext === undefined ? {} : { afterContext: match.afterContext }),
|
|
399
|
-
})),
|
|
400
|
-
totalMatches: matches.length,
|
|
401
|
-
},
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
146
|
export function normalizeFsPath(input) {
|
|
405
147
|
const slashes = input.replace(/\\/g, "/");
|
|
406
148
|
if (slashes === "") {
|
|
@@ -492,19 +234,6 @@ export async function writeWorkspaceFilesToRoot(root, files) {
|
|
|
492
234
|
}
|
|
493
235
|
}
|
|
494
236
|
}
|
|
495
|
-
/** Native Read offset/limit: 1-indexed, negative offset counts from the end. */
|
|
496
|
-
export function sliceReadContent(content, offset, limit) {
|
|
497
|
-
if (offset === undefined && limit === undefined) {
|
|
498
|
-
return content;
|
|
499
|
-
}
|
|
500
|
-
const lines = content === "" ? [] : content.split("\n");
|
|
501
|
-
const total = lines.length;
|
|
502
|
-
const effectiveOffset = offset ?? 1;
|
|
503
|
-
const effectiveLimit = limit ?? (effectiveOffset < 0 ? Math.abs(effectiveOffset) : total);
|
|
504
|
-
const startIndex = effectiveOffset < 0 ? Math.max(0, total + effectiveOffset) : Math.max(0, effectiveOffset - 1);
|
|
505
|
-
const endIndex = Math.min(total, startIndex + effectiveLimit);
|
|
506
|
-
return lines.slice(startIndex, endIndex).join("\n");
|
|
507
|
-
}
|
|
508
237
|
function fsErrorMessage(error, fallback) {
|
|
509
238
|
return error instanceof Error ? error.message : fallback;
|
|
510
239
|
}
|
|
@@ -657,8 +386,13 @@ export function localFileSystem(options) {
|
|
|
657
386
|
const cwd = path.resolve(options.cwd);
|
|
658
387
|
const confineToWorkspace = options.confineToWorkspace === true;
|
|
659
388
|
const readOnlyRoots = (options.readOnlyRoots ?? []).map((root) => path.resolve(root));
|
|
660
|
-
const resolvePath = (
|
|
661
|
-
|
|
389
|
+
const resolvePath = (toolPath) => {
|
|
390
|
+
const input = hostPathFromToolPath(toolPath);
|
|
391
|
+
return path.isAbsolute(input) ? path.resolve(input) : path.resolve(cwd, input);
|
|
392
|
+
};
|
|
393
|
+
const resolveWritable = (toolPath) => confineToWorkspace
|
|
394
|
+
? confinedHostPath(cwd, hostPathFromToolPath(toolPath))
|
|
395
|
+
: Promise.resolve(resolvePath(toolPath));
|
|
662
396
|
const resolveLocated = async (input) => {
|
|
663
397
|
try {
|
|
664
398
|
return await resolveWritable(input);
|
|
@@ -786,20 +520,24 @@ function omittedScan(path) {
|
|
|
786
520
|
return path === undefined || path === "";
|
|
787
521
|
}
|
|
788
522
|
/**
|
|
789
|
-
* The
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
*
|
|
523
|
+
* The session tree: authored files at `/` and an optional skills mount.
|
|
524
|
+
* `scratch`, when given, is mounted at `/tmp`; a turn leaves it out
|
|
525
|
+
* because the SDK mounts its own `/tmp` for each run. An omitted `grep`
|
|
526
|
+
* or `glob` path searches the authored tree only, so a tree that narrows
|
|
527
|
+
* that call (for example to `/repo`) does not also scan skills or
|
|
528
|
+
* scratch. An explicit path searches every mount under it.
|
|
794
529
|
*/
|
|
795
530
|
export function sessionFileSystem(options) {
|
|
796
|
-
const mounts = {
|
|
797
|
-
|
|
798
|
-
"/tmp"
|
|
799
|
-
}
|
|
531
|
+
const mounts = { "/": options.authored };
|
|
532
|
+
if (options.scratch !== undefined) {
|
|
533
|
+
mounts["/tmp"] = options.scratch;
|
|
534
|
+
}
|
|
800
535
|
if (options.skills !== undefined) {
|
|
801
536
|
mounts[options.skills.path] = options.skills.fs;
|
|
802
537
|
}
|
|
538
|
+
if (Object.keys(mounts).length === 1) {
|
|
539
|
+
return options.authored;
|
|
540
|
+
}
|
|
803
541
|
const union = unionFs(mounts);
|
|
804
542
|
return {
|
|
805
543
|
list: (prefix, listOptions) => union.list(prefix, listOptions),
|
package/dist/index.d.ts
CHANGED
|
@@ -25,13 +25,11 @@ export type { ContinuationBuiltin, ContinuationClaim, ContinuationIdentity, Cont
|
|
|
25
25
|
export { classifyExpectedDeliveryFailure, type ExpectedDeliveryFailureReason, } from "./internal/expected-delivery-failure.js";
|
|
26
26
|
export { cursorExternalApiUrl, resolveApiKeySync, type ResolvedApiKey, } from "./internal/cursor/credentials.js";
|
|
27
27
|
export { parseScmPrUrl, type ParsedScmPrUrl } from "./internal/scm/pr-url.js";
|
|
28
|
-
export { synthesizeFileSystemTools } from "./internal/filesystem/tools.js";
|
|
29
28
|
export { validateToolInput, type ToolInputValidation } from "./internal/json-schema.js";
|
|
30
29
|
export { normalizeToolResult } from "./internal/tool-result.js";
|
|
31
30
|
export { resolveAgentV2Hosting, type AgentV2HostingKind } from "./agent-v2-hosting.js";
|
|
32
31
|
export type { LoadAgentProjectOptions } from "./public-deprecated.js";
|
|
33
32
|
export { formatDiagnostics, hasErrorDiagnostics, isAgentProjectDir, loadAgentProject, loadAgentProjects, mintClaim, projectInfo, resolveAgentMounts, } from "./public-deprecated.js";
|
|
34
|
-
export { nearestNeighborMissHint } from "./internal/filesystem/nearest.js";
|
|
35
33
|
export type { AgentServeGitHubTriggerEvent, AgentServeGitHubTriggerTarget, AgentServeOriginTriggerEvent, AgentServeOriginTriggerTarget, AgentServeTriggerEvent, AgentServeTriggerResult, AgentServeTriggerTargetResult, } from "./internal/handleAgentServeTrigger.js";
|
|
36
34
|
export { collectGitHubTriggerTargets, collectOriginTriggerTargets, handleAgentServeTrigger, } from "./internal/handleAgentServeTrigger.js";
|
|
37
35
|
export { MCP_CHANNEL_ID, MCP_ENDPOINT_PATH, mcpEndpointToolNames, TOOL_MCP_ENDPOINT_PATH, } from "./internal/mcp-endpoint.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,OAAO,EACP,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EACL,QAAQ,EACR,UAAU,EACV,MAAM,EACN,aAAa,EACb,GAAG,EACH,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,KAAK,EACL,IAAI,EACJ,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AgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,qBAAqB,CAEtE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,sBAAsB,CAErF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,KAAK,CACzB,YAAY,EAAE,MAAM,GAAG,OAAO,EAC9B,OAAO,GAAE,YAAY,GAAG;IACtB,SAAS,CAAC,EAAE;QACV,sDAAsD;QACtD,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KAC3E,CAAC;IACF;;;;OAIG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CACtB,GACL,OAAO,CAAC,gBAAgB,CAAC,CA0B3B"}
|
package/dist/index.js
CHANGED
|
@@ -29,12 +29,10 @@ export { InvalidAsOfError, VacuousTimeArgsError } from "./internal/as-of.js";
|
|
|
29
29
|
export { classifyExpectedDeliveryFailure, } from "./internal/expected-delivery-failure.js";
|
|
30
30
|
export { cursorExternalApiUrl, resolveApiKeySync, } from "./internal/cursor/credentials.js";
|
|
31
31
|
export { parseScmPrUrl } from "./internal/scm/pr-url.js";
|
|
32
|
-
export { synthesizeFileSystemTools } from "./internal/filesystem/tools.js";
|
|
33
32
|
export { validateToolInput } from "./internal/json-schema.js";
|
|
34
33
|
export { normalizeToolResult } from "./internal/tool-result.js";
|
|
35
34
|
export { resolveAgentV2Hosting } from "./agent-v2-hosting.js";
|
|
36
35
|
export { formatDiagnostics, hasErrorDiagnostics, isAgentProjectDir, loadAgentProject, loadAgentProjects, mintClaim, projectInfo, resolveAgentMounts, } from "./public-deprecated.js";
|
|
37
|
-
export { nearestNeighborMissHint } from "./internal/filesystem/nearest.js";
|
|
38
36
|
export { collectGitHubTriggerTargets, collectOriginTriggerTargets, handleAgentServeTrigger, } from "./internal/handleAgentServeTrigger.js";
|
|
39
37
|
export { MCP_CHANNEL_ID, MCP_ENDPOINT_PATH, mcpEndpointToolNames, TOOL_MCP_ENDPOINT_PATH, } from "./internal/mcp-endpoint.js";
|
|
40
38
|
export { REMINDER_ARGS_MAX_BYTES, ReminderValidationError, rejectAnonymousReminderHandlers, UnknownReminderError, } from "./internal/reminder-runner.js";
|
|
@@ -6,9 +6,9 @@ export declare function httpContinuationIdentity(httpChannel: HttpChannelDefinit
|
|
|
6
6
|
* Stamp `/v2` continuation defaults onto channel constructors that omitted
|
|
7
7
|
* `continuation` when the agent deploys onto v2 architecture. GitHub/Origin
|
|
8
8
|
* type (`pr` / `issue` / `none`) follows declared webhook events.
|
|
9
|
-
* Deployments default to `deployments.deployment/v2`. Change Monitors
|
|
10
|
-
* and
|
|
11
|
-
* `issues.issue/v2`.
|
|
9
|
+
* Deployments default to `deployments.deployment/v2`. Change Monitors,
|
|
10
|
+
* issues, runs, and match-ready default to `change_monitors.checkpoint/v2`,
|
|
11
|
+
* `issues.issue/v2`, `runs.run/v2`, and `match_ready.monitor/v2`.
|
|
12
12
|
* Explicit per-channel selectors are left alone. Idempotent.
|
|
13
13
|
*/
|
|
14
14
|
export declare function applyAgentContinuationDefaults(project: {
|
|
@@ -66,9 +66,9 @@ export function httpContinuationIdentity(httpChannel) {
|
|
|
66
66
|
* Stamp `/v2` continuation defaults onto channel constructors that omitted
|
|
67
67
|
* `continuation` when the agent deploys onto v2 architecture. GitHub/Origin
|
|
68
68
|
* type (`pr` / `issue` / `none`) follows declared webhook events.
|
|
69
|
-
* Deployments default to `deployments.deployment/v2`. Change Monitors
|
|
70
|
-
* and
|
|
71
|
-
* `issues.issue/v2`.
|
|
69
|
+
* Deployments default to `deployments.deployment/v2`. Change Monitors,
|
|
70
|
+
* issues, runs, and match-ready default to `change_monitors.checkpoint/v2`,
|
|
71
|
+
* `issues.issue/v2`, `runs.run/v2`, and `match_ready.monitor/v2`.
|
|
72
72
|
* Explicit per-channel selectors are left alone. Idempotent.
|
|
73
73
|
*/
|
|
74
74
|
export function applyAgentContinuationDefaults(project) {
|
|
@@ -12,22 +12,23 @@
|
|
|
12
12
|
* the channel kind and declared events (`github.pr/v2`, `github.issue/v2`,
|
|
13
13
|
* `github.none/v2`, `slack.thread/v2`, `origin.pr/v2`,
|
|
14
14
|
* `deployments.deployment/v2`, `change_monitors.checkpoint/v2`,
|
|
15
|
-
* `issues.issue/v2`, …) onto
|
|
16
|
-
* selector. An explicit per-channel selector
|
|
15
|
+
* `issues.issue/v2`, `runs.run/v2`, `match_ready.monitor/v2`, …) onto
|
|
16
|
+
* every channel that omitted a selector. An explicit per-channel selector
|
|
17
|
+
* still overrides. JSONPath
|
|
17
18
|
* and per-agent format strings are rejected.
|
|
18
19
|
*/
|
|
19
20
|
import { type SlackDmScope } from "./slack-thread-key.js";
|
|
20
21
|
export type ConversationType = "pr" | "issue" | "thread" | "dm-thread" | "origin-pr" | "gitlab-mr" | "bitbucket-pr" | "deployment" | "run" | "pagerduty-incident";
|
|
21
22
|
/** Factory kinds registered by the hosted entry. They stay off the public union. */
|
|
22
|
-
type RuntimeConversationType = ConversationType | "change-monitor-checkpoint" | "factory-issue";
|
|
23
|
+
type RuntimeConversationType = ConversationType | "change-monitor-checkpoint" | "factory-issue" | "match-ready";
|
|
23
24
|
type RuntimeParsedContinuation = {
|
|
24
25
|
selector: ContinuationSelector;
|
|
25
26
|
version: 1 | 2;
|
|
26
27
|
type: RuntimeConversationType | "none";
|
|
27
28
|
kind: ContinuationKind;
|
|
28
29
|
};
|
|
29
|
-
export type ContinuationKind = "github" | "slack" | "origin" | "gitlab" | "bitbucket" | "deployments" | "change_monitors" | "issues" | "runs" | "pagerduty" | "http";
|
|
30
|
-
export declare const CONTINUATION_SELECTORS: readonly ["github.pr/v1", "github.pr/v2", "github.issue/v1", "github.issue/v2", "github.none/v2", "slack.thread/v1", "slack.thread/v2", "slack.dmthread/v2", "slack.none/v2", "origin.pr/v1", "origin.pr/v2", "origin.none/v2", "gitlab.mr/v2", "gitlab.none/v2", "bitbucket.pr/v2", "bitbucket.none/v2", "deployments.none/v1", "deployments.none/v2", "deployments.deployment/v2", "change_monitors.checkpoint/v2", "issues.issue/v2", "runs.run/v2", "pagerduty.incident/v2", "pagerduty.none/v2", "none/v1", "none/v2"];
|
|
30
|
+
export type ContinuationKind = "github" | "slack" | "origin" | "gitlab" | "bitbucket" | "deployments" | "change_monitors" | "issues" | "runs" | "match_ready" | "pagerduty" | "http";
|
|
31
|
+
export declare const CONTINUATION_SELECTORS: readonly ["github.pr/v1", "github.pr/v2", "github.issue/v1", "github.issue/v2", "github.none/v2", "slack.thread/v1", "slack.thread/v2", "slack.dmthread/v2", "slack.none/v2", "origin.pr/v1", "origin.pr/v2", "origin.none/v2", "gitlab.mr/v2", "gitlab.none/v2", "bitbucket.pr/v2", "bitbucket.none/v2", "deployments.none/v1", "deployments.none/v2", "deployments.deployment/v2", "change_monitors.checkpoint/v2", "issues.issue/v2", "runs.run/v2", "match_ready.monitor/v2", "pagerduty.incident/v2", "pagerduty.none/v2", "none/v1", "none/v2"];
|
|
31
32
|
export type ContinuationSelector = (typeof CONTINUATION_SELECTORS)[number];
|
|
32
33
|
export type ContinuationIdentity = ContinuationSelector;
|
|
33
34
|
/** Agent-root protocol version. Omit / `"v1"` keeps engine minting. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"continuation-identity.d.ts","sourceRoot":"","sources":["../../src/internal/continuation-identity.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"continuation-identity.d.ts","sourceRoot":"","sources":["../../src/internal/continuation-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,KAAK,YAAY,EAAuC,MAAM,uBAAuB,CAAC;AAE/F,MAAM,MAAM,gBAAgB,GACxB,IAAI,GACJ,OAAO,GACP,QAAQ,GACR,WAAW,GACX,WAAW,GACX,WAAW,GACX,cAAc,GACd,YAAY,GACZ,KAAK,GACL,oBAA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ACR,QAAQ,SAAS;IAAE,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;CAAE,EAE9D,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,EAChE,OAAO,EAAE,mBAAmB,GAAG,SAAS,GACvC,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,CAU5D"}
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
* the channel kind and declared events (`github.pr/v2`, `github.issue/v2`,
|
|
13
13
|
* `github.none/v2`, `slack.thread/v2`, `origin.pr/v2`,
|
|
14
14
|
* `deployments.deployment/v2`, `change_monitors.checkpoint/v2`,
|
|
15
|
-
* `issues.issue/v2`, …) onto
|
|
16
|
-
* selector. An explicit per-channel selector
|
|
15
|
+
* `issues.issue/v2`, `runs.run/v2`, `match_ready.monitor/v2`, …) onto
|
|
16
|
+
* every channel that omitted a selector. An explicit per-channel selector
|
|
17
|
+
* still overrides. JSONPath
|
|
17
18
|
* and per-agent format strings are rejected.
|
|
18
19
|
*/
|
|
19
20
|
import { randomBytes } from "node:crypto";
|
|
@@ -43,6 +44,7 @@ export const CONTINUATION_SELECTORS = [
|
|
|
43
44
|
"change_monitors.checkpoint/v2",
|
|
44
45
|
"issues.issue/v2",
|
|
45
46
|
"runs.run/v2",
|
|
47
|
+
"match_ready.monitor/v2",
|
|
46
48
|
"pagerduty.incident/v2",
|
|
47
49
|
"pagerduty.none/v2",
|
|
48
50
|
"none/v1",
|
|
@@ -237,6 +239,11 @@ const SELECTOR_FIELDS = {
|
|
|
237
239
|
type: "run",
|
|
238
240
|
kind: "runs",
|
|
239
241
|
},
|
|
242
|
+
"match_ready.monitor/v2": {
|
|
243
|
+
version: 2,
|
|
244
|
+
type: "match-ready",
|
|
245
|
+
kind: "match_ready",
|
|
246
|
+
},
|
|
240
247
|
"pagerduty.incident/v2": {
|
|
241
248
|
version: 2,
|
|
242
249
|
type: "pagerduty-incident",
|
|
@@ -283,6 +290,8 @@ export function defaultContinuationSelector(kind, version = "v1", eventTypes) {
|
|
|
283
290
|
return membershipOrNone(eventTypes, "factory-issue", "issues.issue/v2", "none/v2");
|
|
284
291
|
case "runs":
|
|
285
292
|
return membershipOrNone(eventTypes, "run", "runs.run/v2", "none/v2");
|
|
293
|
+
case "match_ready":
|
|
294
|
+
return membershipOrNone(eventTypes, "match-ready", "match_ready.monitor/v2", "none/v2");
|
|
286
295
|
case "pagerduty":
|
|
287
296
|
return membershipOrNone(eventTypes, "pagerduty-incident", "pagerduty.incident/v2", "pagerduty.none/v2");
|
|
288
297
|
default:
|
|
@@ -316,6 +325,7 @@ const OMITTED_V2_TYPED_TYPE = {
|
|
|
316
325
|
change_monitors: "change-monitor-checkpoint",
|
|
317
326
|
issues: "factory-issue",
|
|
318
327
|
runs: "run",
|
|
328
|
+
match_ready: "match-ready",
|
|
319
329
|
pagerduty: "pagerduty-incident",
|
|
320
330
|
};
|
|
321
331
|
function isOmittedV2Kind(kind) {
|
|
@@ -400,6 +410,7 @@ function isRegisteredKind(kind) {
|
|
|
400
410
|
case "change_monitors":
|
|
401
411
|
case "issues":
|
|
402
412
|
case "runs":
|
|
413
|
+
case "match_ready":
|
|
403
414
|
case "pagerduty":
|
|
404
415
|
return true;
|
|
405
416
|
default:
|
|
@@ -441,6 +452,8 @@ function formatConversationKey(type, fields) {
|
|
|
441
452
|
return `issues:${fields.issueName}`;
|
|
442
453
|
case "run":
|
|
443
454
|
return `runs:${fields.monitorId}:${fields.runId}`;
|
|
455
|
+
case "match-ready":
|
|
456
|
+
return `match_ready:${fields.changeMonitorName}`;
|
|
444
457
|
case "pagerduty-incident":
|
|
445
458
|
return `pagerduty:incident:${fields.incidentId}`;
|
|
446
459
|
default: {
|
|
@@ -636,6 +649,8 @@ export function extractContinuation(type, eventName, payload) {
|
|
|
636
649
|
return extractNamedResource("factory-issue", "issueName", payload, "issue");
|
|
637
650
|
case "run":
|
|
638
651
|
return extractRun(payload);
|
|
652
|
+
case "match-ready":
|
|
653
|
+
return extractNamedResource("match-ready", "changeMonitorName", payload, "changeMonitor");
|
|
639
654
|
case "pagerduty-incident":
|
|
640
655
|
return extractPagerDuty(payload);
|
|
641
656
|
default: {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native file tools for direct tool calls (`POST /v1/tools/:toolName`).
|
|
3
|
+
* The tools themselves are the SDK's `createFileSystemTools`; this module
|
|
4
|
+
* only maps the names a caller may use onto them and applies the agent's
|
|
5
|
+
* `tools` allowlist the way a turn does.
|
|
6
|
+
*/
|
|
7
|
+
import type { FileSystemTools, ToolName } from "@cursor/sdk";
|
|
8
|
+
export type DirectFileToolName = keyof FileSystemTools;
|
|
9
|
+
/**
|
|
10
|
+
* The file tool a direct call runs. `edit` with `fileText` or `contents`
|
|
11
|
+
* is Write; any other `edit` is StrReplace.
|
|
12
|
+
*/
|
|
13
|
+
export declare function directFileToolName(name: string, input: unknown): DirectFileToolName | undefined;
|
|
14
|
+
/** Omitted `tools` allows every file tool, as it does in a turn. */
|
|
15
|
+
export declare function directFileToolAllowed(name: DirectFileToolName, tools: readonly ToolName[] | undefined): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Where the SDK spills large WebFetch and WebSearch output for a host
|
|
18
|
+
* cwd. Direct Read calls on a host-disk agent may read it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function hostAgentToolsDir(cwd: string): string;
|
|
21
|
+
//# sourceMappingURL=direct-file-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direct-file-tools.d.ts","sourceRoot":"","sources":["../../src/internal/direct-file-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG7D,MAAM,MAAM,kBAAkB,GAAG,MAAM,eAAe,CAAC;AA6BvD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAM/F;AAED,oEAAoE;AACpE,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,kBAAkB,EACxB,KAAK,EAAE,SAAS,QAAQ,EAAE,GAAG,SAAS,GACrC,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMrD"}
|