@stigmer/runner 3.12.0 → 3.12.2
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/.build-fingerprint +1 -1
- package/dist/activities/execute-cursor/capture-flow.d.ts +5 -4
- package/dist/activities/execute-cursor/capture-flow.js +5 -4
- package/dist/activities/execute-cursor/capture-flow.js.map +1 -1
- package/dist/activities/execute-cursor/cas-observations.d.ts +10 -4
- package/dist/activities/execute-cursor/cas-observations.js +10 -4
- package/dist/activities/execute-cursor/cas-observations.js.map +1 -1
- package/dist/activities/execute-cursor/hook-script.js +39 -13
- package/dist/activities/execute-cursor/hook-script.js.map +1 -1
- package/dist/activities/execute-cursor/skill-resolver.d.ts +8 -0
- package/dist/activities/execute-cursor/skill-resolver.js +77 -26
- package/dist/activities/execute-cursor/skill-resolver.js.map +1 -1
- package/dist/activities/execute-deep-agent/attachment-injector.d.ts +23 -8
- package/dist/activities/execute-deep-agent/attachment-injector.js +104 -105
- package/dist/activities/execute-deep-agent/attachment-injector.js.map +1 -1
- package/dist/activities/execute-deep-agent/cas-capture-backend.d.ts +3 -1
- package/dist/activities/execute-deep-agent/cas-capture-backend.js +3 -1
- package/dist/activities/execute-deep-agent/cas-capture-backend.js.map +1 -1
- package/dist/activities/execute-deep-agent/prompt-builder.js +11 -1
- package/dist/activities/execute-deep-agent/prompt-builder.js.map +1 -1
- package/dist/activities/execute-deep-agent/setup.js +15 -3
- package/dist/activities/execute-deep-agent/setup.js.map +1 -1
- package/dist/activities/execute-deep-agent/subagent-wiring.js +16 -9
- package/dist/activities/execute-deep-agent/subagent-wiring.js.map +1 -1
- package/dist/activities/generate-session-subject.d.ts +80 -0
- package/dist/activities/generate-session-subject.js +283 -0
- package/dist/activities/generate-session-subject.js.map +1 -0
- package/dist/client/stigmer-client.d.ts +8 -0
- package/dist/client/stigmer-client.js +10 -0
- package/dist/client/stigmer-client.js.map +1 -1
- package/dist/middleware/approval-gate.d.ts +25 -10
- package/dist/middleware/approval-gate.js +33 -14
- package/dist/middleware/approval-gate.js.map +1 -1
- package/dist/middleware/otel-spans.d.ts +2 -1
- package/dist/middleware/otel-spans.js +2 -1
- package/dist/middleware/otel-spans.js.map +1 -1
- package/dist/middleware/path-normalization.d.ts +15 -2
- package/dist/middleware/path-normalization.js +39 -5
- package/dist/middleware/path-normalization.js.map +1 -1
- package/dist/runner-manager.js +3 -1
- package/dist/runner-manager.js.map +1 -1
- package/dist/runner.js +3 -1
- package/dist/runner.js.map +1 -1
- package/dist/shared/attachment-vision.js +9 -0
- package/dist/shared/attachment-vision.js.map +1 -1
- package/dist/shared/mcp-enabled-tools.d.ts +6 -2
- package/dist/shared/mcp-enabled-tools.js +6 -2
- package/dist/shared/mcp-enabled-tools.js.map +1 -1
- package/dist/shared/mcp-manager.js +8 -0
- package/dist/shared/mcp-manager.js.map +1 -1
- package/dist/shared/plan-mode-permissions.d.ts +46 -10
- package/dist/shared/plan-mode-permissions.js +56 -12
- package/dist/shared/plan-mode-permissions.js.map +1 -1
- package/dist/shared/zip-extract.d.ts +24 -6
- package/dist/shared/zip-extract.js +31 -90
- package/dist/shared/zip-extract.js.map +1 -1
- package/dist/shared/zip-structure.d.ts +61 -0
- package/dist/shared/zip-structure.js +128 -0
- package/dist/shared/zip-structure.js.map +1 -0
- package/package.json +2 -2
- package/src/__test-utils__/zip-fixtures.ts +206 -0
- package/src/activities/__tests__/generate-session-subject.test.ts +348 -0
- package/src/activities/execute-cursor/__tests__/hook-script.test.ts +60 -9
- package/src/activities/execute-cursor/__tests__/skill-resolver.test.ts +166 -49
- package/src/activities/execute-cursor/capture-flow.ts +5 -4
- package/src/activities/execute-cursor/cas-observations.ts +10 -4
- package/src/activities/execute-cursor/hook-script.ts +39 -13
- package/src/activities/execute-cursor/skill-resolver.ts +98 -31
- package/src/activities/execute-deep-agent/__tests__/attachment-injector.test.ts +165 -126
- package/src/activities/execute-deep-agent/__tests__/plan-mode-path-normalization.test.ts +246 -37
- package/src/activities/execute-deep-agent/__tests__/prompt-builder.test.ts +7 -2
- package/src/activities/execute-deep-agent/__tests__/subagent-plan-mode-permissions.test.ts +35 -4
- package/src/activities/execute-deep-agent/attachment-injector.ts +146 -142
- package/src/activities/execute-deep-agent/cas-capture-backend.ts +3 -1
- package/src/activities/execute-deep-agent/prompt-builder.ts +11 -1
- package/src/activities/execute-deep-agent/setup.ts +15 -3
- package/src/activities/execute-deep-agent/subagent-wiring.ts +16 -9
- package/src/activities/generate-session-subject.ts +370 -0
- package/src/client/stigmer-client.ts +11 -0
- package/src/middleware/__tests__/approval-gate.test.ts +130 -1
- package/src/middleware/__tests__/path-normalization.test.ts +29 -3
- package/src/middleware/approval-gate.ts +58 -24
- package/src/middleware/otel-spans.ts +2 -1
- package/src/middleware/path-normalization.ts +42 -5
- package/src/runner-manager.ts +3 -0
- package/src/runner.ts +3 -0
- package/src/shared/__tests__/attachment-vision.test.ts +4 -0
- package/src/shared/__tests__/mcp-manager.test.ts +7 -2
- package/src/shared/__tests__/plan-mode-permissions.test.ts +58 -0
- package/src/shared/__tests__/zip-extract.test.ts +106 -89
- package/src/shared/attachment-vision.ts +9 -0
- package/src/shared/filereview/__tests__/capture.test.ts +48 -0
- package/src/shared/mcp-enabled-tools.ts +6 -2
- package/src/shared/mcp-manager.ts +8 -0
- package/src/shared/plan-mode-permissions.ts +59 -12
- package/src/shared/zip-extract.ts +35 -117
- package/src/shared/zip-structure.ts +181 -0
package/dist/.build-fingerprint
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"hash":"
|
|
1
|
+
{"hash":"c5b58ddebabf1fc9","builtAt":"2026-08-13T18:01:33.891Z","fileCount":293}
|
|
@@ -58,10 +58,11 @@ export declare function captureBaselineToLedger(opts: {
|
|
|
58
58
|
* bytes withheld from durable storage.
|
|
59
59
|
*
|
|
60
60
|
* `deniedTokens` are the identities the hook gated this turn (shell/MCP, or a
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
61
|
+
* secret-like delete — non-secret CAS deletes flow since issue #303). A streamed
|
|
62
|
+
* file-edit row whose identity is in that set is left for the deny-gate
|
|
63
|
+
* reconcile path — it did NOT flow. A flowed gitignored write or delete is NOT
|
|
64
|
+
* in that set (the hook allowed it), so it is stamped like any other flowed
|
|
65
|
+
* edit and its captured delta surfaces as a CAS entry in the set.
|
|
65
66
|
*
|
|
66
67
|
* `hitlDir`/`storage` are omitted only by callers with no artifact storage
|
|
67
68
|
* (captureIgnored off); the CAS half is then skipped and this is a git-only
|
|
@@ -79,10 +79,11 @@ export function captureBaselineToLedger(opts) {
|
|
|
79
79
|
* bytes withheld from durable storage.
|
|
80
80
|
*
|
|
81
81
|
* `deniedTokens` are the identities the hook gated this turn (shell/MCP, or a
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
82
|
+
* secret-like delete — non-secret CAS deletes flow since issue #303). A streamed
|
|
83
|
+
* file-edit row whose identity is in that set is left for the deny-gate
|
|
84
|
+
* reconcile path — it did NOT flow. A flowed gitignored write or delete is NOT
|
|
85
|
+
* in that set (the hook allowed it), so it is stamped like any other flowed
|
|
86
|
+
* edit and its captured delta surfaces as a CAS entry in the set.
|
|
86
87
|
*
|
|
87
88
|
* `hitlDir`/`storage` are omitted only by callers with no artifact storage
|
|
88
89
|
* (captureIgnored off); the CAS half is then skipped and this is a git-only
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture-flow.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/capture-flow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EACL,qBAAqB,IAAI,2BAA2B,EACpD,uBAAuB,IAAI,6BAA6B,EACxD,wBAAwB,IAAI,8BAA8B,GAE3D,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAE9B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,0BAA0B,GAG3B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,aAAa,EAAuB,MAAM,0CAA0C,CAAC;AAM9F,oFAAoF;AACpF,MAAM,UAAU,GAAG,QAAQ,CAAC;AAE5B;;;;;GAKG;AACH,MAAM,yBAAyB,GAAsB;IACnD,oBAAoB;IACpB,yCAAyC;CAC1C,CAAC;AAEF,iFAAiF;AACjF,mFAAmF;AACnF,gFAAgF;AAChF,qBAAqB;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAOvC;IACC,OAAO,6BAA6B,CAAC;QACnC,GAAG,IAAI;QACP,SAAS,EAAE,UAAU;QACrB,YAAY,EAAE,yBAAyB;KACxC,CAAC,CAAC;AACL,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"capture-flow.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/capture-flow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kB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AE,CAAC,IAAI,IAAI,EAAE,CAA4B,CAAC;YACxD,MAAM,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;YACzD,MAAM,KAAK,GAAG,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;YACpE,IAAI,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC;gBAAE,SAAS,CAAC,mCAAmC;YAC1E,gBAAgB,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The Cursor harness's disk-backed observer for
|
|
2
|
+
* The Cursor harness's disk-backed observer for CAS-owned file mutations —
|
|
3
|
+
* gitignored / non-git writes, and (issue #303) pre-delete byte capture — the
|
|
3
4
|
* out-of-process analog of the deep-agent `CasCaptureFilesystemBackend`
|
|
4
5
|
* ({@link ../execute-deep-agent/cas-capture-backend.js}).
|
|
5
6
|
*
|
|
@@ -87,14 +88,19 @@ export declare function readCasObservations(hitlDir: string): Promise<CasObserva
|
|
|
87
88
|
export declare function buildSecretClassifyScript(): string;
|
|
88
89
|
/**
|
|
89
90
|
* Build the standalone Node.js script the hook runs to observe a single
|
|
90
|
-
*
|
|
91
|
-
* `recordBefore` plus the DD-E secret gate.
|
|
91
|
+
* CAS-owned mutation — the disk-backed mirror of `CasCaptureFilesystemBackend`'s
|
|
92
|
+
* `recordBefore` plus the DD-E secret gate. Staging is mutation-agnostic: it
|
|
93
|
+
* records the PRE-mutation bytes, so the hook runs it for a write/edit and —
|
|
94
|
+
* issue #303 — for a delete (whose before-bytes exist only until the tool runs;
|
|
95
|
+
* the boundary later reads after=null and authors the DELETE). The hook's
|
|
96
|
+
* delete arm pre-classifies secrets and never invokes this for a secret-like
|
|
97
|
+
* delete (a gated delete must not leave a "secret" marker in the sidecar).
|
|
92
98
|
*
|
|
93
99
|
* Invoked as `printf %s "$SALIENT" | node -e '<this>' <workspaceRoot> <obsDir>`
|
|
94
100
|
* — the (arbitrary) salient path arrives on stdin so no argv escaping is needed;
|
|
95
101
|
* the two absolute paths ride argv. Prints one token on stdout for the hook:
|
|
96
102
|
* - `captured` — non-secret: staged the pre-turn bytes (first-touch-wins), the
|
|
97
|
-
* hook then ALLOWS the
|
|
103
|
+
* hook then ALLOWS the mutation to flow;
|
|
98
104
|
* - `secret` — secret-like: recorded a content-less marker, the hook then
|
|
99
105
|
* DENIES with the security message (nothing is written);
|
|
100
106
|
* - `error` — the path escaped the workspace or a filesystem error occurred,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The Cursor harness's disk-backed observer for
|
|
2
|
+
* The Cursor harness's disk-backed observer for CAS-owned file mutations —
|
|
3
|
+
* gitignored / non-git writes, and (issue #303) pre-delete byte capture — the
|
|
3
4
|
* out-of-process analog of the deep-agent `CasCaptureFilesystemBackend`
|
|
4
5
|
* ({@link ../execute-deep-agent/cas-capture-backend.js}).
|
|
5
6
|
*
|
|
@@ -162,14 +163,19 @@ export function buildSecretClassifyScript() {
|
|
|
162
163
|
}
|
|
163
164
|
/**
|
|
164
165
|
* Build the standalone Node.js script the hook runs to observe a single
|
|
165
|
-
*
|
|
166
|
-
* `recordBefore` plus the DD-E secret gate.
|
|
166
|
+
* CAS-owned mutation — the disk-backed mirror of `CasCaptureFilesystemBackend`'s
|
|
167
|
+
* `recordBefore` plus the DD-E secret gate. Staging is mutation-agnostic: it
|
|
168
|
+
* records the PRE-mutation bytes, so the hook runs it for a write/edit and —
|
|
169
|
+
* issue #303 — for a delete (whose before-bytes exist only until the tool runs;
|
|
170
|
+
* the boundary later reads after=null and authors the DELETE). The hook's
|
|
171
|
+
* delete arm pre-classifies secrets and never invokes this for a secret-like
|
|
172
|
+
* delete (a gated delete must not leave a "secret" marker in the sidecar).
|
|
167
173
|
*
|
|
168
174
|
* Invoked as `printf %s "$SALIENT" | node -e '<this>' <workspaceRoot> <obsDir>`
|
|
169
175
|
* — the (arbitrary) salient path arrives on stdin so no argv escaping is needed;
|
|
170
176
|
* the two absolute paths ride argv. Prints one token on stdout for the hook:
|
|
171
177
|
* - `captured` — non-secret: staged the pre-turn bytes (first-touch-wins), the
|
|
172
|
-
* hook then ALLOWS the
|
|
178
|
+
* hook then ALLOWS the mutation to flow;
|
|
173
179
|
* - `secret` — secret-like: recorded a content-less marker, the hook then
|
|
174
180
|
* DENIES with the security message (nothing is written);
|
|
175
181
|
* - `error` — the path escaped the workspace or a filesystem error occurred,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cas-observations.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/cas-observations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cas-observations.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/cas-observations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAEzG,yDAAyD;AACzD,MAAM,CAAC,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAE3D,iFAAiF;AACjF,MAAM,WAAW,GAAG,YAAY,CAAC;AACjC,8EAA8E;AAC9E,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B,kEAAkE;AAClE,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,OAAO,IAAI,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;AACjD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,o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,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO;QACL,wFAAwF;QACxF,GAAG,wBAAwB,EAAE;QAC7B,wDAAwD;KACzD,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,6BAA6B;IAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC/C,OAAO;QACL,mFAAmF;QACnF,oEAAoE;QACpE,6EAA6E;QAC7E,uEAAuE;QACvE,2EAA2E;QAC3E,4EAA4E;QAC5E,8EAA8E;QAC9E,iEAAiE;QACjE,yCAAyC;QACzC,8DAA8D;QAC9D,6FAA6F;QAC7F,uEAAuE;QACvE,GAAG,wBAAwB,EAAE;QAC7B,yEAAyE;QACzE,uCAAuC,UAAU,yCAAyC,UAAU,IAAI;QACxG,uDAAuD;QACvD,6EAA6E;QAC7E,mKAAmK;QACnK,0EAA0E;QAC1E,mEAAmE;QACnE,gFAAgF;QAChF,8EAA8E;QAC9E,gEAAgE;QAChE,0GAA0G;QAC1G,yEAAyE;QACzE,wEAAwE;QACxE,2RAA2R;QAC3R,mCAAmC;KACpC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACb,CAAC"}
|
|
@@ -557,9 +557,8 @@ if echo "$STATE" | grep -q '"captureIgnored":true'; then
|
|
|
557
557
|
fi
|
|
558
558
|
# gitWorkspace selects the capture substrate (Slice 2c). Default true when the
|
|
559
559
|
# key is absent (older state files). When false the workspace is NOT a git tree:
|
|
560
|
-
# there is no git snapshot, so EVERY file write is CAS-staged below (not
|
|
561
|
-
# gitignored ones)
|
|
562
|
-
# (no CAS delete-capture path, parity with the deep-agent).
|
|
560
|
+
# there is no git snapshot, so EVERY file write/delete is CAS-staged below (not
|
|
561
|
+
# only gitignored ones) and the git-tracked flow arm is skipped.
|
|
563
562
|
GIT_WORKSPACE=true
|
|
564
563
|
if echo "$STATE" | grep -q '"gitWorkspace":false'; then
|
|
565
564
|
GIT_WORKSPACE=false
|
|
@@ -580,9 +579,10 @@ fi
|
|
|
580
579
|
# secret-like one must be hard-blocked in every mode. WHICH writes are CAS-owned
|
|
581
580
|
# depends on the substrate: in a git tree it is only the GITIGNORED writes (git
|
|
582
581
|
# captures the tracked ones); in a NON-GIT workspace it is EVERY write (there is
|
|
583
|
-
# no git snapshot). Only a built-in write/edit (category "write") takes
|
|
584
|
-
# deletes
|
|
585
|
-
# approval gate). The staging runs on
|
|
582
|
+
# no git snapshot). Only a built-in write/edit (category "write") takes THIS arm;
|
|
583
|
+
# deletes take their own staging arm just below (issue #303), shell/MCP stay on
|
|
584
|
+
# the deny-gate (parity with the deep-agent approval gate). The staging runs on
|
|
585
|
+
# the runner's own Node binary (the
|
|
586
586
|
# disk-backed mirror of CasCaptureFilesystemBackend.recordBefore): the salient
|
|
587
587
|
# path rides stdin (no argv escaping), the workspace root and the per-turn
|
|
588
588
|
# cas-observations dir ride argv. "captured" -> allow (apply-then-review);
|
|
@@ -612,6 +612,32 @@ if [ "$CAPTURE_IGNORED" = "true" ] && [ "$CATEGORY" = "write" ] && [ -n "$SALIEN
|
|
|
612
612
|
fi
|
|
613
613
|
fi
|
|
614
614
|
|
|
615
|
+
# --- Capture mode: observe CAS-owned deletes for review (issue #303) --------
|
|
616
|
+
# The delete twin of the write arm above — a non-secret CAS-owned delete stages
|
|
617
|
+
# its before-bytes (the one moment they still exist on disk) and flows; the
|
|
618
|
+
# turn boundary then reads after=null and authors a reviewable, restorable
|
|
619
|
+
# DELETE entry. One deliberate difference from the write arm: the path is
|
|
620
|
+
# classified for secret-likeness BEFORE any staging touches the sidecar. A
|
|
621
|
+
# secret-like delete must stay on the deny-gate below where a human may still
|
|
622
|
+
# approve it (its args expose no secret content, unlike a write) — staging it
|
|
623
|
+
# would both persist the secret before-bytes and mark the sidecar "secret",
|
|
624
|
+
# making the boundary author a blocking DIFF_UNREVIEWABLE for a merely-gated
|
|
625
|
+
# delete. Every failure mode (secret, classify error, staging error) falls
|
|
626
|
+
# through to the deny-gate rather than denying here, so grants and leases keep
|
|
627
|
+
# applying to a gated delete exactly as before this arm existed; the eventual
|
|
628
|
+
# resolution records its own ledger kind.
|
|
629
|
+
if [ "$CAPTURE_IGNORED" = "true" ] && [ "$CATEGORY" = "delete" ] && [ -n "$SALIENT" ] && { [ "$GIT_WORKSPACE" = "false" ] || __stigmer_is_gitignored "$SALIENT"; }; then
|
|
630
|
+
DELETE_SECRET_RESULT=$(printf '%s' "$SALIENT" | ELECTRON_RUN_AS_NODE=1 "$NODE_BIN" -e '${secretClassifyScript}' 2>/dev/null || echo error)
|
|
631
|
+
if [ "$DELETE_SECRET_RESULT" = "ok" ]; then
|
|
632
|
+
OBS_DIR="$(dirname "$STATE_FILE")/${CAS_OBSERVATIONS_DIRNAME}"
|
|
633
|
+
OBS_RESULT=$(printf '%s' "$SALIENT" | ELECTRON_RUN_AS_NODE=1 "$NODE_BIN" -e '${observationStagingScript}' "$GIT_ROOT" "$OBS_DIR" 2>/dev/null || echo error)
|
|
634
|
+
if [ "$OBS_RESULT" = "captured" ]; then
|
|
635
|
+
echo '{"permission":"allow"}'
|
|
636
|
+
exit 0
|
|
637
|
+
fi
|
|
638
|
+
fi
|
|
639
|
+
fi
|
|
640
|
+
|
|
615
641
|
# --- 1a. MCP capability manifest: enabled_tools (issue #350) ---
|
|
616
642
|
# Runs BEFORE the auto-approve-all shortcut and every grant check because
|
|
617
643
|
# enabled_tools is a capability manifest, not an approval gate: no bypass may
|
|
@@ -683,13 +709,13 @@ if [ -n "$CATEGORY" ]; then
|
|
|
683
709
|
# Capture mode (GIT tree only): a git-tracked file mutation (write/edit/delete)
|
|
684
710
|
# flows freely — the runner captures the whole change set with git at the turn
|
|
685
711
|
# boundary and gates it per-file for review. A gitignored path is invisible to
|
|
686
|
-
# that git snapshot: a non-secret gitignored WRITE was already
|
|
687
|
-
# (staged + allowed,
|
|
688
|
-
# reaches the deny-gate when captureIgnored
|
|
689
|
-
#
|
|
690
|
-
# (category "shell") never takes this branch
|
|
691
|
-
# NON-GIT workspace this arm is skipped
|
|
692
|
-
#
|
|
712
|
+
# that git snapshot: a non-secret gitignored WRITE or DELETE was already
|
|
713
|
+
# handled above (staged + allowed, hard-blocked, or left to fall through) when
|
|
714
|
+
# captureIgnored is on; here it only reaches the deny-gate when captureIgnored
|
|
715
|
+
# is off (no artifact storage), or it is a secret-like DELETE (approvable, but
|
|
716
|
+
# never staged — issue #303). shell (category "shell") never takes this branch
|
|
717
|
+
# and stays gated as always. In a NON-GIT workspace this arm is skipped
|
|
718
|
+
# entirely (there is no git diff): writes and deletes were CAS-staged above.
|
|
693
719
|
if [ "$CAPTURE_MODE" = "true" ] && [ "$GIT_WORKSPACE" = "true" ] && { [ "$CATEGORY" = "write" ] || [ "$CATEGORY" = "delete" ]; }; then
|
|
694
720
|
if ! __stigmer_is_gitignored "$SALIENT"; then
|
|
695
721
|
echo '{"permission":"allow"}'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-script.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/hook-script.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6GG;AAEH,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EACL,eAAe,EACf,eAAe,EACf,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAE3H,6EAA6E;AAC7E,4EAA4E;AAC5E,2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B;;;;oDAI/B,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sFAsCG,oBAAoB;;;;;oDAKtD,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;kDA2B9B,6BAA6B;;;;gDAI/B,+BAA+B;;;;;;;;;CAS9E,CAAC;AACF,CAAC"}
|
|
@@ -7,6 +7,14 @@
|
|
|
7
7
|
* - Uses a platform-managed directory outside the workspace
|
|
8
8
|
* - Ensures the workspace `.stigmer` symlink (see stigmer-link.ts)
|
|
9
9
|
* - Returns metadata for prompt injection
|
|
10
|
+
*
|
|
11
|
+
* The mount is cached by the skill's content-addressed version hash
|
|
12
|
+
* (stigmer/stigmer#672): metadata is fetched on every execution (that keeps
|
|
13
|
+
* latest-version freshness), but the artifact download and file rewrite are
|
|
14
|
+
* skipped when the mounted content's hash already matches. The session's
|
|
15
|
+
* platform dir survives across executions, so on an active session every
|
|
16
|
+
* message after the first pays a metadata read instead of a full artifact
|
|
17
|
+
* transfer.
|
|
10
18
|
*/
|
|
11
19
|
import type { StigmerClient } from "../../client/stigmer-client.js";
|
|
12
20
|
import type { ApiResourceReference } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
@@ -7,13 +7,27 @@
|
|
|
7
7
|
* - Uses a platform-managed directory outside the workspace
|
|
8
8
|
* - Ensures the workspace `.stigmer` symlink (see stigmer-link.ts)
|
|
9
9
|
* - Returns metadata for prompt injection
|
|
10
|
+
*
|
|
11
|
+
* The mount is cached by the skill's content-addressed version hash
|
|
12
|
+
* (stigmer/stigmer#672): metadata is fetched on every execution (that keeps
|
|
13
|
+
* latest-version freshness), but the artifact download and file rewrite are
|
|
14
|
+
* skipped when the mounted content's hash already matches. The session's
|
|
15
|
+
* platform dir survives across executions, so on an active session every
|
|
16
|
+
* message after the first pays a metadata read instead of a full artifact
|
|
17
|
+
* transfer.
|
|
10
18
|
*/
|
|
11
|
-
import { mkdir, writeFile, rm } from "node:fs/promises";
|
|
19
|
+
import { mkdir, readFile, writeFile, rm } from "node:fs/promises";
|
|
12
20
|
import { join, dirname } from "node:path";
|
|
13
21
|
import { getPlatformDir } from "../../shared/workspace/platform-dir.js";
|
|
14
22
|
import { extractZipFileEntries } from "../../shared/zip-extract.js";
|
|
15
23
|
import { ensureStigmerSymlink, STIGMER_LOCAL_STATE_DIR } from "../../shared/workspace/stigmer-link.js";
|
|
16
24
|
const SKILLS_SUBDIR = "skills";
|
|
25
|
+
/**
|
|
26
|
+
* Marker recording what a skill's mount directory currently holds. Written
|
|
27
|
+
* LAST, after every file of the mount landed — a crash mid-write leaves no
|
|
28
|
+
* marker, so the next execution remounts instead of trusting a partial tree.
|
|
29
|
+
*/
|
|
30
|
+
const MOUNT_MARKER_FILE = ".stigmer-mount.json";
|
|
17
31
|
/**
|
|
18
32
|
* Resolve skill references into written SKILL.md files and prompt metadata.
|
|
19
33
|
*
|
|
@@ -37,8 +51,27 @@ export async function resolveSkills(client, skillRefs, options) {
|
|
|
37
51
|
for (const ref of skillRefs) {
|
|
38
52
|
try {
|
|
39
53
|
const skill = await client.getSkillByReference(ref);
|
|
54
|
+
const spec = skill.spec;
|
|
55
|
+
if (!spec?.skillMd) {
|
|
56
|
+
console.warn(`[resolveSkills] skill ${ref.org}/${ref.slug} fetched but had no skillMd content`);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const name = spec.name || skill.metadata?.slug || "unknown";
|
|
60
|
+
const skillDir = join(skillsDir, name);
|
|
61
|
+
const versionHash = skill.status?.versionHash ?? "";
|
|
62
|
+
const wantsArtifact = Boolean(skill.status?.artifactStorageKey);
|
|
63
|
+
const meta = {
|
|
64
|
+
name,
|
|
65
|
+
description: spec.description || `Skill: ${name}`,
|
|
66
|
+
path: join(STIGMER_LOCAL_STATE_DIR, SKILLS_SUBDIR, name, "SKILL.md"),
|
|
67
|
+
};
|
|
68
|
+
if (versionHash !== "" && (await mountIsFresh(skillDir, versionHash, wantsArtifact))) {
|
|
69
|
+
results.push(meta);
|
|
70
|
+
console.log(`[resolveSkills] mount cache hit: ${name} (version ${versionHash.slice(0, 12)}) — skipping artifact transfer`);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
40
73
|
let artifactBytes;
|
|
41
|
-
if (
|
|
74
|
+
if (wantsArtifact) {
|
|
42
75
|
try {
|
|
43
76
|
const resp = await client.getSkillArtifact(skill.status.artifactStorageKey);
|
|
44
77
|
if (resp.artifact && resp.artifact.length > 0) {
|
|
@@ -50,14 +83,9 @@ export async function resolveSkills(client, skillRefs, options) {
|
|
|
50
83
|
`falling back to SKILL.md only: ${err instanceof Error ? err.message : err}`);
|
|
51
84
|
}
|
|
52
85
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
console.log(`[resolveSkills] wrote skill: ${meta.name} -> ${meta.path}`);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
console.warn(`[resolveSkills] skill ${ref.org}/${ref.slug} fetched but had no skillMd content`);
|
|
60
|
-
}
|
|
86
|
+
await writeSkillMount(skill, skillDir, artifactBytes);
|
|
87
|
+
results.push(meta);
|
|
88
|
+
console.log(`[resolveSkills] wrote skill: ${name} -> ${meta.path}`);
|
|
61
89
|
}
|
|
62
90
|
catch (err) {
|
|
63
91
|
console.warn(`[resolveSkills] failed to resolve skill ${ref.org}/${ref.slug}: ${err instanceof Error ? err.message : err}`);
|
|
@@ -66,29 +94,52 @@ export async function resolveSkills(client, skillRefs, options) {
|
|
|
66
94
|
console.log(`[resolveSkills] completed: ${results.length}/${skillRefs.length} skills resolved`);
|
|
67
95
|
return results;
|
|
68
96
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Whether the mount at `skillDir` already holds this version's content.
|
|
99
|
+
*
|
|
100
|
+
* Fresh means: the marker's hash matches AND the mount isn't a degraded
|
|
101
|
+
* SKILL.md-only fallback when the skill does carry an artifact. Any read or
|
|
102
|
+
* parse failure counts as stale — the remount is the safe default.
|
|
103
|
+
*/
|
|
104
|
+
async function mountIsFresh(skillDir, versionHash, wantsArtifact) {
|
|
105
|
+
try {
|
|
106
|
+
const raw = await readFile(join(skillDir, MOUNT_MARKER_FILE), "utf-8");
|
|
107
|
+
const marker = JSON.parse(raw);
|
|
108
|
+
return marker.versionHash === versionHash && (marker.artifactMounted === true || !wantsArtifact);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* (Re)write a skill's mount directory from scratch.
|
|
116
|
+
*
|
|
117
|
+
* The directory is removed first so files deleted between versions don't
|
|
118
|
+
* linger in the mount, then SKILL.md and the artifact files are written, and
|
|
119
|
+
* the marker is stamped LAST (see MOUNT_MARKER_FILE for the crash-safety
|
|
120
|
+
* contract). SKILL.md always comes from `spec.skillMd` — the server's
|
|
121
|
+
* authoritative copy — never from the zip; both the zip's SKILL.md and any
|
|
122
|
+
* stray marker-named entry are excluded from extraction so the mount's
|
|
123
|
+
* ownership of those two files is unconditional.
|
|
124
|
+
*/
|
|
125
|
+
async function writeSkillMount(skill, skillDir, artifactBytes) {
|
|
126
|
+
await rm(skillDir, { recursive: true, force: true });
|
|
75
127
|
await mkdir(skillDir, { recursive: true });
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
const entries = await extractZipFileEntries(artifactBytes, { exclude: ["SKILL.md"] });
|
|
128
|
+
await writeFile(join(skillDir, "SKILL.md"), skill.spec.skillMd, "utf-8");
|
|
129
|
+
const artifactMounted = artifactBytes !== undefined && artifactBytes.length > 0;
|
|
130
|
+
if (artifactMounted) {
|
|
131
|
+
const entries = await extractZipFileEntries(artifactBytes, { exclude: ["SKILL.md", MOUNT_MARKER_FILE] });
|
|
80
132
|
for (const entry of entries) {
|
|
81
133
|
const filePath = join(skillDir, entry.path);
|
|
82
134
|
await mkdir(dirname(filePath), { recursive: true });
|
|
83
135
|
await writeFile(filePath, entry.content, "utf-8");
|
|
84
136
|
}
|
|
85
137
|
}
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
};
|
|
138
|
+
const versionHash = skill.status?.versionHash ?? "";
|
|
139
|
+
if (versionHash !== "") {
|
|
140
|
+
const marker = { versionHash, artifactMounted };
|
|
141
|
+
await writeFile(join(skillDir, MOUNT_MARKER_FILE), JSON.stringify(marker), "utf-8");
|
|
142
|
+
}
|
|
92
143
|
}
|
|
93
144
|
/**
|
|
94
145
|
* Clean up platform-managed skill directory for a session.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-resolver.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/skill-resolver.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"skill-resolver.js","sourceRoot":"","sources":["../../../src/activities/execute-cursor/skill-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAK1C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEvG,MAAM,aAAa,GAAG,QAAQ,CAAC;AAE/B;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAmBhD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAqB,EACrB,SAAiC,EACjC,OAA6B;IAE7B,OAAO,CAAC,GAAG,CACT,6BAA6B,OAAO,CAAC,SAAS,IAAI;QAClD,u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,MAAM,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IAC9C,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IAAC,MAAM,CAAC;QACP,cAAc;IAChB,CAAC;AACH,CAAC"}
|
|
@@ -5,13 +5,23 @@
|
|
|
5
5
|
* validates ZIP archives with security guards, and writes files into the
|
|
6
6
|
* workspace via the platform mount namespace (.stigmer/inputs/).
|
|
7
7
|
*
|
|
8
|
-
* Security model: attachments are untrusted user uploads.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* Security model: attachments are untrusted user uploads. ZIP archives are
|
|
9
|
+
* parsed from the central directory — the format's authoritative index —
|
|
10
|
+
* via the shared structural layer (shared/zip-structure.ts; issue #567,
|
|
11
|
+
* which killed this module's local-header walk: it silently truncated
|
|
12
|
+
* stored streaming entries and rejected Go-default archives outright).
|
|
13
|
+
* Every entry is validated for path traversal, zip bombs, and format
|
|
14
|
+
* integrity BEFORE any extraction occurs, and because the central
|
|
15
|
+
* directory's sizes are declarations an attacker controls, decompression
|
|
16
|
+
* re-enforces them: an entry whose actual output disagrees with its
|
|
17
|
+
* declared size aborts the injection.
|
|
11
18
|
*
|
|
12
19
|
* Error model: fail-hard. Any attachment failure aborts the entire injection
|
|
13
20
|
* and propagates a descriptive error. Attachments are explicit user inputs —
|
|
14
|
-
* running with partial inputs produces silently incorrect results.
|
|
21
|
+
* running with partial inputs produces silently incorrect results. This is
|
|
22
|
+
* deliberately the OPPOSITE policy from the skill-artifact reader
|
|
23
|
+
* (shared/zip-extract.ts, non-fatal empty return): skill artifacts were
|
|
24
|
+
* structurally vouched for by the push gates, attachments never are.
|
|
15
25
|
*
|
|
16
26
|
* Duplicate names are NOT a failure (issue #364): a default-derived mount
|
|
17
27
|
* path that collides is renamed with the platform's `stem-2.ext` semantics
|
|
@@ -99,13 +109,18 @@ export declare class AttachmentValidationError extends Error {
|
|
|
99
109
|
* file entries (directories excluded) if the archive passes all checks.
|
|
100
110
|
*
|
|
101
111
|
* Security checks enforced:
|
|
102
|
-
* 1. Valid ZIP format (
|
|
112
|
+
* 1. Valid ZIP format (readable central directory; fail-hard, see module doc)
|
|
103
113
|
* 2. No absolute paths (entries starting with / or \)
|
|
104
114
|
* 3. No path traversal (.. components)
|
|
105
115
|
* 4. No null bytes in filenames
|
|
106
|
-
* 5.
|
|
107
|
-
* 6.
|
|
108
|
-
*
|
|
116
|
+
* 5. No duplicate entry paths (a contradictory manifest)
|
|
117
|
+
* 6. Only supported compression methods (stored, deflate) — checked here
|
|
118
|
+
* so an unsupported entry can never abort extraction after earlier
|
|
119
|
+
* entries were already written
|
|
120
|
+
* 7. Non-empty archive (at least one file entry)
|
|
121
|
+
* 8. File count within limits (max 1000)
|
|
122
|
+
* 9. Total declared uncompressed size within limits (max 100 MB) —
|
|
123
|
+
* declarations are re-enforced against actual output at decompression
|
|
109
124
|
*/
|
|
110
125
|
export declare function validateZipForExtraction(zipData: Buffer, sourceFilename: string): ZipEntryInfo[];
|
|
111
126
|
/**
|