@tangle-network/agent-app 0.61.4 → 0.62.0
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/{DesignCanvas-L6J72JQ2.js → DesignCanvas-IQKYAEC4.js} +3 -2
- package/dist/{DesignCanvasEditor-QFQD63MR.js → DesignCanvasEditor-O7OCZTGC.js} +5 -4
- package/dist/{TimelineEditor-7KBPJQLT.js → TimelineEditor-VB2UJ34D.js} +4 -2
- package/dist/VaultPane-AYW7CO33.js +8 -0
- package/dist/agent-profiles/d1.js +1 -1
- package/dist/agent-profiles/index.d.ts +0 -82
- package/dist/agent-profiles/index.js +1 -21
- package/dist/agent-profiles/self-management.d.ts +0 -55
- package/dist/alerting/index.d.ts +1 -1
- package/dist/alerting/index.js +1 -3
- package/dist/alerting/slack.d.ts +6 -79
- package/dist/app-auth/drizzle.d.ts +17 -271
- package/dist/app-auth/drizzle.js +6 -2
- package/dist/app-auth/drizzle.js.map +1 -1
- package/dist/app-auth/index.js +3 -3
- package/dist/assets/types.d.ts +2 -1
- package/dist/assistant/AssistantPanel.d.ts +1 -1
- package/dist/assistant/index.js +635 -392
- package/dist/assistant/index.js.map +1 -1
- package/dist/billing/identity-locks.d.ts +5 -0
- package/dist/billing/index.js +1 -1
- package/dist/brand-extraction/index.js.map +1 -1
- package/dist/brand-extraction/types.d.ts +2 -1
- package/dist/chat-react/index.js +6 -5
- package/dist/chat-routes/attachment-write-safety.d.ts +4 -0
- package/dist/chat-routes/draft-persistence.d.ts +2 -14
- package/dist/chat-routes/index.d.ts +1 -0
- package/dist/chat-routes/index.js +853 -773
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/sandbox-model-source.d.ts +20 -0
- package/dist/chat-routes/stored-attachments.d.ts +18 -0
- package/dist/chat-routes/turn-admission.d.ts +1 -1
- package/dist/chat-routes/turn-execution.d.ts +2 -2
- package/dist/chat-routes/turn-route-contracts.d.ts +3 -29
- package/dist/chat-store/core.d.ts +19 -1
- package/dist/chat-store/index.js.map +1 -1
- package/dist/chat-store/store.d.ts +3 -29
- package/dist/{chunk-ATQQCG4I.js → chunk-2VJLLRVV.js} +2 -2
- package/dist/{chunk-R4X5474U.js → chunk-52SDU43B.js} +12 -27
- package/dist/chunk-52SDU43B.js.map +1 -0
- package/dist/{chunk-MDRH3SDA.js → chunk-54YIL7WM.js} +3 -3
- package/dist/{chunk-6QJ3GB3A.js → chunk-5GSZGTPJ.js} +2 -2
- package/dist/{chunk-5IM2CLYX.js → chunk-6JEDSKFH.js} +232 -218
- package/dist/chunk-6JEDSKFH.js.map +1 -0
- package/dist/{chunk-6PRQ45QE.js → chunk-6OG4244Y.js} +1 -1
- package/dist/chunk-6OG4244Y.js.map +1 -0
- package/dist/{chunk-ZDPUC6CM.js → chunk-6ZVSMA4T.js} +3 -3
- package/dist/{chunk-TXUAGSFR.js → chunk-76MPX7JQ.js} +47 -1
- package/dist/chunk-76MPX7JQ.js.map +1 -0
- package/dist/{chunk-BOQ4HVVH.js → chunk-7ISHKBAD.js} +61 -52
- package/dist/chunk-7ISHKBAD.js.map +1 -0
- package/dist/chunk-7PULOECS.js +22 -0
- package/dist/chunk-7PULOECS.js.map +1 -0
- package/dist/{chunk-KJODHPWM.js → chunk-CPVGRQ43.js} +511 -339
- package/dist/chunk-CPVGRQ43.js.map +1 -0
- package/dist/{chunk-LO6VQ35O.js → chunk-CQZVJVME.js} +2 -2
- package/dist/{chunk-Y43PXON2.js → chunk-EFQUAWWF.js} +577 -546
- package/dist/chunk-EFQUAWWF.js.map +1 -0
- package/dist/{chunk-FPNZMIAW.js → chunk-ELX5YITO.js} +1 -1
- package/dist/chunk-ELX5YITO.js.map +1 -0
- package/dist/chunk-FGAROAUF.js +19 -0
- package/dist/chunk-FGAROAUF.js.map +1 -0
- package/dist/{chunk-HN6MZ2XL.js → chunk-FTNGGR37.js} +641 -466
- package/dist/chunk-FTNGGR37.js.map +1 -0
- package/dist/{chunk-G4F2NWZH.js → chunk-FZ3ZFVAC.js} +4 -4
- package/dist/{chunk-UCCSJX64.js → chunk-GIEUZBQQ.js} +1112 -644
- package/dist/chunk-GIEUZBQQ.js.map +1 -0
- package/dist/{chunk-MEKOWH5E.js → chunk-IVBREL7A.js} +785 -526
- package/dist/chunk-IVBREL7A.js.map +1 -0
- package/dist/{chunk-WSEXFTN4.js → chunk-JBXNU5WD.js} +26 -26
- package/dist/chunk-JBXNU5WD.js.map +1 -0
- package/dist/{chunk-F2VX6TTJ.js → chunk-JRCZHDRG.js} +2 -41
- package/dist/chunk-JRCZHDRG.js.map +1 -0
- package/dist/{chunk-LXYQOOXU.js → chunk-JRW6LCIA.js} +552 -302
- package/dist/chunk-JRW6LCIA.js.map +1 -0
- package/dist/{chunk-TVPH5T4F.js → chunk-KS4I7KVC.js} +16 -22
- package/dist/{chunk-TVPH5T4F.js.map → chunk-KS4I7KVC.js.map} +1 -1
- package/dist/{chunk-J2BBYVGF.js → chunk-MRZP65DZ.js} +1 -117
- package/dist/chunk-MRZP65DZ.js.map +1 -0
- package/dist/{chunk-4ZSLX3LY.js → chunk-OODZCBSM.js} +1 -1
- package/dist/chunk-OODZCBSM.js.map +1 -0
- package/dist/chunk-P4RRC4AO.js +47 -0
- package/dist/chunk-P4RRC4AO.js.map +1 -0
- package/dist/{chunk-ORQD4AUO.js → chunk-PCAY23GS.js} +1 -6
- package/dist/chunk-PCAY23GS.js.map +1 -0
- package/dist/{chunk-NMZUW6VJ.js → chunk-PEJ5OP5B.js} +3 -3
- package/dist/chunk-PEJ5OP5B.js.map +1 -0
- package/dist/{chunk-NHYRIM4I.js → chunk-PIPNDZ6H.js} +304 -194
- package/dist/chunk-PIPNDZ6H.js.map +1 -0
- package/dist/{chunk-L7LQRJGD.js → chunk-TCJ4TMOW.js} +37 -33
- package/dist/{chunk-L7LQRJGD.js.map → chunk-TCJ4TMOW.js.map} +1 -1
- package/dist/chunk-UHSUY6H6.js +79 -0
- package/dist/chunk-UHSUY6H6.js.map +1 -0
- package/dist/{chunk-PDD5A43Y.js → chunk-UTL6TEN6.js} +3 -3
- package/dist/{chunk-VJBFCNAU.js → chunk-UW2DKTEM.js} +123 -130
- package/dist/chunk-UW2DKTEM.js.map +1 -0
- package/dist/{chunk-S27DKRI6.js → chunk-VDYEVCQQ.js} +2 -2
- package/dist/{chunk-UFQM46NV.js → chunk-VK3F4N4U.js} +2 -2
- package/dist/{chunk-6ZIC6OG5.js → chunk-VYBTQK25.js} +126 -122
- package/dist/chunk-VYBTQK25.js.map +1 -0
- package/dist/{chunk-RL3Z747H.js → chunk-W2BV2XOC.js} +1491 -700
- package/dist/chunk-W2BV2XOC.js.map +1 -0
- package/dist/{chunk-FUZETA6Z.js → chunk-X6SZGQTK.js} +2 -2
- package/dist/{chunk-CD2LQXY6.js → chunk-XOHE6SKU.js} +14 -16
- package/dist/{chunk-CD2LQXY6.js.map → chunk-XOHE6SKU.js.map} +1 -1
- package/dist/{chunk-ZBB5KQ6B.js → chunk-Y3GO6SG3.js} +73 -66
- package/dist/chunk-Y3GO6SG3.js.map +1 -0
- package/dist/chunk-ZAMHLXNS.js +56 -0
- package/dist/chunk-ZAMHLXNS.js.map +1 -0
- package/dist/{chunk-RHFN7TUV.js → chunk-ZDHCV462.js} +47 -44
- package/dist/{chunk-RHFN7TUV.js.map → chunk-ZDHCV462.js.map} +1 -1
- package/dist/chunk-ZOS3D26Z.js +72 -0
- package/dist/chunk-ZOS3D26Z.js.map +1 -0
- package/dist/design-canvas/index.js +32 -32
- package/dist/design-canvas/index.js.map +1 -1
- package/dist/design-canvas-react/components/DesignCanvas.d.ts +1 -1
- package/dist/design-canvas-react/components/Workspace.d.ts +1 -1
- package/dist/design-canvas-react/components/glyphs.d.ts +31 -40
- package/dist/design-canvas-react/components/transform-math.d.ts +0 -8
- package/dist/design-canvas-react/components/use-workspace-keyboard.d.ts +2 -2
- package/dist/design-canvas-react/contracts.d.ts +2 -2
- package/dist/design-canvas-react/engine.js +1 -1
- package/dist/design-canvas-react/index.js +9 -7
- package/dist/design-canvas-react/index.js.map +1 -1
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/eval/calibration.d.ts +1 -38
- package/dist/eval/index.d.ts +2 -4
- package/dist/eval/index.js +0 -84
- package/dist/eval/index.js.map +1 -1
- package/dist/harness/index.d.ts +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/harness/session-selection.d.ts +2 -2
- package/dist/hub-approvals/index.js +1 -1
- package/dist/hub-approvals/result.d.ts +1 -1
- package/dist/hub-approvals-react/index.js +4 -4
- package/dist/hub-approvals-react/index.js.map +1 -1
- package/dist/hub-approvals-react/parts.d.ts +1 -1
- package/dist/launch-invariants/cli.js +4 -4
- package/dist/launch-invariants/index.js +3 -3
- package/dist/launch-invariants/testing.js +4 -4
- package/dist/legibility/cli.js +1 -1
- package/dist/legibility/index.js +1 -1
- package/dist/{mention-editor-B23OMFT2.js → mention-editor-4BKBMWIK.js} +83 -57
- package/dist/mention-editor-4BKBMWIK.js.map +1 -0
- package/dist/missions/index.js +144 -137
- package/dist/missions/index.js.map +1 -1
- package/dist/operator/index.js +1 -1
- package/dist/peer-floors/check.js +1 -1
- package/dist/peer-floors/cli.js +6 -14
- package/dist/peer-floors/cli.js.map +1 -1
- package/dist/peer-floors/source-entries.d.ts +6 -0
- package/dist/platform/index.js +10 -10
- package/dist/preset-cloudflare/index.js +1 -1
- package/dist/profile/index.d.ts +0 -1
- package/dist/profile/index.js +1 -422
- package/dist/profile/index.js.map +1 -1
- package/dist/profile-editor/server.d.ts +0 -1
- package/dist/profile-editor/server.js +0 -1
- package/dist/profile-editor/server.js.map +1 -1
- package/dist/public-consultation/index.d.ts +2 -2
- package/dist/public-consultation/index.js +6 -6
- package/dist/record/drizzle.js +156 -148
- package/dist/record/drizzle.js.map +1 -1
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/router-turn.js +3 -3
- package/dist/sandbox/index.js +5 -5
- package/dist/sequences/drizzle.js +5 -15
- package/dist/sequences/drizzle.js.map +1 -1
- package/dist/sequences/index.d.ts +1 -0
- package/dist/sequences/index.js +18 -14
- package/dist/sequences/index.js.map +1 -1
- package/dist/sequences/row-mapping.d.ts +7 -0
- package/dist/sequences-react/components/TimelineEditor.d.ts +0 -40
- package/dist/sequences-react/components/TimelineHistory.d.ts +31 -0
- package/dist/sequences-react/components/glyphs.d.ts +12 -21
- package/dist/sequences-react/components/index.d.ts +0 -2
- package/dist/sequences-react/components/interaction-math.d.ts +3 -3
- package/dist/sequences-react/contracts.d.ts +1 -1
- package/dist/sequences-react/engine/snap.d.ts +2 -2
- package/dist/sequences-react/index.js +4 -4
- package/dist/sequences-react/index.js.map +1 -1
- package/dist/settings-react/index.js +13 -30
- package/dist/settings-react/index.js.map +1 -1
- package/dist/settings-react/timezone-picker.d.ts +0 -6
- package/dist/signoff/browser-budget.d.ts +6 -1
- package/dist/signoff/cli.d.ts +0 -7
- package/dist/signoff/cli.js +1 -2
- package/dist/signoff/cli.js.map +1 -1
- package/dist/signoff/index.js +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +5 -25
- package/dist/skills/marketplace.d.ts +1 -75
- package/dist/skills-placement/box.js +3 -4
- package/dist/skills-placement/box.js.map +1 -1
- package/dist/skills-placement/index.js +3 -4
- package/dist/spend/cli-args.d.ts +1 -1
- package/dist/spend/cli.js +3 -3
- package/dist/spend/cli.js.map +1 -1
- package/dist/spend/index.js +1 -1
- package/dist/stories/design-canvas/fixtures.d.ts +1 -14
- package/dist/stream/index.js +17 -17
- package/dist/studio/generation.d.ts +1 -1
- package/dist/studio/index.js +1 -1
- package/dist/studio-react/index.js +353 -184
- package/dist/studio-react/index.js.map +1 -1
- package/dist/studio-react/studio-composer.d.ts +1 -5
- package/dist/studio-react/studio-history-screen.d.ts +1 -1
- package/dist/teams/invitations-api.d.ts +3 -3
- package/dist/teams/invitations-api.js +74 -72
- package/dist/teams/invitations-api.js.map +1 -1
- package/dist/teams/member-sync.d.ts +2 -0
- package/dist/teams/members-api.d.ts +2 -2
- package/dist/teams/members-api.js +1 -1
- package/dist/teams-react/index.js +28 -45
- package/dist/teams-react/index.js.map +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/mcp-arguments.d.ts +1 -1
- package/dist/trace/index.d.ts +1 -18
- package/dist/trace/index.js +1 -36
- package/dist/trace/index.js.map +1 -1
- package/dist/trace/mission-flow.d.ts +1 -59
- package/dist/turn-health/index.d.ts +1 -1
- package/dist/turn-health/index.js +2 -2
- package/dist/turn-health/sink.d.ts +2 -1
- package/dist/turn-trace/index.js +2 -4
- package/dist/turn-trace/recorder.d.ts +0 -2
- package/dist/vault/VaultPane.d.ts +0 -20
- package/dist/vault/VaultPaneOperations.d.ts +318 -0
- package/dist/vault/index.js +2 -1
- package/dist/vault/index.js.map +1 -1
- package/dist/vault/lazy.js +1 -1
- package/dist/web-react/agent-profile-editor.d.ts +1 -2
- package/dist/web-react/agent-profile-editor.js +6 -5
- package/dist/web-react/chat-composer.d.ts +1 -1
- package/dist/web-react/durable-plan-flow.d.ts +6 -1
- package/dist/web-react/editor-glyphs.d.ts +12 -0
- package/dist/web-react/focus-navigation.d.ts +12 -0
- package/dist/web-react/history-controls.d.ts +37 -0
- package/dist/web-react/index.js +36 -34
- package/dist/web-react/interaction-question-card.d.ts +1 -1
- package/dist/web-react/record-grid-writes.d.ts +31 -0
- package/dist/web-react/record-grid.d.ts +1 -48
- package/dist/web-react/session-history-panel.d.ts +1 -9
- package/dist/web-react/use-document-dark.d.ts +1 -0
- package/dist/workspace-export/engine.d.ts +1 -6
- package/dist/workspace-export/index.js +198 -185
- package/dist/workspace-export/index.js.map +1 -1
- package/dist/workspace-export/routes.d.ts +1 -1
- package/dist/workspace-react/index.js +9 -8
- package/dist/workspace-react/index.js.map +1 -1
- package/package.json +1 -11
- package/dist/VaultPane-RXL3WLA2.js +0 -7
- package/dist/agent-profiles/reaper.d.ts +0 -31
- package/dist/agent-profiles/reaper.js +0 -29
- package/dist/agent-profiles/reaper.js.map +0 -1
- package/dist/chunk-4ZSLX3LY.js.map +0 -1
- package/dist/chunk-5IM2CLYX.js.map +0 -1
- package/dist/chunk-6OSJNJA2.js +0 -251
- package/dist/chunk-6OSJNJA2.js.map +0 -1
- package/dist/chunk-6PRQ45QE.js.map +0 -1
- package/dist/chunk-6ZIC6OG5.js.map +0 -1
- package/dist/chunk-BDEBQ4WO.js +0 -38
- package/dist/chunk-BDEBQ4WO.js.map +0 -1
- package/dist/chunk-BOQ4HVVH.js.map +0 -1
- package/dist/chunk-F2VX6TTJ.js.map +0 -1
- package/dist/chunk-FPNZMIAW.js.map +0 -1
- package/dist/chunk-HN6MZ2XL.js.map +0 -1
- package/dist/chunk-J2BBYVGF.js.map +0 -1
- package/dist/chunk-KJODHPWM.js.map +0 -1
- package/dist/chunk-LTWJYNEC.js +0 -100
- package/dist/chunk-LTWJYNEC.js.map +0 -1
- package/dist/chunk-LXYQOOXU.js.map +0 -1
- package/dist/chunk-MEKOWH5E.js.map +0 -1
- package/dist/chunk-NHYRIM4I.js.map +0 -1
- package/dist/chunk-NMZUW6VJ.js.map +0 -1
- package/dist/chunk-ORQD4AUO.js.map +0 -1
- package/dist/chunk-R4X5474U.js.map +0 -1
- package/dist/chunk-RL3Z747H.js.map +0 -1
- package/dist/chunk-TXUAGSFR.js.map +0 -1
- package/dist/chunk-UCCSJX64.js.map +0 -1
- package/dist/chunk-VJBFCNAU.js.map +0 -1
- package/dist/chunk-WSEXFTN4.js.map +0 -1
- package/dist/chunk-Y43PXON2.js.map +0 -1
- package/dist/chunk-ZBB5KQ6B.js.map +0 -1
- package/dist/eval/parity.d.ts +0 -74
- package/dist/mention-editor-B23OMFT2.js.map +0 -1
- package/dist/profile/humanizer-skill.d.ts +0 -23
- package/dist/profile/humanizer-skill.vendored.d.ts +0 -4
- package/dist/sequences-react/components/BrandMark.d.ts +0 -10
- package/dist/skills/marketplace-drizzle.d.ts +0 -121
- package/dist/skills/marketplace-drizzle.js +0 -34
- package/dist/skills/marketplace-drizzle.js.map +0 -1
- package/dist/teams-react/components/BrandMark.d.ts +0 -10
- /package/dist/{DesignCanvas-L6J72JQ2.js.map → DesignCanvas-IQKYAEC4.js.map} +0 -0
- /package/dist/{DesignCanvasEditor-QFQD63MR.js.map → DesignCanvasEditor-O7OCZTGC.js.map} +0 -0
- /package/dist/{TimelineEditor-7KBPJQLT.js.map → TimelineEditor-VB2UJ34D.js.map} +0 -0
- /package/dist/{VaultPane-RXL3WLA2.js.map → VaultPane-AYW7CO33.js.map} +0 -0
- /package/dist/{chunk-ATQQCG4I.js.map → chunk-2VJLLRVV.js.map} +0 -0
- /package/dist/{chunk-MDRH3SDA.js.map → chunk-54YIL7WM.js.map} +0 -0
- /package/dist/{chunk-6QJ3GB3A.js.map → chunk-5GSZGTPJ.js.map} +0 -0
- /package/dist/{chunk-ZDPUC6CM.js.map → chunk-6ZVSMA4T.js.map} +0 -0
- /package/dist/{chunk-LO6VQ35O.js.map → chunk-CQZVJVME.js.map} +0 -0
- /package/dist/{chunk-G4F2NWZH.js.map → chunk-FZ3ZFVAC.js.map} +0 -0
- /package/dist/{chunk-PDD5A43Y.js.map → chunk-UTL6TEN6.js.map} +0 -0
- /package/dist/{chunk-S27DKRI6.js.map → chunk-VDYEVCQQ.js.map} +0 -0
- /package/dist/{chunk-UFQM46NV.js.map → chunk-VK3F4N4U.js.map} +0 -0
- /package/dist/{chunk-FUZETA6Z.js.map → chunk-X6SZGQTK.js.map} +0 -0
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A searchable timezone field: the same popover, search and keyboard model as
|
|
3
|
-
* `ModelPicker`. Zones come from the browser's IANA list, grouped by region
|
|
4
|
-
* with today's UTC offset, and match by city, zone name or offset ("+5:30",
|
|
5
|
-
* "utc-4"). The value is always the IANA name; one the list lacks still shows.
|
|
6
|
-
*/
|
|
7
1
|
export interface TimezonePickerProps {
|
|
8
2
|
/** The trigger's id, for the row's label. */
|
|
9
3
|
id?: string;
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* instead of passing with a note. One page load can't be paced from outside
|
|
30
30
|
* the page, so the exit code is the enforcement.
|
|
31
31
|
*/
|
|
32
|
-
import type { Page } from 'playwright';
|
|
32
|
+
import type { Page, Browser, BrowserContextOptions } from 'playwright';
|
|
33
33
|
/** Chromium flags that stop prerender and speculative prefetch of linked pages. */
|
|
34
34
|
export declare const QUIET_CHROMIUM_ARGS: readonly string[];
|
|
35
35
|
/** Requests per 10 s a check may send; a quarter of the shared zone limit. */
|
|
@@ -68,3 +68,8 @@ export declare function isOverBudget(count: NetworkCount, budget?: number): bool
|
|
|
68
68
|
/** 0, or `NETWORK_OVER_BUDGET_EXIT` when the run went over the budget. */
|
|
69
69
|
export declare function networkExitCode(count: NetworkCount | undefined): number;
|
|
70
70
|
export declare function formatNetworkCount(count: NetworkCount): string;
|
|
71
|
+
/** Every visual check installs its theme before opening a network-metered page. */
|
|
72
|
+
export declare function createMeteredBrowserPage(browser: Browser, options: BrowserContextOptions, meter: RequestMeter, themeScript?: string): Promise<{
|
|
73
|
+
context: import("playwright").BrowserContext;
|
|
74
|
+
page: Page;
|
|
75
|
+
}>;
|
package/dist/signoff/cli.d.ts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { type RunSignoffOptions } from './run';
|
|
3
|
-
interface ParsedArgs extends RunSignoffOptions {
|
|
4
|
-
readonly jsonPath?: string;
|
|
5
|
-
readonly quiet?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function parseArgs(argv: readonly string[]): ParsedArgs;
|
|
8
2
|
export declare function runSignoffCli(argv: readonly string[]): Promise<number>;
|
|
9
|
-
export {};
|
package/dist/signoff/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
runSignoff,
|
|
11
11
|
runSurfaceLadderCli,
|
|
12
12
|
runWorkspaceSurfaceCli
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-KS4I7KVC.js";
|
|
14
14
|
import "../chunk-LRYY3OX7.js";
|
|
15
15
|
import {
|
|
16
16
|
invokedAsScript
|
|
@@ -230,7 +230,6 @@ if (invokedAsScript(import.meta.url, process.argv[1])) {
|
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
232
|
export {
|
|
233
|
-
parseArgs,
|
|
234
233
|
runSignoffCli
|
|
235
234
|
};
|
|
236
235
|
//# sourceMappingURL=cli.js.map
|
package/dist/signoff/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/signoff/cli.ts","../../src/signoff/defaults-cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * `agent-app-signoff` — run the local sign-off gate and print the proof.\n *\n * Exits 0 only when every declared step passed in a pristine tree. Exit 1 is a\n * real failure; exit 2 is a usage or config error, so a script can tell \"your\n * code is broken\" from \"your gate is misconfigured\".\n *\n * agent-app-signoff # this repo, working tree, default config\n * agent-app-signoff --source head # exactly the commit that would merge\n * agent-app-signoff --seed 12345 # reproduce a previous run's orders\n * agent-app-signoff --keep-going # run every step, full picture\n * agent-app-signoff --json proof.json # machine-readable record\n * agent-app-signoff defaults [repoDir] # which agent-app defaults each app has\n * agent-app-signoff shell-alignment --base-url <url> --route <path> # header dividers meet the rail\n * agent-app-signoff surface-ladder --base-url <url> --route <path> # cards and fields step off their parent\n * agent-app-signoff workspace-surface --base-url <url> --route <path> # every page on the shared panel\n */\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { dirname, resolve } from 'node:path'\nimport { runDefaultsCli } from './defaults-cli'\nimport { invokedAsScript } from './invoked-as-script'\nimport { formatSignoffLine, formatSignoffReport } from './report'\nimport { runSignoff, type RunSignoffOptions } from './run'\nimport { runShellAlignmentCli } from './shell-alignment-cli'\nimport { runSurfaceLadderCli } from './surface-ladder-cli'\nimport { runWorkspaceSurfaceCli } from './workspace-surface-cli'\nimport type { SignoffEvent, SignoffSource } from './types'\n\ninterface ParsedArgs extends RunSignoffOptions {\n readonly jsonPath?: string\n readonly quiet?: boolean\n}\n\nfunction usage(): string {\n return [\n 'Usage: agent-app-signoff [repoDir] [options]',\n '',\n ' --source head|working-tree bytes to verify (default working-tree)',\n ' --config <path> config module (default signoff.config.mjs)',\n ' --seed <n> base seed; reproduces a previous run',\n ' --shuffle-runs <n> override every shuffled step\\'s run count',\n ' --max-parallel <n> cap concurrent steps',\n ' --cache-dir <path> clean trees + pristine stores live here',\n ' --keep-going run every step even after one fails',\n ' --keep-workspace leave the clean tree on disk to inspect',\n ' --json <path> write the machine-readable report',\n ' --quiet verdict only; no per-step progress',\n '',\n 'Subcommands:',\n ' defaults report which agent-app defaults each app has (--help for options)',\n ' shell-alignment measure header dividers against the rail in a browser (--help for options)',\n ' surface-ladder measure card and field steps, field borders and card copy in a browser (--help for options)',\n ' workspace-surface every page sits on one shared panel under an inset shell header (--help for options)',\n ].join('\\n')\n}\n\nfunction fail(message: string): never {\n process.stderr.write(`agent-app-signoff: ${message}\\n\\n${usage()}\\n`)\n process.exit(2)\n}\n\nfunction positiveInt(raw: string, flag: string): number {\n const value = Number.parseInt(raw, 10)\n if (!Number.isFinite(value) || value < 0) fail(`${flag} needs a non-negative integer, got \"${raw}\"`)\n return value\n}\n\nexport function parseArgs(argv: readonly string[]): ParsedArgs {\n const parsed: {\n repoDir?: string\n configPath?: string\n source?: SignoffSource\n seed?: number\n shuffleRuns?: number\n maxParallel?: number\n cacheDir?: string\n keepGoing?: boolean\n keepWorkspace?: boolean\n jsonPath?: string\n quiet?: boolean\n } = {}\n\n for (let index = 0; index < argv.length; index += 1) {\n const flag = argv[index] as string\n const take = (): string => {\n const value = argv[index + 1]\n if (value === undefined) fail(`${flag} needs a value`)\n index += 1\n return value\n }\n switch (flag) {\n case '--source': {\n const value = take()\n if (value !== 'head' && value !== 'working-tree') fail(`--source must be head or working-tree, got \"${value}\"`)\n parsed.source = value\n break\n }\n case '--config': parsed.configPath = take(); break\n case '--seed': parsed.seed = positiveInt(take(), '--seed'); break\n case '--shuffle-runs': parsed.shuffleRuns = positiveInt(take(), '--shuffle-runs'); break\n case '--max-parallel': parsed.maxParallel = positiveInt(take(), '--max-parallel'); break\n case '--cache-dir': parsed.cacheDir = take(); break\n case '--keep-going': parsed.keepGoing = true; break\n case '--keep-workspace': parsed.keepWorkspace = true; break\n case '--json': parsed.jsonPath = take(); break\n case '--quiet': parsed.quiet = true; break\n case '-h':\n case '--help':\n process.stdout.write(`${usage()}\\n`)\n process.exit(0)\n break\n default:\n if (flag.startsWith('-')) fail(`unknown option: ${flag}`)\n if (parsed.repoDir !== undefined) fail(`unexpected second directory: ${flag}`)\n parsed.repoDir = flag\n }\n }\n return parsed\n}\n\nfunction progressWriter(): (event: SignoffEvent) => void {\n return (event) => {\n switch (event.kind) {\n case 'cache-prune':\n process.stderr.write(`· cache ${event.beforeBytes} → ${event.afterBytes} allocated bytes; ` +\n `${event.removed.length} idle entries removed${event.overBudgetBytes ? `; ${event.overBudgetBytes} bytes held by active or kept trees` : ''}\\n`)\n break\n case 'tree':\n process.stderr.write(`· clean tree at ${event.path} (${event.head.slice(0, 12)}${event.dirty ? ' + working tree' : ''})\\n`)\n break\n case 'store':\n process.stderr.write(`· store ${event.cacheHit ? 'warm' : 'COLD'} ${event.cacheKey.slice(0, 16)}\\n`)\n break\n case 'install-start':\n process.stderr.write(`· ${event.command}\\n`)\n break\n case 'install-end':\n process.stderr.write(`· install exit ${event.exitCode} in ${event.durationMs}ms\\n`)\n break\n case 'step-start':\n process.stderr.write(`· start ${event.name}${event.seed === null ? '' : ` (seed ${event.seed})`}\\n`)\n break\n case 'step-end':\n process.stderr.write(`· ${event.status === 'passed' ? 'ok' : event.status} ${event.name} ${event.durationMs}ms\\n`)\n break\n }\n }\n}\n\nexport async function runSignoffCli(argv: readonly string[]): Promise<number> {\n if (argv[0] === 'defaults') return runDefaultsCli(argv.slice(1))\n if (argv[0] === 'shell-alignment') return runShellAlignmentCli(argv.slice(1))\n if (argv[0] === 'surface-ladder') return runSurfaceLadderCli(argv.slice(1))\n if (argv[0] === 'workspace-surface') return runWorkspaceSurfaceCli(argv.slice(1))\n const args = parseArgs(argv)\n const report = await runSignoff({ ...args, onEvent: args.quiet ? undefined : progressWriter() })\n\n if (args.jsonPath !== undefined) {\n const abs = resolve(args.jsonPath)\n mkdirSync(dirname(abs), { recursive: true })\n writeFileSync(abs, `${JSON.stringify(report, null, 2)}\\n`)\n }\n\n // `--quiet` is documented as \"verdict only\", and CLAUDE.md names the one-line\n // `signoff PASS <sha> …` summary as an accepted PR proof. Printing the full\n // report here contradicted both, and left the only producer of that summary\n // with no caller.\n process.stdout.write(`${args.quiet ? formatSignoffLine(report) : formatSignoffReport(report)}\\n`)\n return report.ok ? 0 : 1\n}\n\n/* c8 ignore start — process wiring, exercised by the bin itself */\nif (invokedAsScript(import.meta.url, process.argv[1])) {\n runSignoffCli(process.argv.slice(2))\n .then((code) => process.exit(code))\n .catch((err: unknown) => {\n process.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`)\n process.exit(2)\n })\n}\n/* c8 ignore stop */\n","/**\n * `agent-app-signoff defaults` — report which agent-app defaults each app in a checkout has.\n *\n * agent-app-signoff defaults [repoDir] # the matrix for the apps in repoDir\n * agent-app-signoff defaults --probe # also ask Intelligence for each app's last exported turn\n * agent-app-signoff defaults --json matrix.json # the same rows, machine-readable\n *\n * Exit 0 unless an app turns a default off without a reason (1), or the usage is wrong (2). `--probe` reads the\n * Intelligence key from `TANGLE_INTELLIGENCE_API_KEY`; it reads the traces of the tenant that owns the apps' export keys.\n */\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { dirname, resolve } from 'node:path'\nimport { checkAppDefaults, collectLastExports, formatAppDefaults } from './app-defaults'\nimport { loadSignoffConfig } from './config'\n\nfunction defaultsUsage(): string {\n return [\n 'Usage: agent-app-signoff defaults [repoDir] [options]',\n '',\n ' --probe ask Intelligence for each app\\'s last exported turn (needs TANGLE_INTELLIGENCE_API_KEY)',\n ' --no-bundle skip the Worker upload measure (it runs the app\\'s own wrangler, so build first)',\n ' --json <path> write the rows',\n ].join('\\n')\n}\n\nexport async function runDefaultsCli(argv: readonly string[]): Promise<number> {\n let repoDir = process.cwd()\n let probe = false\n let measureBundle = true\n let jsonPath: string | undefined\n for (let index = 0; index < argv.length; index += 1) {\n const flag = argv[index] as string\n if (flag === '--probe') probe = true\n else if (flag === '--no-bundle') measureBundle = false\n else if (flag === '--json') {\n jsonPath = argv[index + 1]\n index += 1\n if (jsonPath === undefined) return usageError('--json needs a path')\n } else if (flag === '-h' || flag === '--help') {\n process.stdout.write(`${defaultsUsage()}\\n`)\n return 0\n } else if (flag.startsWith('-')) return usageError(`unknown option: ${flag}`)\n else repoDir = resolve(flag)\n }\n let exemptions\n try {\n exemptions = (await loadSignoffConfig({ repoRoot: repoDir })).config.agentApp?.exemptions\n } catch {\n // A checkout with no signoff config, or one that does not load here, declares no exemptions.\n }\n const apiKey = process.env.TANGLE_INTELLIGENCE_API_KEY?.trim()\n if (probe && !apiKey) return usageError('--probe needs TANGLE_INTELLIGENCE_API_KEY')\n const exports = probe && apiKey ? await collectLastExports(repoDir, apiKey) : undefined\n const result = checkAppDefaults(repoDir, { exemptions, measureBundle, exports })\n if (jsonPath !== undefined) {\n const abs = resolve(jsonPath)\n mkdirSync(dirname(abs), { recursive: true })\n writeFileSync(abs, `${JSON.stringify(result, null, 2)}\\n`)\n }\n process.stdout.write(formatAppDefaults(result))\n return result.findings.length === 0 ? 0 : 1\n}\n\nfunction usageError(message: string): number {\n process.stderr.write(`agent-app-signoff defaults: ${message}\\n\\n${defaultsUsage()}\\n`)\n return 2\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,SAAS,aAAAA,YAAW,iBAAAC,sBAAqB;AACzC,SAAS,WAAAC,UAAS,WAAAC,gBAAe;;;ACTjC,SAAS,WAAW,qBAAqB;AACzC,SAAS,SAAS,eAAe;AAIjC,SAAS,gBAAwB;AAC/B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,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U,QAAQ,MAAM,CAAC,CAAC;AAAA,CAAI;AAAA,EAC3D;AAMA,UAAQ,OAAO,MAAM,GAAG,KAAK,QAAQ,kBAAkB,MAAM,IAAI,oBAAoB,MAAM,CAAC;AAAA,CAAI;AAChG,SAAO,OAAO,KAAK,IAAI;AACzB;AAGA,IAAI,gBAAgB,YAAY,KAAK,QAAQ,KAAK,CAAC,CAAC,GAAG;AACrD,gBAAc,QAAQ,KAAK,MAAM,CAAC,CAAC,EAChC,KAAK,CAAC,SAAS,QAAQ,KAAK,IAAI,CAAC,EACjC,MAAM,CAAC,QAAiB;AACvB,YAAQ,OAAO,MAAM,GAAG,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAAA,CAAI;AAC5E,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACL;","names":["mkdirSync","writeFileSync","dirname","resolve","resolve","mkdirSync","dirname","writeFileSync"]}
|
|
1
|
+
{"version":3,"sources":["../../src/signoff/cli.ts","../../src/signoff/defaults-cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * `agent-app-signoff` — run the local sign-off gate and print the proof.\n *\n * Exits 0 only when every declared step passed in a pristine tree. Exit 1 is a\n * real failure; exit 2 is a usage or config error, so a script can tell \"your\n * code is broken\" from \"your gate is misconfigured\".\n *\n * agent-app-signoff # this repo, working tree, default config\n * agent-app-signoff --source head # exactly the commit that would merge\n * agent-app-signoff --seed 12345 # reproduce a previous run's orders\n * agent-app-signoff --keep-going # run every step, full picture\n * agent-app-signoff --json proof.json # machine-readable record\n * agent-app-signoff defaults [repoDir] # which agent-app defaults each app has\n * agent-app-signoff shell-alignment --base-url <url> --route <path> # header dividers meet the rail\n * agent-app-signoff surface-ladder --base-url <url> --route <path> # cards and fields step off their parent\n * agent-app-signoff workspace-surface --base-url <url> --route <path> # every page on the shared panel\n */\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { dirname, resolve } from 'node:path'\nimport { runDefaultsCli } from './defaults-cli'\nimport { invokedAsScript } from './invoked-as-script'\nimport { formatSignoffLine, formatSignoffReport } from './report'\nimport { runSignoff, type RunSignoffOptions } from './run'\nimport { runShellAlignmentCli } from './shell-alignment-cli'\nimport { runSurfaceLadderCli } from './surface-ladder-cli'\nimport { runWorkspaceSurfaceCli } from './workspace-surface-cli'\nimport type { SignoffEvent, SignoffSource } from './types'\n\ninterface ParsedArgs extends RunSignoffOptions {\n readonly jsonPath?: string\n readonly quiet?: boolean\n}\n\nfunction usage(): string {\n return [\n 'Usage: agent-app-signoff [repoDir] [options]',\n '',\n ' --source head|working-tree bytes to verify (default working-tree)',\n ' --config <path> config module (default signoff.config.mjs)',\n ' --seed <n> base seed; reproduces a previous run',\n ' --shuffle-runs <n> override every shuffled step\\'s run count',\n ' --max-parallel <n> cap concurrent steps',\n ' --cache-dir <path> clean trees + pristine stores live here',\n ' --keep-going run every step even after one fails',\n ' --keep-workspace leave the clean tree on disk to inspect',\n ' --json <path> write the machine-readable report',\n ' --quiet verdict only; no per-step progress',\n '',\n 'Subcommands:',\n ' defaults report which agent-app defaults each app has (--help for options)',\n ' shell-alignment measure header dividers against the rail in a browser (--help for options)',\n ' surface-ladder measure card and field steps, field borders and card copy in a browser (--help for options)',\n ' workspace-surface every page sits on one shared panel under an inset shell header (--help for options)',\n ].join('\\n')\n}\n\nfunction fail(message: string): never {\n process.stderr.write(`agent-app-signoff: ${message}\\n\\n${usage()}\\n`)\n process.exit(2)\n}\n\nfunction positiveInt(raw: string, flag: string): number {\n const value = Number.parseInt(raw, 10)\n if (!Number.isFinite(value) || value < 0) fail(`${flag} needs a non-negative integer, got \"${raw}\"`)\n return value\n}\n\nfunction parseArgs(argv: readonly string[]): ParsedArgs {\n const parsed: {\n repoDir?: string\n configPath?: string\n source?: SignoffSource\n seed?: number\n shuffleRuns?: number\n maxParallel?: number\n cacheDir?: string\n keepGoing?: boolean\n keepWorkspace?: boolean\n jsonPath?: string\n quiet?: boolean\n } = {}\n\n for (let index = 0; index < argv.length; index += 1) {\n const flag = argv[index] as string\n const take = (): string => {\n const value = argv[index + 1]\n if (value === undefined) fail(`${flag} needs a value`)\n index += 1\n return value\n }\n switch (flag) {\n case '--source': {\n const value = take()\n if (value !== 'head' && value !== 'working-tree') fail(`--source must be head or working-tree, got \"${value}\"`)\n parsed.source = value\n break\n }\n case '--config': parsed.configPath = take(); break\n case '--seed': parsed.seed = positiveInt(take(), '--seed'); break\n case '--shuffle-runs': parsed.shuffleRuns = positiveInt(take(), '--shuffle-runs'); break\n case '--max-parallel': parsed.maxParallel = positiveInt(take(), '--max-parallel'); break\n case '--cache-dir': parsed.cacheDir = take(); break\n case '--keep-going': parsed.keepGoing = true; break\n case '--keep-workspace': parsed.keepWorkspace = true; break\n case '--json': parsed.jsonPath = take(); break\n case '--quiet': parsed.quiet = true; break\n case '-h':\n case '--help':\n process.stdout.write(`${usage()}\\n`)\n process.exit(0)\n break\n default:\n if (flag.startsWith('-')) fail(`unknown option: ${flag}`)\n if (parsed.repoDir !== undefined) fail(`unexpected second directory: ${flag}`)\n parsed.repoDir = flag\n }\n }\n return parsed\n}\n\nfunction progressWriter(): (event: SignoffEvent) => void {\n return (event) => {\n switch (event.kind) {\n case 'cache-prune':\n process.stderr.write(`· cache ${event.beforeBytes} → ${event.afterBytes} allocated bytes; ` +\n `${event.removed.length} idle entries removed${event.overBudgetBytes ? `; ${event.overBudgetBytes} bytes held by active or kept trees` : ''}\\n`)\n break\n case 'tree':\n process.stderr.write(`· clean tree at ${event.path} (${event.head.slice(0, 12)}${event.dirty ? ' + working tree' : ''})\\n`)\n break\n case 'store':\n process.stderr.write(`· store ${event.cacheHit ? 'warm' : 'COLD'} ${event.cacheKey.slice(0, 16)}\\n`)\n break\n case 'install-start':\n process.stderr.write(`· ${event.command}\\n`)\n break\n case 'install-end':\n process.stderr.write(`· install exit ${event.exitCode} in ${event.durationMs}ms\\n`)\n break\n case 'step-start':\n process.stderr.write(`· start ${event.name}${event.seed === null ? '' : ` (seed ${event.seed})`}\\n`)\n break\n case 'step-end':\n process.stderr.write(`· ${event.status === 'passed' ? 'ok' : event.status} ${event.name} ${event.durationMs}ms\\n`)\n break\n }\n }\n}\n\nexport async function runSignoffCli(argv: readonly string[]): Promise<number> {\n if (argv[0] === 'defaults') return runDefaultsCli(argv.slice(1))\n if (argv[0] === 'shell-alignment') return runShellAlignmentCli(argv.slice(1))\n if (argv[0] === 'surface-ladder') return runSurfaceLadderCli(argv.slice(1))\n if (argv[0] === 'workspace-surface') return runWorkspaceSurfaceCli(argv.slice(1))\n const args = parseArgs(argv)\n const report = await runSignoff({ ...args, onEvent: args.quiet ? undefined : progressWriter() })\n\n if (args.jsonPath !== undefined) {\n const abs = resolve(args.jsonPath)\n mkdirSync(dirname(abs), { recursive: true })\n writeFileSync(abs, `${JSON.stringify(report, null, 2)}\\n`)\n }\n\n // `--quiet` is documented as \"verdict only\", and CLAUDE.md names the one-line\n // `signoff PASS <sha> …` summary as an accepted PR proof. Printing the full\n // report here contradicted both, and left the only producer of that summary\n // with no caller.\n process.stdout.write(`${args.quiet ? formatSignoffLine(report) : formatSignoffReport(report)}\\n`)\n return report.ok ? 0 : 1\n}\n\n/* c8 ignore start — process wiring, exercised by the bin itself */\nif (invokedAsScript(import.meta.url, process.argv[1])) {\n runSignoffCli(process.argv.slice(2))\n .then((code) => process.exit(code))\n .catch((err: unknown) => {\n process.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`)\n process.exit(2)\n })\n}\n/* c8 ignore stop */\n","/**\n * `agent-app-signoff defaults` — report which agent-app defaults each app in a checkout has.\n *\n * agent-app-signoff defaults [repoDir] # the matrix for the apps in repoDir\n * agent-app-signoff defaults --probe # also ask Intelligence for each app's last exported turn\n * agent-app-signoff defaults --json matrix.json # the same rows, machine-readable\n *\n * Exit 0 unless an app turns a default off without a reason (1), or the usage is wrong (2). `--probe` reads the\n * Intelligence key from `TANGLE_INTELLIGENCE_API_KEY`; it reads the traces of the tenant that owns the apps' export keys.\n */\nimport { mkdirSync, writeFileSync } from 'node:fs'\nimport { dirname, resolve } from 'node:path'\nimport { checkAppDefaults, collectLastExports, formatAppDefaults } from './app-defaults'\nimport { loadSignoffConfig } from './config'\n\nfunction defaultsUsage(): string {\n return [\n 'Usage: agent-app-signoff defaults [repoDir] [options]',\n '',\n ' --probe ask Intelligence for each app\\'s last exported turn (needs TANGLE_INTELLIGENCE_API_KEY)',\n ' --no-bundle skip the Worker upload measure (it runs the app\\'s own wrangler, so build first)',\n ' --json <path> write the rows',\n ].join('\\n')\n}\n\nexport async function runDefaultsCli(argv: readonly string[]): Promise<number> {\n let repoDir = process.cwd()\n let probe = false\n let measureBundle = true\n let jsonPath: string | undefined\n for (let index = 0; index < argv.length; index += 1) {\n const flag = argv[index] as string\n if (flag === '--probe') probe = true\n else if (flag === '--no-bundle') measureBundle = false\n else if (flag === '--json') {\n jsonPath = argv[index + 1]\n index += 1\n if (jsonPath === undefined) return usageError('--json needs a path')\n } else if (flag === '-h' || flag === '--help') {\n process.stdout.write(`${defaultsUsage()}\\n`)\n return 0\n } else if (flag.startsWith('-')) return usageError(`unknown option: ${flag}`)\n else repoDir = resolve(flag)\n }\n let exemptions\n try {\n exemptions = (await loadSignoffConfig({ repoRoot: repoDir })).config.agentApp?.exemptions\n } catch {\n // A checkout with no signoff config, or one that does not load here, declares no exemptions.\n }\n const apiKey = process.env.TANGLE_INTELLIGENCE_API_KEY?.trim()\n if (probe && !apiKey) return usageError('--probe needs TANGLE_INTELLIGENCE_API_KEY')\n const exports = probe && apiKey ? await collectLastExports(repoDir, apiKey) : undefined\n const result = checkAppDefaults(repoDir, { exemptions, measureBundle, exports })\n if (jsonPath !== undefined) {\n const abs = resolve(jsonPath)\n mkdirSync(dirname(abs), { recursive: true })\n writeFileSync(abs, `${JSON.stringify(result, null, 2)}\\n`)\n }\n process.stdout.write(formatAppDefaults(result))\n return result.findings.length === 0 ? 0 : 1\n}\n\nfunction usageError(message: string): number {\n process.stderr.write(`agent-app-signoff defaults: ${message}\\n\\n${defaultsUsage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AAM,WAAW,EAAE,GAAG,MAAM,SAAS,KAAK,QAAQ,SAAY,eAAe,EAAE,CAAC;AAE/F,MAAI,KAAK,aAAa,QAAW;AAC/B,UAAM,MAAMC,SAAQ,KAAK,QAAQ;AACjC,IAAAC,WAAUC,SAAQ,GAAG,GAAG,EAAE,WAAW,KAAK,CAAC;AAC3C,IAAAC,eAAc,KAAK,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAAA,CAAI;AAAA,EAC3D;AAMA,UAAQ,OAAO,MAAM,GAAG,KAAK,QAAQ,kBAAkB,MAAM,IAAI,oBAAoB,MAAM,CAAC;AAAA,CAAI;AAChG,SAAO,OAAO,KAAK,IAAI;AACzB;AAGA,IAAI,gBAAgB,YAAY,KAAK,QAAQ,KAAK,CAAC,CAAC,GAAG;AACrD,gBAAc,QAAQ,KAAK,MAAM,CAAC,CAAC,EAChC,KAAK,CAAC,SAAS,QAAQ,KAAK,IAAI,CAAC,EACjC,MAAM,CAAC,QAAiB;AACvB,YAAQ,OAAO,MAAM,GAAG,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAAA,CAAI;AAC5E,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACL;","names":["mkdirSync","writeFileSync","dirname","resolve","resolve","mkdirSync","dirname","writeFileSync"]}
|
package/dist/signoff/index.js
CHANGED
package/dist/skills/index.d.ts
CHANGED
|
@@ -270,4 +270,4 @@ export declare function assertSkillDeliveryDisjoint(inlineIds: Iterable<string>,
|
|
|
270
270
|
* fields by hand.
|
|
271
271
|
*/
|
|
272
272
|
export declare function mergeComposedSkills(batches: ComposedSkills[]): ComposedSkills;
|
|
273
|
-
export {
|
|
273
|
+
export { mergeSkillCatalogs, validateMarketplaceCatalog, type MarketplaceSkill, type CatalogSkillEntry, } from './marketplace';
|
package/dist/skills/index.js
CHANGED
|
@@ -5,47 +5,28 @@ import {
|
|
|
5
5
|
corpusSkills,
|
|
6
6
|
loadMarkdownCorpus,
|
|
7
7
|
mergeComposedSkills,
|
|
8
|
+
mergeSkillCatalogs,
|
|
8
9
|
parseCorpusSkills,
|
|
9
10
|
registrySkills,
|
|
10
11
|
renderInlineSkills,
|
|
11
12
|
renderSkillIndex,
|
|
12
13
|
skillEntryFromMarkdown,
|
|
13
14
|
skillMountPath,
|
|
14
|
-
skillRefs
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
MAX_MARKETPLACE_ENTRIES,
|
|
18
|
-
createInMemoryMarketplaceStore,
|
|
19
|
-
createKVMarketplaceStore,
|
|
20
|
-
createStaticMarketplaceStore,
|
|
21
|
-
marketplaceDiscoveryLine,
|
|
22
|
-
marketplaceRowsFor,
|
|
23
|
-
mergeSkillCatalogs,
|
|
24
|
-
namespacedSkillId,
|
|
25
|
-
parseNamespacedSkillId,
|
|
26
|
-
validateMarketplaceCatalog,
|
|
27
|
-
validateMarketplaceSkill
|
|
28
|
-
} from "../chunk-LTWJYNEC.js";
|
|
15
|
+
skillRefs,
|
|
16
|
+
validateMarketplaceCatalog
|
|
17
|
+
} from "../chunk-76MPX7JQ.js";
|
|
29
18
|
import {
|
|
30
19
|
parseSkillFrontmatter
|
|
31
20
|
} from "../chunk-PV33JZKV.js";
|
|
32
21
|
export {
|
|
33
|
-
MAX_MARKETPLACE_ENTRIES,
|
|
34
22
|
assertSkillDeliveryDisjoint,
|
|
35
23
|
composeShellResources,
|
|
36
24
|
composeSkills,
|
|
37
25
|
corpusSkills,
|
|
38
|
-
createInMemoryMarketplaceStore,
|
|
39
|
-
createKVMarketplaceStore,
|
|
40
|
-
createStaticMarketplaceStore,
|
|
41
26
|
loadMarkdownCorpus,
|
|
42
|
-
marketplaceDiscoveryLine,
|
|
43
|
-
marketplaceRowsFor,
|
|
44
27
|
mergeComposedSkills,
|
|
45
28
|
mergeSkillCatalogs,
|
|
46
|
-
namespacedSkillId,
|
|
47
29
|
parseCorpusSkills,
|
|
48
|
-
parseNamespacedSkillId,
|
|
49
30
|
parseSkillFrontmatter,
|
|
50
31
|
registrySkills,
|
|
51
32
|
renderInlineSkills,
|
|
@@ -53,7 +34,6 @@ export {
|
|
|
53
34
|
skillEntryFromMarkdown,
|
|
54
35
|
skillMountPath,
|
|
55
36
|
skillRefs,
|
|
56
|
-
validateMarketplaceCatalog
|
|
57
|
-
validateMarketplaceSkill
|
|
37
|
+
validateMarketplaceCatalog
|
|
58
38
|
};
|
|
59
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The cross-agent skill marketplace — a shared catalog contract on top of the
|
|
3
|
-
* self-mount verb.
|
|
4
|
-
*
|
|
5
|
-
* Every product with the self-improve verb carries its own skill catalog
|
|
6
|
-
* (8–12 skills each, fleet-wide), mounting them through
|
|
7
|
-
* `createMountProfileChangeTool`, which already validates ids, caps mounts
|
|
8
|
-
* and protects the baseline. What the fleet lacks is SHARING: a kicad skill
|
|
9
|
-
* proven on hardware-agent should mount on the legal agent (patent drawings)
|
|
10
|
-
* or the creative agent (product CAD) without a copy in every repo.
|
|
11
|
-
*
|
|
12
|
-
* This module is the marketplace's substrate: the catalog ENTRY format, a
|
|
13
|
-
* read-only store port with the standard adapters, the merge that unions a
|
|
14
|
-
* product's local catalog with shared entries (namespaced `product:id`,
|
|
15
|
-
* local precedence, deduped, capped), and the one-line discovery fragment
|
|
16
|
-
* products surface next to the verb's catalog. Mounting, validation, caps
|
|
17
|
-
* and baseline protection stay exactly where they were proven — in the
|
|
18
|
-
* verb. The marketplace only decides what MAY be discovered and mounted.
|
|
19
|
-
*
|
|
20
|
-
* An entry advertises the skill's identity, not its content: the owning
|
|
21
|
-
* product ships SKILL.md bodies and executable companions in its own repo
|
|
22
|
-
* (and its own profile mounts), so sharing is opt-in per product and the
|
|
23
|
-
* entry is honest about what a foreign mount means — the description and
|
|
24
|
-
* the owning product, nothing hidden.
|
|
25
|
-
*/
|
|
1
|
+
/** Shared skill catalog validation and local/shared catalog composition. */
|
|
26
2
|
/** A shareable skill as the owning product publishes it. */
|
|
27
3
|
export interface MarketplaceSkill {
|
|
28
4
|
/** Registry-unique skill id WITHIN the owning product (slug: lowercase
|
|
@@ -36,24 +12,6 @@ export interface MarketplaceSkill {
|
|
|
36
12
|
* Provenance only — never fetched by this module. */
|
|
37
13
|
readonly source?: string;
|
|
38
14
|
}
|
|
39
|
-
/** Bound on a shared catalog so discovery text stays a prompt-sized line,
|
|
40
|
-
* not a dump. */
|
|
41
|
-
export declare const MAX_MARKETPLACE_ENTRIES = 64;
|
|
42
|
-
/** Validate one marketplace entry — fail loud on a malformed catalog rather
|
|
43
|
-
* than silently mis-mounting it. */
|
|
44
|
-
export declare function validateMarketplaceSkill(entry: MarketplaceSkill): MarketplaceSkill;
|
|
45
|
-
/** The mounted id for a shared skill: `product:id` (namespaced so a foreign
|
|
46
|
-
* skill can never shadow a local one). */
|
|
47
|
-
export declare function namespacedSkillId(entry: {
|
|
48
|
-
product: string;
|
|
49
|
-
id: string;
|
|
50
|
-
}): string;
|
|
51
|
-
/** Split a namespaced id back into `{ product, id }`; a bare id resolves to
|
|
52
|
-
* product `null` (a local skill). */
|
|
53
|
-
export declare function parseNamespacedSkillId(mountedId: string): {
|
|
54
|
-
product: string | null;
|
|
55
|
-
id: string;
|
|
56
|
-
};
|
|
57
15
|
/** Validate a whole shared catalog: entries well-formed, ids unique, size
|
|
58
16
|
* capped. Returns the validated entries in stable (product, id) order. */
|
|
59
17
|
export declare function validateMarketplaceCatalog(entries: readonly MarketplaceSkill[]): readonly MarketplaceSkill[];
|
|
@@ -70,35 +28,3 @@ export interface CatalogSkillEntry {
|
|
|
70
28
|
* local description stays authoritative. Output is deduped, sorted, and
|
|
71
29
|
* safe to hand straight to `createMountProfileChangeTool`'s `skills`. */
|
|
72
30
|
export declare function mergeSkillCatalogs(local: readonly CatalogSkillEntry[], shared: readonly MarketplaceSkill[]): readonly CatalogSkillEntry[];
|
|
73
|
-
/** The discovery fragment: one line naming every shared skill a foreign
|
|
74
|
-
* agent can mount, for system prompts and tool descriptions. Returns null
|
|
75
|
-
* when there is nothing to share (no line, no prompt cost). */
|
|
76
|
-
export declare function marketplaceDiscoveryLine(shared: readonly MarketplaceSkill[]): string | null;
|
|
77
|
-
/** Read-only view over a shared catalog. Products source it from their own
|
|
78
|
-
* D1/KV, a platform registry, or a pinned static list — the port stays the
|
|
79
|
-
* same. */
|
|
80
|
-
export interface MarketplaceStore {
|
|
81
|
-
list(): Promise<readonly MarketplaceSkill[]>;
|
|
82
|
-
}
|
|
83
|
-
/** Non-durable default for tests and single-instance products. Validates on
|
|
84
|
-
* construction so a malformed catalog fails at wiring, not at mount. */
|
|
85
|
-
export declare function createInMemoryMarketplaceStore(entries: readonly MarketplaceSkill[]): MarketplaceStore;
|
|
86
|
-
/** Static-list store over a product-pinned catalog (checked into the
|
|
87
|
-
* product repo). Same validation guarantees, no async source. */
|
|
88
|
-
export declare const createStaticMarketplaceStore: typeof createInMemoryMarketplaceStore;
|
|
89
|
-
/** A KV-backed read-only MarketplaceStore (Cloudflare KV or any lookalike).
|
|
90
|
-
* The whole catalog is one JSON value at `prefix:catalog`. */
|
|
91
|
-
export declare function createKVMarketplaceStore(kv: {
|
|
92
|
-
get(key: string): Promise<string | null>;
|
|
93
|
-
}, prefix?: string): MarketplaceStore;
|
|
94
|
-
/** Publish helper for the write side (products/platform own the writer):
|
|
95
|
-
* render validated rows for the standard table (see
|
|
96
|
-
* `./skills/marketplace-drizzle` for the table itself). */
|
|
97
|
-
export interface MarketplaceRow {
|
|
98
|
-
readonly id: string;
|
|
99
|
-
readonly product: string;
|
|
100
|
-
readonly skillId: string;
|
|
101
|
-
readonly description: string;
|
|
102
|
-
readonly source: string | null;
|
|
103
|
-
}
|
|
104
|
-
export declare function marketplaceRowsFor(entries: readonly MarketplaceSkill[]): readonly MarketplaceRow[];
|
|
@@ -4,10 +4,9 @@ import {
|
|
|
4
4
|
} from "../chunk-CTREXL3O.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveSkillDir
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-LTWJYNEC.js";
|
|
7
|
+
} from "../chunk-54YIL7WM.js";
|
|
8
|
+
import "../chunk-ELX5YITO.js";
|
|
9
|
+
import "../chunk-76MPX7JQ.js";
|
|
11
10
|
import "../chunk-PV33JZKV.js";
|
|
12
11
|
import {
|
|
13
12
|
sha256Hex
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/skills-placement/box.ts"],"sourcesContent":["/**\n * Delivery of a profile's declared skill corpus onto a running box.\n *\n * The platform materializer is add-or-skip-identical only: it refuses to\n * replace a `SKILL.md` whose content changed and never removes a skill dropped\n * from a later selection. Products edit skill bodies on deploy while boxes live\n * for hours, so this reconcile supplies replace-on-change and prune-on-removal,\n * keyed on a content manifest on the box so an unchanged corpus transfers no\n * bodies. `resolveSkillDir` decides the directory; no path literal lives here.\n *\n * The SDK file API replaces complete files, so identical concurrent reconciles\n * converge without a lock; a concurrent stale delete may return not found.\n */\nimport type { AgentProfileFileMount, AgentProfileResourceRef } from '@tangle-network/agent-interface'\nimport { NotFoundError, type SandboxInstance } from '@tangle-network/sandbox'\nimport type { Harness } from '../harness/index'\nimport type { Outcome } from '../sandbox/outcome'\nimport { writeProfileFilesToBox } from '../sandbox/profile-files'\nimport { shellQuote } from '../sandbox/binary-read'\nimport { resolveSkillDir } from './index'\nimport { sha256Hex } from '../crypto/digest'\n\ninterface DeclaredSkill {\n id: string\n content: string\n}\n\ninterface SkillCorpusManifest {\n schema: string\n hash: string\n ids: string[]\n}\n\nconst SKILL_ID_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/\nconst PLACED_CORPORA_LIMIT = 512\n\nexport interface ProfileSkillPlacerConfig {\n /** Manifest schema id written on the box, e.g. `acme-skill-corpus-v1`.\n * Changing it makes every box re-place its corpus once. */\n manifestSchema: string\n /** Home-relative directory holding one manifest per harness, e.g. `~/.tangle/acme-skill-corpora`. */\n manifestDir: string\n /** Resource name prefix for the manifest file mount, e.g. `acme` gives `<harness>-acme-skill-manifest`. */\n manifestName: string\n /**\n * The box filesystem's identity, when the product can read it. With it, a\n * corpus this isolate already placed on the same filesystem skips the\n * on-box manifest read entirely; a replaced filesystem has a new id, so its\n * receipt never matches. Return null when the filesystem is not identified.\n */\n filesystemIncarnation?: (box: SandboxInstance) => string | null\n /**\n * Serialize placement on the box with a `mkdir` lock beside the manifest\n * (30 s wait, a lock older than 2 minutes is reclaimed). Without it, two\n * isolates placing different corpora at once (a rolling deploy) can leave a\n * manifest that names a skill the other one pruned.\n */\n boxLock?: boolean\n}\n\nfunction homeRelative(path: string): string {\n if (!path.startsWith('~/')) throw new Error(`Expected a home-relative path, got ${path}`)\n return path.slice(2)\n}\n\nfunction shellHomePath(path: string): string {\n return `~/${shellQuote(homeRelative(path))}`\n}\n\nasync function acquireBoxLock(box: SandboxInstance, manifestDir: string, lockPath: string): Promise<Outcome<void>> {\n const command = [\n `mkdir -p ${shellHomePath(manifestDir)}`,\n `lock=${shellHomePath(lockPath)}`,\n 'deadline=$(( $(date +%s) + 30 ))',\n 'while ! mkdir \"$lock\" 2>/dev/null; do',\n ' now=$(date +%s)',\n ' if [ -n \"$(find \"$lock\" -maxdepth 0 -mmin +2 -print 2>/dev/null)\" ]; then rm -rf \"$lock\"; continue; fi',\n ' if [ \"$now\" -ge \"$deadline\" ]; then echo \"timed out waiting for skill placement lock\" >&2; exit 42; fi',\n ' sleep 0.1',\n 'done',\n ].join('\\n')\n try {\n const acquired = await box.exec(command)\n if (acquired.exitCode === 0) return { succeeded: true, value: undefined }\n return { succeeded: false, error: new Error(`placeProfileSkillsOnBox: ${acquired.stderr || 'failed to acquire skill placement lock'}`) }\n } catch (error) {\n return { succeeded: false, error: new Error('placeProfileSkillsOnBox: failed to acquire the skill placement lock', { cause: error }) }\n }\n}\n\nasync function releaseBoxLock(box: SandboxInstance, lockPath: string): Promise<Outcome<void>> {\n try {\n const released = await box.exec(`rm -rf ${shellHomePath(lockPath)}`)\n if (released.exitCode === 0) return { succeeded: true, value: undefined }\n return { succeeded: false, error: new Error(`placeProfileSkillsOnBox: failed to release skill placement lock: ${released.stderr}`) }\n } catch (error) {\n return { succeeded: false, error: new Error('placeProfileSkillsOnBox: failed to release the skill placement lock', { cause: error }) }\n }\n}\n\n/** `null` when any ref is not an inline body: a github ref needs async\n * pre-resolution, which the platform materializer also refuses. */\nfunction declaredSkills(refs: readonly AgentProfileResourceRef[]): DeclaredSkill[] | null {\n const skills: DeclaredSkill[] = []\n for (const ref of refs) {\n if (ref.kind !== 'inline') return null\n skills.push({ id: ref.name, content: ref.content })\n }\n return skills\n}\n\nfunction skillFileMounts(root: string, skills: readonly DeclaredSkill[]): AgentProfileFileMount[] {\n return skills.map((skill) => ({\n path: `~/${root}/${skill.id}/SKILL.md`,\n resource: { kind: 'inline' as const, name: skill.id, content: skill.content },\n }))\n}\n\n/**\n * Build the product's skill placer. `placeProfileSkillsOnBox` makes the box's\n * skill directory for a harness match the declared corpus exactly: every\n * declared body present, every previously placed body no longer declared\n * removed. Empty `refs`, or a harness with no skill directory, is a no-op.\n */\nexport function createProfileSkillPlacer(config: ProfileSkillPlacerConfig) {\n const { manifestSchema, manifestDir, manifestName, filesystemIncarnation, boxLock = false } = config\n\n // Corpora this isolate placed or verified, by box, filesystem and harness. Digests only.\n const placedCorpora = new Map<string, string>()\n // A composed corpus is one cached array per harness, so its digest is too.\n const corpusManifests = new WeakMap<readonly AgentProfileResourceRef[], Promise<SkillCorpusManifest>>()\n\n async function skillManifest(skills: readonly DeclaredSkill[]): Promise<SkillCorpusManifest> {\n const normalized = [...skills].sort((a, b) => a.id.localeCompare(b.id))\n return {\n schema: manifestSchema,\n hash: await sha256Hex(JSON.stringify(normalized)),\n ids: normalized.map((skill) => skill.id),\n }\n }\n\n function corpusManifest(refs: readonly AgentProfileResourceRef[], skills: readonly DeclaredSkill[]) {\n let manifest = corpusManifests.get(refs)\n if (!manifest) {\n manifest = skillManifest(skills)\n manifest.catch(() => corpusManifests.delete(refs))\n corpusManifests.set(refs, manifest)\n }\n return manifest\n }\n\n function parseSkillManifest(raw: string): SkillCorpusManifest | null {\n try {\n const value = JSON.parse(raw) as Partial<SkillCorpusManifest>\n if (value.schema !== manifestSchema || typeof value.hash !== 'string') return null\n if (!Array.isArray(value.ids) || value.ids.some((id) => typeof id !== 'string' || !SKILL_ID_RE.test(id))) return null\n return { schema: manifestSchema, hash: value.hash, ids: value.ids }\n } catch {\n return null\n }\n }\n\n function receiptKey(box: SandboxInstance, harness: Harness): string | null {\n const incarnation = filesystemIncarnation?.(box)\n return box.id && incarnation ? `${box.id}\\0${incarnation}\\0${harness}` : null\n }\n\n function recordPlacement(key: string | null, hash: string): void {\n if (!key) return\n if (placedCorpora.size >= PLACED_CORPORA_LIMIT) placedCorpora.clear()\n placedCorpora.set(key, hash)\n }\n\n async function placeSkills(\n box: SandboxInstance,\n harness: Harness,\n root: string,\n skills: readonly DeclaredSkill[],\n expected: SkillCorpusManifest,\n ): Promise<Outcome<void>> {\n const markerPath = `${manifestDir}/${harness}.json`\n let current: SkillCorpusManifest | null = null\n try {\n current = parseSkillManifest(await box.fs.read(homeRelative(markerPath)))\n } catch (err) {\n if (!(err instanceof NotFoundError)) {\n return {\n succeeded: false,\n error: new Error('placeProfileSkillsOnBox: failed to read the sandbox skill manifest', { cause: err }),\n }\n }\n }\n if (current?.hash === expected.hash) return { succeeded: true, value: undefined }\n\n const written = await writeProfileFilesToBox(box, skillFileMounts(root, skills))\n if (!written.succeeded) {\n return {\n succeeded: false,\n error: new Error('placeProfileSkillsOnBox: failed to write the sandbox skill corpus', { cause: written.error }),\n }\n }\n\n const expectedIds = new Set(expected.ids)\n for (const id of (current?.ids ?? []).filter((id) => !expectedIds.has(id))) {\n try {\n await box.fs.delete(homeRelative(`~/${root}/${id}`), { recursive: true })\n } catch (err) {\n // Another identical reconcile may have removed it first; any other failure stays visible.\n if (err instanceof NotFoundError) continue\n return {\n succeeded: false,\n error: new Error('placeProfileSkillsOnBox: stale skill cleanup failed', { cause: err }),\n }\n }\n }\n\n const manifestWritten = await writeProfileFilesToBox(box, [{\n path: markerPath,\n resource: { kind: 'inline', name: `${harness}-${manifestName}-skill-manifest`, content: JSON.stringify(expected) },\n }])\n if (!manifestWritten.succeeded) {\n return {\n succeeded: false,\n error: new Error('placeProfileSkillsOnBox: failed to write the sandbox skill manifest', { cause: manifestWritten.error }),\n }\n }\n return { succeeded: true, value: undefined }\n }\n\n async function placeProfileSkillsOnBox(\n box: SandboxInstance,\n harness: Harness,\n refs: readonly AgentProfileResourceRef[],\n ): Promise<Outcome<void>> {\n const root = resolveSkillDir(harness)\n if (!root || refs.length === 0) return { succeeded: true, value: undefined }\n\n const skills = declaredSkills(refs)\n if (!skills) {\n return { succeeded: false, error: new Error('placeProfileSkillsOnBox: every declared skill ref must be an inline body') }\n }\n const ids = skills.map((skill) => skill.id)\n if (ids.some((id) => !SKILL_ID_RE.test(id)) || new Set(ids).size !== ids.length) {\n return { succeeded: false, error: new Error('placeProfileSkillsOnBox: skill ids must be unique path-safe slugs') }\n }\n\n let expected: SkillCorpusManifest\n try {\n expected = await corpusManifest(refs, skills)\n } catch (err) {\n return {\n succeeded: false,\n error: new Error('placeProfileSkillsOnBox: failed to hash the declared skill corpus', { cause: err }),\n }\n }\n\n const key = receiptKey(box, harness)\n if (key && placedCorpora.get(key) === expected.hash) return { succeeded: true, value: undefined }\n if (!boxLock) {\n const placed = await placeSkills(box, harness, root, skills, expected)\n if (placed.succeeded) recordPlacement(key, expected.hash)\n return placed\n }\n const lockPath = `${manifestDir}/${harness}.json.lock`\n const acquired = await acquireBoxLock(box, manifestDir, lockPath)\n if (!acquired.succeeded) return acquired\n const placed = await placeSkills(box, harness, root, skills, expected)\n const released = await releaseBoxLock(box, lockPath)\n if (placed.succeeded && released.succeeded) recordPlacement(key, expected.hash)\n return released.succeeded ? placed : released\n }\n\n /** Whether two skill declarations carry the same inline corpus. */\n async function sameSkillCorpus(\n left: readonly AgentProfileResourceRef[] | undefined,\n right: readonly AgentProfileResourceRef[],\n ): Promise<boolean> {\n if (!left) return right.length === 0\n if (left === right) return true\n const leftSkills = declaredSkills(left)\n const rightSkills = declaredSkills(right)\n if (!leftSkills || !rightSkills) return false\n const [a, b] = await Promise.all([corpusManifest(left, leftSkills), corpusManifest(right, rightSkills)])\n return a.hash === b.hash\n }\n\n return { placeProfileSkillsOnBox, sameSkillCorpus }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,SAAS,qBAA2C;AAmBpD,IAAM,cAAc;AACpB,IAAM,uBAAuB;AA0B7B,SAAS,aAAa,MAAsB;AAC1C,MAAI,CAAC,KAAK,WAAW,IAAI,EAAG,OAAM,IAAI,MAAM,sCAAsC,IAAI,EAAE;AACxF,SAAO,KAAK,MAAM,CAAC;AACrB;AAEA,SAAS,cAAc,MAAsB;AAC3C,SAAO,KAAK,WAAW,aAAa,IAAI,CAAC,CAAC;AAC5C;AAEA,eAAe,eAAe,KAAsB,aAAqB,UAA0C;AACjH,QAAM,UAAU;AAAA,IACd,YAAY,cAAc,WAAW,CAAC;AAAA,IACtC,QAAQ,cAAc,QAAQ,CAAC;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AACX,MAAI;AACF,UAAM,WAAW,MAAM,IAAI,KAAK,OAAO;AACvC,QAAI,SAAS,aAAa,EAAG,QAAO,EAAE,WAAW,MAAM,OAAO,OAAU;AACxE,WAAO,EAAE,WAAW,OAAO,OAAO,IAAI,MAAM,4BAA4B,SAAS,UAAU,wCAAwC,EAAE,EAAE;AAAA,EACzI,SAAS,OAAO;AACd,WAAO,EAAE,WAAW,OAAO,OAAO,IAAI,MAAM,uEAAuE,EAAE,OAAO,MAAM,CAAC,EAAE;AAAA,EACvI;AACF;AAEA,eAAe,eAAe,KAAsB,UAA0C;AAC5F,MA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AS,UAAW,iBAAgB,KAAK,SAAS,IAAI;AAC9E,WAAO,SAAS,YAAY,SAAS;AAAA,EACvC;AAGA,iBAAe,gBACb,MACA,OACkB;AAClB,QAAI,CAAC,KAAM,QAAO,MAAM,WAAW;AACnC,QAAI,SAAS,MAAO,QAAO;AAC3B,UAAM,aAAa,eAAe,IAAI;AACtC,UAAM,cAAc,eAAe,KAAK;AACxC,QAAI,CAAC,cAAc,CAAC,YAAa,QAAO;AACxC,UAAM,CAAC,GAAG,CAAC,IAAI,MAAM,QAAQ,IAAI,CAAC,eAAe,MAAM,UAAU,GAAG,eAAe,OAAO,WAAW,CAAC,CAAC;AACvG,WAAO,EAAE,SAAS,EAAE;AAAA,EACtB;AAEA,SAAO,EAAE,yBAAyB,gBAAgB;AACpD;","names":["id","placed"]}
|
|
1
|
+
{"version":3,"sources":["../../src/skills-placement/box.ts"],"sourcesContent":["/**\n * Delivery of a profile's declared skill corpus onto a running box.\n *\n * The platform materializer is add-or-skip-identical only: it refuses to\n * replace a `SKILL.md` whose content changed and never removes a skill dropped\n * from a later selection. Products edit skill bodies on deploy while boxes live\n * for hours, so this reconcile supplies replace-on-change and prune-on-removal,\n * keyed on a content manifest on the box so an unchanged corpus transfers no\n * bodies. `resolveSkillDir` decides the directory; no path literal lives here.\n *\n * The SDK file API replaces complete files, so identical concurrent reconciles\n * converge without a lock; a concurrent stale delete may return not found.\n */\nimport type { AgentProfileFileMount, AgentProfileResourceRef } from '@tangle-network/agent-interface'\nimport { NotFoundError, type SandboxInstance } from '@tangle-network/sandbox'\nimport type { Harness } from '../harness/index'\nimport type { Outcome } from '../sandbox/outcome'\nimport { writeProfileFilesToBox } from '../sandbox/profile-files'\nimport { shellQuote } from '../sandbox/binary-read'\nimport { resolveSkillDir } from './index'\nimport { sha256Hex } from '../crypto/digest'\n\ninterface DeclaredSkill {\n id: string\n content: string\n}\n\ninterface SkillCorpusManifest {\n schema: string\n hash: string\n ids: string[]\n}\n\nconst SKILL_ID_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/\nconst PLACED_CORPORA_LIMIT = 512\n\nexport interface ProfileSkillPlacerConfig {\n /** Manifest schema id written on the box, e.g. `acme-skill-corpus-v1`.\n * Changing it makes every box re-place its corpus once. */\n manifestSchema: string\n /** Home-relative directory holding one manifest per harness, e.g. `~/.tangle/acme-skill-corpora`. */\n manifestDir: string\n /** Resource name prefix for the manifest file mount, e.g. `acme` gives `<harness>-acme-skill-manifest`. */\n manifestName: string\n /**\n * The box filesystem's identity, when the product can read it. With it, a\n * corpus this isolate already placed on the same filesystem skips the\n * on-box manifest read entirely; a replaced filesystem has a new id, so its\n * receipt never matches. Return null when the filesystem is not identified.\n */\n filesystemIncarnation?: (box: SandboxInstance) => string | null\n /**\n * Serialize placement on the box with a `mkdir` lock beside the manifest\n * (30 s wait, a lock older than 2 minutes is reclaimed). Without it, two\n * isolates placing different corpora at once (a rolling deploy) can leave a\n * manifest that names a skill the other one pruned.\n */\n boxLock?: boolean\n}\n\nfunction homeRelative(path: string): string {\n if (!path.startsWith('~/')) throw new Error(`Expected a home-relative path, got ${path}`)\n return path.slice(2)\n}\n\nfunction shellHomePath(path: string): string {\n return `~/${shellQuote(homeRelative(path))}`\n}\n\nasync function acquireBoxLock(box: SandboxInstance, manifestDir: string, lockPath: string): Promise<Outcome<void>> {\n const command = [\n `mkdir -p ${shellHomePath(manifestDir)}`,\n `lock=${shellHomePath(lockPath)}`,\n 'deadline=$(( $(date +%s) + 30 ))',\n 'while ! mkdir \"$lock\" 2>/dev/null; do',\n ' now=$(date +%s)',\n ' if [ -n \"$(find \"$lock\" -maxdepth 0 -mmin +2 -print 2>/dev/null)\" ]; then rm -rf \"$lock\"; continue; fi',\n ' if [ \"$now\" -ge \"$deadline\" ]; then echo \"timed out waiting for skill placement lock\" >&2; exit 42; fi',\n ' sleep 0.1',\n 'done',\n ].join('\\n')\n try {\n const acquired = await box.exec(command)\n if (acquired.exitCode === 0) return { succeeded: true, value: undefined }\n return { succeeded: false, error: new Error(`placeProfileSkillsOnBox: ${acquired.stderr || 'failed to acquire skill placement lock'}`) }\n } catch (error) {\n return { succeeded: false, error: new Error('placeProfileSkillsOnBox: failed to acquire the skill placement lock', { cause: error }) }\n }\n}\n\nasync function releaseBoxLock(box: SandboxInstance, lockPath: string): Promise<Outcome<void>> {\n try {\n const released = await box.exec(`rm -rf ${shellHomePath(lockPath)}`)\n if (released.exitCode === 0) return { succeeded: true, value: undefined }\n return { succeeded: false, error: new Error(`placeProfileSkillsOnBox: failed to release skill placement lock: ${released.stderr}`) }\n } catch (error) {\n return { succeeded: false, error: new Error('placeProfileSkillsOnBox: failed to release the skill placement lock', { cause: error }) }\n }\n}\n\n/** `null` when any ref is not an inline body: a github ref needs async\n * pre-resolution, which the platform materializer also refuses. */\nfunction declaredSkills(refs: readonly AgentProfileResourceRef[]): DeclaredSkill[] | null {\n const skills: DeclaredSkill[] = []\n for (const ref of refs) {\n if (ref.kind !== 'inline') return null\n skills.push({ id: ref.name, content: ref.content })\n }\n return skills\n}\n\nfunction skillFileMounts(root: string, skills: readonly DeclaredSkill[]): AgentProfileFileMount[] {\n return skills.map((skill) => ({\n path: `~/${root}/${skill.id}/SKILL.md`,\n resource: { kind: 'inline' as const, name: skill.id, content: skill.content },\n }))\n}\n\n/**\n * Build the product's skill placer. `placeProfileSkillsOnBox` makes the box's\n * skill directory for a harness match the declared corpus exactly: every\n * declared body present, every previously placed body no longer declared\n * removed. Empty `refs`, or a harness with no skill directory, is a no-op.\n */\nexport function createProfileSkillPlacer(config: ProfileSkillPlacerConfig) {\n const { manifestSchema, manifestDir, manifestName, filesystemIncarnation, boxLock = false } = config\n\n // Corpora this isolate placed or verified, by box, filesystem and harness. Digests only.\n const placedCorpora = new Map<string, string>()\n // A composed corpus is one cached array per harness, so its digest is too.\n const corpusManifests = new WeakMap<readonly AgentProfileResourceRef[], Promise<SkillCorpusManifest>>()\n\n async function skillManifest(skills: readonly DeclaredSkill[]): Promise<SkillCorpusManifest> {\n const normalized = [...skills].sort((a, b) => a.id.localeCompare(b.id))\n return {\n schema: manifestSchema,\n hash: await sha256Hex(JSON.stringify(normalized)),\n ids: normalized.map((skill) => skill.id),\n }\n }\n\n function corpusManifest(refs: readonly AgentProfileResourceRef[], skills: readonly DeclaredSkill[]) {\n let manifest = corpusManifests.get(refs)\n if (!manifest) {\n manifest = skillManifest(skills)\n manifest.catch(() => corpusManifests.delete(refs))\n corpusManifests.set(refs, manifest)\n }\n return manifest\n }\n\n function parseSkillManifest(raw: string): SkillCorpusManifest | null {\n try {\n const value = JSON.parse(raw) as Partial<SkillCorpusManifest>\n if (value.schema !== manifestSchema || typeof value.hash !== 'string') return null\n if (!Array.isArray(value.ids) || value.ids.some((id) => typeof id !== 'string' || !SKILL_ID_RE.test(id))) return null\n return { schema: manifestSchema, hash: value.hash, ids: value.ids }\n } catch {\n return null\n }\n }\n\n function receiptKey(box: SandboxInstance, harness: Harness): string | null {\n const incarnation = filesystemIncarnation?.(box)\n return box.id && incarnation ? `${box.id}\\0${incarnation}\\0${harness}` : null\n }\n\n function recordPlacement(key: string | null, hash: string): void {\n if (!key) return\n if (placedCorpora.size >= PLACED_CORPORA_LIMIT) placedCorpora.clear()\n placedCorpora.set(key, hash)\n }\n\n async function placeSkills(\n box: SandboxInstance,\n harness: Harness,\n root: string,\n skills: readonly DeclaredSkill[],\n expected: SkillCorpusManifest,\n ): Promise<Outcome<void>> {\n const markerPath = `${manifestDir}/${harness}.json`\n let current: SkillCorpusManifest | null = null\n try {\n current = parseSkillManifest(await box.fs.read(homeRelative(markerPath)))\n } catch (err) {\n if (!(err instanceof NotFoundError)) {\n return {\n succeeded: false,\n error: new Error('placeProfileSkillsOnBox: failed to read the sandbox skill manifest', { cause: err }),\n }\n }\n }\n if (current?.hash === expected.hash) return { succeeded: true, value: undefined }\n\n const written = await writeProfileFilesToBox(box, skillFileMounts(root, skills))\n if (!written.succeeded) {\n return {\n succeeded: false,\n error: new Error('placeProfileSkillsOnBox: failed to write the sandbox skill corpus', { cause: written.error }),\n }\n }\n\n const expectedIds = new Set(expected.ids)\n for (const id of (current?.ids ?? []).filter((id) => !expectedIds.has(id))) {\n try {\n await box.fs.delete(homeRelative(`~/${root}/${id}`), { recursive: true })\n } catch (err) {\n // Another identical reconcile may have removed it first; any other failure stays visible.\n if (err instanceof NotFoundError) continue\n return {\n succeeded: false,\n error: new Error('placeProfileSkillsOnBox: stale skill cleanup failed', { cause: err }),\n }\n }\n }\n\n const manifestWritten = await writeProfileFilesToBox(box, [{\n path: markerPath,\n resource: { kind: 'inline', name: `${harness}-${manifestName}-skill-manifest`, content: JSON.stringify(expected) },\n }])\n if (!manifestWritten.succeeded) {\n return {\n succeeded: false,\n error: new Error('placeProfileSkillsOnBox: failed to write the sandbox skill manifest', { cause: manifestWritten.error }),\n }\n }\n return { succeeded: true, value: undefined }\n }\n\n async function placeProfileSkillsOnBox(\n box: SandboxInstance,\n harness: Harness,\n refs: readonly AgentProfileResourceRef[],\n ): Promise<Outcome<void>> {\n const root = resolveSkillDir(harness)\n if (!root || refs.length === 0) return { succeeded: true, value: undefined }\n\n const skills = declaredSkills(refs)\n if (!skills) {\n return { succeeded: false, error: new Error('placeProfileSkillsOnBox: every declared skill ref must be an inline body') }\n }\n const ids = skills.map((skill) => skill.id)\n if (ids.some((id) => !SKILL_ID_RE.test(id)) || new Set(ids).size !== ids.length) {\n return { succeeded: false, error: new Error('placeProfileSkillsOnBox: skill ids must be unique path-safe slugs') }\n }\n\n let expected: SkillCorpusManifest\n try {\n expected = await corpusManifest(refs, skills)\n } catch (err) {\n return {\n succeeded: false,\n error: new Error('placeProfileSkillsOnBox: failed to hash the declared skill corpus', { cause: err }),\n }\n }\n\n const key = receiptKey(box, harness)\n if (key && placedCorpora.get(key) === expected.hash) return { succeeded: true, value: undefined }\n if (!boxLock) {\n const placed = await placeSkills(box, harness, root, skills, expected)\n if (placed.succeeded) recordPlacement(key, expected.hash)\n return placed\n }\n const lockPath = `${manifestDir}/${harness}.json.lock`\n const acquired = await acquireBoxLock(box, manifestDir, lockPath)\n if (!acquired.succeeded) return acquired\n const placed = await placeSkills(box, harness, root, skills, expected)\n const released = await releaseBoxLock(box, lockPath)\n if (placed.succeeded && released.succeeded) recordPlacement(key, expected.hash)\n return released.succeeded ? placed : released\n }\n\n /** Whether two skill declarations carry the same inline corpus. */\n async function sameSkillCorpus(\n left: readonly AgentProfileResourceRef[] | undefined,\n right: readonly AgentProfileResourceRef[],\n ): Promise<boolean> {\n if (!left) return right.length === 0\n if (left === right) return true\n const leftSkills = declaredSkills(left)\n const rightSkills = declaredSkills(right)\n if (!leftSkills || !rightSkills) return false\n const [a, b] = await Promise.all([corpusManifest(left, leftSkills), corpusManifest(right, rightSkills)])\n return a.hash === b.hash\n }\n\n return { placeProfileSkillsOnBox, sameSkillCorpus }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAS,qBAA2C;AAmBpD,IAAM,cAAc;AACpB,IAAM,uBAAuB;AA0B7B,SAAS,aAAa,MAAsB;AAC1C,MAAI,CAAC,KAAK,WAAW,IAAI,EAAG,OAAM,IAAI,MAAM,sCAAsC,IAAI,EAAE;AACxF,SAAO,KAAK,MAAM,CAAC;AACrB;AAEA,SAAS,cAAc,MAAsB;AAC3C,SAAO,KAAK,WAAW,aAAa,IAAI,CAAC,CAAC;AAC5C;AAEA,eAAe,eAAe,KAAsB,aAAqB,UAA0C;AACjH,QAAM,UAAU;AAAA,IACd,YAAY,cAAc,WAAW,CAAC;AAAA,IACtC,QAAQ,cAAc,QAAQ,CAAC;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AACX,MAAI;AACF,UAAM,WAAW,MAAM,IAAI,KAAK,OAAO;AACvC,QAAI,SAAS,aAAa,EAAG,QAAO,EAAE,WAAW,MAAM,OAAO,OAAU;AACxE,WAAO,EAAE,WAAW,OAAO,OAAO,IAAI,MAAM,4BAA4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AW,MAAM,eAAe,KAAK,aAAa,QAAQ;AAChE,QAAI,CAAC,SAAS,UAAW,QAAO;AAChC,UAAM,SAAS,MAAM,YAAY,KAAK,SAAS,MAAM,QAAQ,QAAQ;AACrE,UAAM,WAAW,MAAM,eAAe,KAAK,QAAQ;AACnD,QAAI,OAAO,aAAa,SAAS,UAAW,iBAAgB,KAAK,SAAS,IAAI;AAC9E,WAAO,SAAS,YAAY,SAAS;AAAA,EACvC;AAGA,iBAAe,gBACb,MACA,OACkB;AAClB,QAAI,CAAC,KAAM,QAAO,MAAM,WAAW;AACnC,QAAI,SAAS,MAAO,QAAO;AAC3B,UAAM,aAAa,eAAe,IAAI;AACtC,UAAM,cAAc,eAAe,KAAK;AACxC,QAAI,CAAC,cAAc,CAAC,YAAa,QAAO;AACxC,UAAM,CAAC,GAAG,CAAC,IAAI,MAAM,QAAQ,IAAI,CAAC,eAAe,MAAM,UAAU,GAAG,eAAe,OAAO,WAAW,CAAC,CAAC;AACvG,WAAO,EAAE,SAAS,EAAE;AAAA,EACtB;AAEA,SAAO,EAAE,yBAAyB,gBAAgB;AACpD;","names":["id","placed"]}
|
|
@@ -4,10 +4,9 @@ import {
|
|
|
4
4
|
skillSupportFileMounts,
|
|
5
5
|
unsupportedSkillHarnesses,
|
|
6
6
|
withSkillSupportFiles
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-LTWJYNEC.js";
|
|
7
|
+
} from "../chunk-54YIL7WM.js";
|
|
8
|
+
import "../chunk-ELX5YITO.js";
|
|
9
|
+
import "../chunk-76MPX7JQ.js";
|
|
11
10
|
import "../chunk-PV33JZKV.js";
|
|
12
11
|
export {
|
|
13
12
|
composeSkillsForHarness,
|
package/dist/spend/cli-args.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ReconcileSpendOptions } from './reconcile';
|
|
|
2
2
|
/** A usage or config problem — exit code 2, never a finding. */
|
|
3
3
|
export declare class SpendUsageError extends Error {
|
|
4
4
|
}
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const SPEND_USAGE: string;
|
|
6
6
|
export interface SpendCliArgs {
|
|
7
7
|
readonly configFile: string;
|
|
8
8
|
readonly json: boolean;
|
package/dist/spend/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
formatSpendReport,
|
|
4
4
|
reconcileSpend,
|
|
5
5
|
spendReportToJson
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-ZDHCV462.js";
|
|
7
7
|
|
|
8
8
|
// src/spend/cli-args.ts
|
|
9
9
|
import { pathToFileURL } from "url";
|
|
@@ -11,7 +11,7 @@ import { resolve } from "path";
|
|
|
11
11
|
var SpendUsageError = class extends Error {
|
|
12
12
|
};
|
|
13
13
|
var DEFAULT_CONFIG_FILE = "spend.config.mjs";
|
|
14
|
-
var
|
|
14
|
+
var SPEND_USAGE = [
|
|
15
15
|
"agent-app-spend-check \u2014 reconcile settled sandbox compute against what this product asked for.",
|
|
16
16
|
"",
|
|
17
17
|
"Usage: agent-app-spend-check [--config <file>] [--json] [--as-of <iso>] [--skip <check,check>]",
|
|
@@ -106,7 +106,7 @@ try {
|
|
|
106
106
|
if (err instanceof SpendUsageError) {
|
|
107
107
|
process.stderr.write(`${err.message === "help" ? "" : `${err.message}
|
|
108
108
|
|
|
109
|
-
`}${
|
|
109
|
+
`}${SPEND_USAGE}
|
|
110
110
|
`);
|
|
111
111
|
process.exit(2);
|
|
112
112
|
}
|
package/dist/spend/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/spend/cli-args.ts","../../src/spend/cli.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url'\nimport { resolve } from 'node:path'\nimport type { ReconcileSpendOptions } from './reconcile'\n\n/** A usage or config problem — exit code 2, never a finding. */\nexport class SpendUsageError extends Error {}\n\nconst DEFAULT_CONFIG_FILE = 'spend.config.mjs'\n\nexport const
|
|
1
|
+
{"version":3,"sources":["../../src/spend/cli-args.ts","../../src/spend/cli.ts"],"sourcesContent":["import { pathToFileURL } from 'node:url'\nimport { resolve } from 'node:path'\nimport type { ReconcileSpendOptions } from './reconcile'\n\n/** A usage or config problem — exit code 2, never a finding. */\nexport class SpendUsageError extends Error {}\n\nconst DEFAULT_CONFIG_FILE = 'spend.config.mjs'\n\nexport const SPEND_USAGE = [\n 'agent-app-spend-check — reconcile settled sandbox compute against what this product asked for.',\n '',\n 'Usage: agent-app-spend-check [--config <file>] [--json] [--as-of <iso>] [--skip <check,check>]',\n '',\n ` --config <file> Config module. Default ${DEFAULT_CONFIG_FILE}.`,\n ' --json Emit the report as JSON instead of a table.',\n ' --as-of <iso> Treat this instant as \"now\". Default: the current time.',\n ' --skip <checks> Comma-separated check ids to leave out.',\n '',\n 'The config module default-exports (or exports as `config`) the reconcile options,',\n 'or a function returning them. It supplies the two things this package cannot:',\n 'the product\\'s own expectation store, and an authenticated fetch of its settled',\n 'ledger rows. Scope that fetch to boxes this product owns.',\n '',\n 'Exit 0 = clean, 1 = findings, 2 = usage or config error.',\n].join('\\n')\n\nexport interface SpendCliArgs {\n readonly configFile: string\n readonly json: boolean\n readonly asOf: number | undefined\n readonly skip: readonly string[]\n}\n\n/** Parse argv. Split out of `cli.ts` so it is testable without a `process.exit`. */\nexport function parseSpendArgs(argv: readonly string[]): SpendCliArgs {\n let configFile = DEFAULT_CONFIG_FILE\n let json = false\n let asOf: number | undefined\n let skip: string[] = []\n\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i]\n if (arg === '--json') {\n json = true\n } else if (arg === '--config') {\n const value = argv[++i]\n if (!value) throw new SpendUsageError('--config needs a file path')\n configFile = value\n } else if (arg === '--as-of') {\n const value = argv[++i]\n if (!value) throw new SpendUsageError('--as-of needs an ISO instant')\n const parsed = Date.parse(value)\n if (Number.isNaN(parsed)) throw new SpendUsageError(`--as-of is not a date: ${value}`)\n asOf = parsed\n } else if (arg === '--skip') {\n const value = argv[++i]\n if (!value) throw new SpendUsageError('--skip needs a comma-separated list of check ids')\n skip = value.split(',').map((part) => part.trim()).filter(Boolean)\n } else if (arg === '--help' || arg === '-h') {\n throw new SpendUsageError('help')\n } else if (arg !== undefined) {\n throw new SpendUsageError(`unrecognized argument: ${arg}`)\n }\n }\n\n return { configFile, json, asOf, skip }\n}\n\n/**\n * Load the product's reconcile options.\n *\n * A function export is awaited, so a config can open its database connection and\n * mint its platform credential at load time rather than at module scope.\n */\nexport async function loadSpendConfig(configFile: string): Promise<ReconcileSpendOptions> {\n const resolved = resolve(process.cwd(), configFile)\n let module: Record<string, unknown>\n try {\n module = (await import(pathToFileURL(resolved).href)) as Record<string, unknown>\n } catch (err) {\n throw new SpendUsageError(\n `could not load ${resolved}: ${err instanceof Error ? err.message : String(err)}`,\n )\n }\n const exported = module.default ?? module.config\n const value = typeof exported === 'function' ? await (exported as () => unknown)() : exported\n if (!value || typeof value !== 'object') {\n throw new SpendUsageError(`${resolved} must export reconcile options as \\`default\\` or \\`config\\``)\n }\n const options = value as Partial<ReconcileSpendOptions>\n if (!Array.isArray(options.rows)) {\n throw new SpendUsageError(`${resolved} must supply \\`rows\\` — the product's own settled-ledger fetch`)\n }\n if (!options.store) {\n throw new SpendUsageError(`${resolved} must supply \\`store\\` — the product's expectation ledger`)\n }\n return options as ReconcileSpendOptions\n}\n","#!/usr/bin/env node\n/**\n * `agent-app-spend-check` — reconcile what the platform charged for sandbox\n * compute against what this product believes it asked for.\n *\n * Runs in the CONSUMER's repo, on a schedule, over the consumer's own ledger\n * fetch and expectation store — the two things this package deliberately does\n * not reach for. Add it next to the other gates:\n *\n * \"scripts\": { \"spend-check\": \"agent-app-spend-check\" }\n *\n * Exits 1 on any finding, 0 when clean, 2 on a usage or config error. It never\n * disputes, refunds, or writes anything; the output is evidence a human acts on.\n */\nimport { SpendUsageError, SPEND_USAGE, loadSpendConfig, parseSpendArgs } from './cli-args'\nimport { reconcileSpend } from './reconcile'\nimport { formatSpendReport, spendReportToJson } from './report'\nimport type { SpendCheckId } from './types'\n\nasync function main(): Promise<number> {\n const args = parseSpendArgs(process.argv.slice(2))\n const config = await loadSpendConfig(args.configFile)\n const report = await reconcileSpend({\n ...config,\n ...(args.asOf !== undefined ? { asOf: args.asOf } : {}),\n ...(args.skip.length > 0 ? { skip: args.skip as SpendCheckId[] } : {}),\n })\n const rendered = args.json ? spendReportToJson(report) : formatSpendReport(report)\n // A clean report is routine output; a failing one belongs on stderr so a cron\n // that only forwards stderr still delivers the alert.\n if (report.ok) process.stdout.write(`${rendered}\\n`)\n else process.stderr.write(`${rendered}\\n`)\n return report.ok ? 0 : 1\n}\n\ntry {\n process.exit(await main())\n} catch (err) {\n if (err instanceof SpendUsageError) {\n process.stderr.write(`${err.message === 'help' ? '' : `${err.message}\\n\\n`}${SPEND_USAGE}\\n`)\n process.exit(2)\n }\n process.stderr.write(\n `agent-app-spend-check failed: ${err instanceof Error ? err.message : String(err)}\\n`,\n )\n process.exit(2)\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AAIjB,IAAM,kBAAN,cAA8B,MAAM;AAAC;AAE5C,IAAM,sBAAsB;AAErB,IAAM,cAAc;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,8CAA8C,mBAAmB;AAAA,EACjE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAUJ,SAAS,eAAe,MAAuC;AACpE,MAAI,aAAa;AACjB,MAAI,OAAO;AACX,MAAI;AACJ,MAAI,OAAiB,CAAC;AAEtB,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,MAAM,KAAK,CAAC;AAClB,QAAI,QAAQ,UAAU;AACpB,aAAO;AAAA,IACT,WAAW,QAAQ,YAAY;AAC7B,YAAM,QAAQ,KAA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@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Local fixtures + harness helpers for the design-canvas stories.
|
|
3
|
-
*
|
|
4
|
-
* The poster adapts the shared canvas fixture; the multi-page and empty
|
|
5
|
-
* scenes are additions covering the editor's page strip, layers states, and
|
|
6
|
-
* empty-state doors.
|
|
7
|
-
*/
|
|
1
|
+
export { useDocumentDark as useIsDark } from '../../web-react/use-document-dark';
|
|
8
2
|
import type { SceneDocument, ScenePage } from '../../design-canvas';
|
|
9
3
|
import type { SceneOperation } from '../../design-canvas';
|
|
10
4
|
/** Keep the local Glow and Badge placement while sharing the poster artwork. */
|
|
@@ -23,13 +17,6 @@ export declare function makeEmptyScene(): SceneDocument;
|
|
|
23
17
|
export declare function makeMultiPageScene(): SceneDocument;
|
|
24
18
|
/** The layers-showcase page on its own (panel stories). */
|
|
25
19
|
export declare function makeLayersShowcasePage(): ScenePage;
|
|
26
|
-
/**
|
|
27
|
-
* Read the live theme from the document element so the Konva canvas (which
|
|
28
|
-
* cannot resolve CSS vars) paints with the active palette. Tracks the global
|
|
29
|
-
* Storybook theme toolbar, which mutates `data-theme` / `.dark` on
|
|
30
|
-
* `document.documentElement`. Stories never set the theme themselves.
|
|
31
|
-
*/
|
|
32
|
-
export declare function useIsDark(): boolean;
|
|
33
20
|
/**
|
|
34
21
|
* Host-side persistence for editor stories, mirroring the playground canvas
|
|
35
22
|
* route: ops are reduced into local document state with the engine's real
|
package/dist/stream/index.js
CHANGED
|
@@ -12,6 +12,23 @@ import {
|
|
|
12
12
|
normalizeClientTurnId,
|
|
13
13
|
resolveChatTurn
|
|
14
14
|
} from "../chunk-YG66IHDU.js";
|
|
15
|
+
import {
|
|
16
|
+
DEFAULT_RUNNING_TURN_LEASE_MS,
|
|
17
|
+
DEFAULT_RUNNING_TURN_RENEW_INTERVAL_MS,
|
|
18
|
+
TURN_EVENTS_MIGRATION_SQL,
|
|
19
|
+
TURN_STATUS_LEASE_MIGRATION_SQL,
|
|
20
|
+
TURN_STATUS_RETENTION_MIGRATION_SQL,
|
|
21
|
+
TURN_STATUS_SCOPE_MIGRATION_SQL,
|
|
22
|
+
coalesceChatStreamEvents,
|
|
23
|
+
coalesceDeltas,
|
|
24
|
+
createBufferedTurnTap,
|
|
25
|
+
createD1TurnEventStore,
|
|
26
|
+
createMemoryTurnEventStore,
|
|
27
|
+
isLiveProgressEvent,
|
|
28
|
+
pumpBufferedTurn,
|
|
29
|
+
replayTurnEvents,
|
|
30
|
+
stampReplaySeq
|
|
31
|
+
} from "../chunk-ISP6ZH3G.js";
|
|
15
32
|
import {
|
|
16
33
|
MISSING_TOOL_TERMINAL_ERROR,
|
|
17
34
|
MISSING_TOOL_TERMINAL_REASON,
|
|
@@ -35,23 +52,6 @@ import {
|
|
|
35
52
|
terminalizeDanglingToolParts
|
|
36
53
|
} from "../chunk-VUBJZEZB.js";
|
|
37
54
|
import "../chunk-6VQCFJWP.js";
|
|
38
|
-
import {
|
|
39
|
-
DEFAULT_RUNNING_TURN_LEASE_MS,
|
|
40
|
-
DEFAULT_RUNNING_TURN_RENEW_INTERVAL_MS,
|
|
41
|
-
TURN_EVENTS_MIGRATION_SQL,
|
|
42
|
-
TURN_STATUS_LEASE_MIGRATION_SQL,
|
|
43
|
-
TURN_STATUS_RETENTION_MIGRATION_SQL,
|
|
44
|
-
TURN_STATUS_SCOPE_MIGRATION_SQL,
|
|
45
|
-
coalesceChatStreamEvents,
|
|
46
|
-
coalesceDeltas,
|
|
47
|
-
createBufferedTurnTap,
|
|
48
|
-
createD1TurnEventStore,
|
|
49
|
-
createMemoryTurnEventStore,
|
|
50
|
-
isLiveProgressEvent,
|
|
51
|
-
pumpBufferedTurn,
|
|
52
|
-
replayTurnEvents,
|
|
53
|
-
stampReplaySeq
|
|
54
|
-
} from "../chunk-ISP6ZH3G.js";
|
|
55
55
|
import "../chunk-WL7PZK7Q.js";
|
|
56
56
|
export {
|
|
57
57
|
DEFAULT_RUNNING_TURN_LEASE_MS,
|
|
@@ -54,7 +54,7 @@ export declare const MIN_IMAGE_COUNT = 1;
|
|
|
54
54
|
/** Define the maximum number of images allowed for upload or display */
|
|
55
55
|
export declare const MAX_IMAGE_COUNT = 8;
|
|
56
56
|
/** Resolve a human-readable relative time string from a given date or return an empty string if null */
|
|
57
|
-
export declare function relativeTime(date: Date | null): string;
|
|
57
|
+
export declare function relativeTime(date: Date | string | null): string;
|
|
58
58
|
/** Resolve the output directory path based on the specified generation type */
|
|
59
59
|
export declare function outputPathFor(type: GenerationType): string;
|
|
60
60
|
/** Resolve the vault path string from a Generation object or return null if unavailable */
|