@cursor/july 0.1.103 → 0.1.105
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/change-monitors/change-monitors-channel.d.ts +5 -0
- package/dist/channels/change-monitors/change-monitors-channel.d.ts.map +1 -0
- package/dist/channels/change-monitors/change-monitors-channel.js +41 -0
- package/dist/channels/change-monitors/index.d.ts +4 -0
- package/dist/channels/change-monitors/index.d.ts.map +1 -0
- package/dist/channels/change-monitors/index.js +2 -0
- package/dist/channels/change-monitors/types.d.ts +39 -0
- package/dist/channels/change-monitors/types.d.ts.map +1 -0
- package/dist/channels/change-monitors/types.js +1 -0
- package/dist/channels/deployments/deployments-channel.d.ts.map +1 -1
- package/dist/channels/deployments/deployments-channel.js +1 -0
- package/dist/channels/deployments/types.d.ts +2 -0
- package/dist/channels/deployments/types.d.ts.map +1 -1
- package/dist/channels/github/defaults.d.ts.map +1 -1
- package/dist/channels/github/defaults.js +4 -0
- package/dist/channels/github/progress.d.ts +22 -0
- package/dist/channels/github/progress.d.ts.map +1 -1
- package/dist/channels/github/progress.js +32 -5
- package/dist/channels/issues/index.d.ts +4 -0
- package/dist/channels/issues/index.d.ts.map +1 -0
- package/dist/channels/issues/index.js +2 -0
- package/dist/channels/issues/issues-channel.d.ts +5 -0
- package/dist/channels/issues/issues-channel.d.ts.map +1 -0
- package/dist/channels/issues/issues-channel.js +37 -0
- package/dist/channels/issues/types.d.ts +33 -0
- package/dist/channels/issues/types.d.ts.map +1 -0
- package/dist/channels/issues/types.js +1 -0
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.DW9pXkpL.js → app.BVwaffdK.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.CJxMklAy.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.CdEIUwDg.js → VPLocalSearchBox.WuWTZ1x8.js} +1 -1
- package/dist/docs/assets/chunks/{theme.YZMHgPgg.js → theme.BYdI_6sF.js} +2 -2
- package/dist/docs/assets/{guides_github.md.DKYiT9do.js → guides_github.md.c0gdGJ-D.js} +1 -1
- package/dist/docs/assets/{guides_github.md.DKYiT9do.lean.js → guides_github.md.c0gdGJ-D.lean.js} +1 -1
- package/dist/docs/assets/guides_grokbot-agents.md.DVqdhBKb.js +9 -0
- package/dist/docs/assets/guides_grokbot-agents.md.DVqdhBKb.lean.js +1 -0
- package/dist/docs/assets/index.md.BW_6tOgR.js +5 -0
- package/dist/docs/assets/index.md.BW_6tOgR.lean.js +1 -0
- package/dist/docs/assets/{reference_channels.md.Dz8Cnudp.js → reference_channels.md.DBGcaB7m.js} +2 -2
- package/dist/docs/assets/{reference_channels.md.Dz8Cnudp.lean.js → reference_channels.md.DBGcaB7m.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.CJNc_xYK.js → reference_cli.md.C6Lo8SEd.js} +2 -1
- package/dist/docs/assets/{reference_extensions.md.DykHW3qL.js → reference_extensions.md.CGmMLblt.js} +1 -1
- package/dist/docs/assets/templates_grokbot-agents.md.c1s6Flp9.js +3 -0
- package/dist/docs/assets/templates_grokbot-agents.md.c1s6Flp9.lean.js +1 -0
- package/dist/docs/building-with-agents.html +4 -4
- package/dist/docs/concepts.html +4 -4
- package/dist/docs/deployment.html +4 -4
- package/dist/docs/design/filesystem.md +376 -0
- package/dist/docs/evals.html +4 -4
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/cloud-agents.html +5 -5
- package/dist/docs/guides/convert-automation.html +4 -4
- package/dist/docs/guides/github.html +6 -6
- package/dist/docs/guides/github.md +5 -0
- package/dist/docs/guides/grokbot-agents.html +35 -0
- package/dist/docs/guides/grokbot-agents.md +88 -0
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +4 -4
- package/dist/docs/guides/opentelemetry.html +5 -5
- package/dist/docs/guides/slack.html +4 -4
- package/dist/docs/guides/webhooks.html +4 -4
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +4 -4
- package/dist/docs/index.html +6 -6
- package/dist/docs/index.md +6 -1
- package/dist/docs/llms-full.txt +562 -2
- package/dist/docs/llms.txt +3 -0
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +4 -4
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +6 -6
- package/dist/docs/reference/channels.md +20 -0
- package/dist/docs/reference/cli.html +7 -6
- package/dist/docs/reference/cli.md +2 -1
- package/dist/docs/reference/connections.html +4 -4
- package/dist/docs/reference/extensions.html +6 -6
- package/dist/docs/reference/extensions.md +2 -0
- package/dist/docs/reference/hooks.html +4 -4
- package/dist/docs/reference/http-api.html +4 -4
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +4 -4
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/result.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +4 -4
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +4 -4
- package/dist/docs/scaffolding-agents.html +4 -4
- package/dist/docs/skills/ab.html +4 -4
- package/dist/docs/skills/create-agent.html +4 -4
- package/dist/docs/skills/debug.html +4 -4
- package/dist/docs/skills/evals.html +4 -4
- package/dist/docs/skills/framework-map.html +4 -4
- package/dist/docs/skills/github.html +4 -4
- package/dist/docs/skills/hillclimb.html +4 -4
- package/dist/docs/skills/index.html +4 -4
- package/dist/docs/skills/mcp-auth.html +4 -4
- package/dist/docs/skills/otel.html +4 -4
- package/dist/docs/skills/setup-slack.html +4 -4
- package/dist/docs/storage.html +4 -4
- package/dist/docs/templates/agentic-owners.html +4 -4
- package/dist/docs/templates/agents-md.html +4 -4
- package/dist/docs/templates/code-wiki.html +5 -5
- package/dist/docs/templates/demo.html +5 -5
- package/dist/docs/templates/grokbot-agents.html +29 -0
- package/dist/docs/templates/grokbot-agents.md +48 -0
- package/dist/docs/templates/pr-autofixer.html +4 -4
- package/dist/docs/templates/security-help.html +4 -4
- package/dist/docs/templates/security-reviewer.html +4 -4
- package/dist/docs/templates/triage.html +4 -4
- package/dist/docs/troubleshooting.html +4 -4
- package/dist/files.d.ts +7 -2
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +7 -2
- package/dist/filesystem.d.ts +440 -0
- package/dist/filesystem.d.ts.map +1 -0
- package/dist/filesystem.js +1694 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/internal/continuation-channel.d.ts +4 -2
- package/dist/internal/continuation-channel.d.ts.map +1 -1
- package/dist/internal/continuation-channel.js +21 -12
- package/dist/internal/continuation-identity.d.ts +13 -5
- package/dist/internal/continuation-identity.d.ts.map +1 -1
- package/dist/internal/continuation-identity.js +74 -35
- package/dist/internal/cursor-agent-template.d.ts +1 -1
- package/dist/internal/cursor-agent-template.d.ts.map +1 -1
- package/dist/internal/cursor-agent-template.js +1 -0
- package/dist/internal/discovery/agent.d.ts.map +1 -1
- package/dist/internal/discovery/agent.js +80 -8
- package/dist/internal/discovery/info.d.ts.map +1 -1
- package/dist/internal/discovery/info.js +3 -0
- package/dist/internal/factory-resource-channel.d.ts +33 -0
- package/dist/internal/factory-resource-channel.d.ts.map +1 -0
- package/dist/internal/factory-resource-channel.js +77 -0
- package/dist/internal/filesystem/errors.d.ts +64 -0
- package/dist/internal/filesystem/errors.d.ts.map +1 -0
- package/dist/internal/filesystem/errors.js +175 -0
- package/dist/internal/filesystem/format.d.ts +28 -0
- package/dist/internal/filesystem/format.d.ts.map +1 -0
- package/dist/internal/filesystem/format.js +213 -0
- package/dist/internal/filesystem/merge.d.ts +34 -0
- package/dist/internal/filesystem/merge.d.ts.map +1 -0
- package/dist/internal/filesystem/merge.js +196 -0
- package/dist/internal/filesystem/scratch.d.ts +59 -0
- package/dist/internal/filesystem/scratch.d.ts.map +1 -0
- package/dist/internal/filesystem/scratch.js +212 -0
- package/dist/internal/filesystem/sdk-schemas.d.ts +29 -0
- package/dist/internal/filesystem/sdk-schemas.d.ts.map +1 -0
- package/dist/internal/filesystem/sdk-schemas.js +153 -0
- package/dist/internal/filesystem/tools.d.ts +42 -0
- package/dist/internal/filesystem/tools.d.ts.map +1 -0
- package/dist/internal/filesystem/tools.js +618 -0
- package/dist/internal/filesystem/walk.d.ts +74 -0
- package/dist/internal/filesystem/walk.d.ts.map +1 -0
- package/dist/internal/filesystem/walk.js +339 -0
- package/dist/internal/framework-file-storage.d.ts +3 -1
- package/dist/internal/framework-file-storage.d.ts.map +1 -1
- package/dist/internal/framework-file-storage.js +3 -1
- package/dist/internal/guest-network.d.ts +5 -2
- package/dist/internal/guest-network.d.ts.map +1 -1
- package/dist/internal/guest-network.js +7 -2
- package/dist/internal/hosted-delivery.d.ts +7 -0
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +41 -3
- package/dist/internal/hosted-managed-automation.d.ts.map +1 -1
- package/dist/internal/hosted-managed-automation.js +27 -2
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +4 -1
- package/dist/internal/sdk-runner.d.ts +13 -1
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +21 -1
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +11 -3
- package/dist/internal/session-engine.d.ts +30 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +484 -82
- package/dist/internal/store-mirror.d.ts +2 -2
- package/dist/internal/store-mirror.js +2 -2
- package/dist/internal/tenant-slack/relay.d.ts +2 -0
- package/dist/internal/tenant-slack/relay.d.ts.map +1 -1
- package/dist/internal/tenant-slack/relay.js +18 -8
- package/dist/internal/testing/factory-resource-fixtures.d.ts +48 -0
- package/dist/internal/testing/factory-resource-fixtures.d.ts.map +1 -0
- package/dist/internal/testing/factory-resource-fixtures.js +41 -0
- package/dist/internal/workspace-sync.d.ts +31 -6
- package/dist/internal/workspace-sync.d.ts.map +1 -1
- package/dist/internal/workspace-sync.js +67 -12
- package/dist/internal/workspace.d.ts +9 -0
- package/dist/internal/workspace.d.ts.map +1 -1
- package/dist/internal/workspace.js +16 -0
- package/dist/playground/assets/{index-59KvgREd.js → index-BaQzjaNK.js} +40 -40
- package/dist/playground/assets/index-CceqnLTX.css +1 -0
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +60 -11
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +6 -1
- package/docs/design/filesystem.md +376 -0
- package/docs/guides/github.md +5 -0
- package/docs/guides/grokbot-agents.md +93 -0
- package/docs/reference/channels.md +20 -0
- package/docs/reference/cli.md +2 -1
- package/docs/reference/extensions.md +2 -0
- package/docs/templates/grokbot-agents.md +53 -0
- package/package.json +25 -2
- package/src/channels/change-monitors/change-monitors-channel.ts +62 -0
- package/src/channels/change-monitors/index.ts +8 -0
- package/src/channels/change-monitors/types.ts +44 -0
- package/src/channels/deployments/deployments-channel.ts +1 -0
- package/src/channels/deployments/types.ts +2 -0
- package/src/channels/github/defaults.ts +4 -0
- package/src/channels/github/progress.ts +76 -10
- package/src/channels/issues/index.ts +9 -0
- package/src/channels/issues/issues-channel.ts +51 -0
- package/src/channels/issues/types.ts +41 -0
- package/src/files.ts +9 -2
- package/src/filesystem.ts +2074 -0
- package/src/index.ts +28 -0
- package/src/internal/continuation-channel.ts +29 -12
- package/src/internal/continuation-identity.ts +122 -37
- package/src/internal/cursor-agent-template.ts +1 -0
- package/src/internal/discovery/agent.ts +87 -1
- package/src/internal/discovery/info.ts +3 -0
- package/src/internal/factory-resource-channel.ts +122 -0
- package/src/internal/filesystem/errors.ts +220 -0
- package/src/internal/filesystem/format.ts +276 -0
- package/src/internal/filesystem/merge.ts +195 -0
- package/src/internal/filesystem/scratch.ts +255 -0
- package/src/internal/filesystem/sdk-schemas.ts +204 -0
- package/src/internal/filesystem/tools.ts +821 -0
- package/src/internal/filesystem/walk.ts +369 -0
- package/src/internal/framework-file-storage.ts +3 -1
- package/src/internal/guest-network.ts +8 -2
- package/src/internal/hosted-delivery.ts +71 -2
- package/src/internal/hosted-managed-automation.ts +49 -5
- package/src/internal/init-project.ts +4 -1
- package/src/internal/sdk-runner.ts +23 -0
- package/src/internal/server.ts +16 -0
- package/src/internal/session-engine.ts +595 -73
- package/src/internal/store-mirror.ts +2 -2
- package/src/internal/tenant-slack/relay.ts +28 -4
- package/src/internal/testing/factory-resource-fixtures.ts +85 -0
- package/src/internal/workspace-sync.ts +84 -12
- package/src/internal/workspace.ts +20 -0
- package/src/types.ts +58 -11
- package/templates/grokbot-agents/README.md +26 -0
- package/templates/grokbot-agents/agent/agent.ts +6 -0
- package/templates/grokbot-agents/agent/extensions/grokbot.ts +5 -0
- package/templates/grokbot-agents/agent/instructions.md +7 -0
- package/templates/grokbot-agents/evals/evals.config.ts +5 -0
- package/templates/grokbot-agents/evals/grokbot-agents.eval.ts +18 -0
- package/templates/grokbot-agents/init.json +18 -0
- package/templates/grokbot-agents/package.json +17 -0
- package/templates/grokbot-agents/tsconfig.json +12 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.nrl1ifBq.js +0 -1
- package/dist/docs/assets/index.md.D75GWhPl.js +0 -5
- package/dist/docs/assets/index.md.D75GWhPl.lean.js +0 -1
- package/dist/playground/assets/index-MbMxXg-y.css +0 -1
- /package/dist/docs/assets/{reference_cli.md.CJNc_xYK.lean.js → reference_cli.md.C6Lo8SEd.lean.js} +0 -0
- /package/dist/docs/assets/{reference_extensions.md.DykHW3qL.lean.js → reference_extensions.md.CGmMLblt.lean.js} +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursive listing, existence probes, and native LS trees. Matches the
|
|
3
|
+
* change-monitor VFS contract on origin/main: `list` is files-only and
|
|
4
|
+
* recursive; `stat` tells file / directory / missing apart; composers
|
|
5
|
+
* merge already-sorted streams with a k-way heap.
|
|
6
|
+
*/
|
|
7
|
+
import type { DirEntry, FileInfo, FileSystem } from "../../filesystem.js";
|
|
8
|
+
/**
|
|
9
|
+
* Native LS `directoryTreeRoot` (LocalLsExecutor ingest tree).
|
|
10
|
+
* Synthesis builds this from `list` + `stat` via `buildLsTree`.
|
|
11
|
+
* Not a FileSystem method result and not part of the public
|
|
12
|
+
* Agent SDK surface.
|
|
13
|
+
*/
|
|
14
|
+
export interface LsDirectoryTreeNode {
|
|
15
|
+
absPath: string;
|
|
16
|
+
childrenDirs: LsDirectoryTreeNode[];
|
|
17
|
+
childrenFiles: Array<{
|
|
18
|
+
name: string;
|
|
19
|
+
}>;
|
|
20
|
+
childrenWereProcessed: boolean;
|
|
21
|
+
fullSubtreeExtensionCounts: Record<string, number>;
|
|
22
|
+
numFiles: number;
|
|
23
|
+
}
|
|
24
|
+
/** Filename-character ingest budget; matches LocalLsExecutor. */
|
|
25
|
+
export declare const LS_INGEST_CHARACTER_BUDGET = 2500;
|
|
26
|
+
/**
|
|
27
|
+
* Yield the files under `prefix`, sorted. A file whose path equals
|
|
28
|
+
* `prefix` is not under itself.
|
|
29
|
+
*/
|
|
30
|
+
export declare function listFilesFromPaths(files: Iterable<DirEntry>, prefix?: string): AsyncGenerator<DirEntry>;
|
|
31
|
+
export declare function normalizeListPrefix(prefix?: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Existence probe over a flat file-path index. Exact key → file; any
|
|
34
|
+
* key with this prefix → directory; `""` / `/` → directory; else missing.
|
|
35
|
+
*/
|
|
36
|
+
export declare function statFromFilePaths(files: Iterable<string>, path: string): FileInfo;
|
|
37
|
+
export declare function collectList(root: Pick<FileSystem, "list">, prefix?: string): Promise<DirEntry[]>;
|
|
38
|
+
export declare function collectGlob(root: Pick<FileSystem, "glob">, options: {
|
|
39
|
+
pattern: string;
|
|
40
|
+
dir?: string;
|
|
41
|
+
}): Promise<DirEntry[]>;
|
|
42
|
+
/**
|
|
43
|
+
* List, then `stat` only when nothing came back. A non-empty listing is
|
|
44
|
+
* already a directory (a file is not under itself).
|
|
45
|
+
*/
|
|
46
|
+
export declare function collectListOrStat(root: Pick<FileSystem, "list" | "stat">, path?: string): Promise<{
|
|
47
|
+
kind: FileInfo["kind"];
|
|
48
|
+
files: DirEntry[];
|
|
49
|
+
}>;
|
|
50
|
+
export declare function mergeSortedByPath(sources: Array<Iterable<DirEntry> | AsyncIterable<DirEntry>>, options?: {
|
|
51
|
+
unique?: boolean;
|
|
52
|
+
}): AsyncGenerator<DirEntry>;
|
|
53
|
+
/**
|
|
54
|
+
* Build the native LS tree from a recursive file listing. Applies the
|
|
55
|
+
* LocalLsExecutor ingest budget so a huge directory truncates the same way.
|
|
56
|
+
*/
|
|
57
|
+
export declare function buildLsTree(dir: string, files: readonly DirEntry[]): LsDirectoryTreeNode;
|
|
58
|
+
/**
|
|
59
|
+
* Native LS ignore_globs: a pattern that is not already recursive is
|
|
60
|
+
* matched at any depth (the same `** /` prefix the Cursor SDK native uses).
|
|
61
|
+
*/
|
|
62
|
+
export declare function applyIgnores(entries: readonly DirEntry[], ignoreGlobs?: readonly string[]): DirEntry[];
|
|
63
|
+
export declare function lsFromList(root: Pick<FileSystem, "list" | "stat">, path?: string, ignoreGlobs?: readonly string[]): Promise<{
|
|
64
|
+
status: "success";
|
|
65
|
+
value: {
|
|
66
|
+
directoryTreeRoot: LsDirectoryTreeNode;
|
|
67
|
+
};
|
|
68
|
+
} | {
|
|
69
|
+
status: "error";
|
|
70
|
+
error: {
|
|
71
|
+
message: string;
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
//# sourceMappingURL=walk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../../src/internal/filesystem/walk.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE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ACZ,OAAO,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC,CAUxD;AAED,wBAAuB,iBAAiB,CACtC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,EAC5D,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7B,cAAc,CAAC,QAAQ,CAAC,CAK1B;AAaD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS,QAAQ,EAAE,GACzB,mBAAmB,CAkBrB;AAwFD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,SAAS,QAAQ,EAAE,EAC5B,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,GAC9B,QAAQ,EAAE,CAOZ;AAcD,wBAAsB,UAAU,CAC9B,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,EACvC,IAAI,CAAC,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,GAC9B,OAAO,CACN;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE;QAAE,iBAAiB,EAAE,mBAAmB,CAAA;KAAE,CAAA;CAAE,GACxE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAClD,CAyBA"}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursive listing, existence probes, and native LS trees. Matches the
|
|
3
|
+
* change-monitor VFS contract on origin/main: `list` is files-only and
|
|
4
|
+
* recursive; `stat` tells file / directory / missing apart; composers
|
|
5
|
+
* merge already-sorted streams with a k-way heap.
|
|
6
|
+
*/
|
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
17
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
18
|
+
var m = o[Symbol.asyncIterator], i;
|
|
19
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
20
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
21
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
22
|
+
};
|
|
23
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
24
|
+
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
|
25
|
+
var i, p;
|
|
26
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
27
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
28
|
+
};
|
|
29
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
30
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
31
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
32
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
33
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
34
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
35
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
36
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
37
|
+
function fulfill(value) { resume("next", value); }
|
|
38
|
+
function reject(value) { resume("throw", value); }
|
|
39
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
40
|
+
};
|
|
41
|
+
import { posix } from "node:path";
|
|
42
|
+
import { minimatch } from "minimatch";
|
|
43
|
+
import { normalizeFsPath } from "../../filesystem.js";
|
|
44
|
+
import { mergeSorted } from "./merge.js";
|
|
45
|
+
/** Filename-character ingest budget; matches LocalLsExecutor. */
|
|
46
|
+
export const LS_INGEST_CHARACTER_BUDGET = 2500;
|
|
47
|
+
/**
|
|
48
|
+
* Yield the files under `prefix`, sorted. A file whose path equals
|
|
49
|
+
* `prefix` is not under itself.
|
|
50
|
+
*/
|
|
51
|
+
export function listFilesFromPaths(files, prefix) {
|
|
52
|
+
return __asyncGenerator(this, arguments, function* listFilesFromPaths_1() {
|
|
53
|
+
const scope = normalizeListPrefix(prefix);
|
|
54
|
+
const withSlash = scope === "/" ? "/" : `${scope}/`;
|
|
55
|
+
const matches = [];
|
|
56
|
+
for (const file of files) {
|
|
57
|
+
const filePath = normalizeFsPath(file.path);
|
|
58
|
+
if (scope === "/") {
|
|
59
|
+
matches.push(file.size === undefined
|
|
60
|
+
? { path: filePath }
|
|
61
|
+
: { path: filePath, size: file.size });
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (filePath === scope || !filePath.startsWith(withSlash)) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
matches.push(file.size === undefined
|
|
68
|
+
? { path: filePath }
|
|
69
|
+
: { path: filePath, size: file.size });
|
|
70
|
+
}
|
|
71
|
+
matches.sort((left, right) => left.path.localeCompare(right.path));
|
|
72
|
+
yield __await(yield* __asyncDelegator(__asyncValues(matches)));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export function normalizeListPrefix(prefix) {
|
|
76
|
+
if (prefix === undefined || prefix === "" || prefix === "/") {
|
|
77
|
+
return "/";
|
|
78
|
+
}
|
|
79
|
+
return normalizeFsPath(prefix);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Existence probe over a flat file-path index. Exact key → file; any
|
|
83
|
+
* key with this prefix → directory; `""` / `/` → directory; else missing.
|
|
84
|
+
*/
|
|
85
|
+
export function statFromFilePaths(files, path) {
|
|
86
|
+
const normalized = normalizeListPrefix(path);
|
|
87
|
+
if (normalized === "/") {
|
|
88
|
+
return { kind: "directory" };
|
|
89
|
+
}
|
|
90
|
+
const prefix = `${normalized}/`;
|
|
91
|
+
for (const file of files) {
|
|
92
|
+
const filePath = normalizeFsPath(file);
|
|
93
|
+
if (filePath === normalized) {
|
|
94
|
+
return { kind: "file" };
|
|
95
|
+
}
|
|
96
|
+
if (filePath.startsWith(prefix)) {
|
|
97
|
+
return { kind: "directory" };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return { kind: "missing" };
|
|
101
|
+
}
|
|
102
|
+
export function collectList(root, prefix) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
var _a, e_1, _b, _c;
|
|
105
|
+
const entries = [];
|
|
106
|
+
if (root.list === undefined) {
|
|
107
|
+
return entries;
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
for (var _d = true, _e = __asyncValues(root.list(prefix)), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
|
|
111
|
+
_c = _f.value;
|
|
112
|
+
_d = false;
|
|
113
|
+
const entry = _c;
|
|
114
|
+
entries.push(entry);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
118
|
+
finally {
|
|
119
|
+
try {
|
|
120
|
+
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
|
|
121
|
+
}
|
|
122
|
+
finally { if (e_1) throw e_1.error; }
|
|
123
|
+
}
|
|
124
|
+
return entries;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
export function collectGlob(root, options) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
var _a, e_2, _b, _c;
|
|
130
|
+
const entries = [];
|
|
131
|
+
if (root.glob === undefined) {
|
|
132
|
+
return entries;
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
for (var _d = true, _e = __asyncValues(root.glob(options.pattern, options.dir)), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
|
|
136
|
+
_c = _f.value;
|
|
137
|
+
_d = false;
|
|
138
|
+
const entry = _c;
|
|
139
|
+
entries.push(entry);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
143
|
+
finally {
|
|
144
|
+
try {
|
|
145
|
+
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
|
|
146
|
+
}
|
|
147
|
+
finally { if (e_2) throw e_2.error; }
|
|
148
|
+
}
|
|
149
|
+
return entries;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* List, then `stat` only when nothing came back. A non-empty listing is
|
|
154
|
+
* already a directory (a file is not under itself).
|
|
155
|
+
*/
|
|
156
|
+
export function collectListOrStat(root, path) {
|
|
157
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
const files = yield collectList(root, path);
|
|
159
|
+
if (files.length > 0) {
|
|
160
|
+
return { kind: "directory", files };
|
|
161
|
+
}
|
|
162
|
+
if (root.stat === undefined) {
|
|
163
|
+
return { kind: "missing", files };
|
|
164
|
+
}
|
|
165
|
+
const probe = path === undefined || path === "" ? "." : path;
|
|
166
|
+
return { kind: (yield root.stat(probe)).kind, files };
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
export function mergeSortedByPath(sources, options) {
|
|
170
|
+
return __asyncGenerator(this, arguments, function* mergeSortedByPath_1() {
|
|
171
|
+
yield __await(yield* __asyncDelegator(__asyncValues(mergeSorted(sources, {
|
|
172
|
+
compare: (left, right) => left.path.localeCompare(right.path),
|
|
173
|
+
unique: (options === null || options === void 0 ? void 0 : options.unique) === true,
|
|
174
|
+
}))));
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
function emptyLsNode(absPath) {
|
|
178
|
+
return {
|
|
179
|
+
absPath,
|
|
180
|
+
childrenDirs: [],
|
|
181
|
+
childrenFiles: [],
|
|
182
|
+
childrenWereProcessed: true,
|
|
183
|
+
fullSubtreeExtensionCounts: {},
|
|
184
|
+
numFiles: 0,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Build the native LS tree from a recursive file listing. Applies the
|
|
189
|
+
* LocalLsExecutor ingest budget so a huge directory truncates the same way.
|
|
190
|
+
*/
|
|
191
|
+
export function buildLsTree(dir, files) {
|
|
192
|
+
const rootPath = normalizeListPrefix(dir);
|
|
193
|
+
const root = emptyLsNode(rootPath);
|
|
194
|
+
const dirNodes = new Map([[rootPath, root]]);
|
|
195
|
+
const state = {
|
|
196
|
+
charactersUsed: rootPath.length,
|
|
197
|
+
budgetExceeded: false,
|
|
198
|
+
};
|
|
199
|
+
for (const file of files) {
|
|
200
|
+
addPathToTree(file.path, rootPath, dirNodes, state, LS_INGEST_CHARACTER_BUDGET);
|
|
201
|
+
}
|
|
202
|
+
return root;
|
|
203
|
+
}
|
|
204
|
+
function addPathToTree(filePath, rootPath, dirNodes, state, characterBudget) {
|
|
205
|
+
var _a;
|
|
206
|
+
const fileName = posix.basename(filePath);
|
|
207
|
+
const dirPath = posixParent(filePath);
|
|
208
|
+
ensureDirectoryPath(dirPath, rootPath, dirNodes, state.budgetExceeded);
|
|
209
|
+
const parentNode = dirNodes.get(dirPath);
|
|
210
|
+
if (parentNode === undefined) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const fileCharCost = fileName.length;
|
|
214
|
+
if (!state.budgetExceeded &&
|
|
215
|
+
state.charactersUsed + fileCharCost <= characterBudget) {
|
|
216
|
+
parentNode.childrenFiles.push({ name: fileName });
|
|
217
|
+
state.charactersUsed += fileCharCost;
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (!state.budgetExceeded) {
|
|
221
|
+
state.budgetExceeded = true;
|
|
222
|
+
let currentDir = dirPath;
|
|
223
|
+
while (currentDir.startsWith(rootPath)) {
|
|
224
|
+
const node = dirNodes.get(currentDir);
|
|
225
|
+
if (node !== undefined) {
|
|
226
|
+
node.childrenWereProcessed = false;
|
|
227
|
+
}
|
|
228
|
+
const parentDir = posixParent(currentDir);
|
|
229
|
+
if (parentDir === currentDir) {
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
currentDir = parentDir;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const extension = posix.extname(filePath);
|
|
236
|
+
let currentDir = dirPath;
|
|
237
|
+
while (currentDir.startsWith(rootPath)) {
|
|
238
|
+
const node = dirNodes.get(currentDir);
|
|
239
|
+
if (node !== undefined) {
|
|
240
|
+
node.fullSubtreeExtensionCounts[extension] =
|
|
241
|
+
((_a = node.fullSubtreeExtensionCounts[extension]) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
242
|
+
node.numFiles += 1;
|
|
243
|
+
}
|
|
244
|
+
const parentDir = posixParent(currentDir);
|
|
245
|
+
if (parentDir === currentDir) {
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
currentDir = parentDir;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
function ensureDirectoryPath(dirPath, rootPath, dirNodes, budgetExceeded) {
|
|
252
|
+
if (dirNodes.has(dirPath) || dirPath === rootPath) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const parentPath = posixParent(dirPath);
|
|
256
|
+
if (parentPath !== dirPath && pathIsUnderRoot(parentPath, rootPath)) {
|
|
257
|
+
ensureDirectoryPath(parentPath, rootPath, dirNodes, budgetExceeded);
|
|
258
|
+
}
|
|
259
|
+
const dirNode = Object.assign(Object.assign({}, emptyLsNode(dirPath)), { childrenWereProcessed: !budgetExceeded });
|
|
260
|
+
dirNodes.set(dirPath, dirNode);
|
|
261
|
+
const parentNode = dirNodes.get(parentPath);
|
|
262
|
+
if (parentNode !== undefined) {
|
|
263
|
+
parentNode.childrenDirs.push(dirNode);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function pathIsUnderRoot(path, rootPath) {
|
|
267
|
+
return (path === rootPath ||
|
|
268
|
+
path.startsWith(rootPath === "/" ? "/" : `${rootPath}/`));
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Native LS ignore_globs: a pattern that is not already recursive is
|
|
272
|
+
* matched at any depth (the same `** /` prefix the Cursor SDK native uses).
|
|
273
|
+
*/
|
|
274
|
+
export function applyIgnores(entries, ignoreGlobs) {
|
|
275
|
+
if (ignoreGlobs === undefined || ignoreGlobs.length === 0) {
|
|
276
|
+
return [...entries];
|
|
277
|
+
}
|
|
278
|
+
return entries.filter((entry) => !ignoreGlobs.some((glob) => matchesIgnoreGlob(entry.path, glob)));
|
|
279
|
+
}
|
|
280
|
+
function matchesIgnoreGlob(filePath, glob) {
|
|
281
|
+
const recursivePrefix = "**".concat("/");
|
|
282
|
+
const pattern = glob.startsWith(recursivePrefix)
|
|
283
|
+
? glob
|
|
284
|
+
: recursivePrefix + glob;
|
|
285
|
+
const relative = filePath.replace(/^\//, "");
|
|
286
|
+
return (minimatch(relative, pattern, { dot: true }) ||
|
|
287
|
+
minimatch(filePath, pattern, { dot: true }));
|
|
288
|
+
}
|
|
289
|
+
export function lsFromList(root, path, ignoreGlobs) {
|
|
290
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
291
|
+
const listed = yield collectListOrStat(root, path);
|
|
292
|
+
const treePath = path !== null && path !== void 0 ? path : inferListedRoot(listed.files);
|
|
293
|
+
switch (listed.kind) {
|
|
294
|
+
case "missing":
|
|
295
|
+
return {
|
|
296
|
+
status: "error",
|
|
297
|
+
error: { message: `Path does not exist: ${treePath}` },
|
|
298
|
+
};
|
|
299
|
+
case "file":
|
|
300
|
+
return {
|
|
301
|
+
status: "error",
|
|
302
|
+
error: { message: `Path is not a directory: ${treePath}` },
|
|
303
|
+
};
|
|
304
|
+
case "directory":
|
|
305
|
+
return {
|
|
306
|
+
status: "success",
|
|
307
|
+
value: {
|
|
308
|
+
directoryTreeRoot: buildLsTree(treePath, applyIgnores(listed.files, ignoreGlobs)),
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
function inferListedRoot(files) {
|
|
315
|
+
if (files.length === 0) {
|
|
316
|
+
return "/";
|
|
317
|
+
}
|
|
318
|
+
let prefix = posixParent(files[0].path);
|
|
319
|
+
for (const file of files) {
|
|
320
|
+
while (prefix !== "/" &&
|
|
321
|
+
file.path !== prefix &&
|
|
322
|
+
!file.path.startsWith(`${prefix}/`)) {
|
|
323
|
+
const parent = posixParent(prefix);
|
|
324
|
+
if (parent === prefix) {
|
|
325
|
+
return "/";
|
|
326
|
+
}
|
|
327
|
+
prefix = parent;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return prefix;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* `path.posix.dirname` returns `.` for slash-free paths. Treat that as
|
|
334
|
+
* the virtual root so LS walks terminate and relative files attach to `/`.
|
|
335
|
+
*/
|
|
336
|
+
function posixParent(path) {
|
|
337
|
+
const dir = posix.dirname(path);
|
|
338
|
+
return dir === "." || dir === path ? "/" : dir;
|
|
339
|
+
}
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* - the **framework-level** store (`AGENT_SERVE_FRAMEWORK_STORE_SOURCE_ID`)
|
|
10
10
|
* holds engine-owned session state — session records, event transcripts,
|
|
11
11
|
* hosted-execution run logs, the continuation index, and the SDK
|
|
12
|
-
* conversation mirror — and is never
|
|
12
|
+
* conversation mirror — and is never mounted into author code or models.
|
|
13
|
+
* The authenticated dashboard may read diagnostic families, but never the
|
|
14
|
+
* continuation index.
|
|
13
15
|
*
|
|
14
16
|
* This module puts framework session state on the framework store. The
|
|
15
17
|
* {@link storageKeys} scheme was designed for exactly this: keys are a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-file-storage.d.ts","sourceRoot":"","sources":["../../src/internal/framework-file-storage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"framework-file-storage.d.ts","sourceRoot":"","sources":["../../src/internal/framework-file-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,eAAe,CAAC;AAiBjE;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAavD;AAED,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CACxC,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC,CACvD,CAAC;AAkBF;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,QAAQ,GAAG,mBAAmB,CAuDvE;AA+CD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,EAAE,EAAE,mBAAmB,CAAC;IACxB,KAAK,EAAE,mBAAmB,CAAC;CAC5B,GAAG,mBAAmB,GAAG,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAe1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GACrC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CA0BnC"}
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* - the **framework-level** store (`AGENT_SERVE_FRAMEWORK_STORE_SOURCE_ID`)
|
|
10
10
|
* holds engine-owned session state — session records, event transcripts,
|
|
11
11
|
* hosted-execution run logs, the continuation index, and the SDK
|
|
12
|
-
* conversation mirror — and is never
|
|
12
|
+
* conversation mirror — and is never mounted into author code or models.
|
|
13
|
+
* The authenticated dashboard may read diagnostic families, but never the
|
|
14
|
+
* continuation index.
|
|
13
15
|
*
|
|
14
16
|
* This module puts framework session state on the framework store. The
|
|
15
17
|
* {@link storageKeys} scheme was designed for exactly this: keys are a
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Quiet guest Connect (`TypeError: fetch failed` with no errno, Connect
|
|
16
16
|
* `[unknown]`/`[canceled]`/`[unavailable]`, headers/body timeout) is a
|
|
17
|
-
* stall, not a dead NIC. Those become `guest_connect_stalled` so TAS
|
|
18
|
-
*
|
|
17
|
+
* stall, not a dead NIC. Those become `guest_connect_stalled` so TAS
|
|
18
|
+
* retries the same pod — including when `waitForCompletion` resolves
|
|
19
|
+
* with that message instead of throwing.
|
|
19
20
|
*/
|
|
20
21
|
export declare const GUEST_NETWORK_UNAVAILABLE = "guest_network_unavailable";
|
|
21
22
|
export declare const GUEST_CONNECT_STALLED = "guest_connect_stalled";
|
|
@@ -51,6 +52,8 @@ export declare function hasGuestNetworkErrno(error: unknown): boolean;
|
|
|
51
52
|
* mapper can return `guest_connect_stalled` instead of a mystery 503.
|
|
52
53
|
*/
|
|
53
54
|
export declare function isQuietGuestConnectStall(error: unknown): boolean;
|
|
55
|
+
/** Message-only form for `waitForCompletion` outcomes that do not throw. */
|
|
56
|
+
export declare function isQuietGuestConnectStallMessage(message: string): boolean;
|
|
54
57
|
/** Last-line wait inside an already-open hosted POST. */
|
|
55
58
|
export declare const DEFAULT_WAIT_TIMEOUT_MS = 8000;
|
|
56
59
|
export type GuestNetworkWaitOptions = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guest-network.d.ts","sourceRoot":"","sources":["../../src/internal/guest-network.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"guest-network.d.ts","sourceRoot":"","sources":["../../src/internal/guest-network.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AACrE,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,QAAS,CAAC;AAuB1D,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,IAAI,EAAE,OAAO,yBAAyB,CAA6B;IAC5E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B,YACE,OAAO,SAAsD,EAC7D,MAAM,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO,EAMzD;CACF;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,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,wBAAsB,wBAAwB,CAC5C,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,sBAAsB,CAAC,CAkDjC;AAED;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,QAAQ,CAAC,CAsCnB"}
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Quiet guest Connect (`TypeError: fetch failed` with no errno, Connect
|
|
16
16
|
* `[unknown]`/`[canceled]`/`[unavailable]`, headers/body timeout) is a
|
|
17
|
-
* stall, not a dead NIC. Those become `guest_connect_stalled` so TAS
|
|
18
|
-
*
|
|
17
|
+
* stall, not a dead NIC. Those become `guest_connect_stalled` so TAS
|
|
18
|
+
* retries the same pod — including when `waitForCompletion` resolves
|
|
19
|
+
* with that message instead of throwing.
|
|
19
20
|
*/
|
|
20
21
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
21
22
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -103,6 +104,10 @@ export function isQuietGuestConnectStall(error) {
|
|
|
103
104
|
}
|
|
104
105
|
return isQuietSignatureAtDepth(error, 0);
|
|
105
106
|
}
|
|
107
|
+
/** Message-only form for `waitForCompletion` outcomes that do not throw. */
|
|
108
|
+
export function isQuietGuestConnectStallMessage(message) {
|
|
109
|
+
return QUIET_CONNECT_MESSAGE.test(message);
|
|
110
|
+
}
|
|
106
111
|
function errorCode(error) {
|
|
107
112
|
const code = error.code;
|
|
108
113
|
return typeof code === "string" && code.length > 0 ? code : undefined;
|
|
@@ -68,6 +68,13 @@ export declare function registerHostedDeliveryRoute(input: {
|
|
|
68
68
|
flushStartLog?(startLogId: string): Promise<void>;
|
|
69
69
|
/** Snapshot of the process log ring at persist time. */
|
|
70
70
|
snapshotLogs?(): LogRingEntry[];
|
|
71
|
+
/**
|
|
72
|
+
* Drop the cached SDK agent handle before the HTTP reply. Hosted v2
|
|
73
|
+
* hibernates this process as soon as the reply lands; leaving the handle
|
|
74
|
+
* in memory freezes a dead Connect/HTTP2 session that the next wake
|
|
75
|
+
* then reuses.
|
|
76
|
+
*/
|
|
77
|
+
evictSdkSession?(sessionId: string): void;
|
|
71
78
|
/**
|
|
72
79
|
* Wait until guest egress works before authored admission/execution.
|
|
73
80
|
* Defaults to {@link waitForGuestNetworkReady}. Tests inject a stub.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-delivery.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAK1C,OAAO,
|
|
1
|
+
{"version":3,"file":"hosted-delivery.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAK1C,OAAO,EAKL,KAAK,sBAAsB,EAI5B,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EAKL,KAAK,eAAe,EAGrB,MAAM,+BAA+B,CAAC;AAYvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAErE,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAA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;;;;OAIG;IACH,mBAAmB,CAAC,IAAI,wBAAwB,CAAC;CAClD,GAAG,IAAI,CAwVP"}
|
|
@@ -11,7 +11,7 @@ import { randomBytes } from "node:crypto";
|
|
|
11
11
|
import { dispatchOutcome } from "./channel-dispatch.js";
|
|
12
12
|
import { consumeHostedBoundSecrets, } from "./cursor/hosted-bound-secrets.js";
|
|
13
13
|
import { createDeferredChannelSession, DeferredChannelSessionError, } from "./deferred-channel-session.js";
|
|
14
|
-
import { formatGuestNetworkServerTiming, GUEST_NETWORK_UNAVAILABLE, GuestNetworkUnavailableError, waitForGuestNetworkReady, } from "./guest-network.js";
|
|
14
|
+
import { formatGuestNetworkServerTiming, GUEST_CONNECT_STALLED, GUEST_NETWORK_UNAVAILABLE, GuestNetworkUnavailableError, isQuietGuestConnectStallMessage, waitForGuestNetworkReady, } from "./guest-network.js";
|
|
15
15
|
import { getHostedAdmissionAdapter, } from "./hosted-admission-adapter.js";
|
|
16
16
|
import { HostedAdmissionLocalSendError, runDuringHostedAdmission, } from "./hosted-admission-context.js";
|
|
17
17
|
import { HOSTED_ADMISSION_PATH, HOSTED_DELIVERY_HEADER, HOSTED_DELIVERY_PROTOCOL_VERSION, HOSTED_EXECUTION_PATH, parseHostedAdmission, parseHostedExecution, } from "./hosted-delivery-protocol.js";
|
|
@@ -289,10 +289,18 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
289
289
|
if (unconsumed !== undefined) {
|
|
290
290
|
return finish(unconsumed);
|
|
291
291
|
}
|
|
292
|
-
const
|
|
292
|
+
const rawAdmission = yield readJsonObject(request);
|
|
293
|
+
const delivery = parseHostedAdmission(rawAdmission);
|
|
293
294
|
if (delivery === undefined) {
|
|
295
|
+
const rawKeys = typeof rawAdmission === "object" &&
|
|
296
|
+
rawAdmission !== null &&
|
|
297
|
+
!Array.isArray(rawAdmission)
|
|
298
|
+
? Object.keys(rawAdmission)
|
|
299
|
+
: [];
|
|
300
|
+
console.info(`[agent-sdk] hosted admission rejected: envelope failed to parse keys=${JSON.stringify(rawKeys)} hasManagedAutomation=${String(rawKeys.includes("managedAutomation"))}`);
|
|
294
301
|
return finish(errorResponse(400, "invalid_hosted_admission", "Expected a supported Agent SDK hosted-admission envelope."));
|
|
295
302
|
}
|
|
303
|
+
console.info(`[agent-sdk] hosted admission received deliveryId=${delivery.deliveryId} channelId=${delivery.channelId} channelKind=${delivery.channelKind} eventType=${delivery.eventType} sessionMode=${delivery.sessionMode} managedAutomation=${delivery.managedAutomation === undefined ? "<absent>" : `automationUuid=${delivery.managedAutomation.automationUuid} mcpServerNames=${String(delivery.managedAutomation.mcpServerNames.length)} slackChannels=${delivery.managedAutomation.slackChannels === undefined ? "<absent>" : JSON.stringify(delivery.managedAutomation.slackChannels)}`}`);
|
|
296
304
|
recordHostedManagedAutomation(delivery);
|
|
297
305
|
const channel = input.channels.find((candidate) => candidate.id === delivery.channelId);
|
|
298
306
|
if (channel === undefined) {
|
|
@@ -387,15 +395,21 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
387
395
|
sessionId: "",
|
|
388
396
|
turnStatus: HOSTED_EXECUTION_DIAG_RUNNING_STATUS,
|
|
389
397
|
});
|
|
398
|
+
let sessionId = "";
|
|
390
399
|
try {
|
|
391
400
|
const args = input.buildHandlerArgs(admitted.send.channelId, execution.sessionPublicId);
|
|
392
401
|
const session = yield args.send(admitted.send.message, Object.assign(Object.assign({}, admitted.send.options), { mailboxContinuation: {
|
|
393
402
|
key: admitted.send.mailboxContinuationKey,
|
|
394
403
|
} }));
|
|
404
|
+
sessionId = session.id;
|
|
395
405
|
const outcome = yield session.waitForCompletion();
|
|
396
406
|
// Failed turns drain too: their record/continuation updates must
|
|
397
407
|
// survive the park just like a finished turn's.
|
|
398
408
|
yield (_a = input.drainSessionDurability) === null || _a === void 0 ? void 0 : _a.call(input, session.id);
|
|
409
|
+
// Evict before the reply: TAS parks and hibernates this process
|
|
410
|
+
// as soon as the POST returns. A leftover SDK handle freezes a
|
|
411
|
+
// dead Connect/HTTP2 session that the next wake then reuses.
|
|
412
|
+
evictHostedSdkSessions(input.evictSdkSession, session.id, execution.sessionPublicId);
|
|
399
413
|
yield writeDiag({
|
|
400
414
|
sessionId: session.id,
|
|
401
415
|
turnStatus: outcome.status,
|
|
@@ -403,11 +417,14 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
403
417
|
abortReason: abortReasonFromTurnStatus(outcome.status, outcome.errorMessage),
|
|
404
418
|
});
|
|
405
419
|
if (outcome.status !== "finished") {
|
|
420
|
+
// waitForCompletion resolves (does not throw) on a quiet
|
|
421
|
+
// Connect abort. Map that to guest_connect_stalled so TAS
|
|
422
|
+
// retries the same pod. Real runner failures stay turn_failed.
|
|
406
423
|
return {
|
|
407
424
|
status: 503,
|
|
408
425
|
body: {
|
|
409
426
|
ok: false,
|
|
410
|
-
error:
|
|
427
|
+
error: hostedErrorForUnfinishedTurn(outcome.errorMessage),
|
|
411
428
|
turnStatus: outcome.status,
|
|
412
429
|
message: outcome.errorMessage,
|
|
413
430
|
},
|
|
@@ -423,6 +440,7 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
423
440
|
};
|
|
424
441
|
}
|
|
425
442
|
catch (error) {
|
|
443
|
+
evictHostedSdkSessions(input.evictSdkSession, sessionId, execution.sessionPublicId);
|
|
426
444
|
yield writeDiag({
|
|
427
445
|
sessionId: "",
|
|
428
446
|
turnStatus: "error",
|
|
@@ -439,6 +457,26 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
439
457
|
}),
|
|
440
458
|
});
|
|
441
459
|
}
|
|
460
|
+
function evictHostedSdkSessions(evict, ...ids) {
|
|
461
|
+
if (evict === undefined) {
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
const seen = new Set();
|
|
465
|
+
for (const id of ids) {
|
|
466
|
+
if (id === undefined || id === "" || seen.has(id)) {
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
seen.add(id);
|
|
470
|
+
evict(id);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
function hostedErrorForUnfinishedTurn(errorMessage) {
|
|
474
|
+
if (errorMessage !== undefined &&
|
|
475
|
+
isQuietGuestConnectStallMessage(errorMessage)) {
|
|
476
|
+
return GUEST_CONNECT_STALLED;
|
|
477
|
+
}
|
|
478
|
+
return "turn_failed";
|
|
479
|
+
}
|
|
442
480
|
function afterHostedWork(flushOtel, work) {
|
|
443
481
|
return __awaiter(this, void 0, void 0, function* () {
|
|
444
482
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-managed-automation.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-managed-automation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"hosted-managed-automation.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-managed-automation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AAoCtF,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,gCAAgC,CAAC;CACtD,GAAG,IAAI,CA4BP;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,MAAM,GACjB,gCAAgC,GAAG,SAAS,CAiB9C;AAED,4DAA4D;AAC5D,wBAAgB,mCAAmC,IAAI,IAAI,CAE1D"}
|