wicked-crew 0.16.11 → 0.16.13
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/README.md +28 -8
- package/dist/api/artifact-outline.d.ts +64 -0
- package/dist/api/artifact-outline.d.ts.map +1 -0
- package/dist/api/artifact-outline.js +254 -0
- package/dist/api/artifact-outline.js.map +1 -0
- package/dist/api/beneath.d.ts +76 -0
- package/dist/api/beneath.d.ts.map +1 -0
- package/dist/api/beneath.js +214 -0
- package/dist/api/beneath.js.map +1 -0
- package/dist/api/capture.d.ts +2 -2
- package/dist/api/chat-citations.d.ts +25 -1
- package/dist/api/chat-citations.d.ts.map +1 -1
- package/dist/api/chat-citations.js +186 -61
- package/dist/api/chat-citations.js.map +1 -1
- package/dist/api/chat-context.d.ts +236 -0
- package/dist/api/chat-context.d.ts.map +1 -0
- package/dist/api/chat-context.js +808 -0
- package/dist/api/chat-context.js.map +1 -0
- package/dist/api/chat-history.d.ts +20 -0
- package/dist/api/chat-history.d.ts.map +1 -1
- package/dist/api/chat-history.js +46 -1
- package/dist/api/chat-history.js.map +1 -1
- package/dist/api/chat-proposals.d.ts +534 -0
- package/dist/api/chat-proposals.d.ts.map +1 -0
- package/dist/api/chat-proposals.js +1562 -0
- package/dist/api/chat-proposals.js.map +1 -0
- package/dist/api/chat-scope.d.ts +41 -0
- package/dist/api/chat-scope.d.ts.map +1 -1
- package/dist/api/chat-scope.js +87 -15
- package/dist/api/chat-scope.js.map +1 -1
- package/dist/api/chat-transcripts.d.ts +27 -2
- package/dist/api/chat-transcripts.d.ts.map +1 -1
- package/dist/api/chat-transcripts.js +105 -4
- package/dist/api/chat-transcripts.js.map +1 -1
- package/dist/api/diagnostics.d.ts +15 -0
- package/dist/api/diagnostics.d.ts.map +1 -1
- package/dist/api/diagnostics.js +56 -0
- package/dist/api/diagnostics.js.map +1 -1
- package/dist/api/elicitation-cache.d.ts +13 -0
- package/dist/api/elicitation-cache.d.ts.map +1 -1
- package/dist/api/elicitation-cache.js +12 -0
- package/dist/api/elicitation-cache.js.map +1 -1
- package/dist/api/eval-sample.d.ts +12 -12
- package/dist/api/frame-guard.d.ts +62 -0
- package/dist/api/frame-guard.d.ts.map +1 -0
- package/dist/api/frame-guard.js +97 -0
- package/dist/api/frame-guard.js.map +1 -0
- package/dist/api/governance-steering.d.ts +4 -4
- package/dist/api/multiscope.d.ts +3 -0
- package/dist/api/multiscope.d.ts.map +1 -1
- package/dist/api/multiscope.js +13 -0
- package/dist/api/multiscope.js.map +1 -1
- package/dist/api/needs.d.ts +6 -0
- package/dist/api/needs.d.ts.map +1 -1
- package/dist/api/needs.js +31 -4
- package/dist/api/needs.js.map +1 -1
- package/dist/api/product.d.ts.map +1 -1
- package/dist/api/product.js +13 -2
- package/dist/api/product.js.map +1 -1
- package/dist/api/project-aggregates.d.ts +6 -6
- package/dist/api/project-aggregates.d.ts.map +1 -1
- package/dist/api/project-aggregates.js +16 -24
- package/dist/api/project-aggregates.js.map +1 -1
- package/dist/api/requirements.d.ts +261 -6
- package/dist/api/requirements.d.ts.map +1 -1
- package/dist/api/requirements.js +344 -64
- package/dist/api/requirements.js.map +1 -1
- package/dist/api/routes.d.ts +156 -4
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +851 -78
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-brief.d.ts +78 -0
- package/dist/api/run-brief.d.ts.map +1 -0
- package/dist/api/run-brief.js +318 -0
- package/dist/api/run-brief.js.map +1 -0
- package/dist/api/run-files.d.ts.map +1 -1
- package/dist/api/run-files.js +5 -1
- package/dist/api/run-files.js.map +1 -1
- package/dist/api/run-timing-index.d.ts +27 -0
- package/dist/api/run-timing-index.d.ts.map +1 -1
- package/dist/api/run-timing-index.js +65 -0
- package/dist/api/run-timing-index.js.map +1 -1
- package/dist/api/seat-images.d.ts +102 -0
- package/dist/api/seat-images.d.ts.map +1 -0
- package/dist/api/seat-images.js +333 -0
- package/dist/api/seat-images.js.map +1 -0
- package/dist/api/server.d.ts +3 -0
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +265 -2
- package/dist/api/server.js.map +1 -1
- package/dist/api/steering-landing.d.ts +48 -1
- package/dist/api/steering-landing.d.ts.map +1 -1
- package/dist/api/steering-landing.js +116 -42
- package/dist/api/steering-landing.js.map +1 -1
- package/dist/api/system-snapshot.d.ts +51 -2
- package/dist/api/system-snapshot.d.ts.map +1 -1
- package/dist/api/system-snapshot.js +151 -15
- package/dist/api/system-snapshot.js.map +1 -1
- package/dist/api/testing.d.ts +4 -4
- package/dist/api/testing.js +2 -2
- package/dist/api/testing.js.map +1 -1
- package/dist/apps/spec.d.ts +3009 -0
- package/dist/apps/spec.d.ts.map +1 -0
- package/dist/apps/spec.js +870 -0
- package/dist/apps/spec.js.map +1 -0
- package/dist/campaigns/routes.js +1 -1
- package/dist/campaigns/routes.js.map +1 -1
- package/dist/cli/index.js +3 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/core/adapter.d.ts +12 -0
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +36 -1
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/deliver-text.d.ts.map +1 -1
- package/dist/core/deliver-text.js +22 -10
- package/dist/core/deliver-text.js.map +1 -1
- package/dist/core/estate-mcp-client.d.ts +7 -1
- package/dist/core/estate-mcp-client.d.ts.map +1 -1
- package/dist/core/estate-mcp-client.js +10 -2
- package/dist/core/estate-mcp-client.js.map +1 -1
- package/dist/core/exec.d.ts +12 -0
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +23 -0
- package/dist/core/exec.js.map +1 -1
- package/dist/core/reassign-refusal.d.ts.map +1 -1
- package/dist/core/reassign-refusal.js +23 -3
- package/dist/core/reassign-refusal.js.map +1 -1
- package/dist/core/repoPaths.d.ts +32 -7
- package/dist/core/repoPaths.d.ts.map +1 -1
- package/dist/core/repoPaths.js +56 -9
- package/dist/core/repoPaths.js.map +1 -1
- package/dist/core/requirements-graph-setting.d.ts +32 -0
- package/dist/core/requirements-graph-setting.d.ts.map +1 -0
- package/dist/core/requirements-graph-setting.js +84 -0
- package/dist/core/requirements-graph-setting.js.map +1 -0
- package/dist/core/run-boot-resume.d.ts +4 -1
- package/dist/core/run-boot-resume.d.ts.map +1 -1
- package/dist/core/run-boot-resume.js +6 -1
- package/dist/core/run-boot-resume.js.map +1 -1
- package/dist/core/run-identity.d.ts.map +1 -1
- package/dist/core/run-identity.js +6 -0
- package/dist/core/run-identity.js.map +1 -1
- package/dist/core/types.d.ts +14 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/decisions/chat-recorder.d.ts +14 -3
- package/dist/decisions/chat-recorder.d.ts.map +1 -1
- package/dist/decisions/chat-recorder.js +54 -9
- package/dist/decisions/chat-recorder.js.map +1 -1
- package/dist/editors/csp.d.ts +24 -4
- package/dist/editors/csp.d.ts.map +1 -1
- package/dist/editors/csp.js +35 -8
- package/dist/editors/csp.js.map +1 -1
- package/dist/editors/registry.d.ts +46 -21
- package/dist/editors/registry.d.ts.map +1 -1
- package/dist/editors/registry.js +13 -2
- package/dist/editors/registry.js.map +1 -1
- package/dist/editors/routes.d.ts +4 -1
- package/dist/editors/routes.d.ts.map +1 -1
- package/dist/editors/routes.js +30 -3
- package/dist/editors/routes.js.map +1 -1
- package/dist/editors/visuals.d.ts +51 -0
- package/dist/editors/visuals.d.ts.map +1 -0
- package/dist/editors/visuals.js +164 -0
- package/dist/editors/visuals.js.map +1 -0
- package/dist/editors/webrtc-guard.d.ts +94 -0
- package/dist/editors/webrtc-guard.d.ts.map +1 -0
- package/dist/editors/webrtc-guard.js +506 -0
- package/dist/editors/webrtc-guard.js.map +1 -0
- package/dist/inspect/reading.d.ts +110 -0
- package/dist/inspect/reading.d.ts.map +1 -0
- package/dist/inspect/reading.js +325 -0
- package/dist/inspect/reading.js.map +1 -0
- package/dist/inspect/routes.d.ts +14 -0
- package/dist/inspect/routes.d.ts.map +1 -0
- package/dist/inspect/routes.js +44 -0
- package/dist/inspect/routes.js.map +1 -0
- package/dist/inspect/service.d.ts +161 -0
- package/dist/inspect/service.d.ts.map +1 -0
- package/dist/inspect/service.js +466 -0
- package/dist/inspect/service.js.map +1 -0
- package/dist/interactive/bridge-pool.d.ts +11 -2
- package/dist/interactive/bridge-pool.d.ts.map +1 -1
- package/dist/interactive/bridge-pool.js +10 -1
- package/dist/interactive/bridge-pool.js.map +1 -1
- package/dist/interactive/doc-binding.d.ts +156 -0
- package/dist/interactive/doc-binding.d.ts.map +1 -0
- package/dist/interactive/doc-binding.js +277 -0
- package/dist/interactive/doc-binding.js.map +1 -0
- package/dist/interactive/doc-delete-routes.d.ts +3 -0
- package/dist/interactive/doc-delete-routes.d.ts.map +1 -1
- package/dist/interactive/doc-delete-routes.js +4 -0
- package/dist/interactive/doc-delete-routes.js.map +1 -1
- package/dist/interactive/draft-events.d.ts +89 -3
- package/dist/interactive/draft-events.d.ts.map +1 -1
- package/dist/interactive/draft-events.js +441 -30
- package/dist/interactive/draft-events.js.map +1 -1
- package/dist/interactive/draft-skill.d.ts +7 -0
- package/dist/interactive/draft-skill.d.ts.map +1 -1
- package/dist/interactive/draft-skill.js +10 -3
- package/dist/interactive/draft-skill.js.map +1 -1
- package/dist/interactive/edit-events.d.ts +2 -0
- package/dist/interactive/edit-events.d.ts.map +1 -1
- package/dist/interactive/edit-events.js +11 -0
- package/dist/interactive/edit-events.js.map +1 -1
- package/dist/interactive/proposal-create.d.ts +143 -0
- package/dist/interactive/proposal-create.d.ts.map +1 -0
- package/dist/interactive/proposal-create.js +318 -0
- package/dist/interactive/proposal-create.js.map +1 -0
- package/dist/interactive/proxy-routes.d.ts +60 -3
- package/dist/interactive/proxy-routes.d.ts.map +1 -1
- package/dist/interactive/proxy-routes.js +217 -3
- package/dist/interactive/proxy-routes.js.map +1 -1
- package/dist/interactive/source-packet.d.ts +126 -0
- package/dist/interactive/source-packet.d.ts.map +1 -0
- package/dist/interactive/source-packet.js +482 -0
- package/dist/interactive/source-packet.js.map +1 -0
- package/dist/learnings/estate.d.ts +16 -0
- package/dist/learnings/estate.d.ts.map +1 -0
- package/dist/learnings/estate.js +68 -0
- package/dist/learnings/estate.js.map +1 -0
- package/dist/learnings/extract.d.ts +56 -0
- package/dist/learnings/extract.d.ts.map +1 -0
- package/dist/learnings/extract.js +252 -0
- package/dist/learnings/extract.js.map +1 -0
- package/dist/learnings/recall.d.ts +43 -0
- package/dist/learnings/recall.d.ts.map +1 -0
- package/dist/learnings/recall.js +104 -0
- package/dist/learnings/recall.js.map +1 -0
- package/dist/learnings/service.d.ts +183 -0
- package/dist/learnings/service.d.ts.map +1 -0
- package/dist/learnings/service.js +571 -0
- package/dist/learnings/service.js.map +1 -0
- package/dist/mcp/ask-server.d.ts.map +1 -1
- package/dist/mcp/ask-server.js +37 -4
- package/dist/mcp/ask-server.js.map +1 -1
- package/dist/mcp/broker.d.ts +12 -1
- package/dist/mcp/broker.d.ts.map +1 -1
- package/dist/mcp/broker.js +24 -5
- package/dist/mcp/broker.js.map +1 -1
- package/dist/mcp/invoke.d.ts +26 -2
- package/dist/mcp/invoke.d.ts.map +1 -1
- package/dist/mcp/invoke.js +51 -5
- package/dist/mcp/invoke.js.map +1 -1
- package/dist/persona/routes.d.ts +92 -0
- package/dist/persona/routes.d.ts.map +1 -0
- package/dist/persona/routes.js +69 -0
- package/dist/persona/routes.js.map +1 -0
- package/dist/persona/store.d.ts +104 -0
- package/dist/persona/store.d.ts.map +1 -0
- package/dist/persona/store.js +176 -0
- package/dist/persona/store.js.map +1 -0
- package/dist/persona/voice.d.ts +4 -0
- package/dist/persona/voice.d.ts.map +1 -0
- package/dist/persona/voice.js +58 -0
- package/dist/persona/voice.js.map +1 -0
- package/dist/projects/routes.d.ts +2 -2
- package/dist/setup/known.d.ts +56 -0
- package/dist/setup/known.d.ts.map +1 -0
- package/dist/setup/known.js +159 -0
- package/dist/setup/known.js.map +1 -0
- package/dist/setup/routes.d.ts +13 -0
- package/dist/setup/routes.d.ts.map +1 -0
- package/dist/setup/routes.js +20 -0
- package/dist/setup/routes.js.map +1 -0
- package/dist/standing-orders/history.d.ts +2 -0
- package/dist/standing-orders/history.d.ts.map +1 -1
- package/dist/standing-orders/history.js +1 -0
- package/dist/standing-orders/history.js.map +1 -1
- package/dist/studio/assets/WickedSans-Regular-fb698rcD.woff2 +0 -0
- package/dist/studio/assets/WickedSans-SemiBold-CD53n1AC.woff2 +0 -0
- package/dist/studio/assets/WickedScript-Regular-CY5juO6I.woff2 +0 -0
- package/dist/studio/assets/WickedSerif-Regular-mdPEjaVZ.woff2 +0 -0
- package/dist/studio/assets/index-BUZ_-Syk.css +32 -0
- package/dist/studio/assets/index-u4O_7N-b.js +986 -0
- package/dist/studio/editors/wicked-deck/editor.json +6 -1
- package/dist/studio/editors/wicked-deck/icon.svg +1 -0
- package/dist/studio/editors/wicked-deck/index.html +1 -1
- package/dist/studio/editors/wicked-doc/editor.json +6 -1
- package/dist/studio/editors/wicked-doc/icon.svg +1 -0
- package/dist/studio/editors/wicked-doc/index.html +1 -1
- package/dist/studio/editors/wicked-insights/editor.json +6 -1
- package/dist/studio/editors/wicked-insights/icon.svg +1 -0
- package/dist/studio/editors/wicked-insights/index.html +1 -1
- package/dist/studio/editors/wicked-page/editor.json +6 -1
- package/dist/studio/editors/wicked-page/icon.svg +1 -0
- package/dist/studio/editors/wicked-page/index.html +1 -1
- package/dist/studio/editors/wicked-video/editor.json +6 -1
- package/dist/studio/editors/wicked-video/icon.svg +1 -0
- package/dist/studio/editors/wicked-video/index.html +1 -1
- package/dist/studio/index.html +2 -2
- package/dist/studio/testid-inventory.json +5155 -2707
- package/dist/voice/dashboard.d.ts +376 -0
- package/dist/voice/dashboard.d.ts.map +1 -0
- package/dist/voice/dashboard.js +92 -0
- package/dist/voice/dashboard.js.map +1 -0
- package/dist/voice/inject-input.d.ts +51 -0
- package/dist/voice/inject-input.d.ts.map +1 -0
- package/dist/voice/inject-input.js +126 -0
- package/dist/voice/inject-input.js.map +1 -0
- package/dist/voice/routes.d.ts +41 -0
- package/dist/voice/routes.d.ts.map +1 -0
- package/dist/voice/routes.js +116 -0
- package/dist/voice/routes.js.map +1 -0
- package/dist/voice/service.d.ts +177 -0
- package/dist/voice/service.d.ts.map +1 -0
- package/dist/voice/service.js +400 -0
- package/dist/voice/service.js.map +1 -0
- package/dist/workflow-catalog/build.d.ts +35 -0
- package/dist/workflow-catalog/build.d.ts.map +1 -0
- package/dist/workflow-catalog/build.js +229 -0
- package/dist/workflow-catalog/build.js.map +1 -0
- package/dist/workflow-catalog/catalog-data.d.ts +36 -0
- package/dist/workflow-catalog/catalog-data.d.ts.map +1 -0
- package/dist/workflow-catalog/catalog-data.js +430 -0
- package/dist/workflow-catalog/catalog-data.js.map +1 -0
- package/dist/working-doc/event-lines.d.ts +76 -0
- package/dist/working-doc/event-lines.d.ts.map +1 -0
- package/dist/working-doc/event-lines.js +247 -0
- package/dist/working-doc/event-lines.js.map +1 -0
- package/dist/working-doc/routes.d.ts +1 -1
- package/dist/working-doc/routes.d.ts.map +1 -1
- package/dist/working-doc/routes.js +2 -1
- package/dist/working-doc/routes.js.map +1 -1
- package/dist/working-doc/sections.d.ts +3 -1
- package/dist/working-doc/sections.d.ts.map +1 -1
- package/dist/working-doc/sections.js +4 -2
- package/dist/working-doc/sections.js.map +1 -1
- package/dist/working-doc/service.d.ts +66 -1
- package/dist/working-doc/service.d.ts.map +1 -1
- package/dist/working-doc/service.js +298 -22
- package/dist/working-doc/service.js.map +1 -1
- package/dist/working-doc/store.d.ts +8 -2
- package/dist/working-doc/store.d.ts.map +1 -1
- package/dist/working-doc/store.js.map +1 -1
- package/endpoint-manifest.json +205 -2
- package/package.json +5 -4
- package/workflows/distill-learnings.json +27 -0
- package/workflows/inspect-unit.json +27 -0
- package/dist/studio/assets/index-B-f_VEL2.css +0 -32
- package/dist/studio/assets/index-DhkxIK-0.js +0 -845
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OPEN BENEATH A ROOT, FOLLOWING NO LINK BELOW IT (crew#1274; DES-CHAT-ARTIFACTS-001 §5.3 containment).
|
|
3
|
+
*
|
|
4
|
+
* The chat's per-turn block reads and writes under directories a run or a seat can change: a run's evidence root, the
|
|
5
|
+
* chat's scratch root (the seat's own working directory), and a project's docs root. Checking a path (`realpath`,
|
|
6
|
+
* `lstat`) and then opening it is a race: `O_NOFOLLOW` covers only the last component, so an ancestor directory
|
|
7
|
+
* swapped for a link between the check and the open sends the open outside the root. Node has no `openat`, so this
|
|
8
|
+
* module opens with the platform's own guarantee instead of a check:
|
|
9
|
+
*
|
|
10
|
+
* - macOS: `O_NOFOLLOW_ANY` (Darwin ≥ 20): the open fails with ELOOP if ANY component of the path is a link. The
|
|
11
|
+
* root is passed as its real path (no link in it by construction), so the guarantee covers exactly the components
|
|
12
|
+
* below it.
|
|
13
|
+
* - Linux: a descriptor walk: the root is opened as a directory, then each component is opened through the magic
|
|
14
|
+
* link `/proc/self/fd/<dir>/<name>` with `O_NOFOLLOW` — the kernel resolves the magic link to the directory the
|
|
15
|
+
* descriptor holds (never a path re-read), so this is `openat(dir, name, O_NOFOLLOW)`.
|
|
16
|
+
* - Anywhere else (Windows): refused, with the reason. A brief or a copy is then simply not made there.
|
|
17
|
+
*
|
|
18
|
+
* The root itself is trusted: its ancestors belong to the daemon, and a run or a seat cannot rename the root (it can
|
|
19
|
+
* write only inside it). Every component below it is checked on every open, by the kernel.
|
|
20
|
+
*
|
|
21
|
+
* Listing a directory is by IDENTITY, never by a path that could be re-resolved: the directory is first opened beneath
|
|
22
|
+
* the root, then listed through what that descriptor holds — on Linux `/proc/self/fd/<n>`, on macOS
|
|
23
|
+
* `/.vol/<dev>/<ino>` (the volume file system's by-identity name; `/dev/fd/<n>` cannot be listed there). A folder
|
|
24
|
+
* swapped for a link after it was opened still lists as the folder that was opened; a file system without `/.vol`
|
|
25
|
+
* refuses the listing.
|
|
26
|
+
*/
|
|
27
|
+
import { closeSync, constants as fsConstants, existsSync, fstatSync, mkdirSync, openSync, opendirSync, readSync, writeSync } from 'node:fs';
|
|
28
|
+
import { join } from 'node:path';
|
|
29
|
+
/** `O_NOFOLLOW_ANY` from Darwin's `<sys/fcntl.h>`: Node does not export it, and passes open flags through. */
|
|
30
|
+
const DARWIN_O_NOFOLLOW_ANY = 0x20000000;
|
|
31
|
+
let modeHeld = null;
|
|
32
|
+
/** How this platform opens beneath a root. */
|
|
33
|
+
export function beneathMode() {
|
|
34
|
+
if (beneathTestHooks.mode !== undefined)
|
|
35
|
+
return beneathTestHooks.mode;
|
|
36
|
+
modeHeld ??= process.platform === 'darwin' ? 'darwin' : process.platform === 'linux' && existsSync('/proc/self/fd') ? 'procfd' : 'unsupported';
|
|
37
|
+
return modeHeld;
|
|
38
|
+
}
|
|
39
|
+
/** Test seams: called with the absolute path just before an open beneath a root (with its flags), and just before a
|
|
40
|
+
* directory opened beneath a root is listed. */
|
|
41
|
+
export const beneathTestHooks = {};
|
|
42
|
+
export class BeneathError extends Error {
|
|
43
|
+
code;
|
|
44
|
+
constructor(code, message) {
|
|
45
|
+
super(message);
|
|
46
|
+
this.code = code;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** The components of a path relative to a root: no empty, `.`, `..`, absolute or NUL-bearing part. (`/` is the only
|
|
50
|
+
* separator on the platforms this opens on: a backslash is an ordinary character in a POSIX name.) */
|
|
51
|
+
function partsOf(rel) {
|
|
52
|
+
const parts = rel.split('/');
|
|
53
|
+
if (rel === '' || parts.some((p) => p === '' || p === '.' || p === '..' || p.includes('\0'))) {
|
|
54
|
+
throw new BeneathError('EINVAL', `not a path beneath a root: ${JSON.stringify(rel)}`);
|
|
55
|
+
}
|
|
56
|
+
return parts;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Open `rel` beneath the real directory `root`, following no link at or below it. Throws the open's own error (its
|
|
60
|
+
* `code`: ELOOP for a link anywhere below the root, ENOENT, ENOTDIR, EEXIST…) or a {@link BeneathError}.
|
|
61
|
+
*/
|
|
62
|
+
export function openBeneath(root, rel, opts = {}) {
|
|
63
|
+
const parts = partsOf(rel);
|
|
64
|
+
const base = opts.flags ?? fsConstants.O_RDONLY;
|
|
65
|
+
const abs = join(root, ...parts);
|
|
66
|
+
beneathTestHooks.beforeOpen?.(abs, base);
|
|
67
|
+
const mode = beneathMode();
|
|
68
|
+
// Darwin refuses O_NOFOLLOW together with O_NOFOLLOW_ANY (EINVAL); the latter covers the last component too.
|
|
69
|
+
if (mode === 'darwin')
|
|
70
|
+
return openSync(abs, base | DARWIN_O_NOFOLLOW_ANY, opts.mode);
|
|
71
|
+
const leafFlags = base | (fsConstants.O_NOFOLLOW ?? 0);
|
|
72
|
+
if (mode === 'procfd') {
|
|
73
|
+
let dir = openSync(root, fsConstants.O_RDONLY | fsConstants.O_DIRECTORY);
|
|
74
|
+
try {
|
|
75
|
+
for (const p of parts.slice(0, -1)) {
|
|
76
|
+
let next;
|
|
77
|
+
try {
|
|
78
|
+
next = openSync(`/proc/self/fd/${dir}/${p}`, fsConstants.O_RDONLY | fsConstants.O_DIRECTORY | (fsConstants.O_NOFOLLOW ?? 0));
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
// Linux answers a link here with ENOTDIR (O_DIRECTORY is checked first) or ELOOP: either way the folder on
|
|
82
|
+
// the way is not a real folder, and it is said the way macOS says it.
|
|
83
|
+
const code = err.code;
|
|
84
|
+
if (code === 'ENOTDIR' || code === 'ELOOP')
|
|
85
|
+
throw new BeneathError('ELOOP', `${p} is not a real folder (a link is never followed)`);
|
|
86
|
+
throw err;
|
|
87
|
+
}
|
|
88
|
+
closeSync(dir);
|
|
89
|
+
dir = next;
|
|
90
|
+
}
|
|
91
|
+
return openSync(`/proc/self/fd/${dir}/${parts.at(-1)}`, leafFlags, opts.mode);
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
closeSync(dir);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
throw new BeneathError('ENOTSUP', 'this platform cannot open a file without following links in its folders');
|
|
98
|
+
}
|
|
99
|
+
/** Read the regular file `rel` beneath `root`, at most `max` bytes (over = refused, never cut), non-blocking (a FIFO
|
|
100
|
+
* is refused, not waited on). Returns the bytes and the file's stats from the same descriptor. */
|
|
101
|
+
export function readBeneath(root, rel, max) {
|
|
102
|
+
const fd = openBeneath(root, rel, { flags: fsConstants.O_RDONLY | (fsConstants.O_NONBLOCK ?? 0) });
|
|
103
|
+
try {
|
|
104
|
+
const st = fstatSync(fd);
|
|
105
|
+
if (!st.isFile())
|
|
106
|
+
throw new BeneathError('EFTYPE', 'not a regular file');
|
|
107
|
+
if (st.size > max)
|
|
108
|
+
throw new BeneathError('EFBIG', `over ${max} bytes`);
|
|
109
|
+
const buf = Buffer.alloc(st.size);
|
|
110
|
+
let off = 0;
|
|
111
|
+
while (off < st.size) {
|
|
112
|
+
const n = readSync(fd, buf, off, st.size - off, off);
|
|
113
|
+
if (n === 0)
|
|
114
|
+
break;
|
|
115
|
+
off += n;
|
|
116
|
+
}
|
|
117
|
+
return { data: buf.subarray(0, off), st };
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
closeSync(fd);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/** What `rel` beneath `root` is (a regular file, a directory, something else), by its own descriptor; `null` if absent. */
|
|
124
|
+
export function statBeneath(root, rel) {
|
|
125
|
+
let fd;
|
|
126
|
+
try {
|
|
127
|
+
fd = openBeneath(root, rel, { flags: fsConstants.O_RDONLY | (fsConstants.O_NONBLOCK ?? 0) });
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
if (err.code === 'ENOENT')
|
|
131
|
+
return null;
|
|
132
|
+
throw err;
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
return fstatSync(fd);
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
closeSync(fd);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** Create the file `rel` beneath `root` exclusively (never through a link, never over an existing entry) with `data`. */
|
|
142
|
+
export function createBeneath(root, rel, data, mode) {
|
|
143
|
+
const fd = openBeneath(root, rel, { flags: fsConstants.O_WRONLY | fsConstants.O_CREAT | fsConstants.O_EXCL, mode });
|
|
144
|
+
try {
|
|
145
|
+
let off = 0;
|
|
146
|
+
while (off < data.length)
|
|
147
|
+
off += writeSync(fd, data, off, data.length - off);
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
closeSync(fd);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Make the directory `name` directly beneath `root` (one component: the root's own entry) and prove it is a real
|
|
155
|
+
* directory, not a link, by opening it beneath the root.
|
|
156
|
+
*/
|
|
157
|
+
export function mkdirBeneath(root, name, mode = 0o700) {
|
|
158
|
+
partsOf(name);
|
|
159
|
+
if (name.includes('/'))
|
|
160
|
+
throw new BeneathError('EINVAL', 'one folder at a time');
|
|
161
|
+
try {
|
|
162
|
+
mkdirSync(join(root, name), { recursive: false, mode });
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
if (err.code !== 'EEXIST')
|
|
166
|
+
throw err;
|
|
167
|
+
}
|
|
168
|
+
const st = statBeneath(root, name);
|
|
169
|
+
if (st === null || !st.isDirectory())
|
|
170
|
+
throw new BeneathError('ENOTDIR', `${name} is not a real folder`);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The names in the directory `rel` beneath `root` (`''` = the root itself, trusted), at most `max`, listed by the
|
|
174
|
+
* identity of the directory opened beneath the root (see the module doc). `null` when it cannot be listed.
|
|
175
|
+
*/
|
|
176
|
+
export function listBeneath(root, rel, max) {
|
|
177
|
+
let target = root;
|
|
178
|
+
let fd = null;
|
|
179
|
+
try {
|
|
180
|
+
if (rel !== '') {
|
|
181
|
+
fd = openBeneath(root, rel, { flags: fsConstants.O_RDONLY | fsConstants.O_DIRECTORY });
|
|
182
|
+
const st = fstatSync(fd);
|
|
183
|
+
if (!st.isDirectory())
|
|
184
|
+
return null;
|
|
185
|
+
beneathTestHooks.beforeList?.(join(root, ...partsOf(rel)));
|
|
186
|
+
// By identity: what the descriptor holds, whatever the path names now.
|
|
187
|
+
target = beneathMode() === 'procfd' ? `/proc/self/fd/${fd}` : `/.vol/${st.dev}/${st.ino}`;
|
|
188
|
+
}
|
|
189
|
+
const names = [];
|
|
190
|
+
let more = false;
|
|
191
|
+
const handle = opendirSync(target);
|
|
192
|
+
try {
|
|
193
|
+
for (let e = handle.readSync(); e !== null; e = handle.readSync()) {
|
|
194
|
+
if (names.length >= max) {
|
|
195
|
+
more = true;
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
names.push(e.name);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
finally {
|
|
202
|
+
handle.closeSync();
|
|
203
|
+
}
|
|
204
|
+
return { names, more };
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
finally {
|
|
210
|
+
if (fd !== null)
|
|
211
|
+
closeSync(fd);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=beneath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beneath.js","sourceRoot":"","sources":["../../src/api/beneath.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,IAAI,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAc,MAAM,SAAS,CAAC;AACxJ,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,8GAA8G;AAC9G,MAAM,qBAAqB,GAAG,UAAU,CAAC;AAIzC,IAAI,QAAQ,GAAuB,IAAI,CAAC;AACxC,8CAA8C;AAC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AAE,OAAO,IAAI,CAAC;YACnC,gBAAgB,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC3D,uEAAuE;YACvE,MAAM,GAAG,WAAW,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC;QAC5F,CAAC;QACD,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,IAAI,IAAI,GAAG,KAAK,CAAC;QACjB,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC;YACH,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;gBAClE,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;oBACxB,IAAI,GAAG,IAAI,CAAC;oBACZ,MAAM;gBACR,CAAC;gBACD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;YAAS,CAAC;QACT,IAAI,EAAE,KAAK,IAAI;YAAE,SAAS,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;AACH,CAAC"}
|
package/dist/api/capture.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ export declare const CaptureSchema: z.ZodObject<{
|
|
|
61
61
|
/** wicked-core#850 — the explicit reduced-assurance opt-in, forwarded to `POST /runs` only when `true`. */
|
|
62
62
|
reducedAssurance: z.ZodOptional<z.ZodBoolean>;
|
|
63
63
|
}, "strict", z.ZodTypeAny, {
|
|
64
|
+
notes?: string | undefined;
|
|
64
65
|
reducedAssurance?: boolean | undefined;
|
|
65
66
|
files?: ({
|
|
66
67
|
name: string;
|
|
@@ -70,8 +71,8 @@ export declare const CaptureSchema: z.ZodObject<{
|
|
|
70
71
|
mediaType: string;
|
|
71
72
|
dataBase64: string;
|
|
72
73
|
})[] | undefined;
|
|
73
|
-
notes?: string | undefined;
|
|
74
74
|
}, {
|
|
75
|
+
notes?: string | undefined;
|
|
75
76
|
reducedAssurance?: boolean | undefined;
|
|
76
77
|
files?: ({
|
|
77
78
|
name: string;
|
|
@@ -81,7 +82,6 @@ export declare const CaptureSchema: z.ZodObject<{
|
|
|
81
82
|
mediaType: string;
|
|
82
83
|
dataBase64: string;
|
|
83
84
|
})[] | undefined;
|
|
84
|
-
notes?: string | undefined;
|
|
85
85
|
}>;
|
|
86
86
|
/** `POST /proposals/:id/approve` body — present only for an accept WITH an edit. */
|
|
87
87
|
export declare const ApproveEditSchema: z.ZodObject<{
|
|
@@ -19,10 +19,31 @@
|
|
|
19
19
|
* | kind | citation | check |
|
|
20
20
|
* |----------|-----------------------------------|-------|
|
|
21
21
|
* | `path` | `crew/src/api/routes.ts` | the file exists under a read root |
|
|
22
|
-
* | `line` | `routes.ts:2264`, `x.ts:80-90` | the file exists AND has that many lines; when a symbol is named right before the ref, that the symbol is ON that line — otherwise the line it IS on, as a CORRECTION |
|
|
22
|
+
* | `line` | `routes.ts:2264`, `x.ts:80-90` | the file exists AND has that many lines (a range: through its LAST line); when a symbol is named right before the ref, that the symbol is ON that line (in that range) — otherwise the line it IS on, as a CORRECTION |
|
|
23
23
|
* | `symbol` | `execute_wrapped.rs:build_worker_command` | the file exists AND contains the symbol |
|
|
24
24
|
* | `sha` | `6d77153`, 7–40 hex | `git rev-parse --verify --quiet <sha>^{commit}` in the repo the text names, else in any read root |
|
|
25
25
|
*
|
|
26
|
+
* # Where a cited path is looked for (crew#1211)
|
|
27
|
+
*
|
|
28
|
+
* Seats cite paths relative to whatever they were reading, not always to the repo root: on the J3
|
|
29
|
+
* sweep Claude wrote "Paths are under `wicked-crew/packages/crew/src/`" and then cited
|
|
30
|
+
* `core/types.ts:232`, and all 7 such citations were struck through as UNVERIFIED although every
|
|
31
|
+
* one was right. A cited path is looked for, in order:
|
|
32
|
+
* 1. from a repo root, with or without the repo-name prefix (`wicked-crew/x/y.ts`, `x/y.ts`);
|
|
33
|
+
* 2. under a directory the reply itself declares (a backticked `a/b/` or `repo/a/b` token);
|
|
34
|
+
* 3. as the TAIL of a tracked file (`core/types.ts` → `packages/crew/src/core/types.ts`), by whole
|
|
35
|
+
* path segments. A repo name spelled in full confines it to that repo; a declared directory
|
|
36
|
+
* confines a slashed path to it (found only elsewhere ⇒ `unchecked`).
|
|
37
|
+
* Several matches at any step ⇒ the one under a declared directory; still several ⇒ `unchecked`
|
|
38
|
+
* ("the citation does not say which"). Root order is never a tie-break. A repo that could not be
|
|
39
|
+
* listed makes a tail match `unchecked`: the unlisted repo may hold another.
|
|
40
|
+
*
|
|
41
|
+
* The daemon has no record of the files a chat seat opened (`toolInvoked` carries tool names
|
|
42
|
+
* only), so the reply's own directories stand in for "the files the worker read".
|
|
43
|
+
*
|
|
44
|
+
* `unverified` means "there is no such thing in this chat's scope". A citation that names a real
|
|
45
|
+
* file the pass cannot pin to ONE place is `unchecked`, never `unverified`: it is not wrong.
|
|
46
|
+
*
|
|
26
47
|
* # Why a false positive is worse than a miss
|
|
27
48
|
*
|
|
28
49
|
* Prose looks like a path (`e.g`, `something.this`) and words look like SHAs. Flagging prose
|
|
@@ -129,6 +150,8 @@ export interface RawCitation {
|
|
|
129
150
|
path?: string;
|
|
130
151
|
/** The first line of a `line` citation. */
|
|
131
152
|
line?: number;
|
|
153
|
+
/** The last line of a `line` citation's range (`x.ts:80-90` → 90). */
|
|
154
|
+
lineEnd?: number;
|
|
132
155
|
/** The symbol of a `symbol` citation, or the one the sentence named before a `line` citation. */
|
|
133
156
|
symbol?: string;
|
|
134
157
|
/** The repo a `sha` citation's sentence named, when it named one. */
|
|
@@ -165,6 +188,7 @@ export interface ChatCitationsResult {
|
|
|
165
188
|
unchecked: number;
|
|
166
189
|
items: ChatCitationItem[];
|
|
167
190
|
}
|
|
191
|
+
export declare function declaredDirectories(text: string): string[];
|
|
168
192
|
/**
|
|
169
193
|
* Verify every citation in a reply, bounded. Never throws: a broken root, an unreadable file or a
|
|
170
194
|
* git that is not there is a verdict (`unverified` / `unchecked`), not an error.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-citations.d.ts","sourceRoot":"","sources":["../../src/api/chat-citations.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"chat-citations.d.ts","sourceRoot":"","sources":["../../src/api/chat-citations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAOH,mGAAmG;AACnG,MAAM,WAAW,YAAY;IAC3B,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,yFAAyF;IACzF,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yCAAyC;AACzC,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;AAEvF,wFAAwF;AACxF,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AA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