@stigmer/runner 3.11.1-dev.20260812192248 → 3.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/.build-fingerprint +1 -1
  2. package/dist/activities/execute-cursor/attachment-resolver.d.ts +11 -0
  3. package/dist/activities/execute-cursor/attachment-resolver.js +8 -0
  4. package/dist/activities/execute-cursor/attachment-resolver.js.map +1 -1
  5. package/dist/activities/execute-cursor/blueprint-resolver.d.ts +1 -9
  6. package/dist/activities/execute-cursor/blueprint-resolver.js +0 -1
  7. package/dist/activities/execute-cursor/blueprint-resolver.js.map +1 -1
  8. package/dist/activities/execute-cursor/index.d.ts +6 -2
  9. package/dist/activities/execute-cursor/index.js +16 -32
  10. package/dist/activities/execute-cursor/index.js.map +1 -1
  11. package/dist/activities/execute-cursor/prompt-builder.d.ts +15 -11
  12. package/dist/activities/execute-cursor/prompt-builder.js +20 -10
  13. package/dist/activities/execute-cursor/prompt-builder.js.map +1 -1
  14. package/dist/activities/execute-deep-agent/attachment-injector.d.ts +34 -8
  15. package/dist/activities/execute-deep-agent/attachment-injector.js +111 -106
  16. package/dist/activities/execute-deep-agent/attachment-injector.js.map +1 -1
  17. package/dist/activities/execute-deep-agent/index.js +0 -15
  18. package/dist/activities/execute-deep-agent/index.js.map +1 -1
  19. package/dist/activities/execute-deep-agent/mcp-gate.d.ts +0 -2
  20. package/dist/activities/execute-deep-agent/mcp-gate.js +0 -1
  21. package/dist/activities/execute-deep-agent/mcp-gate.js.map +1 -1
  22. package/dist/activities/execute-deep-agent/prompt-builder.d.ts +7 -8
  23. package/dist/activities/execute-deep-agent/prompt-builder.js +25 -8
  24. package/dist/activities/execute-deep-agent/prompt-builder.js.map +1 -1
  25. package/dist/activities/execute-deep-agent/setup.d.ts +0 -10
  26. package/dist/activities/execute-deep-agent/setup.js +13 -45
  27. package/dist/activities/execute-deep-agent/setup.js.map +1 -1
  28. package/dist/config.d.ts +6 -5
  29. package/dist/config.js.map +1 -1
  30. package/dist/middleware/path-normalization.d.ts +15 -2
  31. package/dist/middleware/path-normalization.js +39 -5
  32. package/dist/middleware/path-normalization.js.map +1 -1
  33. package/dist/shared/artifact-storage.d.ts +11 -0
  34. package/dist/shared/artifact-storage.js +2 -0
  35. package/dist/shared/artifact-storage.js.map +1 -1
  36. package/dist/shared/attachment-download-urls.d.ts +62 -0
  37. package/dist/shared/attachment-download-urls.js +79 -0
  38. package/dist/shared/attachment-download-urls.js.map +1 -0
  39. package/dist/shared/channel-attachment.d.ts +1 -1
  40. package/dist/shared/channel-attachment.js +1 -1
  41. package/dist/shared/conversation-attachment.d.ts +2 -3
  42. package/dist/shared/conversation-attachment.js +2 -3
  43. package/dist/shared/conversation-attachment.js.map +1 -1
  44. package/dist/shared/mcp-enabled-tools.d.ts +6 -2
  45. package/dist/shared/mcp-enabled-tools.js +6 -2
  46. package/dist/shared/mcp-enabled-tools.js.map +1 -1
  47. package/dist/shared/mcp-transport-guard.d.ts +2 -2
  48. package/dist/shared/mcp-transport-guard.js +2 -2
  49. package/dist/shared/plan-mode-permissions.d.ts +46 -10
  50. package/dist/shared/plan-mode-permissions.js +56 -12
  51. package/dist/shared/plan-mode-permissions.js.map +1 -1
  52. package/dist/shared/synthesized-attachment.d.ts +4 -4
  53. package/dist/shared/synthesized-attachment.js +4 -4
  54. package/dist/shared/zip-extract.d.ts +24 -6
  55. package/dist/shared/zip-extract.js +31 -90
  56. package/dist/shared/zip-extract.js.map +1 -1
  57. package/dist/shared/zip-structure.d.ts +61 -0
  58. package/dist/shared/zip-structure.js +128 -0
  59. package/dist/shared/zip-structure.js.map +1 -0
  60. package/package.json +2 -2
  61. package/src/__test-utils__/fake-artifact-storage.ts +10 -1
  62. package/src/__test-utils__/zip-fixtures.ts +206 -0
  63. package/src/activities/execute-cursor/__tests__/attachment-resolver.test.ts +63 -3
  64. package/src/activities/execute-cursor/__tests__/build-prompt.test.ts +62 -29
  65. package/src/activities/execute-cursor/__tests__/skill-resolver.test.ts +3 -42
  66. package/src/activities/execute-cursor/attachment-resolver.ts +24 -0
  67. package/src/activities/execute-cursor/blueprint-resolver.ts +1 -10
  68. package/src/activities/execute-cursor/index.ts +22 -37
  69. package/src/activities/execute-cursor/prompt-builder.ts +38 -22
  70. package/src/activities/execute-deep-agent/__tests__/attachment-injector.test.ts +270 -126
  71. package/src/activities/execute-deep-agent/__tests__/hitl-reject.test.ts +0 -2
  72. package/src/activities/execute-deep-agent/__tests__/hitl-resume-approve-all.test.ts +0 -1
  73. package/src/activities/execute-deep-agent/__tests__/hitl-resume-history.test.ts +0 -1
  74. package/src/activities/execute-deep-agent/__tests__/mcp-gate.test.ts +2 -7
  75. package/src/activities/execute-deep-agent/__tests__/plan-mode-path-normalization.test.ts +246 -37
  76. package/src/activities/execute-deep-agent/__tests__/prompt-builder.test.ts +78 -2
  77. package/src/activities/execute-deep-agent/__tests__/sequential-gate-resume.test.ts +0 -1
  78. package/src/activities/execute-deep-agent/__tests__/subagent-plan-mode-permissions.test.ts +35 -4
  79. package/src/activities/execute-deep-agent/attachment-injector.ts +166 -143
  80. package/src/activities/execute-deep-agent/index.ts +0 -19
  81. package/src/activities/execute-deep-agent/mcp-gate.ts +0 -3
  82. package/src/activities/execute-deep-agent/prompt-builder.ts +38 -16
  83. package/src/activities/execute-deep-agent/setup.ts +13 -68
  84. package/src/config.ts +6 -5
  85. package/src/middleware/__tests__/path-normalization.test.ts +29 -3
  86. package/src/middleware/path-normalization.ts +42 -5
  87. package/src/shared/__tests__/artifact-storage.test.ts +9 -0
  88. package/src/shared/__tests__/attachment-download-urls.test.ts +70 -0
  89. package/src/shared/__tests__/channel-attachment.test.ts +2 -2
  90. package/src/shared/__tests__/plan-mode-permissions.test.ts +58 -0
  91. package/src/shared/__tests__/synthesized-attachment.test.ts +19 -41
  92. package/src/shared/__tests__/zip-extract.test.ts +106 -89
  93. package/src/shared/artifact-storage.ts +11 -0
  94. package/src/shared/attachment-download-urls.ts +98 -0
  95. package/src/shared/channel-attachment.ts +1 -1
  96. package/src/shared/conversation-attachment.ts +2 -3
  97. package/src/shared/mcp-enabled-tools.ts +6 -2
  98. package/src/shared/mcp-transport-guard.ts +2 -2
  99. package/src/shared/plan-mode-permissions.ts +59 -12
  100. package/src/shared/synthesized-attachment.ts +4 -4
  101. package/src/shared/zip-extract.ts +35 -117
  102. package/src/shared/zip-structure.ts +181 -0
  103. package/dist/shared/datastore-attachment.d.ts +0 -99
  104. package/dist/shared/datastore-attachment.js +0 -184
  105. package/dist/shared/datastore-attachment.js.map +0 -1
  106. package/src/activities/execute-deep-agent/__tests__/datastore-degradation.test.ts +0 -104
  107. package/src/shared/__tests__/datastore-attachment.test.ts +0 -293
  108. package/src/shared/datastore-attachment.ts +0 -209
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Workspace-relative path normalization for permission-rule-bearing graphs
3
- * (issue #429).
3
+ * (issues #429, #528).
4
4
  *
5
5
  * deepagents' permission enforcement canonicalizes tool-call paths BEFORE any
6
6
  * rule or backend runs, and its validation refuses non-absolute paths — on
@@ -20,13 +20,26 @@
20
20
  * resolves relative paths under the workspace root, so act mode keeps a
21
21
  * byte-zero delta.
22
22
  *
23
+ * It also supplies the workspace root when `ls`/`glob`/`grep` are called
24
+ * with NO path argument (issue #528). Those tools' schema default is "/" —
25
+ * the OS ROOT under the legacy backend — and the default is applied inside
26
+ * the tool, after this seam, so under the workspace read boundary a bare
27
+ * first `ls` would otherwise die with `permission denied for read on /`
28
+ * (the same first-turn degradation class #429 fixed). An EXPLICIT "/" is
29
+ * deliberately NOT rewritten: the model asked for the OS root, and the
30
+ * honest answer under plan mode's read boundary is the rules' denial —
31
+ * silently substituting workspace contents would be an answer to a
32
+ * different question.
33
+ *
23
34
  * Invariant — nothing becomes newly reachable: only paths whose resolution
24
35
  * stays INSIDE the workspace root are rewritten. Escaping relatives (`../x`)
25
36
  * and `~`-carrying paths are left raw so today's validation refusal keeps
26
37
  * speaking (a naive join would resolve `..` away and smuggle an out-of-root
27
38
  * read past validation), and absolute paths pass through byte-untouched.
28
39
  * The middleware converts false errors into correct behavior — never a
29
- * refusal into an allowance the rules didn't decide.
40
+ * refusal into an allowance the rules didn't decide. (The absent-path
41
+ * injection honors the same line: it narrows the tool's own OS-root default
42
+ * to the workspace, granting nothing the rules would refuse.)
30
43
  *
31
44
  * Tool matching is by bare built-in name, the house doctrine (an MCP server
32
45
  * is not expected to shadow a built-in name — see shared/tool-kind.ts); the
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Workspace-relative path normalization for permission-rule-bearing graphs
3
- * (issue #429).
3
+ * (issues #429, #528).
4
4
  *
5
5
  * deepagents' permission enforcement canonicalizes tool-call paths BEFORE any
6
6
  * rule or backend runs, and its validation refuses non-absolute paths — on
@@ -20,13 +20,26 @@
20
20
  * resolves relative paths under the workspace root, so act mode keeps a
21
21
  * byte-zero delta.
22
22
  *
23
+ * It also supplies the workspace root when `ls`/`glob`/`grep` are called
24
+ * with NO path argument (issue #528). Those tools' schema default is "/" —
25
+ * the OS ROOT under the legacy backend — and the default is applied inside
26
+ * the tool, after this seam, so under the workspace read boundary a bare
27
+ * first `ls` would otherwise die with `permission denied for read on /`
28
+ * (the same first-turn degradation class #429 fixed). An EXPLICIT "/" is
29
+ * deliberately NOT rewritten: the model asked for the OS root, and the
30
+ * honest answer under plan mode's read boundary is the rules' denial —
31
+ * silently substituting workspace contents would be an answer to a
32
+ * different question.
33
+ *
23
34
  * Invariant — nothing becomes newly reachable: only paths whose resolution
24
35
  * stays INSIDE the workspace root are rewritten. Escaping relatives (`../x`)
25
36
  * and `~`-carrying paths are left raw so today's validation refusal keeps
26
37
  * speaking (a naive join would resolve `..` away and smuggle an out-of-root
27
38
  * read past validation), and absolute paths pass through byte-untouched.
28
39
  * The middleware converts false errors into correct behavior — never a
29
- * refusal into an allowance the rules didn't decide.
40
+ * refusal into an allowance the rules didn't decide. (The absent-path
41
+ * injection honors the same line: it narrows the tool's own OS-root default
42
+ * to the workspace, granting nothing the rules would refuse.)
30
43
  *
31
44
  * Tool matching is by bare built-in name, the house doctrine (an MCP server
32
45
  * is not expected to shadow a built-in name — see shared/tool-kind.ts); the
@@ -38,9 +51,8 @@ import { isAbsolute, relative } from "node:path";
38
51
  import { resolveWorkspacePath } from "../shared/file-change.js";
39
52
  /**
40
53
  * The path-bearing argument of each deepagents built-in filesystem tool.
41
- * `ls`/`glob`/`grep` take a base directory `path` (defaulting to "/" when
42
- * omitted absolute, so untouched here); the file tools take `file_path`.
43
- * Confirmed against the installed deepagents' tool definitions.
54
+ * `ls`/`glob`/`grep` take a base directory `path`; the file tools take
55
+ * `file_path`. Confirmed against the installed deepagents' tool definitions.
44
56
  */
45
57
  const PATH_ARG_BY_TOOL = new Map([
46
58
  ["ls", "path"],
@@ -50,6 +62,14 @@ const PATH_ARG_BY_TOOL = new Map([
50
62
  ["write_file", "file_path"],
51
63
  ["edit_file", "file_path"],
52
64
  ]);
65
+ /**
66
+ * The tools whose path argument is optional with an OS-root ("/") schema
67
+ * default. When the model omits it, this middleware supplies the workspace
68
+ * root instead (issue #528). The file tools are deliberately excluded: an
69
+ * absent `file_path` is a genuine model error, and the tool's own input
70
+ * validation gives the better message.
71
+ */
72
+ const DIR_DEFAULTING_TOOLS = new Set(["ls", "glob", "grep"]);
53
73
  /**
54
74
  * Rewrite `raw` to its workspace-absolute form, or return undefined when the
55
75
  * value must be left untouched (absolute already, `~`-carrying, or escaping
@@ -91,6 +111,20 @@ export function createPathNormalizationMiddleware(config) {
91
111
  if (!argKey)
92
112
  return handler(request);
93
113
  const raw = request.toolCall.args[argKey];
114
+ // Absent base directory on ls/glob/grep: the middleware sees the
115
+ // model's raw args, BEFORE the tool's zod parse applies the "/"
116
+ // (OS root) schema default — so the omission must be filled here,
117
+ // where the workspace root is known. An explicit "/" is not this
118
+ // case and flows through to an honest rule denial (header doctrine).
119
+ if (raw == null && DIR_DEFAULTING_TOOLS.has(request.toolCall.name)) {
120
+ return handler({
121
+ ...request,
122
+ toolCall: {
123
+ ...request.toolCall,
124
+ args: { ...request.toolCall.args, [argKey]: rootDir },
125
+ },
126
+ });
127
+ }
94
128
  if (typeof raw !== "string")
95
129
  return handler(request);
96
130
  const normalized = normalizeWorkspacePathArg(raw, rootDir);
@@ -1 +1 @@
1
- {"version":3,"file":"path-normalization.js","sourceRoot":"","sources":["../../src/middleware/path-normalization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE;;;;;GAKG;AACH,MAAM,gBAAgB,GAAgC,IAAI,GAAG,CAAC;IAC5D,CAAC,IAAI,EAAE,MAAM,CAAC;IACd,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,WAAW,EAAE,WAAW,CAAC;IAC1B,CAAC,YAAY,EAAE,WAAW,CAAC;IAC3B,CAAC,WAAW,EAAE,WAAW,CAAC;CAC3B,CAAC,CAAC;AAOH;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,GAAW,EACX,OAAe;IAEf,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1D,wEAAwE;IACxE,wEAAwE;IACxE,wCAAwC;IACxC,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAEnD,MAAM,EAAE,YAAY,EAAE,GAAG,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAEnE,wEAAwE;IACxE,uEAAuE;IACvE,uEAAuE;IACvE,6BAA6B;IAC7B,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,EA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;aACF,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -23,6 +23,15 @@
23
23
  import type { Config } from "../config.js";
24
24
  import type { RetryOptions } from "./grpc-retry.js";
25
25
  export interface ArtifactStorage {
26
+ /**
27
+ * What kind of URL {@link getDownloadUrl} mints — self-described by the
28
+ * backend so consumers (the attachment hand-off prompt wording,
29
+ * attachment-download-urls.ts) can never disagree with the storage actually
30
+ * in use. "presigned": time-limited, single-object, remotely fetchable.
31
+ * "local-serve": the stigmer-server's unauthenticated loopback serve URL,
32
+ * reachable only from this machine.
33
+ */
34
+ readonly downloadUrlKind: "presigned" | "local-serve";
26
35
  upload(key: string, content: Buffer, contentType?: string): Promise<string>;
27
36
  getDownloadUrl(key: string): Promise<string>;
28
37
  /**
@@ -40,6 +49,7 @@ export interface ArtifactStorage {
40
49
  }
41
50
  export type ArtifactStorageType = "local" | "proxy";
42
51
  export declare class LocalArtifactStorage implements ArtifactStorage {
52
+ readonly downloadUrlKind: "local-serve";
43
53
  private readonly basePath;
44
54
  private readonly serveUrlBase;
45
55
  constructor(basePath: string, serveUrlBase: string);
@@ -71,6 +81,7 @@ export interface ProxyArtifactStorageOptions extends RetryOptions {
71
81
  readonly transferTimeoutMs?: number;
72
82
  }
73
83
  export declare class ProxyArtifactStorage implements ArtifactStorage {
84
+ readonly downloadUrlKind: "presigned";
74
85
  private readonly baseUrl;
75
86
  private readonly authTokenSource;
76
87
  /** Governs the proxy presign calls and the exists probe. */
@@ -26,6 +26,7 @@ import { homedir } from "node:os";
26
26
  import { fetchWithRetry } from "./http-retry.js";
27
27
  // ── Local Backend ────────────────────────────────────────────────────
28
28
  export class LocalArtifactStorage {
29
+ downloadUrlKind = "local-serve";
29
30
  basePath;
30
31
  serveUrlBase;
31
32
  constructor(basePath, serveUrlBase) {
@@ -102,6 +103,7 @@ const DEFAULT_RETRY = {
102
103
  transferTimeoutMs: 120_000,
103
104
  };
104
105
  export class ProxyArtifactStorage {
106
+ downloadUrlKind = "presigned";
105
107
  baseUrl;
106
108
  authTokenSource;
107
109
  /** Governs the proxy presign calls and the exists probe. */
@@ -1 +1 @@
1
- {"version":3,"file":"artifact-storage.js","sourceRoot":"","sources":["../../src/shared/artifact-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,OAAO,EAAE,cAAc,EAAyB,MAAM,iBAAiB,CAAC;AAuBxE,wEAAwE;AAExE,MAAM,OAAO,oBAAoB;IACd,QAAQ,CAAS;IACjB,YAAY,CAAS;IAEtC,YAAY,QAAgB,EAAE,YAAoB;QAChD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW,EAAE,OAAe,EAAE,YAAqB;QAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QAC7C,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,MAAM,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACnC,OAAO,GAAG,CAAC;IACb,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,GAAW;QAC9B,OAAO,GAAG,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,GAAW;QACxB,2EAA2E;QAC3E,4EA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AC,IAAI,CACV,4EAA4E;YAC5E,6EAA6E;YAC7E,wBAAwB,GAAG,CAAC,WAAW,UAAU,GAAG,CAAC,SAAS,IAAI;YAClE,mFAAmF;YACnF,iEAAiE,CAClE,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Download-URL hand-off for execution attachments (issue #532) — the single
3
+ * owner of the mint policy and the prompt wording that lets an agent pass an
4
+ * attachment to a tool whose backend cannot read the sandbox filesystem.
5
+ *
6
+ * Both harnesses (Cursor and deep-agent) materialize attachments to disk and
7
+ * list the workspace paths in their input-files prompt section; that story is
8
+ * unchanged and this module never touches it. What this module adds is the
9
+ * *remote hand-off* story: a per-attachment download URL, minted from the
10
+ * artifact storage the runner already downloads through, surfaced beside the
11
+ * path so the model can quote a short URL string in a tool-call argument
12
+ * instead of the impossible alternative (base64 through the model caps out in
13
+ * the tens of KB; real attachments run 2–8 MB).
14
+ *
15
+ * Mint rule: any attachment with a `storageKey` and a usable storage gets a
16
+ * URL, regardless of which branch materialized the bytes — this covers the
17
+ * local-mode fast path when an uploaded copy also exists. Attachments with no
18
+ * storage key (pure CLI-local files) and extracted ZIP entries (no
19
+ * attachment-level object) get no URL, and their listing is unchanged.
20
+ *
21
+ * Failure is non-fatal and silent in the prompt: the file IS materialized —
22
+ * only the remote hand-off affordance is absent — so a presign hiccup must
23
+ * not abort a turn the way a missing input does (the resolver/injector
24
+ * fail-hard doctrine covers inputs, not affordances). This mirrors how vision
25
+ * delivery degrades without killing materialization. The degrade is logged;
26
+ * the URL value itself is never logged (a presigned URL in the log pipeline
27
+ * would outlive its purpose).
28
+ *
29
+ * What the URL actually is depends on the storage backend, and the prompt
30
+ * must not overpromise: proxy storage mints genuinely presigned, time-limited,
31
+ * single-object URLs a remote service can fetch; local storage returns the
32
+ * stigmer-server's loopback serve URL, which only same-machine tools can
33
+ * reach. The backend self-describes via {@link ArtifactStorage.downloadUrlKind}
34
+ * and {@link downloadUrlDisclosureLine} words each kind honestly.
35
+ */
36
+ import type { ArtifactStorage } from "./artifact-storage.js";
37
+ /**
38
+ * What kind of URL a storage backend's `getDownloadUrl` mints. A property of
39
+ * the backend, not of the runner's execution mode: storage follows transport
40
+ * (see loadArtifactStorageConfig), so a local desktop runner on a cloud proxy
41
+ * mints real presigned URLs.
42
+ */
43
+ export type DownloadUrlKind = "presigned" | "local-serve";
44
+ /**
45
+ * Mint a download URL for one attachment, or `undefined` when there is
46
+ * nothing to mint (no key / no storage) or the mint fails (logged, non-fatal
47
+ * — see module doc). The caller spreads the result into its per-attachment
48
+ * record with the conditional-spread convention, so an unminted URL leaves no
49
+ * field behind.
50
+ */
51
+ export declare function mintAttachmentDownloadUrl(storage: ArtifactStorage | undefined, storageKey: string, filename: string): Promise<string | undefined>;
52
+ /**
53
+ * The shared hand-off wording both harnesses embed into their input-files
54
+ * prompt section when at least one listed file carries a download URL (each
55
+ * wraps it in its own section framing). Kept here so the two prompts never
56
+ * drift apart in what they promise the agent.
57
+ *
58
+ * Each kind is worded to its real capability. "Time-limited" is deliberately
59
+ * unquantified: the presign TTL belongs to the serving side (the cloud
60
+ * proxy's constant today) and hardcoding it here would silently drift.
61
+ */
62
+ export declare function downloadUrlDisclosureLine(kind: DownloadUrlKind): string;
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Download-URL hand-off for execution attachments (issue #532) — the single
3
+ * owner of the mint policy and the prompt wording that lets an agent pass an
4
+ * attachment to a tool whose backend cannot read the sandbox filesystem.
5
+ *
6
+ * Both harnesses (Cursor and deep-agent) materialize attachments to disk and
7
+ * list the workspace paths in their input-files prompt section; that story is
8
+ * unchanged and this module never touches it. What this module adds is the
9
+ * *remote hand-off* story: a per-attachment download URL, minted from the
10
+ * artifact storage the runner already downloads through, surfaced beside the
11
+ * path so the model can quote a short URL string in a tool-call argument
12
+ * instead of the impossible alternative (base64 through the model caps out in
13
+ * the tens of KB; real attachments run 2–8 MB).
14
+ *
15
+ * Mint rule: any attachment with a `storageKey` and a usable storage gets a
16
+ * URL, regardless of which branch materialized the bytes — this covers the
17
+ * local-mode fast path when an uploaded copy also exists. Attachments with no
18
+ * storage key (pure CLI-local files) and extracted ZIP entries (no
19
+ * attachment-level object) get no URL, and their listing is unchanged.
20
+ *
21
+ * Failure is non-fatal and silent in the prompt: the file IS materialized —
22
+ * only the remote hand-off affordance is absent — so a presign hiccup must
23
+ * not abort a turn the way a missing input does (the resolver/injector
24
+ * fail-hard doctrine covers inputs, not affordances). This mirrors how vision
25
+ * delivery degrades without killing materialization. The degrade is logged;
26
+ * the URL value itself is never logged (a presigned URL in the log pipeline
27
+ * would outlive its purpose).
28
+ *
29
+ * What the URL actually is depends on the storage backend, and the prompt
30
+ * must not overpromise: proxy storage mints genuinely presigned, time-limited,
31
+ * single-object URLs a remote service can fetch; local storage returns the
32
+ * stigmer-server's loopback serve URL, which only same-machine tools can
33
+ * reach. The backend self-describes via {@link ArtifactStorage.downloadUrlKind}
34
+ * and {@link downloadUrlDisclosureLine} words each kind honestly.
35
+ */
36
+ /**
37
+ * Mint a download URL for one attachment, or `undefined` when there is
38
+ * nothing to mint (no key / no storage) or the mint fails (logged, non-fatal
39
+ * — see module doc). The caller spreads the result into its per-attachment
40
+ * record with the conditional-spread convention, so an unminted URL leaves no
41
+ * field behind.
42
+ */
43
+ export async function mintAttachmentDownloadUrl(storage, storageKey, filename) {
44
+ if (!storageKey || !storage)
45
+ return undefined;
46
+ try {
47
+ return await storage.getDownloadUrl(storageKey);
48
+ }
49
+ catch (err) {
50
+ console.warn(`[attachment-download-urls] could not mint a download URL for ` +
51
+ `'${filename}' (key: ${storageKey}) — the file is materialized and the ` +
52
+ `turn proceeds without one: ${err instanceof Error ? err.message : String(err)}`);
53
+ return undefined;
54
+ }
55
+ }
56
+ /**
57
+ * The shared hand-off wording both harnesses embed into their input-files
58
+ * prompt section when at least one listed file carries a download URL (each
59
+ * wraps it in its own section framing). Kept here so the two prompts never
60
+ * drift apart in what they promise the agent.
61
+ *
62
+ * Each kind is worded to its real capability. "Time-limited" is deliberately
63
+ * unquantified: the presign TTL belongs to the serving side (the cloud
64
+ * proxy's constant today) and hardcoding it here would silently drift.
65
+ */
66
+ export function downloadUrlDisclosureLine(kind) {
67
+ switch (kind) {
68
+ case "presigned":
69
+ return ("Where a file lists a download URL, you can pass that URL to tools " +
70
+ "whose backends cannot read this workspace's filesystem (e.g. remote " +
71
+ "services) — the tool fetches the file's contents itself. These URLs " +
72
+ "are time-limited and each grants access to its single file only.");
73
+ case "local-serve":
74
+ return ("Where a file lists a download URL, it is served by the local Stigmer " +
75
+ "server and is reachable only from this machine — tools running on " +
76
+ "this machine can fetch it, but remote services cannot.");
77
+ }
78
+ }
79
+ //# sourceMappingURL=attachment-download-urls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment-download-urls.js","sourceRoot":"","sources":["../../src/shared/attachment-download-urls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAYH;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,OAAoC,EACpC,UAAkB,EAClB,QAAgB;IAEhB,IAAI,CAAC,UAAU,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC9C,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CACV,+DAA+D;YAC/D,IAAI,QAAQ,WAAW,UAAU,uCAAuC;YACxE,8BAA8B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CACjF,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAqB;IAC7D,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,WAAW;YACd,OAAO,CACL,oEAAoE;gBACpE,sEAAsE;gBACtE,sEAAsE;gBACtE,kEAAkE,CACnE,CAAC;QACJ,KAAK,aAAa;YAChB,OAAO,CACL,uEAAuE;gBACvE,oEAAoE;gBACpE,wDAAwD,CACzD,CAAC;IACN,CAAC;AACH,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The runner-synthesized channel messaging attachment (proactive-messaging
3
- * DD-006 D7/D8) — the datastore records attachment's structural twin.
3
+ * DD-006 D7/D8).
4
4
  *
5
5
  * When the control plane says an agent serves at least one
6
6
  * proactive-messaging channel (the `listMessagingChannels` discovery
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The runner-synthesized channel messaging attachment (proactive-messaging
3
- * DD-006 D7/D8) — the datastore records attachment's structural twin.
3
+ * DD-006 D7/D8).
4
4
  *
5
5
  * When the control plane says an agent serves at least one
6
6
  * proactive-messaging channel (the `listMessagingChannels` discovery
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * The runner-synthesized conversation participation attachment
3
- * (channel-conversations DD-008 D-c, A14) — the third synthesized
4
- * attachment, on the datastore module's shape (a cheap local predicate,
5
- * not the channel module's discovery machinery).
3
+ * (channel-conversations DD-008 D-c, A14) — a cheap local predicate,
4
+ * not the channel module's discovery machinery.
6
5
  *
7
6
  * When the session IS a live channel conversation, the runner
8
7
  * synthesizes ONE MCP attachment serving `escalate_to_human`, so the
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * The runner-synthesized conversation participation attachment
3
- * (channel-conversations DD-008 D-c, A14) — the third synthesized
4
- * attachment, on the datastore module's shape (a cheap local predicate,
5
- * not the channel module's discovery machinery).
3
+ * (channel-conversations DD-008 D-c, A14) — a cheap local predicate,
4
+ * not the channel module's discovery machinery.
6
5
  *
7
6
  * When the session IS a live channel conversation, the runner
8
7
  * synthesizes ONE MCP attachment serving `escalate_to_human`, so the
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-attachment.js","sourceRoot":"","sources":["../../src/shared/conversation-attachment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAKH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,sBAAsB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAExD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAA0C;IAE1C,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,CAAC;IACrD,OAAO,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gCAAgC,CAC9C,SAA6B,EAC7B,OAAqC;IAErC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,OAAO,CAAC,cAAc,KAAK,IAAI,IAAI,OAAO,CAAC,cAAc,KAAK,EAAE,EAAE,CAAC;QACrE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,mEAAmE;IACnE,OAAO;QACL,IAAI,EAAE,4BAA4B;QAClC,aAAa,EAAE,EAAE;QACjB,mBAAmB,EAAE,EAAE;QACvB,qBAAqB,EAAE,EAAE;QACzB,2BAA2B,EAAE,KAAK;QAClC,cAAc,EAAE,MAAM;QACtB,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,kBAAkB;QACpE,OAAO,EAAE,OAAO,CAAC,UAAU,KAAK,IAAI,IAAI,OAAO,CAAC,UAAU,KAAK,EAAE;YAC/D,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,OAAO,CAAC,UAAU,EAAE,EAAE;YACnD,CAAC,CAAC,SAAS;KACd,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"conversation-attachment.js","sourceRoot":"","sources":["../../src/shared/conversation-attachment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAKH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,sBAAsB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAExD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAA0C;IAE1C,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,CAAC;IACrD,OAAO,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gCAAgC,CAC9C,SAA6B,EAC7B,OAAqC;IAErC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,OAAO,CAAC,cAAc,KAAK,IAAI,IAAI,OAAO,CAAC,cAAc,KAAK,EAAE,EAAE,CAAC;QACrE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,mEAAmE;IACnE,OAAO;QACL,IAAI,EAAE,4BAA4B;QAClC,aAAa,EAAE,EAAE;QACjB,mBAAmB,EAAE,EAAE;QACvB,qBAAqB,EAAE,EAAE;QACzB,2BAA2B,EAAE,KAAK;QAClC,cAAc,EAAE,MAAM;QACtB,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,kBAAkB;QACpE,OAAO,EAAE,OAAO,CAAC,UAAU,KAAK,IAAI,IAAI,OAAO,CAAC,UAAU,KAAK,EAAE;YAC/D,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,OAAO,CAAC,UAAU,EAAE,EAAE;YACnD,CAAC,CAAC,SAAS;KACd,CAAC;AACJ,CAAC"}
@@ -21,8 +21,12 @@
21
21
  * identity space as the sub-agent McpAccess filter and the approval-policy
22
22
  * maps. An enabled name the server does not expose is warned and dropped
23
23
  * (enforce the intersection): the restriction still holds and the run
24
- * proceeds with the valid subset; apply-time validation against
25
- * discovered_capabilities is the server-side follow-up that catches typos.
24
+ * proceeds with the valid subset. The server-side half (issue #402) rejects
25
+ * such names at apply time once the referenced server has discovered
26
+ * capabilities (stigmer-server validateEnabledToolsStep /
27
+ * validateDefaultEnabledToolsStep); this runtime leniency remains the
28
+ * safety net for manifests applied before a server's first connect and for
29
+ * toolsets that changed since the last discovery.
26
30
  */
27
31
  /**
28
32
  * Compute the effective allow-list for one resolved MCP server.
@@ -21,8 +21,12 @@
21
21
  * identity space as the sub-agent McpAccess filter and the approval-policy
22
22
  * maps. An enabled name the server does not expose is warned and dropped
23
23
  * (enforce the intersection): the restriction still holds and the run
24
- * proceeds with the valid subset; apply-time validation against
25
- * discovered_capabilities is the server-side follow-up that catches typos.
24
+ * proceeds with the valid subset. The server-side half (issue #402) rejects
25
+ * such names at apply time once the referenced server has discovered
26
+ * capabilities (stigmer-server validateEnabledToolsStep /
27
+ * validateDefaultEnabledToolsStep); this runtime leniency remains the
28
+ * safety net for manifests applied before a server's first connect and for
29
+ * toolsets that changed since the last discovery.
26
30
  */
27
31
  /**
28
32
  * Compute the effective allow-list for one resolved MCP server.
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-enabled-tools.js","sourceRoot":"","sources":["../../src/shared/mcp-enabled-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;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"local" | "cloud", env?
45
45
  /**
46
46
  * Assert that a resolved MCP server's transport is allowed under the given
47
47
  * posture. Applies only to user-defined McpServer resources flowing through
48
- * the resolvers — the internal datastore attachment is synthesized
49
- * separately and is already HTTP in cloud mode.
48
+ * the resolvers — the internal synthesized attachments are built
49
+ * separately and are already HTTP in cloud mode.
50
50
  *
51
51
  * @throws McpTransportError when the posture forbids stdio and the server uses it
52
52
  */
@@ -54,8 +54,8 @@ export function resolveMcpTransportPosture(mode, env = process.env) {
54
54
  /**
55
55
  * Assert that a resolved MCP server's transport is allowed under the given
56
56
  * posture. Applies only to user-defined McpServer resources flowing through
57
- * the resolvers — the internal datastore attachment is synthesized
58
- * separately and is already HTTP in cloud mode.
57
+ * the resolvers — the internal synthesized attachments are built
58
+ * separately and are already HTTP in cloud mode.
59
59
  *
60
60
  * @throws McpTransportError when the posture forbids stdio and the server uses it
61
61
  */
@@ -2,12 +2,26 @@
2
2
  * The Plan-mode filesystem permission rules — the enforcement twin of
3
3
  * `plan-mode-prompt.ts` (which carries the instruction half of the contract).
4
4
  *
5
- * Plan mode is read-only BY CONSTRUCTION on the native harness: these rules
6
- * deny every filesystem write operation at the tool level so
7
- * write_file/edit_file cannot mutate the workspace regardless of what the
8
- * model was told. Rules are first-match-wins with a permissive default, so a
9
- * single deny-all-writes rule is sufficient. (The Cursor harness has no
10
- * tool-level lever and enforces plan mode via its prompt prefix instead.)
5
+ * Plan mode is contained BY CONSTRUCTION on the native harness: these rules
6
+ * deny every filesystem write everywhere AND scope reads to the session
7
+ * workspace (issue #528 — owner ruling: the workspace is plan mode's read
8
+ * boundary on cloud and desktop runners alike). Without the read boundary,
9
+ * model-provided absolute paths reached anywhere the process account could
10
+ * read the pod filesystem (including /proc/self/environ) on cloud runners,
11
+ * the user's whole home directory on desktop — while plan mode still carries
12
+ * exfiltration-capable tools (web_fetch, MCP). Rules are first-match-wins
13
+ * with a permissive default (deepagents' decidePathAccess), so order is
14
+ * load-bearing: the workspace read-allow must precede the read-deny.
15
+ *
16
+ * The workspace-root pattern is matched as a STRING against the raw tool-call
17
+ * path (micromatch, dot:true), before the backend touches disk. That is
18
+ * exactly why the legitimate out-of-workspace reads keep working: skills,
19
+ * attachments, and the approved plan live in the platform dir but are
20
+ * addressed through the `{workspace}/.stigmer` symlink (see
21
+ * shared/workspace/stigmer-link.ts), so their path strings are in-root even
22
+ * though the bytes are not. The same holds for multi-workspace local entries
23
+ * (`{workspace}/{name}` symlinks). A realpath-based boundary would break
24
+ * both; do not "harden" this into one.
11
25
  *
12
26
  * Applied in execute-deep-agent/setup.ts to the parent graph AND threaded
13
27
  * into every compiled sub-agent graph: deepagents' parent-permission
@@ -18,9 +32,9 @@
18
32
  *
19
33
  * Rules travel with a companion: every graph that carries them also installs
20
34
  * the path-normalization middleware (middleware/path-normalization.ts,
21
- * issue #429), because deepagents' rule validation refuses workspace-relative
22
- * paths outright without the shim, prompt-compliant relative READS die in
23
- * validation instead of just working. Both are derived from the same
35
+ * issues #429/#528), because deepagents' rule validation refuses
36
+ * workspace-relative paths outright and its `ls`/`glob`/`grep` schema default
37
+ * of "/" would deny the bare first listing. Both are derived from the same
24
38
  * expression at each composition site so they cannot drift apart.
25
39
  *
26
40
  * Invariant: never combine these rules with a shell-capable (sandbox)
@@ -30,4 +44,26 @@
30
44
  * for shell capability on both the parent and sub-agent backends.
31
45
  */
32
46
  import type { FilesystemPermission } from "deepagents";
33
- export declare const PLAN_MODE_PERMISSIONS: FilesystemPermission[];
47
+ /**
48
+ * Backslash-escape every character micromatch/picomatch treats as glob
49
+ * syntax, so the result matches the input literally. micromatch exports no
50
+ * escape API of its own, and this is correctness, not caution: an unescaped
51
+ * `(` in a desktop project path would make the workspace read-allow rule
52
+ * silently never match — bricking every plan-mode read for that workspace.
53
+ * Semantics are pinned end-to-end through deepagents' own matcher by the
54
+ * special-character workspace suite in plan-mode-path-normalization.test.ts.
55
+ */
56
+ export declare function escapeGlobLiteral(literal: string): string;
57
+ /**
58
+ * Build the plan-mode rule set for a graph whose filesystem backend is
59
+ * rooted at `workspaceRootDir`. The three rules read as the policy:
60
+ * reads allowed in the workspace, reads denied everywhere else, writes
61
+ * denied everywhere.
62
+ *
63
+ * `{root}/**` matches the root itself as well as its subtree (verified
64
+ * against the installed micromatch), so one allow pattern suffices. The
65
+ * root is `path.resolve`d first because enforcement canonicalizes incoming
66
+ * paths (collapsed slashes, no trailing separator) before matching — a
67
+ * trailing slash in the pattern would silently match nothing.
68
+ */
69
+ export declare function buildPlanModePermissions(workspaceRootDir: string): FilesystemPermission[];