@wrongstack/cli 0.313.0 → 0.316.1
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/{acp-LQMSMV32.js → acp-CEQINXWB.js} +2 -2
- package/dist/acp-registry-cache.d.ts +0 -2
- package/dist/acp-server-agent.d.ts +2 -1
- package/dist/arg-parser.d.ts +2 -1
- package/dist/{auth-VQMSZGKE.js → auth-GZ5A5OF5.js} +3 -3
- package/dist/auth-menu/local.d.ts +3 -2
- package/dist/boot/boot-auto-thin.d.ts +44 -0
- package/dist/boot/brain-decision-log.d.ts +2 -1
- package/dist/boot/config-backup-recovery.d.ts +2 -6
- package/dist/boot/dispatch-singleshot.d.ts +2 -1
- package/dist/boot/dispatch-webui.d.ts +5 -1
- package/dist/boot/event-wiring.d.ts +1 -1
- package/dist/boot/execution-mode.d.ts +2 -1
- package/dist/boot/governance-shadow-bridge.d.ts +4 -3
- package/dist/boot/governance-trace-context.d.ts +4 -4
- package/dist/boot/launch-menu.d.ts +2 -2
- package/dist/boot/system-prompt-builder.d.ts +1 -1
- package/dist/boot/system-prompt-menu.d.ts +10 -58
- package/dist/boot/system-prompt.d.ts +3 -3
- package/dist/boot/tool-registry.d.ts +3 -1
- package/dist/boot/tui-coordinator-callbacks.d.ts +2 -1
- package/dist/boot/tui-coordinator-setup.d.ts +3 -2
- package/dist/boot/tui-goal-wiring.d.ts +2 -1
- package/dist/boot/tui-live-sessions.d.ts +3 -1
- package/dist/boot/tui-session-resume.d.ts +82 -10
- package/dist/boot/tui-session-stub-enrich.d.ts +7 -1
- package/dist/boot/tui-settings-adapter.d.ts +3 -2
- package/dist/boot/tui-theme-adapter.d.ts +3 -2
- package/dist/boot/webui-session-child.d.ts +2 -12
- package/dist/boot-auto-thin-BZ675EVT.js +102 -0
- package/dist/boot-config.d.ts +1 -1
- package/dist/brain-menu/panel-service.d.ts +2 -1
- package/dist/chimera-cascade-evidence.d.ts +4 -21
- package/dist/chimera-review-task.d.ts +0 -7
- package/dist/chimera-subagent-ladder.d.ts +2 -2
- package/dist/{chunk-USYOJIV2.js → chunk-32MTOI2I.js} +2 -2
- package/dist/{chunk-CNQZ4HG4.js → chunk-37SPPLUD.js} +57 -8
- package/dist/chunk-ALE5KHCA.js +1 -0
- package/dist/{chunk-GWVLRUVH.js → chunk-G3IMKQRH.js} +25 -6
- package/dist/{chunk-BZJ4MP32.js → chunk-GKHUHAIK.js} +8 -3
- package/dist/{chunk-3JPTNADJ.js → chunk-GPPRNAKW.js} +1 -1
- package/dist/{chunk-KE7E7DPX.js → chunk-HXJYHAR4.js} +1 -1
- package/dist/{chunk-X3N5TS2S.js → chunk-JACOMTIH.js} +2 -76
- package/dist/{chunk-DGXNL7OT.js → chunk-JHUJUIOH.js} +1 -18
- package/dist/{chunk-WOTGMHAH.js → chunk-KG4X5F7Z.js} +1 -1
- package/dist/{chunk-NUIHRGPY.js → chunk-NV3JDK4F.js} +1 -1
- package/dist/{chunk-E3X4KM7T.js → chunk-NZZOYLQ7.js} +5 -10
- package/dist/{chunk-H6C7SO5H.js → chunk-QC5I4VWZ.js} +1 -1
- package/dist/chunk-SXJTVNWF.js +78 -0
- package/dist/{chunk-AOAIPYFB.js → chunk-SYIBTG3X.js} +2 -2
- package/dist/{chunk-PKHGLWUJ.js → chunk-T642Q732.js} +5 -4
- package/dist/{chunk-BGFM3PD7.js → chunk-UZ2TMHNH.js} +1 -1
- package/dist/{chunk-4S52MIIM.js → chunk-VXCCBI2W.js} +2 -2
- package/dist/{chunk-FKWHSFX4.js → chunk-XYKYXFEE.js} +1 -1
- package/dist/cli-entry-point.d.ts +9 -0
- package/dist/cli-eternal-flag.d.ts +1 -1
- package/dist/{cli-main-BFUSCWXE.js → cli-main-IEAM6SK7.js} +3692 -1619
- package/dist/cli-main-helpers.d.ts +3 -3
- package/dist/config-doctor.d.ts +34 -3
- package/dist/context-limit.d.ts +4 -3
- package/dist/{diag-doctor-OPTB2NWY.js → diag-doctor-LFCCBPMD.js} +3 -3
- package/dist/execute-deps.d.ts +36 -7
- package/dist/{execution-TOBPK6MD.js → execution-TZUGCKFU.js} +462 -78
- package/dist/execution-chimera-cascade.d.ts +1 -1
- package/dist/execution-chimera-review.d.ts +1 -1
- package/dist/execution-cleanup.d.ts +2 -1
- package/dist/execution-kanban-dispatch.d.ts +2 -1
- package/dist/execution-repl-fleet-callbacks.d.ts +3 -2
- package/dist/fleet/budget-source.d.ts +2 -1
- package/dist/fleet/host-context.d.ts +8 -1
- package/dist/fleet/host-director-event-bridges.d.ts +28 -3
- package/dist/fleet/host-event-bridge.d.ts +6 -1
- package/dist/fleet/host-explore-companion-registry.d.ts +60 -0
- package/dist/fleet/host-explore-companion.d.ts +7 -3
- package/dist/fleet/host-provider.d.ts +2 -1
- package/dist/fleet/host-session-writer.d.ts +9 -1
- package/dist/fleet/host-shadow-manager.d.ts +82 -20
- package/dist/fleet/host-shadow-pass.d.ts +9 -1
- package/dist/fleet/host-spawn-types.d.ts +9 -0
- package/dist/fleet/host-status.d.ts +2 -1
- package/dist/fleet/host-subagent-factory.d.ts +2 -1
- package/dist/fleet/host-subagent-session-audit.d.ts +56 -0
- package/dist/fleet/host-supervisor.d.ts +11 -1
- package/dist/fleet/host-task-result-report.d.ts +2 -1
- package/dist/fleet/host.d.ts +38 -6
- package/dist/fleet/status-broadcast.d.ts +2 -1
- package/dist/fleet-statusline.d.ts +2 -1
- package/dist/goal-host.d.ts +3 -2
- package/dist/{governance-V2Z42RBE.js → governance-JSGHHA2R.js} +1 -1
- package/dist/governance-hq-telemetry.d.ts +2 -2
- package/dist/{hq-2XIXGAER.js → hq-NDTJRRX3.js} +3 -3
- package/dist/hq-publisher.d.ts +1 -1
- package/dist/hq-recovery-html.d.ts +1 -6
- package/dist/hq-server/auth-state.d.ts +2 -1
- package/dist/hq-server/auth.d.ts +3 -2
- package/dist/hq-server/login-attempt-store.d.ts +2 -1
- package/dist/hq-server/mailbox-gateway-manager.d.ts +2 -1
- package/dist/hq-server/preflight.d.ts +3 -2
- package/dist/hq-server/server-lifecycle.d.ts +2 -1
- package/dist/hq-server/snapshot.d.ts +0 -9
- package/dist/hq-server/startup.d.ts +2 -3
- package/dist/hq-server/types.d.ts +2 -2
- package/dist/hq-server/upgrade-handler.d.ts +2 -1
- package/dist/hq-server/ws-leader.d.ts +0 -6
- package/dist/{hq-server-DBT3OOYD.js → hq-server-OH3SPSE2.js} +3 -13
- package/dist/hq-server.d.ts +1 -6
- package/dist/hq-static-serve.d.ts +2 -1
- package/dist/{hq-ttl-U2FAYFAT.js → hq-ttl-KUO3AU7X.js} +2 -2
- package/dist/{hq-tunnel-RFKGC4HI.js → hq-tunnel-LO55RCZE.js} +1 -1
- package/dist/hq-tunnel.d.ts +2 -1
- package/dist/index.js +113 -109
- package/dist/input-reader.d.ts +2 -1
- package/dist/kanban-dispatch-route.d.ts +27 -2
- package/dist/kanban-hq-sync.d.ts +2 -1
- package/dist/launch-hints.d.ts +2 -1
- package/dist/live-settings-input.d.ts +5 -0
- package/dist/mailbox-bridge-bootstrap.d.ts +2 -3
- package/dist/{mailbox-serve-5S3PHG5D.js → mailbox-serve-VKQIRCCB.js} +47 -28
- package/dist/{mcp-RRPKNRSN.js → mcp-AQKSASHD.js} +1 -1
- package/dist/mcp-serve.d.ts +2 -1
- package/dist/{modeldiag-H6DKWJ2N.js → modeldiag-4NYBRSFP.js} +1 -1
- package/dist/next-task-predictor.d.ts +3 -2
- package/dist/permission-prompt.d.ts +2 -1
- package/dist/picker.d.ts +0 -18
- package/dist/plugin-management.d.ts +3 -14
- package/dist/{plugin-usage-GCTYOZPH.js → plugin-usage-AP7SJCDA.js} +2 -2
- package/dist/{plugins-EEKHCMBE.js → plugins-HQ5FU2AM.js} +3 -5
- package/dist/preflight.d.ts +2 -1
- package/dist/{proxy-wiring-G26YGP7S.js → proxy-wiring-EQB5X5YH.js} +3 -3
- package/dist/renderer.d.ts +18 -1
- package/dist/repl-client-registration.d.ts +2 -1
- package/dist/repl.d.ts +1 -1
- package/dist/{replay-XU6ZD7GM.js → replay-FJ2JBXUA.js} +1 -1
- package/dist/{sdd-runtime-GFZ3NJKS.js → sdd-runtime-FLKCSTYV.js} +3 -5
- package/dist/services/commit-message.d.ts +2 -1
- package/dist/services/sdd/state.d.ts +0 -2
- package/dist/services/sdd-runtime.d.ts +1 -1
- package/dist/services/statusline-config.d.ts +27 -4
- package/dist/session-event-wiring.d.ts +3 -5
- package/dist/{sessions-config-7Q7QJBKJ.js → sessions-config-P2LK2L32.js} +5 -1
- package/dist/sessions-doctor-EXHAZSSE.js +146 -0
- package/dist/settings-menu.d.ts +2 -1
- package/dist/shutdown-cleanup.d.ts +3 -2
- package/dist/{simpleui-dist-33VO3QHF.js → simpleui-dist-JKNRCRRK.js} +1 -1
- package/dist/simpleui-dist.d.ts +3 -2
- package/dist/slash-commands/brain-council.d.ts +0 -4
- package/dist/slash-commands/brain-status.d.ts +0 -1
- package/dist/slash-commands/command-context.d.ts +16 -2
- package/dist/slash-commands/fix-classifier.d.ts +2 -1
- package/dist/slash-commands/kanban-agent-helpers.d.ts +2 -1
- package/dist/slash-commands/kanban-board-handlers.d.ts +2 -1
- package/dist/slash-commands/kanban-lifecycle-diagnostics.d.ts +2 -1
- package/dist/slash-commands/kanban-task-subcommands.d.ts +0 -1
- package/dist/slash-commands/memory-audience.d.ts +1 -10
- package/dist/slash-commands/memory-flags.d.ts +2 -1
- package/dist/slash-commands/sdd-command-helpers.d.ts +3 -2
- package/dist/slash-commands/sdd.d.ts +2 -2
- package/dist/slash-commands/settings-mutations.d.ts +0 -1
- package/dist/slash-commands/sidebar.d.ts +4 -0
- package/dist/slash-commands/statusline.d.ts +4 -4
- package/dist/slash-commands/telegram-pairing.d.ts +2 -2
- package/dist/slash-commands/telegram-setup.d.ts +2 -1
- package/dist/slash-commands/tier.d.ts +13 -0
- package/dist/subcommands/handlers/acp-connection-gate.d.ts +4 -3
- package/dist/subcommands/handlers/bench-run-help.d.ts +3 -8
- package/dist/subcommands/handlers/daemon-inventory.d.ts +3 -2
- package/dist/subcommands/handlers/governance.d.ts +2 -1
- package/dist/subcommands/handlers/model-smoke-test.d.ts +3 -2
- package/dist/subcommands/handlers/modeldiag-eval.d.ts +0 -4
- package/dist/subcommands/handlers/modeldiag-profiles.d.ts +1 -1
- package/dist/subcommands/handlers/models-add-help.d.ts +3 -8
- package/dist/subcommands/handlers/sessions-doctor.d.ts +3 -0
- package/dist/subcommands/handlers/update.d.ts +1 -1
- package/dist/terminal-format.d.ts +3 -2
- package/dist/tui-resource-menus.d.ts +2 -1
- package/dist/tuneup.d.ts +5 -5
- package/dist/{update-ZXNC6I6G.js → update-XKARO3CY.js} +3 -3
- package/dist/{update-check-WARHSVZA.js → update-check-LICQNYFK.js} +2 -2
- package/dist/update-check.d.ts +1 -1
- package/dist/utils/hq-ttl.d.ts +2 -1
- package/dist/webui-server/connection-handler.d.ts +34 -2
- package/dist/webui-server/prefs-seeding.d.ts +11 -1
- package/dist/webui-server/route-contexts.d.ts +45 -5
- package/dist/webui-server/session-start-payload.d.ts +13 -0
- package/dist/webui-server/setup-events.d.ts +14 -1
- package/dist/{webui-server-I53IYBW4.js → webui-server-LZOEH7O6.js} +374 -169
- package/dist/webui-server-options.d.ts +30 -4
- package/dist/wiring/brain-and-orchestration.d.ts +3 -3
- package/dist/wiring/cli-execute-builder.d.ts +3 -0
- package/dist/wiring/cli-heap-watchdog.d.ts +2 -1
- package/dist/wiring/cli-prompt-and-tools-setup.d.ts +10 -8
- package/dist/wiring/codebase-index.d.ts +2 -1
- package/dist/wiring/command-host-state.d.ts +61 -5
- package/dist/wiring/controllers.d.ts +3 -4
- package/dist/wiring/dep-watcher-bridge.d.ts +3 -2
- package/dist/wiring/dep-watcher.d.ts +2 -1
- package/dist/wiring/design-studio.d.ts +2 -1
- package/dist/wiring/director-setup.d.ts +3 -2
- package/dist/wiring/domain-terms-mirror.d.ts +2 -1
- package/dist/wiring/external-plugins.d.ts +3 -2
- package/dist/wiring/fleet-command-handlers.d.ts +2 -2
- package/dist/wiring/heap-watchdog-setup.d.ts +2 -1
- package/dist/wiring/hq-telemetry.d.ts +3 -2
- package/dist/wiring/lifecycle-plugins.d.ts +2 -2
- package/dist/wiring/management-tools.d.ts +30 -2
- package/dist/wiring/metrics.d.ts +2 -2
- package/dist/wiring/plugins.d.ts +0 -1
- package/dist/wiring/prompt-journal-recorder.d.ts +1 -1
- package/dist/wiring/provider-runtime-setup.d.ts +9 -2
- package/dist/wiring/provider-runtime.d.ts +23 -3
- package/dist/wiring/provider-status.d.ts +2 -1
- package/dist/wiring/provider-utility-tools.d.ts +2 -1
- package/dist/wiring/provider.d.ts +2 -1
- package/dist/wiring/replay-governance-setup.d.ts +2 -1
- package/dist/wiring/replay.d.ts +2 -1
- package/dist/wiring/resume-candidate.d.ts +27 -0
- package/dist/wiring/runtime-controller-deps.d.ts +8 -1
- package/dist/wiring/runtime-dispatch-state.d.ts +2 -1
- package/dist/wiring/runtime-lifecycle-deps.d.ts +2 -1
- package/dist/wiring/runtime-picker-deps.d.ts +2 -1
- package/dist/wiring/session-command-handlers.d.ts +2 -2
- package/dist/wiring/session-establishment.d.ts +2 -1
- package/dist/wiring/session-registry.d.ts +3 -2
- package/dist/wiring/session-runtime.d.ts +1 -1
- package/dist/wiring/slash-commands.d.ts +5 -4
- package/dist/wiring/teardown-registrar.d.ts +3 -2
- package/dist/wiring/vector-memory-setup.d.ts +3 -2
- package/dist/wiring/wrongtrace-hooks.d.ts +1 -1
- package/dist/wiring/wrongtrace-telemetry.d.ts +2 -1
- package/dist/{wrongtrace-telemetry-6M2CCBX5.js → wrongtrace-telemetry-FNLANZ5I.js} +1 -1
- package/package.json +30 -30
- package/dist/auth-menu.d.ts +0 -7
- package/dist/chunk-WHOIR577.js +0 -1
- package/dist/webui-server/terminal-log-view.d.ts +0 -47
- package/dist/wiring/tools.d.ts +0 -29
|
@@ -5,7 +5,18 @@ import type { WebSocket } from 'ws';
|
|
|
5
5
|
import type { WSClientMessage, WSServerMessage } from './contracts.js';
|
|
6
6
|
export interface ConnectedClient {
|
|
7
7
|
ws: WebSocket;
|
|
8
|
+
/** The session this connection last acted on. */
|
|
8
9
|
sessionId: string | null;
|
|
10
|
+
/**
|
|
11
|
+
* EVERY session this connection is displaying, as declared by
|
|
12
|
+
* `session.subscribe`.
|
|
13
|
+
*
|
|
14
|
+
* One browser page holds up to four tabs on ONE socket, so `sessionId` is
|
|
15
|
+
* only the tab last touched. Anything that asks "is this session still on
|
|
16
|
+
* someone's screen" — the delete guard, per-tab agent eviction — needs the
|
|
17
|
+
* whole set, or it treats three open tabs as abandoned.
|
|
18
|
+
*/
|
|
19
|
+
sessionIds?: Set<string> | undefined;
|
|
9
20
|
}
|
|
10
21
|
export interface ConnectionHandlerDeps {
|
|
11
22
|
host: string;
|
|
@@ -27,7 +38,6 @@ export interface ConnectionHandlerDeps {
|
|
|
27
38
|
sessionId: string;
|
|
28
39
|
};
|
|
29
40
|
handleMessage: (ws: WebSocket, client: ConnectedClient, msg: WSClientMessage) => Promise<void>;
|
|
30
|
-
abortControllers: Map<string, AbortController>;
|
|
31
41
|
pendingConfirms: Map<string, PendingConfirm>;
|
|
32
42
|
buildSessionStartPayload: (overrides?: Record<string, unknown>, needsSetup?: boolean) => Promise<Record<string, unknown>>;
|
|
33
43
|
loadReplay?: (() => Promise<{
|
|
@@ -35,7 +45,29 @@ export interface ConnectionHandlerDeps {
|
|
|
35
45
|
events?: readonly SessionEvent[] | undefined;
|
|
36
46
|
usage?: Usage | undefined;
|
|
37
47
|
} | null>) | undefined;
|
|
38
|
-
|
|
48
|
+
/**
|
|
49
|
+
* The sessions this RUNTIME currently holds open — the boot session plus any
|
|
50
|
+
* tab the registry is still keeping alive.
|
|
51
|
+
*
|
|
52
|
+
* The browser persists its tab strip in `localStorage`, and on every open it
|
|
53
|
+
* promoted that list back into live tabs. After the server had restarted
|
|
54
|
+
* that list is history: none of those ids belong to this process, so a fresh
|
|
55
|
+
* `wstack --webui` came up wearing the tab strip of some previous run,
|
|
56
|
+
* fronted a session from days ago, and paid for a FULL journal resume (with
|
|
57
|
+
* its todo board) before the user had typed anything. Handing the client the
|
|
58
|
+
* live set lets it keep only the tabs that still exist and start clean
|
|
59
|
+
* otherwise.
|
|
60
|
+
*/
|
|
61
|
+
openSessionIds?: (() => string[]) | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Read back NAMED subagents' transcripts.
|
|
64
|
+
*
|
|
65
|
+
* `subagentIds` comes from the session's OWN journal, because the
|
|
66
|
+
* transcripts directory is shared by every session of the project: asked for
|
|
67
|
+
* everything, this handed each of four open tabs the union of all four tabs'
|
|
68
|
+
* workers.
|
|
69
|
+
*/
|
|
70
|
+
loadAgentSessions?: ((subagentIds: readonly string[]) => Promise<import('@wrongstack/core/coordination').AgentVirtualSession[]>) | undefined;
|
|
39
71
|
needsSetup: boolean;
|
|
40
72
|
}
|
|
41
73
|
export declare function createConnectionHandler(deps: ConnectionHandlerDeps): (ws: WebSocket, req: IncomingMessage) => Promise<void>;
|
|
@@ -17,6 +17,7 @@ interface CliWebUIOptions {
|
|
|
17
17
|
modelAvailabilitySchedule?: ModelBlackoutRule[] | undefined;
|
|
18
18
|
fallbackAuto?: boolean | undefined;
|
|
19
19
|
modelMatrix?: Config['modelMatrix'] | undefined;
|
|
20
|
+
modelTiers?: Config['modelTiers'] | undefined;
|
|
20
21
|
uiLocale?: string | undefined;
|
|
21
22
|
/** WrongProxy / WrongTrace toggle. */
|
|
22
23
|
wrongProxyEnabled?: boolean | undefined;
|
|
@@ -28,7 +29,16 @@ type PrefSnapshot = Record<string, unknown>;
|
|
|
28
29
|
export { PREF_KEYS };
|
|
29
30
|
export declare function seedConfigToMeta(opts: CliWebUIOptions): Promise<void>;
|
|
30
31
|
export interface PrefsSeeding {
|
|
31
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The preference snapshot for one tab.
|
|
34
|
+
*
|
|
35
|
+
* Session-scoped preferences (autonomy, yolo, context strategy, reasoning,
|
|
36
|
+
* the identity variant…) live on each session's OWN context meta, so a
|
|
37
|
+
* snapshot built from the leader's meta describes whichever conversation
|
|
38
|
+
* the leader happens to hold — not the tab that asked. Pass the meta of the
|
|
39
|
+
* asking session; omit it for a single-session host.
|
|
40
|
+
*/
|
|
41
|
+
prefSnapshot: (meta?: Record<string, unknown> | undefined) => PrefSnapshot;
|
|
32
42
|
persistPrefs: (payload: PrefSnapshot) => Promise<void>;
|
|
33
43
|
}
|
|
34
44
|
export declare function createPrefsSeeding(opts: CliWebUIOptions): PrefsSeeding;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module webui-server/route-contexts
|
|
5
5
|
*/
|
|
6
|
+
import type { Agent } from '@wrongstack/core/agent';
|
|
7
|
+
import type { SessionWriter } from '@wrongstack/core/types';
|
|
6
8
|
import { type BrainHandlerContext, type CustomModeStore, type DesignContext, type EmbeddedAgentConfigContext, type EmbeddedConversationContext, type EmbeddedProjectContext, type EmbeddedSessionContext, type IntrospectionRouteContext, type PendingConfirm, type PrefsHandlerContext, type PromptsContext, type SkillsContext } from '@wrongstack/webui-server';
|
|
7
9
|
import type { WebSocket } from 'ws';
|
|
8
10
|
import type { CliWebUIOptions } from '../webui-server-options.js';
|
|
@@ -16,25 +18,63 @@ export interface RouteContextsParams {
|
|
|
16
18
|
currentSessionId: () => string;
|
|
17
19
|
getCustomModeStore: () => Promise<CustomModeStore>;
|
|
18
20
|
buildSessionStartPayload: (overrides?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
19
|
-
|
|
21
|
+
/** Preference snapshot for one tab's meta; the leader's when none is named. */
|
|
22
|
+
prefSnapshot: (meta?: Record<string, unknown> | undefined) => Record<string, unknown>;
|
|
20
23
|
persistPrefs: (patch: Record<string, unknown>) => Promise<void>;
|
|
21
24
|
pendingConfirms: Map<string, PendingConfirm>;
|
|
22
25
|
abortControllers: Map<string, AbortController>;
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
/**
|
|
27
|
+
* The Agent that owns one session's runs — one per open tab.
|
|
28
|
+
*
|
|
29
|
+
* Handing every tab the single leader Agent is what made a second tab answer
|
|
30
|
+
* with "Agent.run() is already in progress on this instance": the guard is
|
|
31
|
+
* right, one instance for four tabs was not.
|
|
32
|
+
*/
|
|
33
|
+
getSessionAgent: (sessionId?: string | undefined) => Agent;
|
|
34
|
+
/**
|
|
35
|
+
* Non-creating registry peek. Feeds the embedded host's `hasSession`
|
|
36
|
+
* ownership check so asking "can this host serve session X?" never
|
|
37
|
+
* materializes an agent (the creating `getSessionAgent` did).
|
|
38
|
+
*/
|
|
39
|
+
peekSessionAgent?: (sessionId?: string | undefined) => Agent | undefined;
|
|
40
|
+
/** Does the host already hold an open writer for that session? */
|
|
41
|
+
isSessionLive: (sessionId: string) => boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The host's foreground-session pointer. Kept OUT of the leader agent's
|
|
44
|
+
* context: that context is the boot tab's runtime, and using it as the
|
|
45
|
+
* pointer made every resume re-point the boot tab.
|
|
46
|
+
*/
|
|
47
|
+
getForegroundSession: () => SessionWriter;
|
|
48
|
+
setForegroundSession: (next: SessionWriter) => void;
|
|
49
|
+
/** Live connections, so `session.subscribe` has somewhere to land. */
|
|
50
|
+
clients: Map<WebSocket, {
|
|
51
|
+
sessionId: string | null;
|
|
52
|
+
sessionIds?: Set<string> | undefined;
|
|
53
|
+
}>;
|
|
54
|
+
/** Retire the per-tab agents of sessions nobody is displaying any more. */
|
|
55
|
+
onSessionsUndisplayed: (sessionIds: string[]) => void;
|
|
56
|
+
/** Stop the subagents one session spawned, when that session is aborted. */
|
|
57
|
+
stopSessionFleet?: ((sessionId: string) => void | Promise<void>) | undefined;
|
|
25
58
|
send: (ws: WebSocket, msg: WSServerMessage) => void;
|
|
26
59
|
broadcast: (msg: WSServerMessage) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Bypasses the session filter `broadcast` applies. Only the project switch
|
|
62
|
+
* uses it: that frame names a session created moments earlier, so no
|
|
63
|
+
* connection can be subscribed to it yet.
|
|
64
|
+
*/
|
|
65
|
+
broadcastEveryone?: ((msg: WSServerMessage) => void) | undefined;
|
|
27
66
|
}
|
|
28
|
-
export declare function createWebuiRouteContexts({ opts, profileConfigPath, profileDir, globalRoot, sessionStartedAt, currentSessionId, getCustomModeStore, buildSessionStartPayload, prefSnapshot, persistPrefs, pendingConfirms, abortControllers,
|
|
67
|
+
export declare function createWebuiRouteContexts({ opts, profileConfigPath, profileDir, globalRoot, sessionStartedAt, currentSessionId, getCustomModeStore, buildSessionStartPayload, prefSnapshot, persistPrefs, pendingConfirms, abortControllers, getSessionAgent, peekSessionAgent, isSessionLive, getForegroundSession, setForegroundSession, clients, onSessionsUndisplayed, stopSessionFleet, send, broadcast, broadcastEveryone, }: RouteContextsParams): {
|
|
29
68
|
brainCtx: BrainHandlerContext;
|
|
30
69
|
introspectionCtx: IntrospectionRouteContext;
|
|
31
70
|
skillsCtx: SkillsContext;
|
|
32
71
|
promptsCtx: PromptsContext;
|
|
33
|
-
designCtx: DesignContext;
|
|
72
|
+
designCtx: (sessionId?: string | undefined) => DesignContext;
|
|
34
73
|
agentConfigCtx: EmbeddedAgentConfigContext;
|
|
35
74
|
prefsCtx: PrefsHandlerContext;
|
|
36
75
|
projectsCtx: EmbeddedProjectContext;
|
|
37
76
|
mailboxRoutes: import("@wrongstack/webui-server").MailboxRouteHandlers;
|
|
77
|
+
chimeraRoutes: import("@wrongstack/webui-server").ChimeraRouteHandlers;
|
|
38
78
|
sessionsCtx: EmbeddedSessionContext;
|
|
39
79
|
connectionCtx: EmbeddedConversationContext;
|
|
40
80
|
};
|
|
@@ -11,6 +11,19 @@ export interface SessionStartPayloadDeps {
|
|
|
11
11
|
session: {
|
|
12
12
|
id: string;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* The Context of ONE session, without creating it.
|
|
16
|
+
*
|
|
17
|
+
* `session.start` is sent for a named session — a resume, a background tab's
|
|
18
|
+
* announce, a model switch in a tab that is not in front — and everything in
|
|
19
|
+
* the payload (model, provider, context mode, window size, cost rates, the
|
|
20
|
+
* context-fill estimate) is a property of THAT session, not of whichever
|
|
21
|
+
* session the leader agent happens to point at. Reading the leader is how a
|
|
22
|
+
* background tab ended up displaying the foreground tab's model and billing
|
|
23
|
+
* its tokens at the foreground tab's rates. Falls back to the leader when
|
|
24
|
+
* the id is unknown, which is exactly the single-session host.
|
|
25
|
+
*/
|
|
26
|
+
getSessionContext?: ((sessionId: string) => Context | undefined) | undefined;
|
|
14
27
|
modelsRegistry?: ModelsRegistry | undefined;
|
|
15
28
|
statusTracker?: import('@wrongstack/core/coordination').ProviderModelStatusTracker | undefined;
|
|
16
29
|
modeId?: string | undefined;
|
|
@@ -9,11 +9,24 @@ export interface SetupEventsDeps {
|
|
|
9
9
|
agent: {
|
|
10
10
|
ctx: Context;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* The Context of a NAMED session, without creating one.
|
|
14
|
+
*
|
|
15
|
+
* Event payloads describe the session that produced them, and the iteration
|
|
16
|
+
* ceiling they carry is a per-tab setting — read off the leader it told a
|
|
17
|
+
* background tab it was capped at a number the user set in another tab.
|
|
18
|
+
*/
|
|
19
|
+
sessionContext?: ((sessionId: string) => Context | undefined) | undefined;
|
|
12
20
|
subscribeEternalIteration?: ((fn: (entry: JournalEntry) => void) => () => void) | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* `targetSessionId` names the tab a frame belongs to when the payload's own
|
|
23
|
+
* `sessionId` is somebody else's (a subagent's). Optional so single-session
|
|
24
|
+
* embedders can keep passing a one-argument broadcaster.
|
|
25
|
+
*/
|
|
13
26
|
broadcast: (msg: {
|
|
14
27
|
type: string;
|
|
15
28
|
payload: unknown;
|
|
16
|
-
}) => void;
|
|
29
|
+
}, targetSessionId?: string) => void;
|
|
17
30
|
sessionPayload: <T extends Record<string, unknown>>(payload: T) => T & {
|
|
18
31
|
sessionId: string;
|
|
19
32
|
};
|