@goah/cli 0.11.4 → 0.13.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/cli.js +165 -66
- package/dist/cli.js.map +1 -1
- package/dist/console/assets/index-3sYrDMmt.css +1 -0
- package/dist/console/assets/index-Rtc_B7cs.js +52 -0
- package/dist/console/assets/index-Rtc_B7cs.js.map +1 -0
- package/dist/console/index.html +2 -2
- package/dist/control.d.ts +13 -13
- package/dist/control.d.ts.map +1 -1
- package/dist/control.js +77 -50
- package/dist/control.js.map +1 -1
- package/dist/index.d.ts +6 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +156 -28
- package/dist/index.js.map +1 -1
- package/dist/live-config.js +2 -2
- package/dist/live-config.js.map +1 -1
- package/dist/prompt-queue.d.ts.map +1 -1
- package/dist/prompt-queue.js +5 -0
- package/dist/prompt-queue.js.map +1 -1
- package/dist/setup-wizard.d.ts +13 -2
- package/dist/setup-wizard.d.ts.map +1 -1
- package/dist/setup-wizard.js +87 -63
- package/dist/setup-wizard.js.map +1 -1
- package/dist/thread-inspect.d.ts +47 -0
- package/dist/thread-inspect.d.ts.map +1 -0
- package/dist/thread-inspect.js +78 -0
- package/dist/thread-inspect.js.map +1 -0
- package/dist/transcript.d.ts +2 -0
- package/dist/transcript.d.ts.map +1 -0
- package/dist/transcript.js +2 -0
- package/dist/transcript.js.map +1 -0
- package/dist/tui-theme.d.ts +1 -0
- package/dist/tui-theme.d.ts.map +1 -1
- package/dist/tui-theme.js +1 -0
- package/dist/tui-theme.js.map +1 -1
- package/dist/tui.d.ts +16 -3
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +332 -80
- package/dist/tui.js.map +1 -1
- package/dist/update.d.ts +1 -0
- package/dist/update.d.ts.map +1 -1
- package/dist/update.js +15 -7
- package/dist/update.js.map +1 -1
- package/dist/web-console.d.ts +1 -1
- package/dist/web-console.d.ts.map +1 -1
- package/dist/web-console.js +27 -37
- package/dist/web-console.js.map +1 -1
- package/dist/welcome.d.ts +2 -2
- package/dist/welcome.d.ts.map +1 -1
- package/dist/welcome.js +24 -36
- package/dist/welcome.js.map +1 -1
- package/node_modules/goah-ledger-contract/dist/execution.d.ts +272 -130
- package/node_modules/goah-ledger-contract/dist/execution.d.ts.map +1 -1
- package/node_modules/goah-ledger-contract/dist/execution.js +31 -19
- package/node_modules/goah-ledger-contract/dist/execution.js.map +1 -1
- package/node_modules/goah-ledger-contract/dist/index.d.ts +1 -2
- package/node_modules/goah-ledger-contract/dist/index.d.ts.map +1 -1
- package/node_modules/goah-ledger-contract/dist/index.js +1 -2
- package/node_modules/goah-ledger-contract/dist/index.js.map +1 -1
- package/node_modules/goah-ledger-contract/dist/kernel.d.ts +1 -1
- package/node_modules/goah-ledger-contract/dist/kernel.d.ts.map +1 -1
- package/node_modules/goah-ledger-contract/dist/kernel.js +1 -1
- package/node_modules/goah-ledger-contract/dist/kernel.js.map +1 -1
- package/node_modules/goah-ledger-contract/dist/transcript.d.ts +63 -0
- package/node_modules/goah-ledger-contract/dist/transcript.d.ts.map +1 -0
- package/node_modules/goah-ledger-contract/dist/transcript.js +115 -0
- package/node_modules/goah-ledger-contract/dist/transcript.js.map +1 -0
- package/node_modules/goah-ledger-contract/package.json +3 -4
- package/node_modules/goah-ledger-sqlite/dist/index.d.ts +32 -23
- package/node_modules/goah-ledger-sqlite/dist/index.d.ts.map +1 -1
- package/node_modules/goah-ledger-sqlite/dist/index.js +764 -394
- package/node_modules/goah-ledger-sqlite/dist/index.js.map +1 -1
- package/node_modules/goah-ledger-sqlite/package.json +2 -2
- package/node_modules/goah-runner-pi/dist/configurator.d.ts.map +1 -1
- package/node_modules/goah-runner-pi/dist/configurator.js +186 -30
- package/node_modules/goah-runner-pi/dist/configurator.js.map +1 -1
- package/node_modules/goah-runner-pi/dist/credential-store.d.ts +2 -0
- package/node_modules/goah-runner-pi/dist/credential-store.d.ts.map +1 -1
- package/node_modules/goah-runner-pi/dist/credential-store.js +117 -23
- package/node_modules/goah-runner-pi/dist/credential-store.js.map +1 -1
- package/node_modules/goah-runner-pi/dist/index.d.ts +18 -6
- package/node_modules/goah-runner-pi/dist/index.d.ts.map +1 -1
- package/node_modules/goah-runner-pi/dist/index.js +97 -12
- package/node_modules/goah-runner-pi/dist/index.js.map +1 -1
- package/node_modules/goah-runner-pi/dist/pi-worker.d.ts +6 -2
- package/node_modules/goah-runner-pi/dist/pi-worker.d.ts.map +1 -1
- package/node_modules/goah-runner-pi/dist/pi-worker.js +232 -70
- package/node_modules/goah-runner-pi/dist/pi-worker.js.map +1 -1
- package/node_modules/goah-runner-pi/dist/steering-no-ack.test-fixture.d.ts +2 -0
- package/node_modules/goah-runner-pi/dist/steering-no-ack.test-fixture.d.ts.map +1 -0
- package/node_modules/goah-runner-pi/dist/steering-no-ack.test-fixture.js +3 -0
- package/node_modules/goah-runner-pi/dist/steering-no-ack.test-fixture.js.map +1 -0
- package/node_modules/goah-runner-pi/dist/steering-reject.test-fixture.d.ts +2 -0
- package/node_modules/goah-runner-pi/dist/steering-reject.test-fixture.d.ts.map +1 -0
- package/node_modules/goah-runner-pi/dist/steering-reject.test-fixture.js +5 -0
- package/node_modules/goah-runner-pi/dist/steering-reject.test-fixture.js.map +1 -0
- package/node_modules/goah-runner-pi/dist/steering-worker.test-fixture.d.ts +2 -0
- package/node_modules/goah-runner-pi/dist/steering-worker.test-fixture.d.ts.map +1 -0
- package/node_modules/goah-runner-pi/dist/steering-worker.test-fixture.js +5 -0
- package/node_modules/goah-runner-pi/dist/steering-worker.test-fixture.js.map +1 -0
- package/node_modules/goah-runner-pi/dist/test-helpers.d.ts +1 -1
- package/node_modules/goah-runner-pi/dist/test-helpers.d.ts.map +1 -1
- package/node_modules/goah-runner-pi/dist/test-helpers.js +3 -1
- package/node_modules/goah-runner-pi/dist/test-helpers.js.map +1 -1
- package/node_modules/goah-runner-pi/dist/verification-worker.d.ts.map +1 -1
- package/node_modules/goah-runner-pi/dist/verification-worker.js +3 -5
- package/node_modules/goah-runner-pi/dist/verification-worker.js.map +1 -1
- package/node_modules/goah-runner-pi/package.json +2 -2
- package/node_modules/goah-supervisor/dist/context-view.d.ts +4 -5
- package/node_modules/goah-supervisor/dist/context-view.d.ts.map +1 -1
- package/node_modules/goah-supervisor/dist/context-view.js +7 -20
- package/node_modules/goah-supervisor/dist/context-view.js.map +1 -1
- package/node_modules/goah-supervisor/dist/index.d.ts +38 -36
- package/node_modules/goah-supervisor/dist/index.d.ts.map +1 -1
- package/node_modules/goah-supervisor/dist/index.js +762 -575
- package/node_modules/goah-supervisor/dist/index.js.map +1 -1
- package/node_modules/goah-supervisor/dist/roles.d.ts +2 -1
- package/node_modules/goah-supervisor/dist/roles.d.ts.map +1 -1
- package/node_modules/goah-supervisor/dist/roles.js +20 -5
- package/node_modules/goah-supervisor/dist/roles.js.map +1 -1
- package/node_modules/goah-supervisor/dist/verification.d.ts +8 -29
- package/node_modules/goah-supervisor/dist/verification.d.ts.map +1 -1
- package/node_modules/goah-supervisor/dist/verification.js +71 -46
- package/node_modules/goah-supervisor/dist/verification.js.map +1 -1
- package/node_modules/goah-supervisor/package.json +2 -2
- package/node_modules/goah-testkit/dist/faux-runner-worker.js +16 -9
- package/node_modules/goah-testkit/dist/faux-runner-worker.js.map +1 -1
- package/node_modules/goah-testkit/dist/index.d.ts +13 -16
- package/node_modules/goah-testkit/dist/index.d.ts.map +1 -1
- package/node_modules/goah-testkit/dist/index.js +27 -44
- package/node_modules/goah-testkit/dist/index.js.map +1 -1
- package/node_modules/goah-testkit/package.json +5 -5
- package/package.json +7 -8
- package/dist/console/assets/index-BJTGvlCH.js +0 -52
- package/dist/console/assets/index-BJTGvlCH.js.map +0 -1
- package/dist/console/assets/index-msBn41Cl.css +0 -1
- package/dist/inspect.d.ts +0 -61
- package/dist/inspect.d.ts.map +0 -1
- package/dist/inspect.js +0 -110
- package/dist/inspect.js.map +0 -1
- package/dist/metrics.d.ts +0 -2
- package/dist/metrics.d.ts.map +0 -1
- package/dist/metrics.js +0 -2
- package/dist/metrics.js.map +0 -1
- package/dist/session.d.ts +0 -2
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -2
- package/dist/session.js.map +0 -1
- package/node_modules/goah-ledger-contract/dist/metrics.d.ts +0 -40
- package/node_modules/goah-ledger-contract/dist/metrics.d.ts.map +0 -1
- package/node_modules/goah-ledger-contract/dist/metrics.js +0 -25
- package/node_modules/goah-ledger-contract/dist/metrics.js.map +0 -1
- package/node_modules/goah-ledger-contract/dist/session.d.ts +0 -63
- package/node_modules/goah-ledger-contract/dist/session.d.ts.map +0 -1
- package/node_modules/goah-ledger-contract/dist/session.js +0 -115
- package/node_modules/goah-ledger-contract/dist/session.js.map +0 -1
- package/node_modules/goah-testkit/dist/mock-connector-worker.d.ts +0 -2
- package/node_modules/goah-testkit/dist/mock-connector-worker.d.ts.map +0 -1
- package/node_modules/goah-testkit/dist/mock-connector-worker.js +0 -29
- package/node_modules/goah-testkit/dist/mock-connector-worker.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
:root{font-family:Avenir Next,Avenir,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;color:#111214;background:#f7f7f4;font-synthesis:none;text-rendering:optimizeLegibility;--blue: #2447d8;--blue-soft: #eef0ff;--ink: #111214;--muted: #6d6d69;--faint: #9a9a95;--line: rgba(17, 18, 20, .11);--surface: #f7f7f4;--white: #fff;--orange: #ec8b18;--red: #d33f36;--green: #2aa762}*{box-sizing:border-box}html,body,#root{min-height:100%;margin:0}button,input,textarea{font:inherit}button{color:inherit}button:focus-visible,input:focus-visible,textarea:focus-visible{outline:3px solid rgba(36,71,216,.22);outline-offset:2px}::selection{color:#fff;background:var(--blue)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.console-shell{min-height:100vh;display:grid;grid-template-columns:232px minmax(0,1fr);background:var(--surface)}.sidebar{position:fixed;inset:0 auto 0 0;width:232px;display:flex;flex-direction:column;border-right:1px solid var(--line);background:#f7f7f4fa;z-index:30}.brand{height:82px;display:flex;align-items:center;gap:10px;padding:0 24px;font-weight:650;font-size:16px;letter-spacing:-.02em}.brand img{width:34px;height:34px;object-fit:contain}.sidebar nav{padding:10px 16px;display:grid;gap:6px}.nav-item{min-height:54px;width:100%;padding:0 14px;border:0;border-radius:10px;background:transparent;display:grid;grid-template-columns:24px 1fr auto auto;align-items:center;gap:12px;text-align:left;cursor:pointer;color:#2c2d30;transition:background .16s ease,color .16s ease}.nav-item:hover{background:#1112140b}.nav-item.active{color:var(--blue);background:var(--blue-soft)}.nav-item svg{width:21px;height:21px;stroke-width:1.8}.nav-item small{color:var(--muted);font-size:12px;font-variant-numeric:tabular-nums}.nav-item.active small{color:var(--blue)}.live-dot,.health-dot{display:inline-block;width:8px;height:8px;border-radius:999px;background:var(--green)}.nav-item.settings{margin:auto 16px 0;width:calc(100% - 32px);border-top:1px solid var(--line);border-radius:0;padding-top:18px;min-height:72px}.sidebar-status{padding:20px 28px;font-size:12px;color:var(--muted)}.sidebar-status p{margin:0;display:flex;align-items:center;gap:9px;color:var(--ink)}.sidebar-status p svg{width:14px}.sidebar-status span{padding-left:17px}.console-main{grid-column:2;min-width:0;min-height:100vh}.connection-banner{position:fixed;top:12px;left:50%;transform:translate(-50%);z-index:60;padding:8px 14px;border:1px solid rgba(236,139,24,.35);border-radius:999px;background:#fff8e9;color:#8c5718;font-size:12px}.overview-layout{min-height:100vh}.overview-content{min-width:0}.goal-header{padding:32px 40px 22px;border-bottom:1px solid var(--line)}.goal-header>p:first-child,.page>header>p{margin:0 0 8px;color:var(--muted);font-size:13px}.goal-header-row{display:flex;align-items:flex-start;justify-content:space-between;gap:24px}.goal-title-row{display:flex;align-items:center;flex-wrap:wrap;gap:12px}.goal-title-row h1{margin:0 14px 0 0;max-width:720px;font-size:clamp(26px,2.2vw,34px);line-height:1.08;letter-spacing:-.035em;font-weight:560}.header-action{flex:none;min-height:40px;padding:0 16px;display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid var(--blue);border-radius:8px;color:#fff;background:var(--blue);cursor:pointer;font-size:13px;font-weight:600}.header-action svg{width:17px;height:17px}.metadata{color:var(--muted);font-size:13px;font-variant-numeric:tabular-nums}.observation{max-width:920px;margin:14px 0 0;color:var(--muted);line-height:1.55;font-size:14px}.observation strong{color:#4a4b4e;font-weight:560}.attention-strip{width:fit-content;max-width:100%;margin-top:14px;padding:8px 11px;display:flex;align-items:center;flex-wrap:wrap;gap:10px 18px;border:1px solid rgba(236,139,24,.26);border-radius:7px;color:#815016;background:#fff8e9;font-size:12px}.attention-strip span{display:inline-flex;align-items:center;gap:6px}.attention-strip svg{width:15px;height:15px}.attention-strip .danger{color:var(--red)}.status{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-size:12px;white-space:nowrap}.status i{width:8px;height:8px;border-radius:50%;background:#a3a3a0}.status-running,.status-active{color:var(--blue)}.status-running i,.status-active i{background:var(--blue)}.status-queued i{background:#7151df}.status-scheduled i{background:var(--green)}.status-blocked i,.status-abnormal i{background:var(--red)}.status-waiting i,.status-paused i,.status-idle-unplanned i{background:#aaa9a4}.organization{padding:22px 40px 26px}.org-tree{max-width:980px}.tree-root,.tree-agent{min-width:0;display:grid;align-items:center;border-bottom:1px solid var(--line)}.tree-root{min-height:68px;grid-template-columns:34px minmax(0,1fr) auto;gap:14px;padding:8px 14px 8px 8px;border-top:1px solid var(--line);background:#ffffff52}.tree-root img{width:30px;height:30px;object-fit:contain}.tree-root>div,.tree-agent>div{min-width:0;display:grid;gap:4px}.tree-root strong,.tree-agent strong{font-size:14px;font-weight:620}.tree-root>div span,.tree-agent>div span{overflow:hidden;color:var(--muted);font-size:12px;text-overflow:ellipsis;white-space:nowrap}.tree-children{position:relative;margin-left:24px;padding-left:28px}.tree-children:before{content:"";position:absolute;left:0;top:0;bottom:29px;width:1px;background:#c9cace}.tree-agent{position:relative;min-height:62px;grid-template-columns:28px minmax(180px,1fr) 104px minmax(138px,auto);gap:14px;padding:8px 8px 8px 0}.tree-agent:before{content:"";position:absolute;left:-28px;top:50%;width:18px;height:1px;background:#c9cace}.tree-agent>svg{width:22px;height:22px;color:var(--blue)}.tree-agent>small{color:var(--muted);font-size:11px;text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}.tree-children>.empty{margin:18px 0}.trajectory-preview{border-top:1px solid var(--line);padding:18px 30px 12px;min-height:180px}.section-heading{display:flex;align-items:center;justify-content:space-between;padding-bottom:14px;border-bottom:1px solid var(--line)}.section-heading h2{margin:0;font-size:14px;font-weight:620}.section-heading button{border:0;background:transparent;color:var(--blue);font-size:12px;cursor:pointer}.trajectory-list{position:relative}.trajectory-list:before{content:"";position:absolute;left:5px;top:16px;bottom:16px;width:1px;background:var(--line)}.trajectory-row{width:100%;min-height:38px;display:grid;grid-template-columns:20px 58px minmax(180px,1fr);align-items:center;gap:10px;border:0;border-bottom:1px solid var(--line);background:transparent;text-align:left;cursor:pointer}.trajectory-row:hover{background:#2447d809}.event-dot{position:relative;z-index:1;width:9px;height:9px;border-radius:50%;background:var(--blue)}.event-dot.success{background:var(--green)}.event-dot.attention-tone{background:var(--orange)}.event-dot.danger{background:var(--red)}.trajectory-row time,.trajectory-row small{color:var(--muted);font-size:12px;font-variant-numeric:tabular-nums}.trajectory-row .actor,.trajectory-row small{display:none}.trajectory-row strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500}.raw-link{margin:12px 0 0 auto;display:flex;align-items:center;gap:7px;border:0;background:transparent;color:var(--blue);cursor:pointer;font-size:12px}.raw-link svg{width:15px}.composer button,.primary{height:48px;border:1px solid var(--line);border-radius:9px;background:transparent;display:flex;align-items:center;justify-content:center;gap:10px;cursor:pointer;font-weight:560}button.primary{color:#fff;background:var(--blue);border-color:var(--blue)}.primary svg{width:18px}.page{min-height:100vh;padding:28px 36px 48px}.page>header{max-width:860px;margin-bottom:20px}.page>header h1{margin:0 0 5px;font-size:28px;letter-spacing:-.03em;font-weight:570}.page>header>span{color:var(--muted);line-height:1.5}.long-trajectory{max-width:1040px;border-top:1px solid var(--line)}.long-trajectory article{position:relative;min-height:96px;display:grid;grid-template-columns:16px 120px 1fr 70px;gap:18px;align-items:start;padding:20px 0;border-bottom:1px solid var(--line)}.long-trajectory article:before{content:"";position:absolute;left:4px;top:28px;bottom:-29px;width:1px;background:var(--line)}.long-trajectory article:last-child:before{display:none}.long-trajectory time,.long-trajectory code,.long-trajectory span{color:var(--muted);font-size:12px}.long-trajectory p{margin:0 0 7px;color:var(--blue);font-size:12px}.long-trajectory h2{margin:0 0 9px;font-size:16px;font-weight:560}.org-trajectory-toolbar{max-width:1040px;display:flex;gap:10px;margin-bottom:18px}.trajectory-filter{min-width:190px;display:grid;gap:5px;color:var(--muted);font-size:10px;text-transform:uppercase;letter-spacing:.08em}.trajectory-filter>button{height:38px;padding:0 10px 0 11px;display:flex;align-items:center;justify-content:space-between;gap:10px;border:1px solid var(--line);border-radius:7px;background:#fff;cursor:pointer;text-align:left;text-transform:none;letter-spacing:0}.trajectory-filter svg{width:15px;color:var(--muted)}.org-event-list{position:relative;max-width:1040px;border-top:1px solid var(--line)}.org-event-list:before{content:"";position:absolute;left:127px;top:0;bottom:0;width:1px;background:var(--line)}.org-event{position:relative;min-height:74px;display:grid;grid-template-columns:106px 12px minmax(0,1fr) auto auto;gap:15px;align-items:center;padding:12px 8px 12px 0;border-bottom:1px solid var(--line)}.org-event>time{color:var(--muted);font-size:11px;font-variant-numeric:tabular-nums}.org-event>.event-dot{width:10px;height:10px}.org-event>div{min-width:0;display:grid;gap:5px}.org-event header{display:flex;align-items:center;gap:9px}.org-event header strong{font-size:13px}.org-event header span,.org-event small{color:var(--faint);font-size:10px}.org-event p{overflow:hidden;margin:0;font-size:13px;font-weight:520;line-height:1.4;text-overflow:ellipsis;white-space:nowrap}.org-event>button{height:32px;padding:0 8px;display:inline-flex;align-items:center;gap:4px;border:0;color:var(--blue);background:transparent;cursor:pointer;font-size:11px}.org-event>button svg{width:14px}.load-older{height:38px;margin-top:16px;padding:0 14px;border:1px solid var(--line);border-radius:7px;background:#fff;cursor:pointer;font-size:12px}.load-older:disabled{opacity:.5}.back-to-trajectory{margin:-8px 0 16px;padding:0;display:inline-flex;align-items:center;gap:7px;border:0;color:var(--blue);background:transparent;cursor:pointer;font-size:12px}.back-to-trajectory svg{width:15px}.trace-toolbar{min-height:48px;display:grid;grid-template-columns:minmax(260px,.8fr) auto minmax(250px,.7fr);gap:22px;align-items:end;padding:0 0 10px}.trace-toolbar>label,.session-field{display:grid;gap:6px;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.08em}.session-select{width:100%;height:38px;padding:0 10px 0 11px;display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid var(--line);border-radius:7px;color:var(--ink);background:#fff;cursor:pointer;text-align:left;text-transform:none;letter-spacing:0}.session-select svg{width:16px;color:var(--muted)}.session-select-content{z-index:120;width:var(--radix-select-trigger-width);max-height:min(340px,var(--radix-select-content-available-height));overflow:hidden;border:1px solid var(--line);border-radius:8px;background:#fff;box-shadow:0 14px 36px #1112141f}.session-select-item{min-height:38px;padding:8px 38px 8px 12px;display:flex;align-items:center;position:relative;color:var(--ink);cursor:default;font-size:12px;outline:0}.session-select-item[data-highlighted]{background:var(--blue-soft)}.session-check{position:absolute;right:12px;display:flex}.session-select-item svg{width:15px;color:var(--blue)}.trace-stats{height:38px;display:flex;align-items:center;gap:22px;color:var(--muted);font-size:12px}.trace-stats span{display:flex;align-items:center;gap:6px;white-space:nowrap}.trace-stats svg{width:15px}.trace-toolbar .trace-search{height:38px;display:flex;flex-direction:row;align-items:center;gap:8px;padding:0 11px;border:1px solid var(--line);border-radius:7px;background:#fff}.trace-search svg{width:16px}.trace-search input{width:100%;border:0;outline:0;background:transparent;text-transform:none;letter-spacing:0}.trace-surface{--trace-rail: 62px;--trace-kind: 92px;--trace-time: 54px;--trace-seq: 56px;--trace-action: 18px;--trace-gap: 10px;--trace-line: 46px}.trace-map{min-height:72px;display:grid;grid-template-columns:var(--trace-rail) minmax(0,1fr);border:1px solid var(--line);border-bottom:0;background:#ffffff75}.trace-labels{padding:12px 7px;display:grid;grid-template-rows:repeat(3,1fr);color:var(--faint);font-size:11px;text-align:left}.trace-lanes{min-width:0;padding:7px 12px 7px var(--trace-gap);display:grid;grid-template-rows:repeat(3,1fr);gap:3px}.trace-lane{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(6px,1fr);gap:4px;align-items:center}.trace-lane i{height:9px;border-radius:2px;background:transparent}.trace-lane.input i.filled{background:#7192ed}.trace-lane.model i.filled{height:14px;background:#8c6db1}.trace-lane.tool i.filled{height:14px;background:#df8125}.trace-scroll{height:clamp(360px,calc(100vh - 270px),720px);border:1px solid var(--line);background:#ffffff8c;overflow:hidden}.trace-scroll>[data-radix-scroll-area-viewport]{width:100%;height:100%}.trace-scrollbar{width:10px;padding:2px;background:#11121406}.trace-scrollbar [data-radix-scroll-area-thumb]{position:relative;display:block;min-height:36px;border-radius:999px;background:#11121438}.trace-list{position:relative;min-height:100%}.trace-list:before{content:"";position:absolute;left:var(--trace-line);top:0;bottom:0;width:1px;background:#d7d8d9}.trace-row{position:relative;width:100%;min-height:50px;display:grid;grid-template-columns:var(--trace-rail) var(--trace-kind) minmax(0,1fr) var(--trace-time) var(--trace-seq) var(--trace-action);gap:var(--trace-gap);align-items:center;padding:6px 12px 6px 0;border:0;border-bottom:1px solid var(--line);background:transparent;text-align:left}.trace-row-trigger{cursor:pointer}.trace-row-trigger:hover{background:#2447d806}.trace-row:last-child{border-bottom:0}.trace-row.turn-start,.trace-collapsible.turn-start{border-top:1px solid var(--line)}.trace-row.turn-start:first-child,.trace-collapsible.turn-start:first-child{border-top:0}.trace-rail-cell{align-self:stretch;position:relative}.turn-label{position:absolute;top:1px;left:7px;color:var(--faint);font-family:var(--mono, ui-monospace);font-size:10px}.trace-node{position:absolute;left:calc(var(--trace-line) - 4.5px);top:50%;z-index:1;width:9px;height:9px;border:2px solid #b6b8ba;border-radius:50%;background:var(--surface);transform:translateY(-50%)}.trace-kind{justify-self:start;padding:5px 10px;border-radius:6px;background:#eef0f2;color:#5b5d62;font-size:11px;font-weight:650;text-transform:uppercase;letter-spacing:.06em}.trace-assistant{color:#75539d;background:#f0eafa}.trace-user{color:#2e64ce;background:#e9f0ff}.trace-context,.trace-compact{color:#278d5c;background:#e9f8ef}.trace-tool{color:#c46a13;background:#fff1df}.trace-handoff{color:var(--blue);background:var(--blue-soft)}.trace-content{min-width:0;display:grid;gap:5px}.trace-content strong{overflow:hidden;color:#26272a;font-size:13px;font-weight:500;line-height:1.4;text-overflow:ellipsis;white-space:nowrap}.trace-content code{overflow:hidden;color:var(--muted);font-size:11px;text-overflow:ellipsis;white-space:nowrap}.trace-row time,.trace-seq{color:var(--faint);font-size:11px;font-variant-numeric:tabular-nums}.trace-seq{text-align:right}.trace-expand{width:15px;color:var(--faint);transition:transform .16s ease}.trace-row-trigger[data-state=open] .trace-expand{transform:rotate(90deg)}.trace-payload{width:100%;min-width:0;overflow:hidden}.trace-payload[data-state=open]{animation:collapsible-down .18s cubic-bezier(.16,1,.3,1)}.trace-payload[data-state=closed]{animation:collapsible-up .14s ease-in}.trace-payload-inner{min-width:0;margin-left:calc(var(--trace-rail) + var(--trace-kind) + (var(--trace-gap) * 2));border-bottom:1px solid var(--line);background:#11121406}.trace-payload-inner>header{width:100%;height:38px;padding:0 12px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);color:var(--muted);font-size:10px;font-weight:650;text-transform:uppercase;letter-spacing:.08em}.trace-payload-inner>header button{flex:none;display:inline-flex;align-items:center;gap:6px;border:0;color:var(--blue);background:transparent;cursor:pointer;font-size:10px;text-transform:none;letter-spacing:0}.trace-payload-inner>header svg{width:14px;height:14px}.trace-payload-inner pre{width:100%;min-width:0;max-height:260px;margin:0;overflow:auto;padding:14px 18px}.trace-payload-inner code{display:block;width:max-content;min-width:100%;color:#55585f;font-size:11px;line-height:1.55;white-space:pre}.trace-empty-state,.trace-no-results{min-height:clamp(320px,calc(100vh - 198px),620px);display:grid;place-content:center;justify-items:center;gap:10px;padding:40px;border:1px solid var(--line);color:var(--muted);background:#ffffff61;text-align:center}.trace-empty-state>svg,.trace-no-results>svg{width:24px;height:24px;color:var(--faint)}.trace-empty-state h2{margin:3px 0 0;color:var(--ink);font-size:16px;font-weight:600}.trace-empty-state p,.trace-no-results p{max-width:480px;margin:0;font-size:13px;line-height:1.55}.trace-empty-state .status{margin-top:4px}@keyframes collapsible-down{0%{height:0;opacity:.4}to{height:var(--radix-collapsible-content-height);opacity:1}}@keyframes collapsible-up{0%{height:var(--radix-collapsible-content-height);opacity:1}to{height:0;opacity:.4}}.ledger-mode{display:grid;grid-template-columns:auto 1fr;align-items:center;margin-bottom:22px;border-bottom:1px solid var(--line)}.ledger-mode>div{display:flex}.ledger-mode [role=tab]{height:46px;padding:0 18px;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--muted);cursor:pointer}.ledger-mode [role=tab][data-state=active]{color:var(--blue);border-bottom-color:var(--blue)}.ledger-mode label{justify-self:end;width:min(340px,80%);height:36px;display:flex;align-items:center;gap:8px;padding:0 11px;border:1px solid var(--line);border-radius:7px;background:#fff}.ledger-mode label svg{width:16px;color:var(--muted)}.ledger-mode input{width:100%;border:0;outline:0;background:transparent}.work-ledger{max-width:1080px;display:grid;gap:8px}.work-record{border:1px solid var(--line);background:#ffffff8a}.work-record h3{margin:0}.work-record-summary{width:100%;min-height:62px;padding:10px 14px;display:grid;grid-template-columns:30px 170px minmax(220px,1fr) minmax(160px,.65fr) 18px;gap:12px;align-items:center;border:0;background:transparent;text-align:left;cursor:pointer}.work-record-summary:hover{background:#2447d806}.work-record-summary>svg:first-child{width:28px;height:28px;padding:6px;border-radius:50%;color:#fff;background:var(--blue)}.work-record-summary>svg:last-child{width:16px;color:var(--muted);transition:transform .18s ease}.work-record-summary[data-state=open]>svg:last-child{transform:rotate(90deg)}.record-agent{display:grid;gap:3px}.record-agent strong{font-size:13px}.record-agent small,.record-next{color:var(--muted);font-size:11px}.record-outcome{overflow:hidden;font-size:13px;font-weight:540;text-overflow:ellipsis;white-space:nowrap}.record-next{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.work-record-content{overflow:hidden;border-top:1px solid var(--line)}.work-record-content[data-state=open]{animation:accordion-down .18s cubic-bezier(.16,1,.3,1)}.work-record-content[data-state=closed]{animation:accordion-up .14s ease-in}.work-record-body{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));background:#ffffff57}.record-section{min-width:0;padding:14px 16px;border-right:1px solid var(--line)}.record-section:last-child{border-right:0}.record-section h3{margin:0 0 8px;color:var(--muted);font-size:9px;text-transform:uppercase;letter-spacing:.09em}.record-section p{margin:0 0 5px;font-size:12px;line-height:1.45}.record-section p:last-child{margin-bottom:0}.record-section p:before{content:"·";margin-right:7px;color:var(--blue)}.record-section.danger{color:var(--red)}.work-record-content>footer{height:38px;padding:0 12px;display:flex;justify-content:flex-end;align-items:center;gap:8px;border-top:1px solid var(--line)}.work-record-content>footer button{border:0;background:transparent;color:var(--blue);cursor:pointer;font-size:11px}.work-record.compact{margin-bottom:6px}.work-record.compact .work-record-summary{grid-template-columns:28px 150px minmax(0,1fr) 18px}.work-record.compact .record-next{display:none}@keyframes accordion-down{0%{height:0;opacity:.3}to{height:var(--radix-accordion-content-height);opacity:1}}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height);opacity:1}to{height:0;opacity:.3}}.session-list{border-top:1px solid var(--line)}.session-list>button{width:100%;min-height:58px;padding:9px 6px;display:grid;grid-template-columns:1fr auto 18px;align-items:center;gap:12px;border:0;border-bottom:1px solid var(--line);background:transparent;text-align:left;cursor:pointer}.session-list>button:hover{background:#2447d809}.session-list>button>span{display:grid;gap:5px}.session-list small{color:var(--muted)}.session-list svg{width:16px}.ledger-toolbar{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:18px}.ledger-toolbar>div{display:flex}.ledger-toolbar button{height:36px;padding:0 16px;border:1px solid var(--line);border-right:0;background:transparent;cursor:pointer;text-transform:capitalize}.ledger-toolbar button:first-child{border-radius:7px 0 0 7px}.ledger-toolbar button:last-child{border-right:1px solid var(--line);border-radius:0 7px 7px 0}.ledger-toolbar button.selected{color:#fff;background:var(--blue);border-color:var(--blue)}.ledger-toolbar label{width:min(340px,40%);height:38px;display:flex;align-items:center;gap:9px;padding:0 12px;border:1px solid var(--line);border-radius:7px;background:#fff}.ledger-toolbar label svg{width:17px;color:var(--muted)}.ledger-toolbar input{min-width:0;flex:1;border:0;outline:0;background:transparent}.ledger-table{border:1px solid var(--line);background:#ffffff73;overflow-x:auto}.ledger-head,.ledger-row{min-width:960px;display:grid;grid-template-columns:66px 80px 190px 120px 180px minmax(260px,1fr);gap:14px;align-items:center;padding:0 14px}.ledger-head{height:42px;color:var(--muted);border-bottom:1px solid var(--line);font-size:11px;text-transform:uppercase;letter-spacing:.08em}.ledger-row{min-height:56px;border-bottom:1px solid var(--line);font-size:12px}.ledger-row:last-child{border-bottom:0}.ledger-row code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#5d5e62}.ledger-row strong{font-weight:560}.ledger-row time{font-variant-numeric:tabular-nums}.agents-workbench{display:grid;grid-template-columns:340px minmax(0,760px);gap:34px}.agent-roster{border-top:1px solid var(--line)}.agent-roster>button{width:100%;min-height:76px;padding:14px 12px;border:0;border-bottom:1px solid var(--line);background:transparent;display:grid;grid-template-columns:24px minmax(0,1fr) 92px;gap:12px;align-items:center;text-align:left;cursor:pointer}.agent-roster>button.selected{background:var(--blue-soft);box-shadow:inset 2px 0 var(--blue)}.agent-roster svg{width:21px;color:var(--blue)}.agent-roster>button>.status{justify-self:start}.agent-roster span{display:grid;gap:5px}.agent-roster small{color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.agent-detail{border-left:1px solid var(--line);padding-left:34px}.agent-detail-head{display:flex;align-items:center;gap:15px;padding-bottom:20px;border-bottom:1px solid var(--line)}.agent-detail-head>svg{width:38px;height:38px;padding:8px;color:#fff;background:var(--blue);border-radius:50%}.agent-detail h2{margin:0 0 5px;font-size:22px}.agent-detail>section{padding:24px 0;border-bottom:1px solid var(--line)}.agent-detail>section>h3{margin:0 0 15px;font-size:13px;text-transform:uppercase;letter-spacing:.08em}.owned-goal{display:grid;gap:8px}.owned-goal span{color:var(--muted);line-height:1.5}.agent-log{min-height:46px;display:grid;grid-template-columns:68px 1fr 60px;gap:12px;align-items:center;border-bottom:1px solid var(--line);font-size:12px}.agent-log time,.agent-log code{color:var(--muted)}.settings-list{max-width:720px;border-top:1px solid var(--line)}.settings-list>div{min-height:64px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}.settings-list span{color:var(--muted)}.settings-list strong{font-weight:560}.empty{color:var(--muted);font-size:13px;line-height:1.45}.modal-backdrop{position:fixed;inset:0;z-index:100;background:#11121447}.composer{position:fixed;left:50%;top:50%;z-index:101;width:min(620px,calc(100vw - 48px));padding:30px;border-radius:14px;background:#fbfbf8;box-shadow:0 32px 100px #11121433;transform:translate(-50%,-50%)}.composer>p{margin:0 0 8px;color:var(--blue);font-size:12px;text-transform:uppercase;letter-spacing:.08em}.composer h2{margin:0 0 22px;font-size:24px}.composer textarea{width:100%;min-height:150px;padding:16px;resize:vertical;border:1px solid var(--line);border-radius:9px;background:#fff;line-height:1.5}.composer>div{margin-top:16px;display:flex;align-items:center;justify-content:space-between;gap:16px}.composer>div>span{color:var(--muted);font-size:12px}.composer .primary{padding:0 20px}.composer .close{position:absolute;right:18px;top:18px;width:36px;height:36px;border:0;background:transparent}.composer .close svg{width:18px}.composer button:disabled{opacity:.45;cursor:not-allowed}.loading{min-height:100vh;display:grid;place-content:center;justify-items:center;background:var(--surface)}.loading img{width:72px}.loading h1{margin:18px 0 6px}.loading p{color:var(--muted)}@media(max-width:1080px){.tree-agent{grid-template-columns:28px minmax(160px,1fr) 96px}.tree-agent>small{grid-column:2 / -1;text-align:left}}@media(max-width:760px){.console-shell{display:block;padding-bottom:72px}.console-main{min-height:calc(100vh - 72px)}.sidebar{inset:auto 0 0;width:auto;height:72px;flex-direction:row;border-top:1px solid var(--line);border-right:0}.brand,.nav-item.settings,.sidebar-status{display:none}.sidebar nav{width:100%;padding:8px 10px;grid-template-columns:repeat(4,1fr);gap:3px}.nav-item{min-height:54px;padding:5px;display:flex;flex-direction:column;justify-content:center;gap:4px;text-align:center;font-size:10px}.nav-item svg{width:18px;height:18px}.nav-item small,.nav-item .live-dot{display:none}.goal-header{padding:24px 20px 20px}.goal-header-row{flex-direction:column;gap:16px}.goal-title-row h1{font-size:28px}.header-action{width:100%}.observation{font-size:13px}.organization{padding:18px 20px 22px}.tree-root{grid-template-columns:30px minmax(0,1fr)}.tree-root>.status{grid-column:2}.tree-children{margin-left:15px;padding-left:22px}.tree-children:before{bottom:37px}.tree-agent{grid-template-columns:24px minmax(0,1fr);gap:8px 12px;padding:12px 4px 12px 0}.tree-agent:before{left:-22px;width:14px}.tree-agent>.status,.tree-agent>small{grid-column:2}.tree-agent>small{text-align:left}.trajectory-preview{padding:20px}.trajectory-row{grid-template-columns:16px 50px 1fr}.trajectory-row strong{font-size:12px}.page{padding:24px 18px 40px}.page>header h1{font-size:26px}.org-trajectory-toolbar{display:grid;grid-template-columns:1fr 1fr}.trajectory-filter{min-width:0}.org-event-list:before{left:5px}.org-event{grid-template-columns:12px minmax(0,1fr) auto;gap:10px;padding:12px 0}.org-event>time{grid-column:2;grid-row:2}.org-event>.event-dot{grid-column:1;grid-row:1 / 3}.org-event>div{grid-column:2 / -1}.org-event>button{grid-column:3;grid-row:2}.org-event>.status{display:none}.org-event p{white-space:normal}.org-event header{flex-wrap:wrap}.ledger-toolbar{align-items:stretch;flex-direction:column}.ledger-toolbar>div{overflow-x:auto}.ledger-toolbar label{width:100%}.trace-toolbar{grid-template-columns:1fr;align-items:stretch}.trace-stats{justify-content:space-between}.trace-surface{--trace-rail: 46px;--trace-kind: 72px;--trace-time: 42px;--trace-seq: 0px;--trace-action: 18px;--trace-gap: 8px;--trace-line: 44px}.trace-map{min-width:0}.trace-scroll{height:clamp(320px,calc(100vh - 454px),560px)}.trace-row,.trace-row-trigger{min-width:0}.trace-row .trace-seq{display:none}.trace-expand{width:14px}.turn-label{left:7px}.trace-kind{padding:4px 7px;font-size:9px}.trace-content strong{font-size:12px}.trace-payload-inner{margin-left:var(--trace-rail)}.trace-payload-inner pre{max-height:220px;padding:12px}.trace-empty-state,.trace-no-results{min-height:360px;padding:28px}.ledger-mode{grid-template-columns:1fr}.ledger-mode label{justify-self:stretch;width:100%;margin:10px 0}.work-record-summary,.work-record.compact .work-record-summary{grid-template-columns:28px minmax(0,1fr) 18px}.work-record-summary>svg:first-child{grid-row:1 / 3}.work-record-summary>svg:last-child{grid-column:3;grid-row:1 / 3}.record-agent,.record-outcome{grid-column:2}.record-next{display:none}.work-record-body{grid-template-columns:1fr}.record-section{min-height:auto;border-right:0;border-bottom:1px solid var(--line)}.record-section:last-child{border-bottom:0}.agents-workbench{grid-template-columns:1fr}.agent-detail{padding-left:0;border-left:0}.agent-roster{display:flex;overflow-x:auto}.agent-roster>button{min-width:250px}.composer>div{align-items:stretch;flex-direction:column}.composer .primary{width:100%}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;transition-duration:.01ms!important}}.chat{min-height:100vh;display:flex;flex-direction:column}.chat-header{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:26px 36px 18px;border-bottom:1px solid var(--line)}.chat-header h1{margin:0 0 4px;font-size:24px;letter-spacing:-.03em;font-weight:580}.chat-header p{margin:0;color:var(--muted);font-size:13px}.chat-live-pill{flex:none;padding:6px 12px;border:1px solid var(--line);border-radius:999px;background:#fff;color:var(--muted);font-size:12px}.chat-live-pill.busy{color:var(--blue);border-color:#2447d859;background:var(--blue-soft)}.chat-scroll{flex:1;overflow-y:auto;display:grid;gap:14px;align-content:start;padding:24px 36px}.chat-empty{color:var(--muted);font-size:14px}.chat-entry{max-width:780px;display:grid;gap:7px}.chat-entry.user{justify-self:end}.chat-entry.user p{margin:0;padding:11px 14px;border-radius:13px 13px 3px;background:var(--blue);color:#fff;line-height:1.5;font-size:14px;white-space:pre-wrap}.chat-entry.user small{color:var(--faint);font-size:11px;text-align:right}.chat-entry.ceo{justify-self:start}.chat-stream{margin:0;padding:12px 14px;border:1px solid var(--line);border-radius:13px 13px 13px 3px;background:#fff;line-height:1.55;font-size:14px;white-space:pre-wrap}.chat-error{margin:0;color:var(--red);font-size:13px}.chat-activity{display:grid;gap:4px;padding:10px 14px;border:1px dashed var(--line);border-radius:9px;color:var(--muted);font-size:12px;font-family:ui-monospace,SF Mono,Menlo,monospace}.chat-activity span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-handoff{display:grid;gap:0;border:1px solid var(--line);border-radius:13px 13px 13px 3px;background:#fff;overflow:hidden}.chat-handoff section{padding:12px 16px}.chat-handoff section+section{border-top:1px solid var(--line)}.chat-handoff section.danger{background:#fdf2f1}.chat-handoff h3{margin:0 0 6px;color:var(--muted);font-size:11px;font-weight:620;text-transform:uppercase;letter-spacing:.07em}.chat-handoff p{margin:0 0 4px;line-height:1.5;font-size:14px}.chat-handoff small{display:block;padding:8px 16px;border-top:1px solid var(--line);color:var(--faint);font-size:11px}.chat-input-bar{display:grid;gap:8px;padding:14px 36px 20px;border-top:1px solid var(--line);background:#ffffff8c}.chat-input-bar textarea{min-height:72px;width:100%;padding:11px 13px;border:1px solid var(--line);border-radius:10px;background:#fff;resize:vertical;line-height:1.5}.chat-input-bar>div{display:flex;align-items:center;justify-content:space-between;gap:16px}.chat-input-bar span{color:var(--faint);font-size:12px}.attention-link{cursor:pointer;font:inherit;text-align:left}.approval-dialog{width:min(640px,calc(100vw - 40px));max-height:min(760px,calc(100vh - 60px));display:grid;gap:14px;overflow-y:auto}.approval-dialog>p{margin:0;color:var(--muted);font-size:14px}.approval-card{display:grid;gap:10px;padding:15px 16px;border:1px solid var(--line);border-radius:10px;background:#fff}.approval-card header{display:flex;align-items:center;justify-content:space-between;gap:12px}.approval-card header strong{font-size:15px}.approval-card dl{margin:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.approval-card dt{color:var(--faint);font-size:11px;text-transform:uppercase;letter-spacing:.06em}.approval-card dd{margin:2px 0 0;font-size:13px}.approval-reason{margin:0;padding:10px 12px;border-left:3px solid var(--blue-soft);background:#eef0ff80;border-radius:0 7px 7px 0;line-height:1.5;font-size:13px}.approval-card textarea{min-height:54px;padding:9px 11px;border:1px solid var(--line);border-radius:8px;resize:vertical;font-size:13px}.approval-card footer{display:flex;justify-content:flex-end;gap:10px}.approval-card .reject{height:44px;padding:0 16px;border:1px solid rgba(211,63,54,.4);border-radius:8px;background:#fff;color:var(--red);font-weight:560;cursor:pointer}
|
package/dist/inspect.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { type EventRecord, type JsonValue, type ReplayedSession, type WakeSnapshot } from "goah-ledger-contract";
|
|
2
|
-
import type { SqliteLedger } from "goah-ledger-sqlite";
|
|
3
|
-
export interface SessionListItem {
|
|
4
|
-
wakeId: string;
|
|
5
|
-
streamId: string;
|
|
6
|
-
agent: string;
|
|
7
|
-
wakeStatus: WakeSnapshot["status"];
|
|
8
|
-
sessionStatus: ReplayedSession["status"] | WakeSnapshot["status"];
|
|
9
|
-
triggerRef: string;
|
|
10
|
-
eventCount: number;
|
|
11
|
-
firstSeq: number | null;
|
|
12
|
-
lastSeq: number | null;
|
|
13
|
-
provider: string | null;
|
|
14
|
-
model: string | null;
|
|
15
|
-
formatVersion: number | null;
|
|
16
|
-
messageCount: number;
|
|
17
|
-
toolCalls: number;
|
|
18
|
-
compactions: number;
|
|
19
|
-
}
|
|
20
|
-
export interface SessionDetail {
|
|
21
|
-
session: SessionListItem;
|
|
22
|
-
eventTypes: Record<string, number>;
|
|
23
|
-
replay: {
|
|
24
|
-
status: ReplayedSession["status"];
|
|
25
|
-
messageCount: number;
|
|
26
|
-
openToolCalls: ReplayedSession["openToolCalls"];
|
|
27
|
-
};
|
|
28
|
-
requests: number;
|
|
29
|
-
activeContext: SessionContextSnapshot | null;
|
|
30
|
-
}
|
|
31
|
-
export interface SessionContextSnapshot {
|
|
32
|
-
eventSeq: number;
|
|
33
|
-
provider: string;
|
|
34
|
-
model: string;
|
|
35
|
-
systemPrompt: string;
|
|
36
|
-
text: string;
|
|
37
|
-
sourceSeqs: number[];
|
|
38
|
-
toolCount: number;
|
|
39
|
-
messageCount: number;
|
|
40
|
-
modelConfig: JsonValue;
|
|
41
|
-
}
|
|
42
|
-
export interface SessionExport {
|
|
43
|
-
format: "goah.session-export.v1";
|
|
44
|
-
exportedAt: string;
|
|
45
|
-
redacted: boolean;
|
|
46
|
-
session: SessionListItem;
|
|
47
|
-
context: SessionContextSnapshot | null;
|
|
48
|
-
replay: ReplayedSession;
|
|
49
|
-
events: EventRecord[];
|
|
50
|
-
}
|
|
51
|
-
export declare function listSessions(ledger: SqliteLedger): SessionListItem[];
|
|
52
|
-
export declare function showSession(ledger: SqliteLedger, wakeId: string): SessionDetail;
|
|
53
|
-
export declare function replayWakeSession(ledger: SqliteLedger, wakeId: string): ReplayedSession;
|
|
54
|
-
export declare function showSessionContext(ledger: SqliteLedger, wakeId: string): SessionContextSnapshot | null;
|
|
55
|
-
export declare function streamEvents(ledger: SqliteLedger, streamId: string, fromStreamSeq?: number): EventRecord[];
|
|
56
|
-
export declare function exportSession(ledger: SqliteLedger, wakeId: string, options?: {
|
|
57
|
-
raw?: boolean;
|
|
58
|
-
now?: string;
|
|
59
|
-
}): SessionExport;
|
|
60
|
-
export declare function redactValue(value: unknown, key?: string): unknown;
|
|
61
|
-
//# sourceMappingURL=inspect.d.ts.map
|
package/dist/inspect.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../src/inspect.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,KAAK,WAAW,EAAE,KAAK,S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os";
|
|
2
|
-
import { replaySession, wakeStream } from "goah-ledger-contract";
|
|
3
|
-
export function listSessions(ledger) {
|
|
4
|
-
return ledger.wakes().map((wake) => summarize(ledger, wake)).sort((a, b) => (b.lastSeq ?? 0) - (a.lastSeq ?? 0));
|
|
5
|
-
}
|
|
6
|
-
export function showSession(ledger, wakeId) {
|
|
7
|
-
const wake = requiredWake(ledger, wakeId);
|
|
8
|
-
const events = ledger.eventsForWake(wakeId);
|
|
9
|
-
const replay = replaySession(events);
|
|
10
|
-
const eventTypes = {};
|
|
11
|
-
for (const event of events)
|
|
12
|
-
eventTypes[event.type] = (eventTypes[event.type] ?? 0) + 1;
|
|
13
|
-
return {
|
|
14
|
-
session: summarize(ledger, wake),
|
|
15
|
-
eventTypes,
|
|
16
|
-
replay: { status: replay.status, messageCount: replay.messages.length, openToolCalls: replay.openToolCalls },
|
|
17
|
-
requests: eventTypes["request.prepared"] ?? 0,
|
|
18
|
-
activeContext: contextSnapshot(events),
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export function replayWakeSession(ledger, wakeId) {
|
|
22
|
-
requiredWake(ledger, wakeId);
|
|
23
|
-
return replaySession(ledger.eventsForWake(wakeId));
|
|
24
|
-
}
|
|
25
|
-
export function showSessionContext(ledger, wakeId) {
|
|
26
|
-
requiredWake(ledger, wakeId);
|
|
27
|
-
return contextSnapshot(ledger.eventsForWake(wakeId));
|
|
28
|
-
}
|
|
29
|
-
export function streamEvents(ledger, streamId, fromStreamSeq = 1) {
|
|
30
|
-
if (!streamId.trim())
|
|
31
|
-
throw new Error("--stream is required");
|
|
32
|
-
if (!Number.isInteger(fromStreamSeq) || fromStreamSeq < 1)
|
|
33
|
-
throw new Error("--from must be a positive integer");
|
|
34
|
-
return ledger.readStream(streamId, fromStreamSeq);
|
|
35
|
-
}
|
|
36
|
-
export function exportSession(ledger, wakeId, options = {}) {
|
|
37
|
-
const detail = showSession(ledger, wakeId);
|
|
38
|
-
const value = {
|
|
39
|
-
format: "goah.session-export.v1",
|
|
40
|
-
exportedAt: options.now ?? new Date().toISOString(),
|
|
41
|
-
redacted: !options.raw,
|
|
42
|
-
session: detail.session,
|
|
43
|
-
context: detail.activeContext,
|
|
44
|
-
replay: replaySession(ledger.eventsForWake(wakeId)),
|
|
45
|
-
events: ledger.eventsForWake(wakeId),
|
|
46
|
-
};
|
|
47
|
-
return options.raw ? value : redactValue(value);
|
|
48
|
-
}
|
|
49
|
-
export function redactValue(value, key = "") {
|
|
50
|
-
if (SENSITIVE_KEY.test(key))
|
|
51
|
-
return "[REDACTED]";
|
|
52
|
-
if (Array.isArray(value))
|
|
53
|
-
return value.map((item) => redactValue(item));
|
|
54
|
-
if (value && typeof value === "object")
|
|
55
|
-
return Object.fromEntries(Object.entries(value).map(([childKey, child]) => [childKey, redactValue(child, childKey)]));
|
|
56
|
-
if (typeof value !== "string")
|
|
57
|
-
return value;
|
|
58
|
-
return value
|
|
59
|
-
.replaceAll(homedir(), "<HOME>")
|
|
60
|
-
.replace(/\bBearer\s+[^\s"']+/gi, "Bearer [REDACTED]")
|
|
61
|
-
.replace(/\b(?:sk|ak|key)[-_][A-Za-z0-9_-]{12,}\b/gi, "[REDACTED]")
|
|
62
|
-
.replace(/((?:api[_-]?key|token|secret|password|authorization)\s*[=:]\s*)[^\s,;"']+/gi, "$1[REDACTED]");
|
|
63
|
-
}
|
|
64
|
-
function summarize(ledger, wake) {
|
|
65
|
-
const events = ledger.eventsForWake(wake.id);
|
|
66
|
-
const replay = replaySession(events);
|
|
67
|
-
const started = events.find((event) => event.type === "session.started")?.data;
|
|
68
|
-
return {
|
|
69
|
-
wakeId: wake.id,
|
|
70
|
-
streamId: wakeStream(wake.id),
|
|
71
|
-
agent: wake.agent,
|
|
72
|
-
wakeStatus: wake.status,
|
|
73
|
-
sessionStatus: replay.status === "running" && ["done", "abnormal", "merge_blocked"].includes(wake.status) ? wake.status : replay.status,
|
|
74
|
-
triggerRef: wake.triggerRef,
|
|
75
|
-
eventCount: events.length,
|
|
76
|
-
firstSeq: events[0]?.seq ?? null,
|
|
77
|
-
lastSeq: events.at(-1)?.seq ?? null,
|
|
78
|
-
provider: typeof started?.provider === "string" ? started.provider : null,
|
|
79
|
-
model: typeof started?.model === "string" ? started.model : null,
|
|
80
|
-
formatVersion: typeof started?.formatVersion === "number" ? started.formatVersion : started ? 0 : null,
|
|
81
|
-
messageCount: replay.messages.length,
|
|
82
|
-
toolCalls: events.filter((event) => event.type === "tool.called").length,
|
|
83
|
-
compactions: events.filter((event) => event.type === "context.compacted").length,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
function contextSnapshot(events) {
|
|
87
|
-
const event = events.findLast((candidate) => candidate.type === "request.prepared");
|
|
88
|
-
if (!event)
|
|
89
|
-
return null;
|
|
90
|
-
const request = event.data;
|
|
91
|
-
return {
|
|
92
|
-
eventSeq: event.seq,
|
|
93
|
-
provider: request.provider,
|
|
94
|
-
model: request.model,
|
|
95
|
-
systemPrompt: request.systemPrompt,
|
|
96
|
-
text: request.activeContext,
|
|
97
|
-
sourceSeqs: request.sourceSeqs,
|
|
98
|
-
toolCount: request.tools.length,
|
|
99
|
-
messageCount: request.messages.length,
|
|
100
|
-
modelConfig: request.modelConfig,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
function requiredWake(ledger, wakeId) {
|
|
104
|
-
const wake = ledger.wake(wakeId);
|
|
105
|
-
if (!wake)
|
|
106
|
-
throw new Error(`wake not found: ${wakeId}`);
|
|
107
|
-
return wake;
|
|
108
|
-
}
|
|
109
|
-
const SENSITIVE_KEY = /^(?:api[_-]?key|token|secret|password|authorization|cookie|set-cookie)$/i;
|
|
110
|
-
//# sourceMappingURL=inspect.js.map
|
package/dist/inspect.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.js","sourceRoot":"","sources":["../src/inspect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,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MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC,MAAM;KACjF,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,MAAqB;IAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,kBAAkB,CAAC,CAAC;IACpF,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,OAAO,GAAG,KAAK,CAAC,IAAkC,CAAC;IACzD,OAAO;QACL,QAAQ,EAAE,KAAK,CAAC,GAAG;QACnB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,IAAI,EAAE,OAAO,CAAC,aAAa;QAC3B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;QAC/B,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,MAAM;QACrC,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,MAAoB,EAAE,MAAc;IACxD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,aAAa,GAAG,0EAA0E,CAAC"}
|
package/dist/metrics.d.ts
DELETED
package/dist/metrics.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
package/dist/metrics.js
DELETED
package/dist/metrics.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
package/dist/session.d.ts
DELETED
package/dist/session.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
package/dist/session.js
DELETED
package/dist/session.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { JsonValue } from "./kernel.js";
|
|
2
|
-
/** Optional goal-measurement policy. It is not part of the Goal contract. */
|
|
3
|
-
export interface MetricContract {
|
|
4
|
-
source: string;
|
|
5
|
-
window: string;
|
|
6
|
-
direction: "increase" | "decrease" | "at_least" | "at_most";
|
|
7
|
-
target: number;
|
|
8
|
-
freshnessMs: number;
|
|
9
|
-
onMissing: "abnormal" | "wake_owner";
|
|
10
|
-
onStale: "abnormal" | "wake_owner";
|
|
11
|
-
sustainForMs?: number;
|
|
12
|
-
guardrails?: Array<{
|
|
13
|
-
metric: string;
|
|
14
|
-
direction: "at_least" | "at_most";
|
|
15
|
-
target: number;
|
|
16
|
-
}>;
|
|
17
|
-
}
|
|
18
|
-
export interface MetricSample {
|
|
19
|
-
goalId: string;
|
|
20
|
-
source: string;
|
|
21
|
-
observedAt: string;
|
|
22
|
-
value: number | null;
|
|
23
|
-
guardrails?: Record<string, number>;
|
|
24
|
-
}
|
|
25
|
-
export interface MetricEvaluation {
|
|
26
|
-
goalId: string;
|
|
27
|
-
status: "met" | "missed" | "missing" | "stale" | "guardrail_breached";
|
|
28
|
-
shouldWakeOwner: boolean;
|
|
29
|
-
evaluatedAt: string;
|
|
30
|
-
value: number | null;
|
|
31
|
-
}
|
|
32
|
-
export interface MetricProcessSpec {
|
|
33
|
-
command: string;
|
|
34
|
-
args: string[];
|
|
35
|
-
env?: Record<string, string>;
|
|
36
|
-
timeoutMs?: number;
|
|
37
|
-
}
|
|
38
|
-
export declare function evaluateMetric(metric: MetricContract, samples: MetricSample[], now: string): MetricEvaluation;
|
|
39
|
-
export declare function metricEventData(value: MetricSample | MetricEvaluation): JsonValue;
|
|
40
|
-
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,UAAU,GAAG,YAAY,CAAC;IACrC,OAAO,EAAE,UAAU,GAAG,YAAY,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,UAAU,GAAG,SAAS,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC3F;AAED,MAAM,WAAW,YAAY;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE;AAC/I,MAAM,WAAW,gBAAgB;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,oBAAoB,CAAC;IAAC,eAAe,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE;AAChM,MAAM,WAAW,iBAAiB;IAAG,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE;AAExH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAmB7G;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,gBAAgB,GAAG,SAAS,CAA0C"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export function evaluateMetric(metric, samples, now) {
|
|
2
|
-
const latest = samples.filter((sample) => sample.source === metric.source).sort((a, b) => b.observedAt.localeCompare(a.observedAt))[0];
|
|
3
|
-
if (!latest || latest.value === null)
|
|
4
|
-
return { goalId: latest?.goalId ?? "unknown", status: "missing", shouldWakeOwner: metric.onMissing === "wake_owner", evaluatedAt: now, value: null };
|
|
5
|
-
if (Date.parse(now) - Date.parse(latest.observedAt) > metric.freshnessMs)
|
|
6
|
-
return { goalId: latest.goalId, status: "stale", shouldWakeOwner: metric.onStale === "wake_owner", evaluatedAt: now, value: latest.value };
|
|
7
|
-
const guardrailBreached = (metric.guardrails ?? []).some((guardrail) => {
|
|
8
|
-
const value = latest.guardrails?.[guardrail.metric];
|
|
9
|
-
return value === undefined || (guardrail.direction === "at_least" ? value < guardrail.target : value > guardrail.target);
|
|
10
|
-
});
|
|
11
|
-
if (guardrailBreached)
|
|
12
|
-
return { goalId: latest.goalId, status: "guardrail_breached", shouldWakeOwner: true, evaluatedAt: now, value: latest.value };
|
|
13
|
-
const meets = (value) => metric.direction === "increase" || metric.direction === "at_least" ? value >= metric.target : value <= metric.target;
|
|
14
|
-
let met = meets(latest.value);
|
|
15
|
-
if (met && metric.sustainForMs) {
|
|
16
|
-
const cutoff = Date.parse(now) - metric.sustainForMs;
|
|
17
|
-
const ordered = samples.filter((sample) => sample.source === metric.source && sample.value !== null && Date.parse(sample.observedAt) <= Date.parse(now)).sort((a, b) => a.observedAt.localeCompare(b.observedAt));
|
|
18
|
-
const baseline = ordered.findLast((sample) => Date.parse(sample.observedAt) <= cutoff);
|
|
19
|
-
const sustained = ordered.filter((sample) => Date.parse(sample.observedAt) >= cutoff);
|
|
20
|
-
met = Boolean(baseline && meets(baseline.value) && sustained.every((sample) => meets(sample.value)));
|
|
21
|
-
}
|
|
22
|
-
return { goalId: latest.goalId, status: met ? "met" : "missed", shouldWakeOwner: !met, evaluatedAt: now, value: latest.value };
|
|
23
|
-
}
|
|
24
|
-
export function metricEventData(value) { return value; }
|
|
25
|
-
//# sourceMappingURL=metrics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,cAAc,CAAC,MAAsB,EAAE,OAAuB,EAAE,GAAW;IACzF,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvI,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI;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,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,eAAe,EAAE,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;AACjI,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAsC,IAAe,OAAO,KAA6B,CAAC,CAAC,CAAC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { EventInput, EventRecord, JsonValue } from "./kernel.js";
|
|
2
|
-
export declare const SESSION_FORMAT_VERSION = 1;
|
|
3
|
-
export declare const SESSION_MIN_READABLE_VERSION = 0;
|
|
4
|
-
export type SessionEventType = "session.started" | "request.prepared" | "turn.started" | "message.user" | "message.assistant.delta" | "message.assistant.completed" | "tool.called" | "tool.completed" | "context.compacted" | "turn.completed" | "session.completed" | "session.interrupted";
|
|
5
|
-
export interface SessionStarted {
|
|
6
|
-
formatVersion: typeof SESSION_FORMAT_VERSION;
|
|
7
|
-
provider: string;
|
|
8
|
-
model: string;
|
|
9
|
-
runner: string;
|
|
10
|
-
contextWindowTokens: number;
|
|
11
|
-
maxOutputTokensPerTurn: number;
|
|
12
|
-
}
|
|
13
|
-
export interface SessionMessage {
|
|
14
|
-
id: string;
|
|
15
|
-
role: "user" | "assistant" | "tool";
|
|
16
|
-
content: JsonValue;
|
|
17
|
-
toolCallId?: string;
|
|
18
|
-
usage?: JsonValue;
|
|
19
|
-
stopReason?: string;
|
|
20
|
-
errorMessage?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface RequestSnapshot {
|
|
23
|
-
provider: string;
|
|
24
|
-
model: string;
|
|
25
|
-
systemPrompt: string;
|
|
26
|
-
activeContext: string;
|
|
27
|
-
messages: JsonValue[];
|
|
28
|
-
tools: JsonValue[];
|
|
29
|
-
modelConfig: JsonValue;
|
|
30
|
-
sourceSeqs: number[];
|
|
31
|
-
}
|
|
32
|
-
export interface ReplayedSession {
|
|
33
|
-
messages: SessionMessage[];
|
|
34
|
-
status: "running" | "completed" | "interrupted";
|
|
35
|
-
openToolCalls: Array<{
|
|
36
|
-
callId: string;
|
|
37
|
-
name: string;
|
|
38
|
-
arguments: JsonValue;
|
|
39
|
-
}>;
|
|
40
|
-
lastRequest: RequestSnapshot | null;
|
|
41
|
-
}
|
|
42
|
-
export declare function isSessionEvent(event: Pick<EventRecord, "type">): event is EventRecord & {
|
|
43
|
-
type: SessionEventType;
|
|
44
|
-
};
|
|
45
|
-
export declare class SessionFormatUnsupportedError extends Error {
|
|
46
|
-
readonly foundVersion: number;
|
|
47
|
-
readonly supportedVersion: number;
|
|
48
|
-
constructor(foundVersion: number, supportedVersion?: number);
|
|
49
|
-
}
|
|
50
|
-
export declare class SessionEventUnsupportedError extends Error {
|
|
51
|
-
readonly eventType: string;
|
|
52
|
-
constructor(eventType: string);
|
|
53
|
-
}
|
|
54
|
-
export declare class SessionCorruptionError extends Error {
|
|
55
|
-
constructor(message: string);
|
|
56
|
-
}
|
|
57
|
-
/** Import supported legacy records without rewriting the append-only source log. */
|
|
58
|
-
export declare function upgradeSessionEvents(source: readonly EventRecord[]): EventRecord[];
|
|
59
|
-
/** Rebuild the model-visible transcript from canonical, normalized session events. */
|
|
60
|
-
export declare function replaySession(events: readonly EventRecord[]): ReplayedSession;
|
|
61
|
-
/** Synthetic facts that close an interrupted session without hiding unknown tool outcomes. */
|
|
62
|
-
export declare function interruptedSessionEvents(events: readonly EventRecord[], ts: string, actor: string): EventInput[];
|
|
63
|
-
//# sourceMappingURL=session.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEtE,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,4BA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QAAC,SAAS,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAAC,WAAW,EAAE,eAAe,GAAG,IAAI,CAAA;CAAE;AAGnO,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,KAAK,IAAI,WAAW,GAAG;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAA8D;AAEjL,qBAAa,6BAA8B,SAAQ,KAAK;IAC1C,QAAQ,CAAC,YAAY,EAAE,MAAM;IAAE,QAAQ,CAAC,gBAAgB;gBAA/C,YAAY,EAAE,MAAM,EAAW,gBAAgB,SAAyB;CAC9F;AACD,qBAAa,4BAA6B,SAAQ,KAAK;IAAe,QAAQ,CAAC,SAAS,EAAE,MAAM;gBAAjB,SAAS,EAAE,MAAM;CAA6H;AAC7N,qBAAa,sBAAuB,SAAQ,KAAK;gBAAe,OAAO,EAAE,MAAM;CAA6D;AAE5I,oFAAoF;AACpF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,GAAG,WAAW,EAAE,CAuBlF;AAED,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,GAAG,eAAe,CA2B7E;AAED,8FAA8F;AAC9F,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,EAAE,CAOhH"}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
export const SESSION_FORMAT_VERSION = 1;
|
|
2
|
-
export const SESSION_MIN_READABLE_VERSION = 0;
|
|
3
|
-
const SESSION_TYPES = new Set(["session.started", "request.prepared", "turn.started", "message.user", "message.assistant.delta", "message.assistant.completed", "tool.called", "tool.completed", "context.compacted", "turn.completed", "session.completed", "session.interrupted"]);
|
|
4
|
-
export function isSessionEvent(event) { return SESSION_TYPES.has(event.type); }
|
|
5
|
-
export class SessionFormatUnsupportedError extends Error {
|
|
6
|
-
foundVersion;
|
|
7
|
-
supportedVersion;
|
|
8
|
-
constructor(foundVersion, supportedVersion = SESSION_FORMAT_VERSION) {
|
|
9
|
-
super(`session format ${foundVersion} is unsupported by this harness (supports ${supportedVersion}); upgrade the harness`);
|
|
10
|
-
this.foundVersion = foundVersion;
|
|
11
|
-
this.supportedVersion = supportedVersion;
|
|
12
|
-
this.name = "SessionFormatUnsupportedError";
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export class SessionEventUnsupportedError extends Error {
|
|
16
|
-
eventType;
|
|
17
|
-
constructor(eventType) {
|
|
18
|
-
super(`required session event is unknown to this harness: ${eventType}`);
|
|
19
|
-
this.eventType = eventType;
|
|
20
|
-
this.name = "SessionEventUnsupportedError";
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export class SessionCorruptionError extends Error {
|
|
24
|
-
constructor(message) { super(message); this.name = "SessionCorruptionError"; }
|
|
25
|
-
}
|
|
26
|
-
/** Import supported legacy records without rewriting the append-only source log. */
|
|
27
|
-
export function upgradeSessionEvents(source) {
|
|
28
|
-
assertContiguous(source);
|
|
29
|
-
const starts = source.filter((event) => event.type === "session.started");
|
|
30
|
-
if (starts.length === 0) {
|
|
31
|
-
if (source.some((event) => isSessionNamespace(event.type)))
|
|
32
|
-
throw new SessionCorruptionError("session events exist without session.started");
|
|
33
|
-
return [...source];
|
|
34
|
-
}
|
|
35
|
-
if (starts.length !== 1)
|
|
36
|
-
throw new SessionCorruptionError("session stream contains multiple session.started events");
|
|
37
|
-
const rawVersion = field(starts[0].data, "formatVersion");
|
|
38
|
-
let version = rawVersion === undefined ? 0 : Number(rawVersion);
|
|
39
|
-
if (!Number.isSafeInteger(version) || version < SESSION_MIN_READABLE_VERSION)
|
|
40
|
-
throw new SessionCorruptionError(`invalid session format version: ${String(rawVersion)}`);
|
|
41
|
-
if (version > SESSION_FORMAT_VERSION)
|
|
42
|
-
throw new SessionFormatUnsupportedError(version);
|
|
43
|
-
let events = [...source];
|
|
44
|
-
while (version < SESSION_FORMAT_VERSION) {
|
|
45
|
-
if (version === 0) {
|
|
46
|
-
events = events.map((event) => event.type === "session.started" ? { ...event, data: { ...event.data, formatVersion: 1 } } : event);
|
|
47
|
-
version = 1;
|
|
48
|
-
}
|
|
49
|
-
else
|
|
50
|
-
throw new SessionFormatUnsupportedError(version);
|
|
51
|
-
}
|
|
52
|
-
for (const event of events) {
|
|
53
|
-
if (!isSessionEvent(event) && isSessionNamespace(event.type) && event.ignorable !== true)
|
|
54
|
-
throw new SessionEventUnsupportedError(event.type);
|
|
55
|
-
}
|
|
56
|
-
return events;
|
|
57
|
-
}
|
|
58
|
-
/** Rebuild the model-visible transcript from canonical, normalized session events. */
|
|
59
|
-
export function replaySession(events) {
|
|
60
|
-
const upgraded = upgradeSessionEvents(events);
|
|
61
|
-
const messages = [];
|
|
62
|
-
const calls = new Map();
|
|
63
|
-
let status = "running";
|
|
64
|
-
let lastRequest = null;
|
|
65
|
-
for (const event of upgraded) {
|
|
66
|
-
if (!isSessionEvent(event))
|
|
67
|
-
continue;
|
|
68
|
-
const data = event.data;
|
|
69
|
-
if (event.type === "message.user" || event.type === "message.assistant.completed")
|
|
70
|
-
messages.push(data.message);
|
|
71
|
-
else if (event.type === "tool.called") {
|
|
72
|
-
const call = { callId: String(data.callId), name: String(data.name), arguments: (data.arguments ?? null) };
|
|
73
|
-
calls.set(call.callId, call);
|
|
74
|
-
}
|
|
75
|
-
else if (event.type === "tool.completed") {
|
|
76
|
-
const callId = String(data.callId);
|
|
77
|
-
calls.delete(callId);
|
|
78
|
-
messages.push({ id: String(data.messageId ?? `tool:${callId}`), role: "tool", toolCallId: callId, content: (data.result ?? null) });
|
|
79
|
-
}
|
|
80
|
-
else if (event.type === "context.compacted") {
|
|
81
|
-
const replaced = new Set(Array.isArray(data.replacedMessageIds) ? data.replacedMessageIds.map(String) : []);
|
|
82
|
-
const kept = messages.filter((message) => !replaced.has(message.id));
|
|
83
|
-
messages.splice(0, messages.length, ...kept);
|
|
84
|
-
messages.unshift({ id: String(data.summaryMessageId), role: "user", content: String(data.summary) });
|
|
85
|
-
}
|
|
86
|
-
else if (event.type === "request.prepared")
|
|
87
|
-
lastRequest = event.data;
|
|
88
|
-
else if (event.type === "session.completed")
|
|
89
|
-
status = "completed";
|
|
90
|
-
else if (event.type === "session.interrupted")
|
|
91
|
-
status = "interrupted";
|
|
92
|
-
}
|
|
93
|
-
return { messages, status, openToolCalls: [...calls.values()], lastRequest };
|
|
94
|
-
}
|
|
95
|
-
/** Synthetic facts that close an interrupted session without hiding unknown tool outcomes. */
|
|
96
|
-
export function interruptedSessionEvents(events, ts, actor) {
|
|
97
|
-
const replayed = replaySession(events);
|
|
98
|
-
if (replayed.status !== "running" || !events.some((event) => event.type === "session.started"))
|
|
99
|
-
return [];
|
|
100
|
-
const streamId = events[0].streamId;
|
|
101
|
-
const repairs = replayed.openToolCalls.map((call) => ({ streamId, ts, actor, type: "tool.completed", data: { callId: call.callId, messageId: `repair:${call.callId}`, result: { outcome: "unknown", synthetic: true, reason: "runner interrupted before a durable result" } } }));
|
|
102
|
-
repairs.push({ streamId, ts, actor, type: "session.interrupted", data: { reason: "runner interrupted" } });
|
|
103
|
-
return repairs;
|
|
104
|
-
}
|
|
105
|
-
function assertContiguous(events) {
|
|
106
|
-
let expected = events[0]?.streamSeq ?? 1;
|
|
107
|
-
for (const event of events) {
|
|
108
|
-
if (event.streamSeq !== expected)
|
|
109
|
-
throw new SessionCorruptionError(`session stream gap: expected ${expected}, got ${event.streamSeq}`);
|
|
110
|
-
expected += 1;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function isSessionNamespace(type) { return ["session.", "request.", "turn.", "message.", "tool.", "context."].some((prefix) => type.startsWith(prefix)); }
|
|
114
|
-
function field(value, key) { return value && typeof value === "object" && !Array.isArray(value) ? value[key] : undefined; }
|
|
115
|
-
//# sourceMappingURL=session.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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E,4CAA4C,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAChS,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE,EAAE,CAAC,CAAC;IAC3G,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,gBAAgB,CAAC,MAA8B;IACtD,IAAI,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,IAAI,CAAC,CAAC;IACzC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,SAAS,KAAK,QAAQ;YAAE,MAAM,IAAI,sBAAsB,CAAC,gCAAgC,QAAQ,SAAS,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QACvI,QAAQ,IAAI,CAAC,CAAC;IAChB,CAAC;AACH,CAAC;AACD,SAAS,kBAAkB,CAAC,IAAY,IAAa,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3K,SAAS,KAAK,CAAC,KAAc,EAAE,GAAW,IAAa,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAiC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-connector-worker.d.ts","sourceRoot":"","sources":["../src/mock-connector-worker.ts"],"names":[],"mappings":""}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { createInterface } from "node:readline";
|
|
3
|
-
const statePath = process.env.GOAH_MOCK_CONNECTOR_STATE;
|
|
4
|
-
if (!statePath)
|
|
5
|
-
throw new Error("GOAH_MOCK_CONNECTOR_STATE is required");
|
|
6
|
-
const input = createInterface({ input: process.stdin });
|
|
7
|
-
for await (const line of input) {
|
|
8
|
-
const request = JSON.parse(line);
|
|
9
|
-
const state = JSON.parse(readFileSync(statePath, "utf8"));
|
|
10
|
-
if (request.operation === "dispatch") {
|
|
11
|
-
if (!state.dispatched.includes(request.action.id))
|
|
12
|
-
state.dispatched.push(request.action.id);
|
|
13
|
-
if (state.failAfterEffect) {
|
|
14
|
-
state.failAfterEffect = false;
|
|
15
|
-
writeFileSync(statePath, JSON.stringify(state));
|
|
16
|
-
process.stderr.write("injected connector crash after side effect\n");
|
|
17
|
-
process.exitCode = 1;
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
writeFileSync(statePath, JSON.stringify(state));
|
|
21
|
-
process.stdout.write(JSON.stringify({ status: "confirmed", externalRef: `mock:${request.action.id}` }));
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
process.stdout.write(JSON.stringify(state.dispatched.includes(request.action.id)
|
|
25
|
-
? { status: "confirmed", externalRef: `mock:${request.action.id}` }
|
|
26
|
-
: { status: "failed" }));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=mock-connector-worker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-connector-worker.js","sourceRoot":"","sources":["../src/mock-connector-worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC;AACxD,IAAI,CAAC,SAAS;IAAE,MAAM,IAAI,KAAK,CA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