@cursor/july 0.1.103 → 0.1.104
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/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.DbMWUyGb.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.Bqsulb9K.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.CdEIUwDg.js → VPLocalSearchBox.DcNeTh9o.js} +1 -1
- package/dist/docs/assets/chunks/{theme.YZMHgPgg.js → theme.DMjhY3gl.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/{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/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 +4 -4
- 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/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +4 -4
- package/dist/docs/guides/opentelemetry.html +4 -4
- 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 +4 -4
- package/dist/docs/llms-full.txt +406 -0
- package/dist/docs/llms.txt +1 -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 +4 -4
- package/dist/docs/reference/connections.html +4 -4
- package/dist/docs/reference/extensions.html +4 -4
- 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 +4 -4
- package/dist/docs/templates/demo.html +4 -4
- 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/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/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/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.map +1 -1
- package/dist/internal/hosted-delivery.js +12 -2
- package/dist/internal/sdk-runner.d.ts +1 -1
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +3 -1
- package/dist/internal/session-engine.d.ts +22 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +362 -40
- 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/playground/assets/{index-59KvgREd.js → index-8YiozU89.js} +38 -38
- package/dist/playground/index.html +1 -1
- package/dist/types.d.ts +51 -3
- package/dist/types.d.ts.map +1 -1
- package/docs/design/filesystem.md +376 -0
- package/docs/guides/github.md +5 -0
- package/docs/reference/channels.md +20 -0
- package/package.json +16 -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/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/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/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/guest-network.ts +8 -2
- package/src/internal/hosted-delivery.ts +18 -1
- package/src/internal/sdk-runner.ts +4 -0
- package/src/internal/session-engine.ts +439 -29
- package/src/internal/testing/factory-resource-fixtures.ts +85 -0
- package/src/types.ts +49 -3
- package/dist/docs/assets/chunks/@localSearchIndexroot.nrl1ifBq.js +0 -1
|
@@ -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,MAAM,qBAAqB,CAAC;AAI1E;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,mBAAmB,EAAE,CAAC;IACpC,aAAa,EAAE,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AAO,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
|
+
}
|
|
@@ -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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AAC,CAAC;CACvC,CAAC;AA2CF,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,CAAC;AAE1E,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,OAAO,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,uBAAuB,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,qBAAqB,GAC3B,MAAM,CAER;AAED;;;;GAIG;AACH,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;
|
|
@@ -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,E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CA4TP"}
|
|
@@ -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";
|
|
@@ -403,11 +403,14 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
403
403
|
abortReason: abortReasonFromTurnStatus(outcome.status, outcome.errorMessage),
|
|
404
404
|
});
|
|
405
405
|
if (outcome.status !== "finished") {
|
|
406
|
+
// waitForCompletion resolves (does not throw) on a quiet
|
|
407
|
+
// Connect abort. Map that to guest_connect_stalled so TAS
|
|
408
|
+
// retries the same pod. Real runner failures stay turn_failed.
|
|
406
409
|
return {
|
|
407
410
|
status: 503,
|
|
408
411
|
body: {
|
|
409
412
|
ok: false,
|
|
410
|
-
error:
|
|
413
|
+
error: hostedErrorForUnfinishedTurn(outcome.errorMessage),
|
|
411
414
|
turnStatus: outcome.status,
|
|
412
415
|
message: outcome.errorMessage,
|
|
413
416
|
},
|
|
@@ -439,6 +442,13 @@ export function registerHostedDeliveryRoute(input) {
|
|
|
439
442
|
}),
|
|
440
443
|
});
|
|
441
444
|
}
|
|
445
|
+
function hostedErrorForUnfinishedTurn(errorMessage) {
|
|
446
|
+
if (errorMessage !== undefined &&
|
|
447
|
+
isQuietGuestConnectStallMessage(errorMessage)) {
|
|
448
|
+
return GUEST_CONNECT_STALLED;
|
|
449
|
+
}
|
|
450
|
+
return "turn_failed";
|
|
451
|
+
}
|
|
442
452
|
function afterHostedWork(flushOtel, work) {
|
|
443
453
|
return __awaiter(this, void 0, void 0, function* () {
|
|
444
454
|
try {
|
|
@@ -31,7 +31,7 @@ export interface AgentRunner {
|
|
|
31
31
|
* a subset of {@link RunnerTurnRequest} — anything that disagrees warms an
|
|
32
32
|
* executor no turn will ask for.
|
|
33
33
|
*/
|
|
34
|
-
export type RunnerPrewarmRequest = Pick<RunnerTurnRequest, "workspaceDir" | "runnerStateDir" | "sandbox" | "tools" | "mcpServers" | "perSendMcpServers" | "subagents" | "model">;
|
|
34
|
+
export type RunnerPrewarmRequest = Pick<RunnerTurnRequest, "workspaceDir" | "runnerStateDir" | "sandbox" | "tools" | "disallowedTools" | "mcpServers" | "perSendMcpServers" | "subagents" | "model">;
|
|
35
35
|
/** Whether a workspace was actually resolved, and why not when it wasn't. */
|
|
36
36
|
export type PrewarmOutcome = {
|
|
37
37
|
readonly warmed: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-runner.d.ts","sourceRoot":"","sources":["../../src/internal/sdk-runner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAOL,KAAK,eAAe,EACpB,KAAK,cAAc,EAEnB,KAAK,SAAS,EAEf,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAEjB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAMnE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,CAAC,UAAU;IASlB,OAAO,CAAC,GAAG;IAIX;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAUrB,OAAO,CAAC,kBAAkB;IAmB1B;;;OAGG;YACW,iBAAiB;YA6BjB,SAAS;YAOT,cAAc;YAsCd,cAAc;IA6C5B,OAAO,CAAC,YAAY;IAQpB;;;OAGG;YACW,mBAAmB;IAoBjC,OAAO,CAAC,QAAQ;CAajB;AAED,4EAA4E;AAC5E,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAMT;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,cAAc,CAQpE;AAiGD,wBAAgB,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,MAAM,CAExE"}
|
|
@@ -374,7 +374,9 @@ export class CursorSdkRunner {
|
|
|
374
374
|
// microtask, no thenable assimilation), exactly as before the mirror
|
|
375
375
|
// existed.
|
|
376
376
|
const store = (_a = this.options.store) !== null && _a !== void 0 ? _a : (yield this.getStore(request.runnerStateDir));
|
|
377
|
-
return Object.assign(Object.assign(Object.assign({}, this.buildSharedOptions(request)), (request.tools === undefined ? {} : { tools: request.tools })),
|
|
377
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, this.buildSharedOptions(request)), (request.tools === undefined ? {} : { tools: request.tools })), (request.disallowedTools === undefined
|
|
378
|
+
? {}
|
|
379
|
+
: { disallowedTools: request.disallowedTools })), { local: Object.assign({ cwd: request.workspaceDir, settingSources: ["project"], store }, (request.sandbox === true
|
|
378
380
|
? { sandboxOptions: { enabled: true } }
|
|
379
381
|
: {})) });
|
|
380
382
|
});
|
|
@@ -236,6 +236,12 @@ export declare class SessionEngine {
|
|
|
236
236
|
private readonly cloudCostBackfillDone;
|
|
237
237
|
/** Deduped in-flight cloud cost backfills, keyed by session id. */
|
|
238
238
|
private readonly cloudCostBackfill;
|
|
239
|
+
/** Per-session FileSystem handle cache (not a tree snapshot). */
|
|
240
|
+
private readonly sessionRoots;
|
|
241
|
+
/** In-flight factory resolves, so the first turn and a racing callTool share one handle. */
|
|
242
|
+
private readonly sessionRootInflight;
|
|
243
|
+
/** Per-turn `unionFs({ "/": authored, "/tmp": tempFs() })`. Dropped at end of turn. */
|
|
244
|
+
private readonly turnRoots;
|
|
239
245
|
constructor(options: SessionEngineOptions);
|
|
240
246
|
/**
|
|
241
247
|
* Attach serve-time resolved connections (peers, Cursor account bridge).
|
|
@@ -417,6 +423,22 @@ export declare class SessionEngine {
|
|
|
417
423
|
*/
|
|
418
424
|
getContinuationLastBotMessageTs(channelId: string, continuationToken: string): Promise<string | undefined>;
|
|
419
425
|
interruptContinuation(channelId: string, continuationToken: string): Promise<boolean>;
|
|
426
|
+
private hasRootOverride;
|
|
427
|
+
/**
|
|
428
|
+
* FileSystem for this turn or `callTool`. Authored `root` (static or
|
|
429
|
+
* factory) is cached per session when `cache` is set; unscoped
|
|
430
|
+
* `callTool` passes the invocation id and does not cache, so factories
|
|
431
|
+
* cannot share one tree across callers. A static handle is used as
|
|
432
|
+
* authored — every session sees that same object. Host-default agents
|
|
433
|
+
* get `localFileSystem` against the harness cwd — same path verbs as
|
|
434
|
+
* the Cursor SDK natives, always through the synthesized tools.
|
|
435
|
+
*/
|
|
436
|
+
private resolveFileSystem;
|
|
437
|
+
private resolveAuthoredFileSystem;
|
|
438
|
+
private dropTurnFileSystem;
|
|
439
|
+
private prepareScratchToolInput;
|
|
440
|
+
private withTurnScratchTools;
|
|
441
|
+
private nativeFileSystemOutcome;
|
|
420
442
|
/**
|
|
421
443
|
* Local harness cwd for a session: per-send override, else the shared
|
|
422
444
|
* `agent.local.workspaceDir`, else `<agent.local.cwd>/<sessionId>`, else
|