@wrongstack/webui-server 0.285.0 → 0.287.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/index.js +1538 -508
- package/dist/index.js.map +4 -4
- package/dist/server/autophase-ws-handler.d.ts +17 -1
- package/dist/server/autophase-ws-handler.d.ts.map +1 -1
- package/dist/server/backend-services.d.ts +12 -23
- package/dist/server/backend-services.d.ts.map +1 -1
- package/dist/server/brain-routes.d.ts +2 -0
- package/dist/server/brain-routes.d.ts.map +1 -1
- package/dist/server/collaboration-ws-handler.d.ts +27 -19
- package/dist/server/collaboration-ws-handler.d.ts.map +1 -1
- package/dist/server/context-meta.d.ts.map +1 -1
- package/dist/server/entry.js +1513 -506
- package/dist/server/entry.js.map +4 -4
- package/dist/server/handlers.js.map +2 -2
- package/dist/server/http-server.d.ts.map +1 -1
- package/dist/server/index.d.ts +6 -5
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/instance-registry.d.ts +3 -1
- package/dist/server/instance-registry.d.ts.map +1 -1
- package/dist/server/kanban-routes.d.ts +3 -0
- package/dist/server/kanban-routes.d.ts.map +1 -1
- package/dist/server/mailbox-handlers.d.ts +12 -0
- package/dist/server/mailbox-handlers.d.ts.map +1 -1
- package/dist/server/mailbox-routes.d.ts +1 -0
- package/dist/server/mailbox-routes.d.ts.map +1 -1
- package/dist/server/mcp-handlers.d.ts +10 -1
- package/dist/server/mcp-handlers.d.ts.map +1 -1
- package/dist/server/mcp-routes.d.ts +4 -0
- package/dist/server/mcp-routes.d.ts.map +1 -1
- package/dist/server/memory-handlers.d.ts +41 -9
- package/dist/server/memory-handlers.d.ts.map +1 -1
- package/dist/server/message-dispatcher.d.ts.map +1 -1
- package/dist/server/mode-handlers.d.ts.map +1 -1
- package/dist/server/port-utils.d.ts +48 -10
- package/dist/server/port-utils.d.ts.map +1 -1
- package/dist/server/pre-context-services.d.ts +3 -1
- package/dist/server/pre-context-services.d.ts.map +1 -1
- package/dist/server/pref-helpers.d.ts +1 -1
- package/dist/server/pref-helpers.d.ts.map +1 -1
- package/dist/server/provider-handlers.d.ts +13 -0
- package/dist/server/provider-handlers.d.ts.map +1 -1
- package/dist/server/provider-routes.d.ts +2 -0
- package/dist/server/provider-routes.d.ts.map +1 -1
- package/dist/server/routes.d.ts +23 -20
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/sdd-wizard-wiring.d.ts +31 -1
- package/dist/server/sdd-wizard-wiring.d.ts.map +1 -1
- package/dist/server/server-runtime.d.ts +1 -0
- package/dist/server/server-runtime.d.ts.map +1 -1
- package/dist/server/session-handlers.d.ts +17 -4
- package/dist/server/session-handlers.d.ts.map +1 -1
- package/dist/server/session-history.d.ts +29 -0
- package/dist/server/session-history.d.ts.map +1 -0
- package/dist/server/setup-events.d.ts +1 -1
- package/dist/server/setup-events.d.ts.map +1 -1
- package/dist/server/standalone-session-identity.d.ts +35 -0
- package/dist/server/standalone-session-identity.d.ts.map +1 -0
- package/dist/server/start-webui.d.ts.map +1 -1
- package/dist/server/ws-payload-validation.d.ts +4 -0
- package/dist/server/ws-payload-validation.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -22,6 +22,14 @@ export declare class AutoPhaseWebSocketHandler {
|
|
|
22
22
|
private logger;
|
|
23
23
|
private events?;
|
|
24
24
|
private projectRoot?;
|
|
25
|
+
/**
|
|
26
|
+
* Optional tap invoked on every board-state broadcast with the live
|
|
27
|
+
* `buildState()` projection. Lets a KanbanRunMirror project the AutoPhase
|
|
28
|
+
* run into a kanban board without this handler knowing about kanban. The
|
|
29
|
+
* WebUI orchestrator does NOT emit PhaseEventMap on the shared bus, so this
|
|
30
|
+
* callback is the mirror's only live signal for AutoPhase.
|
|
31
|
+
*/
|
|
32
|
+
private onBoardState?;
|
|
25
33
|
private orchestrator;
|
|
26
34
|
private graph;
|
|
27
35
|
private store;
|
|
@@ -40,7 +48,15 @@ export declare class AutoPhaseWebSocketHandler {
|
|
|
40
48
|
private runBase;
|
|
41
49
|
/** Per-run worker identities so the board can show "who is on what". */
|
|
42
50
|
private usedNicknames;
|
|
43
|
-
constructor(agent: Agent, context: Context, logger: Logger, storeDir: string, events?: EventBus | undefined, projectRoot?: string | undefined
|
|
51
|
+
constructor(agent: Agent, context: Context, logger: Logger, storeDir: string, events?: EventBus | undefined, projectRoot?: string | undefined,
|
|
52
|
+
/**
|
|
53
|
+
* Optional tap invoked on every board-state broadcast with the live
|
|
54
|
+
* `buildState()` projection. Lets a KanbanRunMirror project the AutoPhase
|
|
55
|
+
* run into a kanban board without this handler knowing about kanban. The
|
|
56
|
+
* WebUI orchestrator does NOT emit PhaseEventMap on the shared bus, so this
|
|
57
|
+
* callback is the mirror's only live signal for AutoPhase.
|
|
58
|
+
*/
|
|
59
|
+
onBoardState?: ((graphId: string, state: Record<string, unknown>) => void) | undefined);
|
|
44
60
|
addClient(ws: WebSocket): void;
|
|
45
61
|
handleMessage(msg: AutoPhaseWSMessage): Promise<void>;
|
|
46
62
|
private handleStart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autophase-ws-handler.d.ts","sourceRoot":"","sources":["../../src/server/autophase-ws-handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAYpC,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAoDzE,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,yBAAyB;IAqBlC,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;IAEd,OAAO,CAAC,MAAM,CAAC;IACf,OAAO,CAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"autophase-ws-handler.d.ts","s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AM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,EAG/F;IAED,SAAS,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAS7B;IAEK,aAAa,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyG1D;YAEa,WAAW;IAwIzB;;;;;OAKG;YACW,UAAU;IASxB;;;;OAIG;YACW,WAAW;IAYzB;;;;;OAKG;YACW,YAAY;IAsB1B,4EAA4E;IAC5E,OAAO,CAAC,aAAa;IAUrB;;;4BAGwB;YACV,UAAU;YA2BV,oBAAoB;IA+BlC,+DAA+D;IAC/D,OAAO,CAAC,kBAAkB;YAKZ,sBAAsB;IAcpC,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,UAAU;IAqGlB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,IAAI;CAKb"}
|
|
@@ -1,30 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Post-context backend service construction for the standalone WebUI server.
|
|
3
|
-
*
|
|
4
|
-
* Phase 1c of the god-module split (issue: God-modules >1500 lines).
|
|
5
|
-
* `startWebUI` previously inlined ~400 lines of construction that runs
|
|
6
|
-
* AFTER `context` exists: the agent pipelines + collab middleware, the
|
|
7
|
-
* strategy compactor + auto-compaction middleware, the tool executor +
|
|
8
|
-
* agent, the tiered Brain + monitor, and the per-feature WebSocket
|
|
9
|
-
* handlers (AutoPhase, specs, SDD board/wizard, worktree, terminal, collab).
|
|
10
|
-
*
|
|
11
|
-
* All of that moves into `createAgentServices()`. The pre-context
|
|
12
|
-
* registries/stores (modelsRegistry, container, toolRegistry, session,
|
|
13
|
-
* tokenCounter, …) stay in `startWebUI` because they are interleaved with
|
|
14
|
-
* the `opts.services?` injection contract the CLI's embedded server
|
|
15
|
-
* relies on; lifting them would restructure that contract, which is a
|
|
16
|
-
* separate, higher-risk task.
|
|
17
|
-
*
|
|
18
|
-
* The factory is pure construction — no behaviour change. It returns a
|
|
19
|
-
* typed `AgentServices` object plus the `updateAutoCompactionMaxContext`
|
|
20
|
-
* closure (which needs the live `context`, `autoCompactor`, and
|
|
21
|
-
* `modelCapabilitiesRef` it just built).
|
|
22
|
-
*/
|
|
23
1
|
import type { AutoCompactionMiddleware, BrainAutoRisk, CollaborationBus, Compactor, Context, MemoryStore, DefaultModeStore, EventBus, Logger, ModelsRegistry, ObservableBrainArbiter, PermissionPolicy, Provider, ProviderRegistry, SessionStore, SkillInstaller, SkillLoader, ToolRegistry, AgentPipelines, Container, SessionReader } from '@wrongstack/core';
|
|
24
2
|
import type { DefaultTokenCounter } from '@wrongstack/core/infrastructure';
|
|
25
3
|
/** Session shape returned by `SessionStore.create()`. */
|
|
26
4
|
type Session = Awaited<ReturnType<SessionStore['create']>>;
|
|
27
|
-
import { Agent, BrainMonitor, ToolExecutor, type AnnotationsStore } from '@wrongstack/core';
|
|
5
|
+
import { Agent, BrainMonitor, BrainDecisionLedger, type BrainRuntime, ToolExecutor, type AnnotationsStore } from '@wrongstack/core';
|
|
28
6
|
import type { MCPRegistry } from '@wrongstack/mcp';
|
|
29
7
|
import { AutoPhaseWebSocketHandler } from './autophase-ws-handler.js';
|
|
30
8
|
import { CollaborationWebSocketHandler } from './collaboration-ws-handler.js';
|
|
@@ -67,6 +45,12 @@ export interface AgentServicesInput {
|
|
|
67
45
|
sessionReader: SessionReader;
|
|
68
46
|
/** Annotations store (collab notes). */
|
|
69
47
|
annotationsStore: AnnotationsStore;
|
|
48
|
+
/**
|
|
49
|
+
* Persist the canonical `config.brain` to the GLOBAL config (serialized
|
|
50
|
+
* behind startWebUI's config write lock). Absent = Brain edits are
|
|
51
|
+
* live-only.
|
|
52
|
+
*/
|
|
53
|
+
persistBrainConfig?: ((config: import('@wrongstack/core/types').BrainConfig) => Promise<void>) | undefined;
|
|
70
54
|
}
|
|
71
55
|
export interface AgentServices {
|
|
72
56
|
collabBus: CollaborationBus;
|
|
@@ -80,6 +64,8 @@ export interface AgentServices {
|
|
|
80
64
|
brainSettings: {
|
|
81
65
|
maxAutoRisk: BrainAutoRisk;
|
|
82
66
|
};
|
|
67
|
+
/** Live-editable Brain config owner (brain.config.get/set routes). */
|
|
68
|
+
brainRuntime: BrainRuntime;
|
|
83
69
|
brainLog: Array<{
|
|
84
70
|
at: number;
|
|
85
71
|
kind: string;
|
|
@@ -87,6 +73,9 @@ export interface AgentServices {
|
|
|
87
73
|
outcome: string;
|
|
88
74
|
}>;
|
|
89
75
|
brainMonitor: BrainMonitor;
|
|
76
|
+
/** LIVE persistent decision ledger (undefined when disabled). Read via the
|
|
77
|
+
* services object at shutdown — ledger toggles swap the instance. */
|
|
78
|
+
brainLedger: BrainDecisionLedger | undefined;
|
|
90
79
|
codebaseIndexing: {
|
|
91
80
|
onFileWritten(filePath: string): void;
|
|
92
81
|
dispose(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend-services.d.ts","sourceRoot":"","sources":["../../src/server/backend-services.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"backend-services.d.ts","sourceRoot":"","sources":["../../src/server/backend-services.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,wBAAwB,EACxB,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,WAAW,EACX,YAAY,EACZ,cAAc,EACd,SAAS,EACT,aAAa,EACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,yDAAyD;AACzD,KAAK,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,C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aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,OAAO,IAAI,IAAI,CAAA;KAAE,CAAC;IAC7E,gBAAgB,EAAE,yBAAyB,CAAC;IAC5C,YAAY,EAAE,qBAAqB,CAAC;IACpC,eAAe,EAAE,wBAAwB,CAAC;IAC1C,gBAAgB,EAAE,yBAAyB,CAAC;IAC5C,eAAe,EAAE,wBAAwB,CAAC;IAC1C,eAAe,EAAE,wBAAwB,CAAC;IAC1C,aAAa,EAAE,6BAA6B,CAAC;IAC7C,2DAA2D;IAC3D,8BAA8B,EAAE,CAC9B,WAAW,EAAE,QAAQ,EACrB,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,cAAc,GAAG,SAAS,KACrC,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC,CAub3F"}
|
|
@@ -4,6 +4,8 @@ export interface BrainRouteHandlers {
|
|
|
4
4
|
status: (ws: WebSocket, msg: WSClientMessage) => Promise<void> | void;
|
|
5
5
|
risk: (ws: WebSocket, msg: WSClientMessage) => Promise<void> | void;
|
|
6
6
|
ask: (ws: WebSocket, msg: WSClientMessage) => Promise<void> | void;
|
|
7
|
+
configGet: (ws: WebSocket, msg: WSClientMessage) => Promise<void> | void;
|
|
8
|
+
configSet: (ws: WebSocket, msg: WSClientMessage) => Promise<void> | void;
|
|
7
9
|
}
|
|
8
10
|
export declare function handleBrainRoute(ws: WebSocket, msg: WSClientMessage, handlers: BrainRouteHandlers): Promise<boolean>;
|
|
9
11
|
//# sourceMappingURL=brain-routes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain-routes.d.ts","sourceRoot":"","sources":["../../src/server/brain-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC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B,gBAAgB,CACpC,EAAE,EAAE,SAAS,EACb,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAAC,OAAO,CAAC,CAoBlB"}
|
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
import type { WebSocket } from 'ws';
|
|
2
2
|
import type { CollaborationBus, EventBus, Logger } from '@wrongstack/core';
|
|
3
3
|
import type { AnnotationsStore, SessionReader } from '@wrongstack/core/storage';
|
|
4
|
+
import type { CollabRole } from './types.js';
|
|
5
|
+
export interface CollaborationHandlerOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the session currently owned by this WebUI runtime. When supplied,
|
|
8
|
+
* joins and live EventBus mirrors are constrained to that session.
|
|
9
|
+
*/
|
|
10
|
+
getActiveSessionId?: (() => string) | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Host-owned authorization for roles that can mutate collaboration state.
|
|
13
|
+
* Omission is intentionally fail-closed: clients may only join as observers.
|
|
14
|
+
*/
|
|
15
|
+
authorizeRole?: ((input: {
|
|
16
|
+
ws: WebSocket;
|
|
17
|
+
sessionId: string;
|
|
18
|
+
requestedRole: Exclude<CollabRole, 'observer'>;
|
|
19
|
+
}) => boolean) | undefined;
|
|
20
|
+
}
|
|
4
21
|
/**
|
|
5
|
-
* CollaborationWebSocketHandler —
|
|
6
|
-
*
|
|
7
|
-
* `AutoPhaseWebSocketHandler`.
|
|
22
|
+
* CollaborationWebSocketHandler — session-scoped collaboration transport.
|
|
23
|
+
* Mirrors `WorktreeWebSocketHandler` and `AutoPhaseWebSocketHandler`.
|
|
8
24
|
*
|
|
9
25
|
* Capabilities in this phase:
|
|
10
26
|
* - A second human (or any client) joins an active agent run as an
|
|
11
27
|
* `observer` and receives a live mirror of the kernel's iteration /
|
|
12
28
|
* tool / subagent events.
|
|
13
|
-
* - The observer declares a `sessionId` on join
|
|
14
|
-
*
|
|
15
|
-
* for now — see the limitation note below.
|
|
29
|
+
* - The observer declares a `sessionId` on join. Hosts provide the live
|
|
30
|
+
* runtime session id so replay and EventBus routing stay session-scoped.
|
|
16
31
|
* - The observer can leave at any time; cleanup runs on WS close/error.
|
|
17
|
-
* -
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* Limitation (documented, acceptable for Phase 1):
|
|
21
|
-
* The webui server multiplexes every active session onto a single
|
|
22
|
-
* EventBus, and most event payloads (`tool.started`, `iteration.*`,
|
|
23
|
-
* `subagent.*`) do NOT carry a `sessionId` field. The webui's primary
|
|
24
|
-
* WS path works because it is the only consumer and assumes one
|
|
25
|
-
* active session at a time. We mirror that assumption here. When a
|
|
26
|
-
* future multi-session "session router" lands, this handler will be
|
|
27
|
-
* upgraded to filter by sessionId.
|
|
32
|
+
* - Privileged roles are never accepted from the wire by themselves.
|
|
33
|
+
* The host must explicitly authorize annotator/controller grants.
|
|
28
34
|
*
|
|
29
35
|
* Protocol additions (see `packages/webui/src/types.ts`):
|
|
30
36
|
* client → server: collab.join { sessionId, role: 'observer' }
|
|
@@ -58,6 +64,7 @@ export declare class CollaborationWebSocketHandler {
|
|
|
58
64
|
* `collabPauseMiddleware` in the webui server boot.
|
|
59
65
|
*/
|
|
60
66
|
private readonly bus?;
|
|
67
|
+
private readonly options;
|
|
61
68
|
private readonly clients;
|
|
62
69
|
/** sessionId → participants currently watching it. */
|
|
63
70
|
private readonly bySession;
|
|
@@ -84,7 +91,7 @@ export declare class CollaborationWebSocketHandler {
|
|
|
84
91
|
* with an error. Wired to the agent's `toolCall` pipeline via
|
|
85
92
|
* `collabPauseMiddleware` in the webui server boot.
|
|
86
93
|
*/
|
|
87
|
-
bus?: CollaborationBus | undefined);
|
|
94
|
+
bus?: CollaborationBus | undefined, options?: CollaborationHandlerOptions);
|
|
88
95
|
addClient(ws: WebSocket): void;
|
|
89
96
|
dispose(): void;
|
|
90
97
|
/**
|
|
@@ -152,7 +159,8 @@ export declare class CollaborationWebSocketHandler {
|
|
|
152
159
|
* Bus callback: a queued injection was spliced into a real tool call. Re-emit
|
|
153
160
|
* `collab.injection.granted` with phase `'consumed'` and the now-known tool
|
|
154
161
|
* name. The injection carries no sessionId, so resolve it from the author's
|
|
155
|
-
* current
|
|
162
|
+
* current participant. If the author has left, fail closed rather than leak
|
|
163
|
+
* the payload to unrelated sessions.
|
|
156
164
|
*/
|
|
157
165
|
private broadcastInjectionConsumed;
|
|
158
166
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collaboration-ws-handler.d.ts","sourceRoot":"","sources":["../../src/server/collaboration-ws-handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAyB,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"collaboration-ws-handler.d.ts","sourceRoot":"","sources":["../../src/server/collaboration-ws-handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAyB,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEhF,OAAO,KAAK,EACV,UAAU,EAGX,MAAM,YAAY,CAAC;AAQpB,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,kBAAkB,CAAC,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,SAAS,CAAC;IAChD;;;OAGG;IACH,aAAa,CAAC,EACV,CAAC,CAAC,KAAK,EAAE;QAAE,EAAE,EAAE,SAAS,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;KAAE,KAAK,OAAO,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cAAc;YA4Ed,aAAa;IA0E3B,OAAO,CAAC,SAAS;IA6CjB,OAAO,CAAC,cAAc;IAgBtB;;;;;;;;;;;OAWG;YACW,aAAa;IAiC3B;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAmB1B,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,SAAS;IAiBjB,OAAO,CAAC,IAAI;IAQZ,OAAO,CAAC,YAAY;YAMN,kBAAkB;YAiDlB,YAAY;YA0CZ,kBAAkB;IAgDhC;;;;;;OAMG;YACW,gBAAgB;IAuF9B;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;CAgCnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-meta.d.ts","sourceRoot":"","sources":["../../src/server/context-meta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACzC,IAAI,
|
|
1
|
+
{"version":3,"file":"context-meta.d.ts","sourceRoot":"","sources":["../../src/server/context-meta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACzC,IAAI,CA+FN"}
|