wicked-crew 0.7.46 → 0.7.48
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/api/capture.d.ts +2 -2
- package/dist/api/chat-citations.d.ts +10 -1
- package/dist/api/chat-citations.d.ts.map +1 -1
- package/dist/api/chat-citations.js +28 -0
- package/dist/api/chat-citations.js.map +1 -1
- package/dist/api/chat-scope.d.ts +4 -2
- package/dist/api/chat-scope.d.ts.map +1 -1
- package/dist/api/chat-scope.js +35 -3
- package/dist/api/chat-scope.js.map +1 -1
- package/dist/api/chat-transcripts.d.ts +23 -1
- package/dist/api/chat-transcripts.d.ts.map +1 -1
- package/dist/api/chat-transcripts.js +61 -6
- package/dist/api/chat-transcripts.js.map +1 -1
- package/dist/api/delivery-index.d.ts +21 -0
- package/dist/api/delivery-index.d.ts.map +1 -1
- package/dist/api/delivery-index.js +36 -0
- package/dist/api/delivery-index.js.map +1 -1
- package/dist/api/elicitation-cache.d.ts +12 -0
- package/dist/api/elicitation-cache.d.ts.map +1 -1
- package/dist/api/elicitation-cache.js +17 -1
- package/dist/api/elicitation-cache.js.map +1 -1
- package/dist/api/eval-sample.d.ts +12 -12
- package/dist/api/governance-steering.d.ts.map +1 -1
- package/dist/api/governance-steering.js +1 -0
- package/dist/api/governance-steering.js.map +1 -1
- package/dist/api/mcp.d.ts +4 -4
- package/dist/api/policy-landing.d.ts +55 -0
- package/dist/api/policy-landing.d.ts.map +1 -0
- package/dist/api/policy-landing.js +174 -0
- package/dist/api/policy-landing.js.map +1 -0
- package/dist/api/recording.d.ts +228 -0
- package/dist/api/recording.d.ts.map +1 -0
- package/dist/api/recording.js +1140 -0
- package/dist/api/recording.js.map +1 -0
- package/dist/api/routes.d.ts +42 -39
- package/dist/api/routes.d.ts.map +1 -1
- package/dist/api/routes.js +362 -107
- package/dist/api/routes.js.map +1 -1
- package/dist/api/run-timing-index.d.ts +17 -0
- package/dist/api/run-timing-index.d.ts.map +1 -1
- package/dist/api/run-timing-index.js +43 -1
- package/dist/api/run-timing-index.js.map +1 -1
- package/dist/api/server.d.ts +27 -0
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +168 -4
- package/dist/api/server.js.map +1 -1
- package/dist/api/testing.d.ts +4 -4
- package/dist/api/testing.d.ts.map +1 -1
- package/dist/api/testing.js +3 -0
- package/dist/api/testing.js.map +1 -1
- package/dist/api/watch-routes.d.ts +30 -0
- package/dist/api/watch-routes.d.ts.map +1 -0
- package/dist/api/watch-routes.js +104 -0
- package/dist/api/watch-routes.js.map +1 -0
- package/dist/campaigns/routes.d.ts +2 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +20 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/core/adapter.d.ts +52 -1
- package/dist/core/adapter.d.ts.map +1 -1
- package/dist/core/adapter.js +193 -5
- package/dist/core/adapter.js.map +1 -1
- package/dist/core/run-identity.js +1 -1
- package/dist/core/run-identity.js.map +1 -1
- package/dist/core/walkthrough-root.d.ts +21 -0
- package/dist/core/walkthrough-root.d.ts.map +1 -0
- package/dist/core/walkthrough-root.js +66 -0
- package/dist/core/walkthrough-root.js.map +1 -0
- package/dist/decisions/chat-recorder.d.ts +129 -0
- package/dist/decisions/chat-recorder.d.ts.map +1 -0
- package/dist/decisions/chat-recorder.js +367 -0
- package/dist/decisions/chat-recorder.js.map +1 -0
- package/dist/decisions/consider.d.ts +102 -0
- package/dist/decisions/consider.d.ts.map +1 -0
- package/dist/decisions/consider.js +207 -0
- package/dist/decisions/consider.js.map +1 -0
- package/dist/decisions/derive.d.ts +79 -0
- package/dist/decisions/derive.d.ts.map +1 -0
- package/dist/decisions/derive.js +282 -0
- package/dist/decisions/derive.js.map +1 -0
- package/dist/decisions/events.d.ts +25 -0
- package/dist/decisions/events.d.ts.map +1 -0
- package/dist/decisions/events.js +24 -0
- package/dist/decisions/events.js.map +1 -0
- package/dist/decisions/ingest.d.ts +51 -0
- package/dist/decisions/ingest.d.ts.map +1 -0
- package/dist/decisions/ingest.js +100 -0
- package/dist/decisions/ingest.js.map +1 -0
- package/dist/decisions/land.d.ts +100 -0
- package/dist/decisions/land.d.ts.map +1 -0
- package/dist/decisions/land.js +466 -0
- package/dist/decisions/land.js.map +1 -0
- package/dist/decisions/ledger.d.ts +60 -0
- package/dist/decisions/ledger.d.ts.map +1 -0
- package/dist/decisions/ledger.js +246 -0
- package/dist/decisions/ledger.js.map +1 -0
- package/dist/decisions/routes.d.ts +10 -0
- package/dist/decisions/routes.d.ts.map +1 -0
- package/dist/decisions/routes.js +141 -0
- package/dist/decisions/routes.js.map +1 -0
- package/dist/decisions/rules-text.d.ts +21 -0
- package/dist/decisions/rules-text.d.ts.map +1 -0
- package/dist/decisions/rules-text.js +50 -0
- package/dist/decisions/rules-text.js.map +1 -0
- package/dist/decisions/types.d.ts +120 -0
- package/dist/decisions/types.d.ts.map +1 -0
- package/dist/decisions/types.js +19 -0
- package/dist/decisions/types.js.map +1 -0
- package/dist/editors/csp.d.ts +31 -0
- package/dist/editors/csp.d.ts.map +1 -0
- package/dist/editors/csp.js +46 -0
- package/dist/editors/csp.js.map +1 -0
- package/dist/editors/pack-install.d.ts +28 -0
- package/dist/editors/pack-install.d.ts.map +1 -0
- package/dist/editors/pack-install.js +153 -0
- package/dist/editors/pack-install.js.map +1 -0
- package/dist/editors/registry.d.ts +142 -0
- package/dist/editors/registry.d.ts.map +1 -0
- package/dist/editors/registry.js +255 -0
- package/dist/editors/registry.js.map +1 -0
- package/dist/editors/routes.d.ts +46 -0
- package/dist/editors/routes.d.ts.map +1 -0
- package/dist/editors/routes.js +166 -0
- package/dist/editors/routes.js.map +1 -0
- package/dist/interactive/bridge-pool.d.ts +7 -2
- package/dist/interactive/bridge-pool.d.ts.map +1 -1
- package/dist/interactive/bridge-pool.js +6 -1
- package/dist/interactive/bridge-pool.js.map +1 -1
- package/dist/interactive/draft-events.d.ts.map +1 -1
- package/dist/interactive/draft-events.js +1 -0
- package/dist/interactive/draft-events.js.map +1 -1
- package/dist/interactive/theme-events.d.ts +119 -0
- package/dist/interactive/theme-events.d.ts.map +1 -0
- package/dist/interactive/theme-events.js +606 -0
- package/dist/interactive/theme-events.js.map +1 -0
- package/dist/projects/events.d.ts.map +1 -1
- package/dist/projects/events.js +2 -1
- package/dist/projects/events.js.map +1 -1
- package/dist/projects/routes.d.ts +2 -2
- package/dist/projects/state-home-preflight.d.ts.map +1 -1
- package/dist/projects/state-home-preflight.js +3 -0
- package/dist/projects/state-home-preflight.js.map +1 -1
- package/dist/projects/state-home-registry.d.ts.map +1 -1
- package/dist/projects/state-home-registry.js +2 -0
- package/dist/projects/state-home-registry.js.map +1 -1
- package/dist/projects/state-home.d.ts +6 -0
- package/dist/projects/state-home.d.ts.map +1 -1
- package/dist/projects/state-home.js +28 -1
- package/dist/projects/state-home.js.map +1 -1
- package/dist/qe/acceptance.d.ts +45 -4
- package/dist/qe/acceptance.d.ts.map +1 -1
- package/dist/qe/acceptance.js +93 -4
- package/dist/qe/acceptance.js.map +1 -1
- package/dist/qe/ledger.d.ts +20 -0
- package/dist/qe/ledger.d.ts.map +1 -1
- package/dist/qe/ledger.js +34 -0
- package/dist/qe/ledger.js.map +1 -1
- package/dist/qe/walkthrough-acceptance.d.ts +82 -0
- package/dist/qe/walkthrough-acceptance.d.ts.map +1 -0
- package/dist/qe/walkthrough-acceptance.js +248 -0
- package/dist/qe/walkthrough-acceptance.js.map +1 -0
- package/dist/skills/base-skill.d.ts.map +1 -1
- package/dist/skills/base-skill.js +3 -2
- package/dist/skills/base-skill.js.map +1 -1
- package/dist/skills/plugin-source.d.ts +19 -1
- package/dist/skills/plugin-source.d.ts.map +1 -1
- package/dist/skills/plugin-source.js +31 -2
- package/dist/skills/plugin-source.js.map +1 -1
- package/dist/skills/runtime.d.ts +11 -2
- package/dist/skills/runtime.d.ts.map +1 -1
- package/dist/skills/runtime.js +29 -1
- package/dist/skills/runtime.js.map +1 -1
- package/dist/skills/store.d.ts +14 -1
- package/dist/skills/store.d.ts.map +1 -1
- package/dist/skills/store.js +19 -5
- package/dist/skills/store.js.map +1 -1
- package/dist/standing-orders/routes.d.ts +22 -22
- package/dist/standing-orders/store.d.ts +10 -10
- package/dist/watch/checks/check-failed.d.ts +24 -0
- package/dist/watch/checks/check-failed.d.ts.map +1 -0
- package/dist/watch/checks/check-failed.js +56 -0
- package/dist/watch/checks/check-failed.js.map +1 -0
- package/dist/watch/checks/claim-vs-evidence.d.ts +30 -0
- package/dist/watch/checks/claim-vs-evidence.d.ts.map +1 -0
- package/dist/watch/checks/claim-vs-evidence.js +152 -0
- package/dist/watch/checks/claim-vs-evidence.js.map +1 -0
- package/dist/watch/checks/deliver-audit.d.ts +19 -0
- package/dist/watch/checks/deliver-audit.d.ts.map +1 -0
- package/dist/watch/checks/deliver-audit.js +129 -0
- package/dist/watch/checks/deliver-audit.js.map +1 -0
- package/dist/watch/checks/index.d.ts +8 -0
- package/dist/watch/checks/index.d.ts.map +1 -0
- package/dist/watch/checks/index.js +24 -0
- package/dist/watch/checks/index.js.map +1 -0
- package/dist/watch/checks/lag.d.ts +24 -0
- package/dist/watch/checks/lag.d.ts.map +1 -0
- package/dist/watch/checks/lag.js +55 -0
- package/dist/watch/checks/lag.js.map +1 -0
- package/dist/watch/checks/quiet-after-claim.d.ts +17 -0
- package/dist/watch/checks/quiet-after-claim.d.ts.map +1 -0
- package/dist/watch/checks/quiet-after-claim.js +89 -0
- package/dist/watch/checks/quiet-after-claim.js.map +1 -0
- package/dist/watch/checks/ungated.d.ts +12 -0
- package/dist/watch/checks/ungated.d.ts.map +1 -0
- package/dist/watch/checks/ungated.js +64 -0
- package/dist/watch/checks/ungated.js.map +1 -0
- package/dist/watch/checks/warned-rule.d.ts +26 -0
- package/dist/watch/checks/warned-rule.d.ts.map +1 -0
- package/dist/watch/checks/warned-rule.js +126 -0
- package/dist/watch/checks/warned-rule.js.map +1 -0
- package/dist/watch/emit.d.ts +122 -0
- package/dist/watch/emit.d.ts.map +1 -0
- package/dist/watch/emit.js +443 -0
- package/dist/watch/emit.js.map +1 -0
- package/dist/watch/events.d.ts +21 -0
- package/dist/watch/events.d.ts.map +1 -0
- package/dist/watch/events.js +21 -0
- package/dist/watch/events.js.map +1 -0
- package/dist/watch/keys.d.ts +15 -0
- package/dist/watch/keys.d.ts.map +1 -0
- package/dist/watch/keys.js +23 -0
- package/dist/watch/keys.js.map +1 -0
- package/dist/watch/lanes.d.ts +41 -0
- package/dist/watch/lanes.d.ts.map +1 -0
- package/dist/watch/lanes.js +73 -0
- package/dist/watch/lanes.js.map +1 -0
- package/dist/watch/loader.d.ts +47 -0
- package/dist/watch/loader.d.ts.map +1 -0
- package/dist/watch/loader.js +178 -0
- package/dist/watch/loader.js.map +1 -0
- package/dist/watch/registry.d.ts +166 -0
- package/dist/watch/registry.d.ts.map +1 -0
- package/dist/watch/registry.js +589 -0
- package/dist/watch/registry.js.map +1 -0
- package/dist/watch/ring.d.ts +32 -0
- package/dist/watch/ring.d.ts.map +1 -0
- package/dist/watch/ring.js +90 -0
- package/dist/watch/ring.js.map +1 -0
- package/dist/watch/router.d.ts +25 -0
- package/dist/watch/router.d.ts.map +1 -0
- package/dist/watch/router.js +87 -0
- package/dist/watch/router.js.map +1 -0
- package/dist/watch/sources.d.ts +42 -0
- package/dist/watch/sources.d.ts.map +1 -0
- package/dist/watch/sources.js +104 -0
- package/dist/watch/sources.js.map +1 -0
- package/dist/watch/types.d.ts +129 -0
- package/dist/watch/types.d.ts.map +1 -0
- package/dist/watch/types.js +6 -0
- package/dist/watch/types.js.map +1 -0
- package/endpoint-manifest.json +272 -1
- package/package.json +3 -2
- package/watch/entries/claim-vs-evidence.json +13 -0
- package/watch/entries/deliver-audit.json +17 -0
- package/watch/entries/quiet-after-claim.json +16 -0
- package/watch/entries/registry-check-failed.json +12 -0
- package/watch/entries/registry-lagging.json +12 -0
- package/watch/entries/risky-call.json +12 -0
- package/watch/entries/ungated.json +13 -0
- package/dist/api/demo.d.ts +0 -90
- package/dist/api/demo.d.ts.map +0 -1
- package/dist/api/demo.js +0 -492
- package/dist/api/demo.js.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decision capture — the ledger's shapes (DES-decision-capture §4.2.1, DC-S4a).
|
|
3
|
+
*
|
|
4
|
+
* The ledger is the ONLY source of ORIGIN: the operator's verbatim words, who typed them (a human
|
|
5
|
+
* actor — an agent's words are never recorded), and the auth mode that decides auto eligibility.
|
|
6
|
+
* One append-only JSONL file per project; a line is a `record` or an `outcome`, and a read folds
|
|
7
|
+
* them into a {@link DecisionView} (api-types 0.80.0).
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the switch. Default `ledger`: record and label, no chips and no auto — the live-precision
|
|
11
|
+
* mode §8 runs before `on` (the corpus gate). An unknown value is `ledger`, never `on`.
|
|
12
|
+
*/
|
|
13
|
+
export function resolveDecisionsMode(env = process.env) {
|
|
14
|
+
const raw = (env['WICKED_DECISIONS'] ?? '').trim().toLowerCase();
|
|
15
|
+
if (raw === 'off' || raw === 'on' || raw === 'ledger')
|
|
16
|
+
return raw;
|
|
17
|
+
return 'ledger';
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/decisions/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAuGH;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACvE,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACjE,IAAI,GAAG,KAAK,KAAK,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC;IAClE,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two Content-Security-Policies of the editor plugin contract (DES-artifact-editor-plugins §8.2,
|
|
3
|
+
* EP-C1). Spelled once, pinned by test — a header is only as good as its exact text.
|
|
4
|
+
*
|
|
5
|
+
* - {@link bundleHeaders}: on the bundle response. `sandbox allow-scripts` sandboxes the bundle even
|
|
6
|
+
* when opened top-level; `default-src 'none'` + `connect-src 'none'` is the line that protects the
|
|
7
|
+
* local no-auth daemon (no fetch, XHR, WebSocket, EventSource or beacon); `form-action 'none'`,
|
|
8
|
+
* `base-uri 'none'`, no workers, no manifest. `script-src 'unsafe-inline'` is acceptable only
|
|
9
|
+
* because the bundle is ONE hashed file and nothing else can load. An editor holding
|
|
10
|
+
* `network.media` (first-party `wicked-page`: agent-authored pages use web images) gets
|
|
11
|
+
* `img-src … https:` and `font-src … https:` — a GET-only channel, never `connect-src`.
|
|
12
|
+
* `navigate-to` / `prefetch-src` are deliberately absent: no browser enforces them (review B1).
|
|
13
|
+
* - {@link shellCsp}: on studio's own shell document. A sandboxed frame may navigate ITSELF, and
|
|
14
|
+
* once it does the bundle's policy is gone — so the shell limits what any frame may point at:
|
|
15
|
+
* crew's own editors route, crew's interactive proxy (today's Document mode), `blob:` and
|
|
16
|
+
* `data:`. The origin is written per response because a path cannot follow `'self'`.
|
|
17
|
+
*/
|
|
18
|
+
import type { EditorRecord } from './registry.js';
|
|
19
|
+
export declare const BUNDLE_CSP_BASE: string;
|
|
20
|
+
/** Exactly the §8.2 header set for one editor's bundle. */
|
|
21
|
+
export declare function bundleHeaders(record: Pick<EditorRecord, 'manifest' | 'firstParty'>): Record<string, string>;
|
|
22
|
+
/** The shell's `frame-src` policy for the request's own origin (`scheme://host[:port]`). */
|
|
23
|
+
export declare function shellCsp(origin: string): string;
|
|
24
|
+
/** `scheme://host` of a request, from what the client sent (a hosted skin may sit behind a proxy). */
|
|
25
|
+
export declare function requestOrigin(req: {
|
|
26
|
+
protocol?: string | undefined;
|
|
27
|
+
headers: {
|
|
28
|
+
host?: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
}): string;
|
|
31
|
+
//# sourceMappingURL=csp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csp.d.ts","sourceRoot":"","sources":["../../src/editors/csp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,eAAO,MAAM,eAAe,QAIc,CAAC;AAE3C,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,YAAY,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAY3G;AAED,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,sGAAsG;AACtG,wBAAgB,aAAa,CAAC,GAAG,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAA;CAAE,GAAG,MAAM,CAIpH"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two Content-Security-Policies of the editor plugin contract (DES-artifact-editor-plugins §8.2,
|
|
3
|
+
* EP-C1). Spelled once, pinned by test — a header is only as good as its exact text.
|
|
4
|
+
*
|
|
5
|
+
* - {@link bundleHeaders}: on the bundle response. `sandbox allow-scripts` sandboxes the bundle even
|
|
6
|
+
* when opened top-level; `default-src 'none'` + `connect-src 'none'` is the line that protects the
|
|
7
|
+
* local no-auth daemon (no fetch, XHR, WebSocket, EventSource or beacon); `form-action 'none'`,
|
|
8
|
+
* `base-uri 'none'`, no workers, no manifest. `script-src 'unsafe-inline'` is acceptable only
|
|
9
|
+
* because the bundle is ONE hashed file and nothing else can load. An editor holding
|
|
10
|
+
* `network.media` (first-party `wicked-page`: agent-authored pages use web images) gets
|
|
11
|
+
* `img-src … https:` and `font-src … https:` — a GET-only channel, never `connect-src`.
|
|
12
|
+
* `navigate-to` / `prefetch-src` are deliberately absent: no browser enforces them (review B1).
|
|
13
|
+
* - {@link shellCsp}: on studio's own shell document. A sandboxed frame may navigate ITSELF, and
|
|
14
|
+
* once it does the bundle's policy is gone — so the shell limits what any frame may point at:
|
|
15
|
+
* crew's own editors route, crew's interactive proxy (today's Document mode), `blob:` and
|
|
16
|
+
* `data:`. The origin is written per response because a path cannot follow `'self'`.
|
|
17
|
+
*/
|
|
18
|
+
export const BUNDLE_CSP_BASE = "sandbox allow-scripts; default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; " +
|
|
19
|
+
"img-src data: blob:{MEDIA}; media-src blob:; font-src data:{MEDIA}; frame-src blob: data: about:; " +
|
|
20
|
+
"child-src blob: data: about:; connect-src 'none'; form-action 'none'; base-uri 'none'; " +
|
|
21
|
+
"worker-src 'none'; manifest-src 'none'";
|
|
22
|
+
/** Exactly the §8.2 header set for one editor's bundle. */
|
|
23
|
+
export function bundleHeaders(record) {
|
|
24
|
+
// `network.media` widens only for a first-party editor: a third-party one would have to ASK
|
|
25
|
+
// (§6.1), and no third-party editor can be installed before EP-C8.
|
|
26
|
+
const media = record.firstParty && record.manifest.permissions.some((p) => p.id === 'network.media') ? ' https:' : '';
|
|
27
|
+
return {
|
|
28
|
+
'Content-Security-Policy': BUNDLE_CSP_BASE.replaceAll('{MEDIA}', media),
|
|
29
|
+
'Cross-Origin-Resource-Policy': 'same-origin',
|
|
30
|
+
'X-Content-Type-Options': 'nosniff',
|
|
31
|
+
'X-DNS-Prefetch-Control': 'off',
|
|
32
|
+
'Referrer-Policy': 'no-referrer',
|
|
33
|
+
'Cache-Control': 'no-store',
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** The shell's `frame-src` policy for the request's own origin (`scheme://host[:port]`). */
|
|
37
|
+
export function shellCsp(origin) {
|
|
38
|
+
return `frame-src ${origin}/api/v1/editors/ ${origin}/api/v1/projects/ blob: data:`;
|
|
39
|
+
}
|
|
40
|
+
/** `scheme://host` of a request, from what the client sent (a hosted skin may sit behind a proxy). */
|
|
41
|
+
export function requestOrigin(req) {
|
|
42
|
+
const proto = req.protocol === 'https' ? 'https' : 'http';
|
|
43
|
+
const host = typeof req.headers.host === 'string' && req.headers.host !== '' ? req.headers.host : 'localhost';
|
|
44
|
+
return `${proto}://${host}`;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=csp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csp.js","sourceRoot":"","sources":["../../src/editors/csp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,CAAC,MAAM,eAAe,GAC1B,oGAAoG;IACpG,oGAAoG;IACpG,yFAAyF;IACzF,wCAAwC,CAAC;AAE3C,2DAA2D;AAC3D,MAAM,UAAU,aAAa,CAAC,MAAqD;IACjF,4FAA4F;IAC5F,mEAAmE;IACnE,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACtH,OAAO;QACL,yBAAyB,EAAE,eAAe,CAAC,UAAU,CAAC,SAAS,EAAE,KAAK,CAAC;QACvE,8BAA8B,EAAE,aAAa;QAC7C,wBAAwB,EAAE,SAAS;QACnC,wBAAwB,EAAE,KAAK;QAC/B,iBAAiB,EAAE,aAAa;QAChC,eAAe,EAAE,UAAU;KAC5B,CAAC;AACJ,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,OAAO,aAAa,MAAM,oBAAoB,MAAM,+BAA+B,CAAC;AACtF,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,aAAa,CAAC,GAA8E;IAC1G,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAC1D,MAAM,IAAI,GAAG,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;IAC9G,OAAO,GAAG,KAAK,MAAM,IAAI,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A pack install, as far as it goes before EP-C8 (DES-artifact-editor-plugins §5.2, §9.2; EP-C1).
|
|
3
|
+
*
|
|
4
|
+
* Install is human-only (§6.4) and runs garden's fail-closed gate FIRST: `pack check --json` on the
|
|
5
|
+
* pack root (schema, every editor's entry inside the pack, its hash, its size, nothing loaded from
|
|
6
|
+
* outside). Then crew reads the spec-2 manifest and lists what the operator would be asked to
|
|
7
|
+
* approve — the editors, the blocks and the pack's skills (§3.2 "Add these") — and REFUSES with 501
|
|
8
|
+
* `third_party_editors_not_available`: an unverified editor must pass the install-time conformance
|
|
9
|
+
* run (cases 1-12 against the bundle, headless Chrome) before it may be installed, and that run is
|
|
10
|
+
* EP-C8. Nothing is written. The refusal carries the check verdict and the approval list, so the
|
|
11
|
+
* operator sees exactly what will be asked once installs open.
|
|
12
|
+
*/
|
|
13
|
+
import type { InstallEditorRefusal, PackCheckResult } from '../core/types.js';
|
|
14
|
+
export type PackCheckRunner = (packRoot: string) => Promise<PackCheckResult>;
|
|
15
|
+
/**
|
|
16
|
+
* Garden's gate, run as a child: `python3 <garden>/scripts/pack/check.py <pack> --json --garden-root <garden>`
|
|
17
|
+
* (`python` when `python3` is not on PATH). A missing garden or an unparseable verdict is a FAILED
|
|
18
|
+
* check with the reason — never a pass.
|
|
19
|
+
*/
|
|
20
|
+
export declare function gardenPackCheck(gardenRoot: string | null): PackCheckRunner;
|
|
21
|
+
export declare class PackInstallError extends Error {
|
|
22
|
+
readonly status: 400 | 404 | 422;
|
|
23
|
+
readonly check?: PackCheckResult | undefined;
|
|
24
|
+
constructor(status: 400 | 404 | 422, message: string, check?: PackCheckResult | undefined);
|
|
25
|
+
}
|
|
26
|
+
/** What `POST /editors` reads of a pack before refusing: the approval list (§3.2). */
|
|
27
|
+
export declare function previewPackInstall(packRootRaw: string, check: PackCheckRunner): Promise<InstallEditorRefusal>;
|
|
28
|
+
//# sourceMappingURL=pack-install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-install.d.ts","sourceRoot":"","sources":["../../src/editors/pack-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAG9E,MAAM,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;AAiB7E;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,eAAe,CAiC1E;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IAEvC,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG;IAEhC,QAAQ,CAAC,KAAK,CAAC,EAAE,eAAe;gBAFvB,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,EAChC,OAAO,EAAE,MAAM,EACN,KAAK,CAAC,EAAE,eAAe,YAAA;CAKnC;AAED,sFAAsF;AACtF,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAgEnH"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A pack install, as far as it goes before EP-C8 (DES-artifact-editor-plugins §5.2, §9.2; EP-C1).
|
|
3
|
+
*
|
|
4
|
+
* Install is human-only (§6.4) and runs garden's fail-closed gate FIRST: `pack check --json` on the
|
|
5
|
+
* pack root (schema, every editor's entry inside the pack, its hash, its size, nothing loaded from
|
|
6
|
+
* outside). Then crew reads the spec-2 manifest and lists what the operator would be asked to
|
|
7
|
+
* approve — the editors, the blocks and the pack's skills (§3.2 "Add these") — and REFUSES with 501
|
|
8
|
+
* `third_party_editors_not_available`: an unverified editor must pass the install-time conformance
|
|
9
|
+
* run (cases 1-12 against the bundle, headless Chrome) before it may be installed, and that run is
|
|
10
|
+
* EP-C8. Nothing is written. The refusal carries the check verdict and the approval list, so the
|
|
11
|
+
* operator sees exactly what will be asked once installs open.
|
|
12
|
+
*/
|
|
13
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
14
|
+
import { isAbsolute, join, resolve } from 'node:path';
|
|
15
|
+
import { execCapped } from '../core/exec.js';
|
|
16
|
+
/** The verdict shape garden's `scripts/pack/check.py --json` prints. */
|
|
17
|
+
function parseCheckOutput(stdout) {
|
|
18
|
+
try {
|
|
19
|
+
const raw = JSON.parse(stdout);
|
|
20
|
+
if (typeof raw !== 'object' || raw === null || typeof raw.ok !== 'boolean')
|
|
21
|
+
return null;
|
|
22
|
+
const findings = (list) => Array.isArray(list)
|
|
23
|
+
? list.flatMap((f) => (typeof f === 'object' && f !== null ? [f] : []))
|
|
24
|
+
: [];
|
|
25
|
+
return { ok: raw.ok, errors: findings(raw.errors), warnings: findings(raw.warnings) };
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Garden's gate, run as a child: `python3 <garden>/scripts/pack/check.py <pack> --json --garden-root <garden>`
|
|
33
|
+
* (`python` when `python3` is not on PATH). A missing garden or an unparseable verdict is a FAILED
|
|
34
|
+
* check with the reason — never a pass.
|
|
35
|
+
*/
|
|
36
|
+
export function gardenPackCheck(gardenRoot) {
|
|
37
|
+
return async (packRoot) => {
|
|
38
|
+
if (gardenRoot === null) {
|
|
39
|
+
return { ok: false, errors: [{ level: 'error', code: 'garden-missing', message: 'no wicked-garden plugin found to run `pack check`' }], warnings: [] };
|
|
40
|
+
}
|
|
41
|
+
const script = join(gardenRoot, 'scripts', 'pack', 'check.py');
|
|
42
|
+
if (!existsSync(script)) {
|
|
43
|
+
return { ok: false, errors: [{ level: 'error', code: 'garden-too-old', message: `this wicked-garden has no scripts/pack/check.py (needs >= 12.40.0)` }], warnings: [] };
|
|
44
|
+
}
|
|
45
|
+
const args = [script, packRoot, '--json', '--garden-root', gardenRoot];
|
|
46
|
+
let stdout = '';
|
|
47
|
+
for (const bin of ['python3', 'python']) {
|
|
48
|
+
try {
|
|
49
|
+
const out = await execCapped(bin, args, { timeout: 60_000, windowsHide: true });
|
|
50
|
+
stdout = out.stdout;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
const e = err;
|
|
55
|
+
if (e.code === 'ENOENT')
|
|
56
|
+
continue; // no such interpreter: try the next spelling
|
|
57
|
+
// A failing check exits 1 with the JSON verdict on stdout.
|
|
58
|
+
if (typeof e.stdout === 'string' && e.stdout.trim() !== '') {
|
|
59
|
+
stdout = e.stdout;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
return { ok: false, errors: [{ level: 'error', code: 'check-failed', message: `pack check did not run: ${e.message}` }], warnings: [] };
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const parsed = parseCheckOutput(stdout);
|
|
66
|
+
if (parsed === null) {
|
|
67
|
+
return { ok: false, errors: [{ level: 'error', code: 'check-unreadable', message: stdout === '' ? 'no python interpreter found (python3 / python)' : 'pack check printed no readable verdict' }], warnings: [] };
|
|
68
|
+
}
|
|
69
|
+
return parsed;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export class PackInstallError extends Error {
|
|
73
|
+
status;
|
|
74
|
+
check;
|
|
75
|
+
constructor(status, message, check) {
|
|
76
|
+
super(message);
|
|
77
|
+
this.status = status;
|
|
78
|
+
this.check = check;
|
|
79
|
+
this.name = 'PackInstallError';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** What `POST /editors` reads of a pack before refusing: the approval list (§3.2). */
|
|
83
|
+
export async function previewPackInstall(packRootRaw, check) {
|
|
84
|
+
if (typeof packRootRaw !== 'string' || packRootRaw.trim() === '' || !isAbsolute(packRootRaw)) {
|
|
85
|
+
throw new PackInstallError(400, '`packRoot` must be an absolute path to a directory holding wicked-pack.json');
|
|
86
|
+
}
|
|
87
|
+
const packRoot = resolve(packRootRaw);
|
|
88
|
+
let isDir = false;
|
|
89
|
+
try {
|
|
90
|
+
isDir = statSync(packRoot).isDirectory();
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
isDir = false;
|
|
94
|
+
}
|
|
95
|
+
if (!isDir)
|
|
96
|
+
throw new PackInstallError(404, `no directory at ${packRoot}`);
|
|
97
|
+
const manifestPath = join(packRoot, 'wicked-pack.json');
|
|
98
|
+
if (!existsSync(manifestPath))
|
|
99
|
+
throw new PackInstallError(400, `${packRoot} holds no wicked-pack.json`);
|
|
100
|
+
// Garden's gate first (fail closed): a refused manifest never gets as far as a listing.
|
|
101
|
+
const verdict = await check(packRoot);
|
|
102
|
+
if (!verdict.ok) {
|
|
103
|
+
throw new PackInstallError(422, `wicked-garden pack check refused the pack (${verdict.errors.length} error${verdict.errors.length === 1 ? '' : 's'})`, verdict);
|
|
104
|
+
}
|
|
105
|
+
let manifest;
|
|
106
|
+
try {
|
|
107
|
+
manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
throw new PackInstallError(400, `wicked-pack.json is not JSON: ${err instanceof Error ? err.message : String(err)}`);
|
|
111
|
+
}
|
|
112
|
+
const editors = Array.isArray(manifest['editors']) ? manifest['editors'] : [];
|
|
113
|
+
if (manifest['spec'] !== 2 || editors.length === 0) {
|
|
114
|
+
throw new PackInstallError(400, 'the pack declares no editors (spec 2 `editors[]`); there is nothing to install here');
|
|
115
|
+
}
|
|
116
|
+
const blocks = Array.isArray(manifest['blocks']) ? manifest['blocks'] : [];
|
|
117
|
+
const skillsDir = typeof manifest['skills_dir'] === 'string' ? manifest['skills_dir'] : 'skills';
|
|
118
|
+
let skills = [];
|
|
119
|
+
try {
|
|
120
|
+
const dir = join(packRoot, skillsDir);
|
|
121
|
+
if (statSync(dir).isDirectory())
|
|
122
|
+
skills = readdirSync(dir).filter((n) => !n.startsWith('.')).sort();
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
skills = [];
|
|
126
|
+
}
|
|
127
|
+
const str = (v) => (typeof v === 'string' ? v : '');
|
|
128
|
+
const strs = (v) => (Array.isArray(v) ? v.filter((x) => typeof x === 'string') : []);
|
|
129
|
+
return {
|
|
130
|
+
code: 'third_party_editors_not_available',
|
|
131
|
+
error: 'third-party editors cannot be installed yet: the install-time conformance run (DES-artifact-editor-plugins EP-C8) ' +
|
|
132
|
+
'has not shipped, and an unverified editor is never installed. The pack passed wicked-garden `pack check`; ' +
|
|
133
|
+
'this is what the install would ask you to approve.',
|
|
134
|
+
check: verdict,
|
|
135
|
+
pack: {
|
|
136
|
+
name: str(manifest['name']),
|
|
137
|
+
vendor: str(manifest['vendor']),
|
|
138
|
+
version: str(manifest['version']),
|
|
139
|
+
editors: editors.map((e) => ({
|
|
140
|
+
id: str(e['id']),
|
|
141
|
+
title: str(e['title']),
|
|
142
|
+
version: str(e['version']),
|
|
143
|
+
kinds: strs(e['kinds']),
|
|
144
|
+
permissions: Array.isArray(e['permissions'])
|
|
145
|
+
? e['permissions'].map((p) => ({ id: str(p['id']), why: str(p['why']) }))
|
|
146
|
+
: [],
|
|
147
|
+
})),
|
|
148
|
+
blocks: blocks.map((b) => ({ id: str(b['id']), label: str(b['label']), produces_kind: str(b['produces_kind']), skills: strs(b['skills']) })),
|
|
149
|
+
skills,
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=pack-install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-install.js","sourceRoot":"","sources":["../../src/editors/pack-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C,wEAAwE;AACxE,SAAS,gBAAgB,CAAC,MAAc;IACtC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAA6B,CAAC;QAC3D,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,CAAC,EAAE,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QACxF,MAAM,QAAQ,GAAG,CAAC,IAAa,EAA6B,EAAE,CAC5D,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YACjB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAsC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC5G,CAAC,CAAC,EAAE,CAAC;QACT,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM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oBAC1C,CAAC,CAAE,CAAC,CAAC,aAAa,CAAoC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;oBAC7G,CAAC,CAAC,EAAE;aACP,CAAC,CAAC;YACH,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;YAC5I,MAAM;SACP;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The artifact-editor registry (DES-artifact-editor-plugins §5.2, §8.6, §9.1; EP-C1).
|
|
3
|
+
*
|
|
4
|
+
* Two kinds of editor exist in the design; one exists today:
|
|
5
|
+
*
|
|
6
|
+
* - **First-party** editors ship INSIDE studio's bundle (§8.6): `<studio dist>/editors/<id>/editor.json`
|
|
7
|
+
* beside the ONE self-contained `index.html` entry. Crew discovers them at boot, pins each entry's
|
|
8
|
+
* sha256 and byte size, and serves the entry through the hashed bundle route (`routes.ts`) with
|
|
9
|
+
* the §8.2 headers. Their ids are `wicked-*` — the reserved first-party namespace every pack is
|
|
10
|
+
* refused (garden `wicked-pack.schema.json`).
|
|
11
|
+
* - **Third-party** editors arrive as garden packs (spec 2 `editors[]`). Their install is REFUSED
|
|
12
|
+
* until the install-time conformance run ships (EP-C8, LATER): `pack-install.ts` still runs
|
|
13
|
+
* garden's fail-closed `pack check` and lists what the operator would be asked to approve, then
|
|
14
|
+
* answers 501. Nothing of a pack is ever written by this registry.
|
|
15
|
+
*
|
|
16
|
+
* Persisted state is ONE file, `<state home>/daemon-editors.json` — the enable/disable flags the
|
|
17
|
+
* operator sets in Settings → Editors (§6.4, human-only). It sits under the `daemon-` prefix both
|
|
18
|
+
* crew's state-home registry and the engine's worker fence already classify (crew#756), so no new
|
|
19
|
+
* top-level entry is introduced; a pack install (EP-C8) will need a registered `editors/` subtree in
|
|
20
|
+
* both repos first.
|
|
21
|
+
*/
|
|
22
|
+
import { z } from 'zod';
|
|
23
|
+
import type { EditorView } from '../core/types.js';
|
|
24
|
+
/** The persisted flags file, under the registered `daemon-` prefix. */
|
|
25
|
+
export declare const EDITORS_STATE_FILENAME = "daemon-editors.json";
|
|
26
|
+
/** Where first-party manifests live inside the studio bundle. */
|
|
27
|
+
export declare const STUDIO_EDITORS_DIRNAME = "editors";
|
|
28
|
+
/** The host's bundle cap (§8.5); a pack's `limits.bundleBytes` may only be lower. */
|
|
29
|
+
export declare const HOST_BUNDLE_CAP_BYTES: number;
|
|
30
|
+
export declare const EDITOR_PERMISSIONS: readonly ["artifact.read", "artifact.write", "selection.chip", "composer.draft", "checks.read", "checks.contribute", "sources.read", "media.read", "artifact.export", "ui.fullscreen", "network.media"];
|
|
31
|
+
/** Editor ids: lowercase dash-words, ≤ 64 (garden's shape); first-party ones start with `wicked-`. */
|
|
32
|
+
export declare const EDITOR_ID: RegExp;
|
|
33
|
+
export declare const FIRST_PARTY_ID: RegExp;
|
|
34
|
+
/** Anchored SemVer (garden's shape). */
|
|
35
|
+
export declare const EDITOR_VERSION: RegExp;
|
|
36
|
+
export declare const EditorManifestSchema: z.ZodObject<{
|
|
37
|
+
id: z.ZodString;
|
|
38
|
+
title: z.ZodString;
|
|
39
|
+
version: z.ZodString;
|
|
40
|
+
protocol: z.ZodArray<z.ZodNumber, "many">;
|
|
41
|
+
kinds: z.ZodArray<z.ZodString, "many">;
|
|
42
|
+
entry: z.ZodDefault<z.ZodString>;
|
|
43
|
+
sizes: z.ZodEffects<z.ZodArray<z.ZodEnum<["inline", "pane", "full"]>, "many">, ("inline" | "pane" | "full")[], ("inline" | "pane" | "full")[]>;
|
|
44
|
+
panels: z.ZodOptional<z.ZodArray<z.ZodEnum<["checks"]>, "many">>;
|
|
45
|
+
permissions: z.ZodArray<z.ZodObject<{
|
|
46
|
+
id: z.ZodEnum<["artifact.read", "artifact.write", "selection.chip", "composer.draft", "checks.read", "checks.contribute", "sources.read", "media.read", "artifact.export", "ui.fullscreen", "network.media"]>;
|
|
47
|
+
why: z.ZodString;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
id: "artifact.read" | "artifact.write" | "selection.chip" | "composer.draft" | "checks.read" | "checks.contribute" | "sources.read" | "media.read" | "artifact.export" | "ui.fullscreen" | "network.media";
|
|
50
|
+
why: string;
|
|
51
|
+
}, {
|
|
52
|
+
id: "artifact.read" | "artifact.write" | "selection.chip" | "composer.draft" | "checks.read" | "checks.contribute" | "sources.read" | "media.read" | "artifact.export" | "ui.fullscreen" | "network.media";
|
|
53
|
+
why: string;
|
|
54
|
+
}>, "many">;
|
|
55
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
56
|
+
bundleBytes: z.ZodNumber;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
bundleBytes: number;
|
|
59
|
+
}, {
|
|
60
|
+
bundleBytes: number;
|
|
61
|
+
}>>;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
|
+
id: string;
|
|
64
|
+
title: string;
|
|
65
|
+
version: string;
|
|
66
|
+
entry: string;
|
|
67
|
+
protocol: number[];
|
|
68
|
+
kinds: string[];
|
|
69
|
+
sizes: ("inline" | "pane" | "full")[];
|
|
70
|
+
permissions: {
|
|
71
|
+
id: "artifact.read" | "artifact.write" | "selection.chip" | "composer.draft" | "checks.read" | "checks.contribute" | "sources.read" | "media.read" | "artifact.export" | "ui.fullscreen" | "network.media";
|
|
72
|
+
why: string;
|
|
73
|
+
}[];
|
|
74
|
+
panels?: "checks"[] | undefined;
|
|
75
|
+
limits?: {
|
|
76
|
+
bundleBytes: number;
|
|
77
|
+
} | undefined;
|
|
78
|
+
}, {
|
|
79
|
+
id: string;
|
|
80
|
+
title: string;
|
|
81
|
+
version: string;
|
|
82
|
+
protocol: number[];
|
|
83
|
+
kinds: string[];
|
|
84
|
+
sizes: ("inline" | "pane" | "full")[];
|
|
85
|
+
permissions: {
|
|
86
|
+
id: "artifact.read" | "artifact.write" | "selection.chip" | "composer.draft" | "checks.read" | "checks.contribute" | "sources.read" | "media.read" | "artifact.export" | "ui.fullscreen" | "network.media";
|
|
87
|
+
why: string;
|
|
88
|
+
}[];
|
|
89
|
+
entry?: string | undefined;
|
|
90
|
+
panels?: "checks"[] | undefined;
|
|
91
|
+
limits?: {
|
|
92
|
+
bundleBytes: number;
|
|
93
|
+
} | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
export type EditorManifest = z.infer<typeof EditorManifestSchema>;
|
|
96
|
+
export interface EditorRecord {
|
|
97
|
+
manifest: EditorManifest;
|
|
98
|
+
/** The full 64-hex sha256 of the entry file, pinned when the registry read it. */
|
|
99
|
+
sha256: string;
|
|
100
|
+
bytes: number;
|
|
101
|
+
/** Absolute path of the entry file. Never on the wire. */
|
|
102
|
+
entryPath: string;
|
|
103
|
+
firstParty: boolean;
|
|
104
|
+
source: 'studio-bundle';
|
|
105
|
+
enabled: boolean;
|
|
106
|
+
}
|
|
107
|
+
export declare function sha256Of(buf: Buffer): string;
|
|
108
|
+
/**
|
|
109
|
+
* A path is served from the bundle only if it IS what it looks like: a real directory or a real
|
|
110
|
+
* file, never a link (codex r1 — a link under `editors/` could point outside the bundle and be
|
|
111
|
+
* served as first-party). `null` = fine; else the reason.
|
|
112
|
+
*/
|
|
113
|
+
export declare function notRealEntry(path: string, want: 'dir' | 'file'): string | null;
|
|
114
|
+
/** The entry must be ONE self-contained file: nothing loaded from outside it (§5.2; the CSP would block it anyway). */
|
|
115
|
+
export declare function externalReferences(html: string): string[];
|
|
116
|
+
/**
|
|
117
|
+
* Read the first-party editors a studio bundle ships. A malformed manifest, a missing or oversized
|
|
118
|
+
* entry, an entry with outside references, or a non-`wicked-*` id is skipped with a reason — never
|
|
119
|
+
* served half-right.
|
|
120
|
+
*/
|
|
121
|
+
export declare function discoverStudioEditors(studioRoot: string, log?: (msg: string) => void): Array<Omit<EditorRecord, 'enabled'>>;
|
|
122
|
+
export declare class EditorRegistry {
|
|
123
|
+
private readonly records;
|
|
124
|
+
private readonly stateFile;
|
|
125
|
+
private readonly log;
|
|
126
|
+
constructor(opts?: {
|
|
127
|
+
stateHome?: string;
|
|
128
|
+
studioRoot?: string;
|
|
129
|
+
log?: (msg: string) => void;
|
|
130
|
+
});
|
|
131
|
+
private readState;
|
|
132
|
+
private writeState;
|
|
133
|
+
/** Where the flags live (diagnostics / tests). */
|
|
134
|
+
get stateFilePath(): string;
|
|
135
|
+
list(): EditorRecord[];
|
|
136
|
+
get(id: string): EditorRecord | null;
|
|
137
|
+
/** Enable or disable (§6.4: the operator's click). Returns the record, or `null` for an unknown id. */
|
|
138
|
+
setEnabled(id: string, enabled: boolean): EditorRecord | null;
|
|
139
|
+
/** The wire view: no paths, the hashed entry URL instead. */
|
|
140
|
+
static view(r: EditorRecord): EditorView;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/editors/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAoB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGrE,uEAAuE;AACvE,eAAO,MAAM,sBAAsB,wBAAwB,CAAC;AAC5D,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