@prismshadow/penguin-server 0.2.16 → 0.2.18
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/README.md +1 -1
- package/dist/api/types.d.ts +402 -52
- package/dist/api/types.js +17 -3
- package/dist/auth-token.js +1 -1
- package/dist/{chunk-HMTT2PX4.js → chunk-2LZDP26O.js} +8 -5
- package/dist/chunk-2LZDP26O.js.map +1 -0
- package/dist/chunk-5YLLSHY3.js +1195 -0
- package/dist/chunk-5YLLSHY3.js.map +1 -0
- package/dist/{chunk-D3JNA6ZI.js → chunk-B3PSKR3D.js} +2 -2
- package/dist/chunk-B3PSKR3D.js.map +1 -0
- package/dist/{chunk-LPPVGHYD.js → chunk-BL4U7GYY.js} +2 -2
- package/dist/chunk-BL4U7GYY.js.map +1 -0
- package/dist/chunk-BRMNPLU6.js +37 -0
- package/dist/chunk-BRMNPLU6.js.map +1 -0
- package/dist/chunk-GGIINEEK.js +3401 -0
- package/dist/chunk-GGIINEEK.js.map +1 -0
- package/dist/{chunk-QFV3ERQO.js → chunk-OQZDL3TR.js} +2 -2
- package/dist/hmr/manifest.js +1 -1
- package/dist/index.js +13440 -8991
- package/dist/index.js.map +1 -1
- package/dist/machine-status.js +2 -2
- package/dist/model-catalog.d.ts +610 -0
- package/dist/model-catalog.js +108 -0
- package/dist/model-catalog.js.map +1 -0
- package/dist/plugin/index.d.ts +170 -74
- package/dist/reset-admin-password.js +2 -2
- package/dist/version-report.js +2 -2
- package/package.json +14 -9
- package/web-dist/assets/{abnfDiagram-VCTEODGH-0AKFiyig.js → abnfDiagram-VCTEODGH-C_Ej4MyZ.js} +1 -1
- package/web-dist/assets/{addon-clipboard-BovFnNVg.js → addon-clipboard-eONBCa8x.js} +1 -1
- package/web-dist/assets/{addon-fit-B1npgxQk.js → addon-fit-Dk6bkT8u.js} +1 -1
- package/web-dist/assets/{addon-web-links-D88QHj7A.js → addon-web-links-e0JpGvGv.js} +1 -1
- package/web-dist/assets/{arc-Beox1Cgf.js → arc-ytwqobEL.js} +1 -1
- package/web-dist/assets/{architectureDiagram-5GKGNRK7-CC1sLMY1.js → architectureDiagram-5GKGNRK7-oxT9SNOE.js} +1 -1
- package/web-dist/assets/{blockDiagram-I7D4REHJ-B8BY1PkZ.js → blockDiagram-I7D4REHJ-D8OXfpb9.js} +1 -1
- package/web-dist/assets/{c4Diagram-7LVT6UL2-yjY0BkxQ.js → c4Diagram-7LVT6UL2-BNYNzSWK.js} +1 -1
- package/web-dist/assets/channel-7Be_pU-b.js +1 -0
- package/web-dist/assets/{chunk-2Q5K7J3B-DdgIvETg.js → chunk-2Q5K7J3B-C2yNhFmh.js} +1 -1
- package/web-dist/assets/{chunk-5VM5RSS4-BE38k1Rs.js → chunk-5VM5RSS4-CAeuhwbB.js} +1 -1
- package/web-dist/assets/{chunk-F27PBJKO-D4YXmaqQ.js → chunk-F27PBJKO-DSuRiLxP.js} +1 -1
- package/web-dist/assets/{chunk-IMKFNOWR-CyJFdThc.js → chunk-IMKFNOWR-MStar4cf.js} +1 -1
- package/web-dist/assets/{chunk-JWPE2WC7-BAM_oEUU.js → chunk-JWPE2WC7-CIgQwRv4.js} +1 -1
- package/web-dist/assets/{chunk-POPQ4Y6H-BP3D0FVi.js → chunk-POPQ4Y6H-CA8evx9g.js} +1 -1
- package/web-dist/assets/{chunk-SVP7TREG-Clk8PdKZ.js → chunk-SVP7TREG-bR7-FT1W.js} +1 -1
- package/web-dist/assets/{chunk-TICWLB2K-EvWPnEGg.js → chunk-TICWLB2K-C0ZdCnvI.js} +1 -1
- package/web-dist/assets/{chunk-XXDRQBXY-6p5D0UB1.js → chunk-XXDRQBXY-CzozFLFI.js} +1 -1
- package/web-dist/assets/classDiagram-ZZMXUADV-BjVhvDIH.js +1 -0
- package/web-dist/assets/classDiagram-v2-VYDZK3BY-BjVhvDIH.js +1 -0
- package/web-dist/assets/{cose-bilkent-JH36ORCC-bpkI-tLJ.js → cose-bilkent-JH36ORCC-nkjrY6eI.js} +1 -1
- package/web-dist/assets/{cynefin-OW5HDTMX-srLaqJ4e.js → cynefin-OW5HDTMX-D2A0h062.js} +1 -1
- package/web-dist/assets/{cynefinDiagram-5FMLGOSQ-BPfpHSPc.js → cynefinDiagram-5FMLGOSQ-DFZQ7d_T.js} +1 -1
- package/web-dist/assets/{dagre-GXQ25YYZ-C4fF5-j7.js → dagre-GXQ25YYZ-DPYLLARd.js} +1 -1
- package/web-dist/assets/{diagram-S7CK7UJ4-BzBLb_9-.js → diagram-S7CK7UJ4-B204Nrur.js} +1 -1
- package/web-dist/assets/{diagram-UQ7AKVKN-BJuJ1o_T.js → diagram-UQ7AKVKN-DWORCZlS.js} +1 -1
- package/web-dist/assets/{diagram-VSXAHHWV-DFelN9i9.js → diagram-VSXAHHWV-Su6Bzm4Z.js} +1 -1
- package/web-dist/assets/{diagram-VX7I27RA-BgrEoPyp.js → diagram-VX7I27RA-B4p8ssYj.js} +1 -1
- package/web-dist/assets/{diagram-Z3DM3KII-C71KiMiX.js → diagram-Z3DM3KII-BgMz7jjW.js} +1 -1
- package/web-dist/assets/{ebnfDiagram-PWID7BFC-EYteyp1b.js → ebnfDiagram-PWID7BFC-DBCS3Cwc.js} +1 -1
- package/web-dist/assets/{erDiagram-RLTQ6QDP-B6n6-sz6.js → erDiagram-RLTQ6QDP-DEm39S5C.js} +1 -1
- package/web-dist/assets/{flowDiagram-HODETNUW-BtoMTdyT.js → flowDiagram-HODETNUW-CEUQGUza.js} +1 -1
- package/web-dist/assets/{ganttDiagram-EL5Y4UJY-CbOAa3vS.js → ganttDiagram-EL5Y4UJY-myYTgwFp.js} +1 -1
- package/web-dist/assets/{gitGraphDiagram-WWUBYQGX-B7-8sszH.js → gitGraphDiagram-WWUBYQGX-BAQ0Kl1C.js} +1 -1
- package/web-dist/assets/highlighter-DRTMVWxI.js +2 -0
- package/web-dist/assets/{highlighter-core-CMXoD8ze.js → highlighter-core-DgISzHrX.js} +1 -1
- package/web-dist/assets/{highlighter.worker-D6D9fPma.js → highlighter.worker-CKF6ok1g.js} +1 -1
- package/web-dist/assets/index-PA-IFoA6.js +1300 -0
- package/web-dist/assets/index-oCEyg9BT.css +1 -0
- package/web-dist/assets/{infoDiagram-27XIBGKW-BBjf6pkP.js → infoDiagram-27XIBGKW-B2WDMvX9.js} +1 -1
- package/web-dist/assets/{ishikawaDiagram-5VMMS53U-BBSvCv45.js → ishikawaDiagram-5VMMS53U-8qHTttjq.js} +1 -1
- package/web-dist/assets/{journeyDiagram-3NMN7TZE-CuHHl5zk.js → journeyDiagram-3NMN7TZE-DKE_xRCO.js} +1 -1
- package/web-dist/assets/{kanban-definition-UXKFOSKX-DJyP4Myw.js → kanban-definition-UXKFOSKX-EnJbHEmV.js} +1 -1
- package/web-dist/assets/{layout-Bqqhdwtt.js → layout-BlhCFmEZ.js} +1 -1
- package/web-dist/assets/{linear-BZfUSIf8.js → linear-Dw2VzU-D.js} +1 -1
- package/web-dist/assets/mermaid.core-CaXNMz57.js +310 -0
- package/web-dist/assets/{mindmap-definition-YA3MSWOX-BtyMD4wz.js → mindmap-definition-YA3MSWOX-DnTTfqbu.js} +1 -1
- package/web-dist/assets/{pegDiagram-XKGWAZYB-BUF_GJ0B.js → pegDiagram-XKGWAZYB-C3SArVd6.js} +1 -1
- package/web-dist/assets/{pieDiagram-E7YTZNPT-nweubbsU.js → pieDiagram-E7YTZNPT-CTOmO6ke.js} +1 -1
- package/web-dist/assets/powershell-DXrKVo3G.js +1 -0
- package/web-dist/assets/powershell-Dpen1YoG.js +1 -0
- package/web-dist/assets/{quadrantDiagram-AXDQQJYC-B_r4Wkxy.js → quadrantDiagram-AXDQQJYC-CbUsMwzO.js} +1 -1
- package/web-dist/assets/{railroadDiagram-O6MQD6OU-Dn7nm0MX.js → railroadDiagram-O6MQD6OU-Co2hsvaZ.js} +1 -1
- package/web-dist/assets/{requirementDiagram-BXWQKSXE-DaagYJ49.js → requirementDiagram-BXWQKSXE-BqFG0eYQ.js} +1 -1
- package/web-dist/assets/{sankeyDiagram-P5KCCOFB-CqEX6H-B.js → sankeyDiagram-P5KCCOFB-YgQHJlB7.js} +1 -1
- package/web-dist/assets/{sequenceDiagram-WJ2MYXX4-BzLfQO55.js → sequenceDiagram-WJ2MYXX4-CdDrP6O2.js} +1 -1
- package/web-dist/assets/{sizeCapture-INFHLROL-BcUuVH2L.js → sizeCapture-INFHLROL-CKwbEVhU.js} +1 -1
- package/web-dist/assets/{stateDiagram-D77RDMKH-BO3LWLvT.js → stateDiagram-D77RDMKH-kTJR3t2p.js} +1 -1
- package/web-dist/assets/stateDiagram-v2-MP3YSRHH-DzaSnZwj.js +1 -0
- package/web-dist/assets/{swimlanes-42K2YHIH-etP_hkIB.js → swimlanes-42K2YHIH-DCAO3rCQ.js} +1 -1
- package/web-dist/assets/swimlanesDiagram-VR7AAH4N-DNfCLejq.js +8 -0
- package/web-dist/assets/{timeline-definition-24CTP7MA-CTLt2XCT.js → timeline-definition-24CTP7MA-DEjnyzKw.js} +1 -1
- package/web-dist/assets/{vennDiagram-4TSXK5OY-DPO6ZSvH.js → vennDiagram-4TSXK5OY-DSihUvCq.js} +1 -1
- package/web-dist/assets/{wardleyDiagram-VM6X3IG4-DFofGg8b.js → wardleyDiagram-VM6X3IG4-CnAoMeCH.js} +1 -1
- package/web-dist/assets/{xterm-RdyTuaAH.js → xterm-3JwPT74G.js} +1 -1
- package/web-dist/assets/{xychartDiagram-S5SC5T6Z-Bgtb34Gu.js → xychartDiagram-S5SC5T6Z-43dHqZTr.js} +1 -1
- package/web-dist/index.html +6 -5
- package/web-dist/workbench-ui.css +164 -34
- package/dist/chunk-3SFJKLQU.js +0 -1016
- package/dist/chunk-3SFJKLQU.js.map +0 -1
- package/dist/chunk-D3JNA6ZI.js.map +0 -1
- package/dist/chunk-HMTT2PX4.js.map +0 -1
- package/dist/chunk-LPPVGHYD.js.map +0 -1
- package/dist/chunk-W7JNIJ25.js +0 -19
- package/dist/chunk-W7JNIJ25.js.map +0 -1
- package/web-dist/assets/channel-mfsAVJLE.js +0 -1
- package/web-dist/assets/classDiagram-ZZMXUADV-BPVO1m8i.js +0 -1
- package/web-dist/assets/classDiagram-v2-VYDZK3BY-BPVO1m8i.js +0 -1
- package/web-dist/assets/highlighter-Bj5l2XH_.js +0 -2
- package/web-dist/assets/index-BOCqRT4e.css +0 -1
- package/web-dist/assets/index-BrMpjp2s.js +0 -1286
- package/web-dist/assets/mermaid.core-BlUspEsI.js +0 -310
- package/web-dist/assets/stateDiagram-v2-MP3YSRHH-B-EuucjM.js +0 -1
- package/web-dist/assets/swimlanesDiagram-VR7AAH4N-0JbFdDbQ.js +0 -8
- /package/dist/{chunk-QFV3ERQO.js.map → chunk-OQZDL3TR.js.map} +0 -0
package/dist/plugin/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SpawnConfiner,
|
|
1
|
+
import { SpawnConfiner, AmspRecord, ThinkingLevelName, ToolCallPayload, ApprovalDecision, ProjectConfig, ModelRef, PluginTables, ListEndpointModelsOptions, ModelRequestContext, ProxyEnvPolicy, ControlEnvContext, AgentAssembly, ApproveFn, StopReason, CompactAvailability, SessionTitleResult, BackgroundCommandInfo, ToolDetachResult, BackgroundSubagentInfo, SubagentMessageOptions, SubagentMessageOutcome } from '@prismshadow/penguin-core';
|
|
2
2
|
import { SandboxProviderSource, SandboxSettings, SandboxDimension, SandboxLimit } from '@prismshadow/penguin-core/plugin';
|
|
3
|
-
import { Slot, Opaque } from '@prismshadow/penguin-core/kernel';
|
|
4
|
-
import { ApprovalMode, ModelRefDto, ChatDefaultsDto, CommandPolicyDto, ModelVisionDetectRequest, ModelVisionDetectResponse, ModelTestRequest, ModelTestResponse, ModelProtocolDetectRequest, ModelProtocolDetectResponse, EndpointModelListRequest, EndpointModelListResponse, ModelsResponse, ModelsUpdateRequest, ProviderConnectionUpdate, PresetSyncMode, PresetSyncResponse, ServerEvent, MessagingChannel, UnavailableSandboxBackend, SessionSandboxPreset, SessionSandbox, SessionInfo, SessionCategory, SessionCategoryCounts, ModelScopeAuthFlowStatusResponse, SessionStatus, PendingSteeringInfo, SessionBackgroundTasks, PendingFollowUpInfo, AgentConfigDto, AgentConfigUpdateRequest, AgentKernelUpdateResponse, VaultResponse, VaultUpdateRequest, PluginUpdateRef, MessagingRuntimeStatus, PluginConfiguration, ContributionsResponse, RendererRef } from '../api/types.js';
|
|
3
|
+
import { Slot, Opaque, ClassCtx } from '@prismshadow/penguin-core/kernel';
|
|
4
|
+
import { ApprovalMode, ModelRefDto, ChatDefaultsDto, CommandPolicyDto, ModelVisionDetectRequest, ModelVisionDetectResponse, ModelTestRequest, ModelTestResponse, ModelProtocolDetectRequest, ModelProtocolDetectResponse, EndpointModelListRequest, EndpointModelListResponse, ModelsResponse, ModelsUpdateRequest, ProviderConnectionUpdate, PresetSyncMode, PresetSyncResponse, ServerEvent, MessagingChannel, UnavailableSandboxBackend, SessionSandboxPreset, SessionSandbox, SessionInfo, SessionCategory, SessionCategoryCounts, ModelScopeAuthFlowStatusResponse, SessionStatus, PendingSteeringInfo, SessionBackgroundTasks, PendingFollowUpInfo, AgentConfigDto, AgentConfigUpdateRequest, AgentKernelUpdateResponse, VaultResponse, VaultUpdateRequest, AgentDeletionInfo, PluginUpdateRef, MessagingRuntimeStatus, PluginConfiguration, ContributionsResponse, RendererRef } from '../api/types.js';
|
|
5
5
|
export { PluginConfigField } from '../api/types.js';
|
|
6
6
|
import { ThinkingLevelName as ThinkingLevelName$1 } from '@prismshadow/penguin-core/interfaces';
|
|
7
|
-
import { SessionSource } from '@prismshadow/
|
|
7
|
+
import { SessionSource } from '@prismshadow/amsp';
|
|
8
8
|
import { Hono } from 'hono';
|
|
9
9
|
import '@prismshadow/penguin-hmr';
|
|
10
10
|
|
|
@@ -23,12 +23,13 @@ interface UserRow {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* "desktop" and "setup" may set a password without the old one (theirs is random and was never
|
|
26
|
-
* shown); desktop-only routes open to "desktop" alone. "
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* shown); desktop-only routes open to "desktop" alone. "remote" is the one-hour browser session
|
|
27
|
+
* Penguin Remote exchanges the local API token for: it counts as the person wherever a check
|
|
28
|
+
* tells a person from the token (human-only writes, identity claims, who drives a run), opens
|
|
29
|
+
* no desktop-only route, and changes the password only with the old one. "token" is the local
|
|
30
|
+
* API token presented as a Bearer header, and nothing else. Anything else reads as "password".
|
|
30
31
|
*/
|
|
31
|
-
type SessionVia = "password" | "desktop" | "setup" | "token";
|
|
32
|
+
type SessionVia = "password" | "desktop" | "setup" | "remote" | "token";
|
|
32
33
|
|
|
33
34
|
declare class SandboxService {
|
|
34
35
|
private mounted;
|
|
@@ -197,6 +198,12 @@ interface CreateTerminalSessionOptions {
|
|
|
197
198
|
cwd: string;
|
|
198
199
|
/** Owning user id — a shell is the most privileged thing this server hands out. */
|
|
199
200
|
ownerUserId: string;
|
|
201
|
+
/**
|
|
202
|
+
* The conversation (PenguinHarness Session) this shell was opened for — not this object's own
|
|
203
|
+
* id. A label the Web App files the shell under, so each conversation lists only its own; null
|
|
204
|
+
* for a shell no conversation asked for (the API, the CLI, the standalone /terminal page).
|
|
205
|
+
*/
|
|
206
|
+
sessionId?: string | null;
|
|
200
207
|
/**
|
|
201
208
|
* Stable per-user display number (tmux-style), assigned by the manager at creation. It
|
|
202
209
|
* travels with the terminal for its whole life — UI numbering must never depend on list
|
|
@@ -256,6 +263,8 @@ interface TerminalSessionInfo {
|
|
|
256
263
|
name: string;
|
|
257
264
|
cwd: string;
|
|
258
265
|
ownerUserId: string;
|
|
266
|
+
/** The conversation the shell belongs to, or null (see CreateTerminalSessionOptions.sessionId). */
|
|
267
|
+
sessionId: string | null;
|
|
259
268
|
title: string | null;
|
|
260
269
|
cols: number;
|
|
261
270
|
rows: number;
|
|
@@ -274,6 +283,8 @@ declare class TerminalSession {
|
|
|
274
283
|
readonly ownerUserId: string;
|
|
275
284
|
readonly createdAt: Date;
|
|
276
285
|
private name;
|
|
286
|
+
/** The conversation this shell belongs to; changes only when that conversation's id does. */
|
|
287
|
+
private owningSession;
|
|
277
288
|
private readonly terminal;
|
|
278
289
|
private readonly ptyProcess;
|
|
279
290
|
private readonly inputMode;
|
|
@@ -293,6 +304,8 @@ declare class TerminalSession {
|
|
|
293
304
|
get exit(): TerminalExitInfo | null;
|
|
294
305
|
info(): TerminalSessionInfo;
|
|
295
306
|
rename(name: string): void;
|
|
307
|
+
/** Files the shell under another conversation — the same one, once its id has self-healed. */
|
|
308
|
+
setSession(sessionId: string | null): void;
|
|
296
309
|
write(data: string): void;
|
|
297
310
|
/**
|
|
298
311
|
* Applies a size request under the claim/update ownership rule, resizing both the pty and
|
|
@@ -324,6 +337,8 @@ declare class TerminalSession {
|
|
|
324
337
|
interface CreateTerminalRequest {
|
|
325
338
|
cwd: string;
|
|
326
339
|
ownerUserId: string;
|
|
340
|
+
/** The conversation the shell is opened for; absent or null for none. */
|
|
341
|
+
sessionId?: string | null;
|
|
327
342
|
name?: string;
|
|
328
343
|
cols?: number;
|
|
329
344
|
rows?: number;
|
|
@@ -372,8 +387,8 @@ interface RecallableFile {
|
|
|
372
387
|
|
|
373
388
|
/** The open streaming fragments of running sessions, as their holder uses them — what {@link LiveTailTracker} implements. */
|
|
374
389
|
interface LiveTail {
|
|
375
|
-
observe(sessionId: string, msg:
|
|
376
|
-
fragments(sessionId: string):
|
|
390
|
+
observe(sessionId: string, msg: AmspRecord): void;
|
|
391
|
+
fragments(sessionId: string): AmspRecord[];
|
|
377
392
|
clear(sessionId: string): void;
|
|
378
393
|
}
|
|
379
394
|
|
|
@@ -527,14 +542,14 @@ interface SessionRow {
|
|
|
527
542
|
*/
|
|
528
543
|
|
|
529
544
|
interface PendingApproval {
|
|
530
|
-
toolCall:
|
|
545
|
+
toolCall: AmspRecord<ToolCallPayload>;
|
|
531
546
|
origin?: string[];
|
|
532
547
|
}
|
|
533
548
|
/** A Session runtime's pending approvals, as its holder uses them — what {@link ApprovalRegistry} implements. */
|
|
534
549
|
interface Approvals {
|
|
535
550
|
readonly size: number;
|
|
536
551
|
list(): PendingApproval[];
|
|
537
|
-
wait(toolCall:
|
|
552
|
+
wait(toolCall: AmspRecord<ToolCallPayload>): Promise<ApprovalDecision>;
|
|
538
553
|
decide(toolCallId: string, decision: ApprovalDecision): boolean;
|
|
539
554
|
denyAll(): void;
|
|
540
555
|
denyMain(): void;
|
|
@@ -543,7 +558,7 @@ interface Approvals {
|
|
|
543
558
|
/** A numbered channel event; `id` is `<epoch>-<seq>`, `data` is serialized single-line JSON. */
|
|
544
559
|
interface ChannelEvent {
|
|
545
560
|
id: string;
|
|
546
|
-
/** SSE event name; omitted (
|
|
561
|
+
/** SSE event name; omitted (a record) means no `event:` line. */
|
|
547
562
|
event?: string;
|
|
548
563
|
data: string;
|
|
549
564
|
}
|
|
@@ -768,6 +783,13 @@ interface TitleNotifier {
|
|
|
768
783
|
* written before the source was required, which records none.
|
|
769
784
|
*/
|
|
770
785
|
type RecordedSource = SessionSource | null;
|
|
786
|
+
/**
|
|
787
|
+
* Who is reading a list, as far as the listing rule cares: a server that adopted this one as a
|
|
788
|
+
* machine at `adoptedAt` (read from {@link ADOPTED_AT_HEADER}), or anyone else (`{}`).
|
|
789
|
+
*/
|
|
790
|
+
interface ListingView {
|
|
791
|
+
adoptedAt?: string;
|
|
792
|
+
}
|
|
771
793
|
|
|
772
794
|
/** One indexed Trace shard. */
|
|
773
795
|
interface TraceFileRow {
|
|
@@ -834,7 +856,7 @@ declare abstract class TraceIndex {
|
|
|
834
856
|
fileIndex: number;
|
|
835
857
|
date: string;
|
|
836
858
|
sizeBytes: number;
|
|
837
|
-
records:
|
|
859
|
+
records: AmspRecord[];
|
|
838
860
|
}): void;
|
|
839
861
|
abstract removeSession(projectId: string, agentId: string, sessionId: string): void;
|
|
840
862
|
abstract removeAgent(projectId: string, agentId: string): void;
|
|
@@ -868,7 +890,7 @@ interface PlatformModelCatalog {
|
|
|
868
890
|
models: PlatformCatalogModel[];
|
|
869
891
|
}
|
|
870
892
|
/**
|
|
871
|
-
* Catalog merge result. `updated` counts
|
|
893
|
+
* Catalog merge result. `updated` counts changes to existing prices, promotions or routes.
|
|
872
894
|
*/
|
|
873
895
|
interface PlatformModelApplyResult {
|
|
874
896
|
added: number;
|
|
@@ -896,6 +918,8 @@ type UtilityCompletion = {
|
|
|
896
918
|
/** ProjectConfigStore: the mechanism ProjectConfigService implements. */
|
|
897
919
|
declare abstract class ProjectConfigStore {
|
|
898
920
|
abstract readRaw(projectId: string): Promise<RawTable>;
|
|
921
|
+
/** Reads every Project's config once, so what the read path's one-time migrations write back (core's and the server's) is on disk before any Session opens one. */
|
|
922
|
+
abstract migrateStoredConfigs(): Promise<void>;
|
|
899
923
|
abstract loadConfig(projectId: string): Promise<ProjectConfig>;
|
|
900
924
|
abstract writeRaw(projectId: string, data: RawTable): Promise<void>;
|
|
901
925
|
abstract writeInitialConfig(projectId: string, name: string): Promise<void>;
|
|
@@ -943,9 +967,8 @@ declare abstract class ProjectConfigStore {
|
|
|
943
967
|
abstract getModelApiKey(projectId: string, provider: string, modelId: string): Promise<string | undefined>;
|
|
944
968
|
/**
|
|
945
969
|
* The key a group's account balance is read with: the group key (never a row's own), or
|
|
946
|
-
* else the environment key
|
|
947
|
-
*
|
|
948
|
-
* Server-side only.
|
|
970
|
+
* else the vendor's environment key where MMSP's vendor client reads it for the group's base
|
|
971
|
+
* URL (none, or the vendor's own default endpoint). Server-side only.
|
|
949
972
|
*/
|
|
950
973
|
abstract getGroupBalanceKey(projectId: string, provider: string): Promise<string | undefined>;
|
|
951
974
|
abstract setModelApiKeyResolver(resolver: (context: ModelRequestContext) => Promise<string | undefined>): void;
|
|
@@ -1103,9 +1126,11 @@ declare class SessionService {
|
|
|
1103
1126
|
* Session the user never kept reads archived, and a subagent with a stray mark does not.
|
|
1104
1127
|
*
|
|
1105
1128
|
* `orgIds` is the list flow's one-query organization map (see listSessions); without it the
|
|
1106
|
-
* organization is a point lookup, which is what the single-Session paths want.
|
|
1129
|
+
* organization is a point lookup, which is what the single-Session paths want. `view` is who
|
|
1130
|
+
* is reading (sourceSeenBy): a server that adopted this one sees its earlier Sessions as CLI
|
|
1131
|
+
* tasks, in `source` and `archived` alike.
|
|
1107
1132
|
*/
|
|
1108
|
-
toInfo(row: SessionRow, hasTrace: boolean, orgIds?: ReadonlyMap<string, string
|
|
1133
|
+
toInfo(row: SessionRow, hasTrace: boolean, orgIds?: ReadonlyMap<string, string>, view?: ListingView): Promise<SessionInfo>;
|
|
1109
1134
|
/**
|
|
1110
1135
|
* A Session's source, with session_meta as the single source of truth: the in-process
|
|
1111
1136
|
* registry answers first (populated at creation / subagent registration / forks / adoption /
|
|
@@ -1115,9 +1140,11 @@ declare class SessionService {
|
|
|
1115
1140
|
* no source is read with the row's client (readRecordedSource). A Session with no Trace yet
|
|
1116
1141
|
* is NOT cached — its meta appears with the first run — and reads as its row says
|
|
1117
1142
|
* (unrunSource): the organization runtime's as `company`, the Agent API's as `api`, any other
|
|
1118
|
-
* as unknown.
|
|
1143
|
+
* as unknown. What the reader sees of it (sourceSeenBy) is applied last and never cached.
|
|
1119
1144
|
*/
|
|
1120
1145
|
private sourceOf;
|
|
1146
|
+
/** The source as recorded (see sourceOf), whoever reads it. */
|
|
1147
|
+
private recordedSourceOf;
|
|
1121
1148
|
/** Whether this Session already has a Trace record (a Task has been run): answered by the index (reconciled first). */
|
|
1122
1149
|
hasTrace(row: SessionRow): Promise<boolean>;
|
|
1123
1150
|
/**
|
|
@@ -1132,7 +1159,7 @@ declare class SessionService {
|
|
|
1132
1159
|
* through the trace index once (hasTrace reconciles the Agent), so a subagent Session is
|
|
1133
1160
|
* known for one even before any list has walked it.
|
|
1134
1161
|
*/
|
|
1135
|
-
listingOf(row: SessionRow): Promise<SessionCategory | null>;
|
|
1162
|
+
listingOf(row: SessionRow, view?: ListingView): Promise<SessionCategory | null>;
|
|
1136
1163
|
/**
|
|
1137
1164
|
* List, sorted by createdAt descending — or, with `order: "activity"`, by lastActiveAt
|
|
1138
1165
|
* descending (ties by sessionId, see {@link compareActivityDesc}). Every row is served
|
|
@@ -1189,6 +1216,9 @@ declare class SessionService {
|
|
|
1189
1216
|
* stays `user`, and a row the organization caches name before the reconcile pass stamps it
|
|
1190
1217
|
* reads as `user`. Without the flag every row is served, whichever client created it, but
|
|
1191
1218
|
* for that rule.
|
|
1219
|
+
*
|
|
1220
|
+
* `view` is who reads the list (sourceSeenBy): every row is classified and served as that
|
|
1221
|
+
* reader sees it.
|
|
1192
1222
|
*/
|
|
1193
1223
|
listSessions(projectId: string, agentId: string, opts?: {
|
|
1194
1224
|
paging?: SessionListPaging;
|
|
@@ -1197,6 +1227,7 @@ declare class SessionService {
|
|
|
1197
1227
|
workspaceGroup?: string;
|
|
1198
1228
|
withCounts?: boolean;
|
|
1199
1229
|
excludeOrg?: boolean;
|
|
1230
|
+
view?: ListingView;
|
|
1200
1231
|
}): Promise<{
|
|
1201
1232
|
sessions: SessionInfo[];
|
|
1202
1233
|
counts?: SessionCategoryCounts;
|
|
@@ -1210,9 +1241,9 @@ declare class SessionService {
|
|
|
1210
1241
|
* and `excludeOrg`, classified the same way — with the source each was classified by and
|
|
1211
1242
|
* whether it has a Trace. It builds no SessionInfo: the page makes one (toInfo) only for the
|
|
1212
1243
|
* rows a response carries, so a request costs a classification per archived row, not a full
|
|
1213
|
-
* row view per archived row.
|
|
1244
|
+
* row view per archived row. `view` is who reads it, as for listSessions.
|
|
1214
1245
|
*/
|
|
1215
|
-
archivedRows(projectId: string, agentId: string): Promise<ArchivedRow[]>;
|
|
1246
|
+
archivedRows(projectId: string, agentId: string, view?: ListingView): Promise<ArchivedRow[]>;
|
|
1216
1247
|
/**
|
|
1217
1248
|
* The rows a list walk starts from: the Agent's index rows, an organization's left out when
|
|
1218
1249
|
* `excludeOrg` asks (see listSessions), with the Project's organization map; and when any row
|
|
@@ -1382,7 +1413,7 @@ declare class ModelScopeAuthService {
|
|
|
1382
1413
|
private sweep;
|
|
1383
1414
|
private evictOldest;
|
|
1384
1415
|
}
|
|
1385
|
-
declare const ModelScopeAuth_base: (abstract new () => Pick<ModelScopeAuthService, "status" | "start" | "
|
|
1416
|
+
declare const ModelScopeAuth_base: (abstract new () => Pick<ModelScopeAuthService, "status" | "start" | "cancel" | "retryApply" | "ensureFresh">) & (<C>(target: C, context: ClassDecoratorContext) => C);
|
|
1386
1417
|
/** The per-App ModelScope key authorization capability consumed by Project model routes. */
|
|
1387
1418
|
declare abstract class ModelScopeAuth extends ModelScopeAuth_base {
|
|
1388
1419
|
}
|
|
@@ -1395,10 +1426,10 @@ type RunOpts = {
|
|
|
1395
1426
|
};
|
|
1396
1427
|
interface RuntimeSession {
|
|
1397
1428
|
readonly sessionId: string;
|
|
1398
|
-
run(newMessages:
|
|
1429
|
+
run(newMessages: AmspRecord[], opts: RunOpts): AsyncGenerator<AmspRecord>;
|
|
1399
1430
|
compact(opts: {
|
|
1400
1431
|
signal: AbortSignal;
|
|
1401
|
-
}): AsyncGenerator<
|
|
1432
|
+
}): AsyncGenerator<AmspRecord>;
|
|
1402
1433
|
/**
|
|
1403
1434
|
* The running context's model (core `Session.provider` / `Session.modelId`, getters over
|
|
1404
1435
|
* the context's session_meta): the row's pair at creation, moved by each in-session switch
|
|
@@ -1419,7 +1450,7 @@ interface RuntimeSession {
|
|
|
1419
1450
|
provider: string;
|
|
1420
1451
|
modelId: string;
|
|
1421
1452
|
signal: AbortSignal;
|
|
1422
|
-
}): AsyncGenerator<
|
|
1453
|
+
}): AsyncGenerator<AmspRecord, StopReason>;
|
|
1423
1454
|
/**
|
|
1424
1455
|
* The Session's thinking level (core `Session.thinkingLevel`, plain state): soft-limited —
|
|
1425
1456
|
* an assignment applies from the Session's very next LLM request. Optional: test fakes may
|
|
@@ -1429,14 +1460,14 @@ interface RuntimeSession {
|
|
|
1429
1460
|
/** Whether compaction is possible and why; when not ok, compact() yields no messages (see core ContextEngine.compactability). */
|
|
1430
1461
|
compactability(): CompactAvailability;
|
|
1431
1462
|
/** Queues a mid-run steering input (core `Session.steer`); false when no Task is running. */
|
|
1432
|
-
steer(input:
|
|
1463
|
+
steer(input: AmspRecord[]): boolean;
|
|
1433
1464
|
/**
|
|
1434
1465
|
* Withdraws a steering input queued via `steer` before core delivers it (core
|
|
1435
1466
|
* `Session.unsteer`, matched by input-list identity); false when it is no longer queued —
|
|
1436
1467
|
* already delivered, or the run exited. Optional: test fakes may omit it, in which case
|
|
1437
1468
|
* every recall reports "already delivered".
|
|
1438
1469
|
*/
|
|
1439
|
-
unsteer?(input:
|
|
1470
|
+
unsteer?(input: AmspRecord[]): boolean;
|
|
1440
1471
|
/** Skips the in-progress reconnect backoff, firing the next retry immediately (core `Session.skipReconnectWait`); false when no wait is in progress. */
|
|
1441
1472
|
skipReconnectWait(): boolean;
|
|
1442
1473
|
/**
|
|
@@ -1446,6 +1477,13 @@ interface RuntimeSession {
|
|
|
1446
1477
|
* Optional: test fakes may omit it, reading as nothing held.
|
|
1447
1478
|
*/
|
|
1448
1479
|
hasPendingInput?(): boolean;
|
|
1480
|
+
/**
|
|
1481
|
+
* Whether the next Task opens a new Trace file (core `Session.contextOpenPending`): a
|
|
1482
|
+
* compaction left the next context's file to its first write, so that Task streams the new
|
|
1483
|
+
* `session_meta` behind its `task_begin`, and the input echo waits for it (see InputEcho).
|
|
1484
|
+
* Optional: test fakes may omit it, reading as no.
|
|
1485
|
+
*/
|
|
1486
|
+
contextOpenPending?(): boolean;
|
|
1449
1487
|
/**
|
|
1450
1488
|
* Runs the named package's `user_prompt` hook (core `Session.runUserPromptHook` — hooks
|
|
1451
1489
|
* run in core and nowhere else); null = the package is not installed or names no such
|
|
@@ -1477,13 +1515,13 @@ interface RuntimeSession {
|
|
|
1477
1515
|
*/
|
|
1478
1516
|
onBackgroundNotice?(listener: () => void): void;
|
|
1479
1517
|
/** Takes the queued background completion notices as task input (core `Session.takeBackgroundNotices`). Optional, like onBackgroundNotice. */
|
|
1480
|
-
takeBackgroundNotices?():
|
|
1518
|
+
takeBackgroundNotices?(): AmspRecord[];
|
|
1481
1519
|
/** Whether completion notices are still queued (core `Session.hasPendingBackgroundNotices`); pins the entry against idle eviction. Optional, like onBackgroundNotice. */
|
|
1482
1520
|
hasPendingBackgroundNotices?(): boolean;
|
|
1483
1521
|
/** Refreshes the listen-port probes behind the process list's `serviceUrl` (core `Session.probeBackgroundCommandServices`). Optional: test fakes may omit it. */
|
|
1484
1522
|
probeBackgroundCommandServices?(): Promise<void>;
|
|
1485
1523
|
/** Subscribes live-forwarded background-subagent messages (core `Session.onBackgroundMessage`); the manager publishes them to the session channel. Optional: test fakes may omit it. */
|
|
1486
|
-
onBackgroundMessage?(listener: (msg:
|
|
1524
|
+
onBackgroundMessage?(listener: (msg: AmspRecord) => void): void;
|
|
1487
1525
|
/** Background command processes owned by the Session's environment (core `Session.listBackgroundCommands`). Optional: test fakes may omit it. */
|
|
1488
1526
|
listBackgroundCommands?(): BackgroundCommandInfo[];
|
|
1489
1527
|
/** Kills one background command process (core `Session.killBackgroundCommand`); false when the id is unknown. Optional, like listBackgroundCommands. */
|
|
@@ -1495,7 +1533,7 @@ interface RuntimeSession {
|
|
|
1495
1533
|
/** All live subagent child sessions of the Session's environment (core `Session.listBackgroundSubagents`). Optional, like listBackgroundCommands. */
|
|
1496
1534
|
listBackgroundSubagents?(): BackgroundSubagentInfo[];
|
|
1497
1535
|
/** Host message to one child session — steering mid-run, a follow-up run when idle, a revival when released (core `Session.sendToBackgroundSubagent`). Optional. */
|
|
1498
|
-
sendToBackgroundSubagent?(childSessionId: string, messages:
|
|
1536
|
+
sendToBackgroundSubagent?(childSessionId: string, messages: AmspRecord[], opts?: SubagentMessageOptions): Promise<SubagentMessageOutcome>;
|
|
1499
1537
|
/** Subscribes the host's session-lifetime fallback approval sink for child sessions (core `Session.setSubagentApprovalFallback`). Optional. */
|
|
1500
1538
|
setSubagentApprovalFallback?(approve: ApproveFn): void;
|
|
1501
1539
|
/** Aborts one child session's current run, keeping the session (core `Session.abortBackgroundSubagentRun`); false when unknown or idle. Optional. */
|
|
@@ -1513,13 +1551,13 @@ interface RuntimeSession {
|
|
|
1513
1551
|
interface SessionLoader {
|
|
1514
1552
|
/**
|
|
1515
1553
|
* Load a runtime Session from an index row: recover (with a Trace) or self-heal
|
|
1516
|
-
* rebuild (no Trace,
|
|
1554
|
+
* rebuild (no Trace, under the row's session_id). Throws HttpError(409) for unrecoverable
|
|
1517
1555
|
* cases such as a missing Workspace.
|
|
1518
1556
|
*/
|
|
1519
1557
|
load(row: SessionRow): Promise<RuntimeSession>;
|
|
1520
1558
|
}
|
|
1521
1559
|
interface UsageRecorderLike {
|
|
1522
|
-
record(ctx: UsageContext, msg:
|
|
1560
|
+
record(ctx: UsageContext, msg: AmspRecord): Promise<void>;
|
|
1523
1561
|
}
|
|
1524
1562
|
interface SessionManagerDeps {
|
|
1525
1563
|
/** The in-memory state this manager works on (see agent-state.ts). Optional: a manager built without one — unit tests — gets an empty state of its own. */
|
|
@@ -1530,6 +1568,12 @@ interface SessionManagerDeps {
|
|
|
1530
1568
|
/** Session-origin registry (session_meta is the single source of truth; subagent registration records the forwarded meta's source here). */
|
|
1531
1569
|
sources: SessionOrigins;
|
|
1532
1570
|
recorder: UsageRecorderLike;
|
|
1571
|
+
/**
|
|
1572
|
+
* The data root, for what is read off an Agent's state on disk before a Session is loaded
|
|
1573
|
+
* (startGoal's goal-plugin check). Optional: a manager built without one — unit tests on a
|
|
1574
|
+
* fake loader — skips those reads, and the loaded Session's own answer decides.
|
|
1575
|
+
*/
|
|
1576
|
+
root?: string;
|
|
1533
1577
|
/** Automatic Session title generation (optional: not injected in tests or when disabled). */
|
|
1534
1578
|
titles?: TitleNotifier;
|
|
1535
1579
|
/** Error persistence (optional: without it, only logs — same as before this was wired up). */
|
|
@@ -1576,7 +1620,7 @@ interface RecallStore {
|
|
|
1576
1620
|
interface QueuedFollowUp {
|
|
1577
1621
|
/** Recall handle (PendingFollowUpInfo.id), assigned at queue time. */
|
|
1578
1622
|
id: string;
|
|
1579
|
-
input:
|
|
1623
|
+
input: AmspRecord[];
|
|
1580
1624
|
/**
|
|
1581
1625
|
* Original content for recall, and the content `task_state` shows on the queued line.
|
|
1582
1626
|
* Always present: a caller that knows more than the input carries (the HTTP route, which
|
|
@@ -1589,7 +1633,7 @@ interface QueuedFollowUp {
|
|
|
1589
1633
|
/** One undelivered steering entry: the display info broadcast on task_state, plus what a recall needs — the exact input list core queued (its unsteer handle) and the original content. */
|
|
1590
1634
|
interface PendingSteeringEntry {
|
|
1591
1635
|
info: PendingSteeringInfo;
|
|
1592
|
-
input:
|
|
1636
|
+
input: AmspRecord[];
|
|
1593
1637
|
recall: RecallStore;
|
|
1594
1638
|
}
|
|
1595
1639
|
/** Active-table entry: a loaded runtime Session plus its running state. */
|
|
@@ -1631,7 +1675,7 @@ interface RuntimeEntry {
|
|
|
1631
1675
|
* the input publish, so the live channel cannot backfill it either. GET /messages
|
|
1632
1676
|
* appends the ones the Trace has not caught up to yet (exact-envelope dedup).
|
|
1633
1677
|
*/
|
|
1634
|
-
pendingInputs:
|
|
1678
|
+
pendingInputs: AmspRecord[];
|
|
1635
1679
|
/**
|
|
1636
1680
|
* The running Task's streamed bootstrap records (mcp_connect begin/end,
|
|
1637
1681
|
* tool_list_ready), held until the run ends. Their Trace writes are deferred by the
|
|
@@ -1640,7 +1684,7 @@ interface RuntimeEntry {
|
|
|
1640
1684
|
* otherwise show nothing at all (a silent blank while a slow server times out).
|
|
1641
1685
|
* GET /messages appends whichever of them the Trace has not caught up to.
|
|
1642
1686
|
*/
|
|
1643
|
-
pendingBootstrap:
|
|
1687
|
+
pendingBootstrap: AmspRecord[];
|
|
1644
1688
|
/**
|
|
1645
1689
|
* Steering messages queued on core but not yet delivered to the model — a display mirror
|
|
1646
1690
|
* of core's steering queue (same FIFO order), so the composer's "steering queued" hint and
|
|
@@ -1736,7 +1780,7 @@ declare class SessionManager {
|
|
|
1736
1780
|
* the resume fallback names the child's owning Agent from its own session row, which must
|
|
1737
1781
|
* belong to the parent's project.
|
|
1738
1782
|
*/
|
|
1739
|
-
sendToSubagent(sessionId: string, childSessionId: string, messages:
|
|
1783
|
+
sendToSubagent(sessionId: string, childSessionId: string, messages: AmspRecord[]): Promise<SubagentMessageOutcome>;
|
|
1740
1784
|
/**
|
|
1741
1785
|
* Sets a Session's thinking level on its loaded runtime (core `Session.thinkingLevel`,
|
|
1742
1786
|
* plain state): the row's value is what the loader applies at load, so this only needs to
|
|
@@ -1752,12 +1796,12 @@ declare class SessionManager {
|
|
|
1752
1796
|
/** Queued follow-up tasks awaiting auto-start, as their display/recall info (id + content summary). */
|
|
1753
1797
|
pendingFollowUpsOf(sessionId: string): PendingFollowUpInfo[];
|
|
1754
1798
|
/**
|
|
1755
|
-
* Live tail of a running session: one synthetic `partial_* start`
|
|
1799
|
+
* Live tail of a running session: one synthetic `partial_* start` AmspRecord per open
|
|
1756
1800
|
* streaming fragment, carrying the full accumulated content so far (see live-tail.ts).
|
|
1757
1801
|
* Empty when idle or when nothing is streaming. GET /messages attaches this (with a
|
|
1758
1802
|
* channel cursor) so a client joining mid-stream can render the in-progress message.
|
|
1759
1803
|
*/
|
|
1760
|
-
liveFragments(sessionId: string):
|
|
1804
|
+
liveFragments(sessionId: string): AmspRecord[];
|
|
1761
1805
|
/**
|
|
1762
1806
|
* The running Task's input messages as published at launch; empty when idle. The engine
|
|
1763
1807
|
* writes these exact envelopes to the Trace only after the first run's bootstrap (MCP
|
|
@@ -1765,9 +1809,9 @@ declare class SessionManager {
|
|
|
1765
1809
|
* not caught up to yet — without this, a client rebuilding history during the connect
|
|
1766
1810
|
* (the draft flow subscribes only after the input publish) loses the user's own message.
|
|
1767
1811
|
*/
|
|
1768
|
-
pendingInputs(sessionId: string):
|
|
1812
|
+
pendingInputs(sessionId: string): AmspRecord[];
|
|
1769
1813
|
/** The running Task's streamed bootstrap records (see RuntimeEntry.pendingBootstrap); empty when idle. */
|
|
1770
|
-
pendingBootstrap(sessionId: string):
|
|
1814
|
+
pendingBootstrap(sessionId: string): AmspRecord[];
|
|
1771
1815
|
/** Number of Sessions for this Agent that are currently running / compacting. */
|
|
1772
1816
|
activeCountForAgent(projectId: string, agentId: string): number;
|
|
1773
1817
|
/** Add a newly created Session to the active table (status idle), avoiding a redundant load on the next Task. */
|
|
@@ -1855,7 +1899,7 @@ declare class SessionManager {
|
|
|
1855
1899
|
* caller's store is read off the input, so a queued follow-up is recallable and shows
|
|
1856
1900
|
* its content whichever path queued it.
|
|
1857
1901
|
*/
|
|
1858
|
-
startTask(sessionId: string, input:
|
|
1902
|
+
startTask(sessionId: string, input: AmspRecord[], opts?: {
|
|
1859
1903
|
queueIfBusy?: boolean;
|
|
1860
1904
|
recall?: RecallStore;
|
|
1861
1905
|
}): Promise<{
|
|
@@ -1885,13 +1929,15 @@ declare class SessionManager {
|
|
|
1885
1929
|
* `user_prompt` hook (hooks run in core and nowhere else — `Session.runUserPromptHook`)
|
|
1886
1930
|
* writes the Session's goal file and answers the round-1 protocol message; it runs under
|
|
1887
1931
|
* the session lock AFTER the idle check, since it overwrites the goal file a running goal
|
|
1888
|
-
* is reading.
|
|
1932
|
+
* is reading. An Agent without the goal plugin's hook package is refused with the route's
|
|
1933
|
+
* 409 before the Session is even loaded (goal-plugin.ts); a loaded Session whose hook
|
|
1934
|
+
* answers null is the same 409, and an empty answer a 500. Round inputs
|
|
1889
1935
|
* are yielded by core and published like any streamed message; progress additionally goes
|
|
1890
1936
|
* out as goal_* server events (the run state itself is the goal file the plugin maintains).
|
|
1891
1937
|
*/
|
|
1892
1938
|
startGoal(sessionId: string, args: {
|
|
1893
1939
|
/** The user's own message(s) exactly as submitted — text and images, no wrapping. */
|
|
1894
|
-
messages:
|
|
1940
|
+
messages: AmspRecord[];
|
|
1895
1941
|
/** The user's own objective text (leading marker blocks stripped): what the plugin records, the goal_started event and the title material. */
|
|
1896
1942
|
objective: string;
|
|
1897
1943
|
budget: number;
|
|
@@ -1901,7 +1947,7 @@ declare class SessionManager {
|
|
|
1901
1947
|
/**
|
|
1902
1948
|
* Taps a goal run's stream for `drive`: round boundaries become goal_round events —
|
|
1903
1949
|
* round 1 from the seeded input (core never yields a run's initial input, so it is
|
|
1904
|
-
* counted here,
|
|
1950
|
+
* counted here, from what startGoal echoes), later rounds from the stop-hook continues
|
|
1905
1951
|
* core yields, each announced by the hook's `continue` event; a harness-stamped input
|
|
1906
1952
|
* nothing announced is another package's user_prompt context riding behind the
|
|
1907
1953
|
* objective, not a round — and the goal hook's `stop` event becomes the
|
|
@@ -1914,9 +1960,9 @@ declare class SessionManager {
|
|
|
1914
1960
|
/** Closes a goal as aborted for the UI (stream cut off / infrastructure failure). */
|
|
1915
1961
|
private finishAborted;
|
|
1916
1962
|
/**
|
|
1917
|
-
* Shared task launch (fresh tasks, auto-started follow-ups and retries): flips to running
|
|
1918
|
-
*
|
|
1919
|
-
* idle. A retry's input is empty: nothing is
|
|
1963
|
+
* Shared task launch (fresh tasks, auto-started follow-ups and retries): flips to running
|
|
1964
|
+
* and drives the run, which echoes the input. Caller holds the session lock and has verified
|
|
1965
|
+
* idle. A retry's input is empty: nothing is echoed or held, and drive gets no title
|
|
1920
1966
|
* material — the turn it resends already offered its text when it was first sent.
|
|
1921
1967
|
*/
|
|
1922
1968
|
private launchTask;
|
|
@@ -1996,7 +2042,7 @@ declare class SessionManager {
|
|
|
1996
2042
|
* keeps the composer's "steering queued" hint, content included, alive across reloads —
|
|
1997
2043
|
* and the content itself is what a recall (recallSteering) hands back to the composer.
|
|
1998
2044
|
*/
|
|
1999
|
-
steer(sessionId: string, input:
|
|
2045
|
+
steer(sessionId: string, input: AmspRecord[], recall: RecallStore): void;
|
|
2000
2046
|
/**
|
|
2001
2047
|
* Recall an undelivered steering message (#287): withdraw it from core's queue and the
|
|
2002
2048
|
* display mirror, re-broadcast state, and hand back its original content for the composer
|
|
@@ -2152,12 +2198,10 @@ declare class SessionManager {
|
|
|
2152
2198
|
* a Task arriving mid-load waits for this load instead of starting a second one.
|
|
2153
2199
|
*
|
|
2154
2200
|
* A Session that is gone or being deleted, alone or with its Agent, resolves quietly: there is
|
|
2155
|
-
* nothing to warm and the caller has nothing to do about it.
|
|
2156
|
-
*
|
|
2157
|
-
*
|
|
2158
|
-
*
|
|
2159
|
-
* load failure rejects; the first Task meets the same failure and reports it where a person
|
|
2160
|
-
* will see it.
|
|
2201
|
+
* nothing to warm and the caller has nothing to do about it. One that never ran is rebuilt
|
|
2202
|
+
* under its own id (see createCoreSessionLoader), so the binding that asked keeps its Session.
|
|
2203
|
+
* Any other load failure rejects; the first Task meets the same failure and reports it where a
|
|
2204
|
+
* person will see it.
|
|
2161
2205
|
*/
|
|
2162
2206
|
preload(sessionId: string): Promise<void>;
|
|
2163
2207
|
private assertOpen;
|
|
@@ -2168,7 +2212,9 @@ declare class SessionManager {
|
|
|
2168
2212
|
private assertIdle;
|
|
2169
2213
|
private generationOf;
|
|
2170
2214
|
private refreshProviderCredentialIfNeeded;
|
|
2171
|
-
/** get-or-resume-or-heal: use directly on an active-table hit; otherwise load via the loader, updating the index's primary key
|
|
2215
|
+
/** get-or-resume-or-heal: use directly on an active-table hit; otherwise load via the loader, updating the index's primary key when it answers another id. */
|
|
2216
|
+
/** startGoal's check before the load (goal-plugin.ts); an unknown id is left to ensureEntry's 404. */
|
|
2217
|
+
private assertGoalPluginInstalled;
|
|
2172
2218
|
private ensureEntry;
|
|
2173
2219
|
/**
|
|
2174
2220
|
* Auto-start of queued background completion notices: called when core signals an
|
|
@@ -2182,7 +2228,8 @@ declare class SessionManager {
|
|
|
2182
2228
|
* Drive the output stream in the background: publish each message + persist usage +
|
|
2183
2229
|
* persist LLM/tool errors; on completion (including errors) resets to idle and pushes
|
|
2184
2230
|
* the status. `titleSource` is passed only for Task runs (compaction doesn't generate
|
|
2185
|
-
* a title): its user text drives automatic title generation at run start
|
|
2231
|
+
* a title): its user text drives automatic title generation at run start, and its `echo`
|
|
2232
|
+
* is the run's input, published right behind the run's first `task_begin` (see InputEcho).
|
|
2186
2233
|
*/
|
|
2187
2234
|
private drive;
|
|
2188
2235
|
/**
|
|
@@ -2330,7 +2377,17 @@ declare abstract class AgentLifecycle {
|
|
|
2330
2377
|
abstract listAgents(projectId: string): Promise<AgentListItem[]>;
|
|
2331
2378
|
/** Every id `createAgent` refuses as taken, as names only, including a folder that does not list. */
|
|
2332
2379
|
abstract takenAgentIds(projectId: string): Promise<string[]>;
|
|
2333
|
-
|
|
2380
|
+
/**
|
|
2381
|
+
* Moves the Agent's folder out of the agents directory in one rename and drops its index row,
|
|
2382
|
+
* so it is gone from every list and route at once; its files are then removed in the
|
|
2383
|
+
* background, as the returned deletion reports. Refuses a built-in Agent, and a folder another
|
|
2384
|
+
* program holds open (409 `agent_folder_busy`, nothing deleted).
|
|
2385
|
+
*/
|
|
2386
|
+
abstract deleteAgent(projectId: string, agentId: string): Promise<AgentDeletionInfo>;
|
|
2387
|
+
/** Where one deletion stands; null once it is unknown here (finished long ago, or never was). */
|
|
2388
|
+
abstract agentDeletion(projectId: string, deletionId: string): AgentDeletionInfo | null;
|
|
2389
|
+
/** Removes whatever deleted Agents left behind when the server last stopped mid-removal. */
|
|
2390
|
+
abstract resumeDeletions(): Promise<void>;
|
|
2334
2391
|
abstract createAgent(projectId: string, agentId: string, name?: string, description?: string, skillNames?: readonly string[], directory?: {
|
|
2335
2392
|
path: string;
|
|
2336
2393
|
names: readonly string[];
|
|
@@ -2357,7 +2414,7 @@ interface AgentListItem {
|
|
|
2357
2414
|
kernelOutdated: boolean;
|
|
2358
2415
|
/** Number of vault keys. */
|
|
2359
2416
|
vaultKeyCount: number;
|
|
2360
|
-
/** Number of scheduled tasks (count of .toml files under schedule/, including invalid ones). */
|
|
2417
|
+
/** Number of scheduled tasks (count of .toml files directly under schedule/, including invalid ones; archived files under schedule/expired/ are not counted). */
|
|
2361
2418
|
scheduleCount: number;
|
|
2362
2419
|
/** Workbench folders with a manifest, including ones with a load error. */
|
|
2363
2420
|
workbenchCount: number;
|
|
@@ -2376,7 +2433,19 @@ declare class AgentService implements AgentLifecycle {
|
|
|
2376
2433
|
private readonly agents;
|
|
2377
2434
|
private readonly agentConfig;
|
|
2378
2435
|
private readonly snapshots;
|
|
2379
|
-
/**
|
|
2436
|
+
/** Deletions this process knows, by `${projectId}/${deletionId}`. */
|
|
2437
|
+
private readonly deletions;
|
|
2438
|
+
/** The removals in flight, by the same key. */
|
|
2439
|
+
private readonly running;
|
|
2440
|
+
/** Shared by every removal, so two deletions at once still hold only PURGE_SLOTS calls. */
|
|
2441
|
+
private readonly limiter;
|
|
2442
|
+
/** Ends this generation's removals when it is disposed; the next one resumes them from disk. */
|
|
2443
|
+
private readonly stopping;
|
|
2444
|
+
setup(ctx: ClassCtx): void;
|
|
2445
|
+
/**
|
|
2446
|
+
* Union of DB index ∪ directory scan; unmanaged directory Agents are backfilled into the DB.
|
|
2447
|
+
* Only what `AgentConfig.exists` accepts is listed — the rule every route checks.
|
|
2448
|
+
*/
|
|
2380
2449
|
listAgents(projectId: string): Promise<AgentListItem[]>;
|
|
2381
2450
|
/** Count installed folders without compiling or walking their UI/runtime assets. */
|
|
2382
2451
|
private workbenchCount;
|
|
@@ -2388,7 +2457,7 @@ declare class AgentService implements AgentLifecycle {
|
|
|
2388
2457
|
takenAgentIds(projectId: string): Promise<string[]>;
|
|
2389
2458
|
/** Number of vault keys (falls back to 0 on read failure). */
|
|
2390
2459
|
private vaultKeyCount;
|
|
2391
|
-
/** Number of scheduled tasks: count of .toml files under schedule/ (0 if the directory doesn't exist). */
|
|
2460
|
+
/** Number of scheduled tasks: count of .toml files directly under schedule/ (0 if the directory doesn't exist). The expired/ subdirectory of archived files is not a .toml name, so it is never counted. */
|
|
2392
2461
|
private scheduleCount;
|
|
2393
2462
|
/**
|
|
2394
2463
|
* One pass over `skills/` and one over `hooks/`, answering the card's questions: how many
|
|
@@ -2449,14 +2518,32 @@ declare class AgentService implements AgentLifecycle {
|
|
|
2449
2518
|
/** Last config modification time: the later of system_config.yaml and AGENTS.md mtime; omitted if neither is readable. */
|
|
2450
2519
|
private configUpdatedAt;
|
|
2451
2520
|
/**
|
|
2452
|
-
* Delete an Agent: the
|
|
2453
|
-
*
|
|
2454
|
-
*
|
|
2455
|
-
* The
|
|
2456
|
-
* agents
|
|
2457
|
-
*
|
|
2521
|
+
* Delete an Agent: the built-in Agents cannot be deleted; callers must first drain any active
|
|
2522
|
+
* run (the session manager's `beginAgentDeletion`) and let go of what holds the folder open.
|
|
2523
|
+
*
|
|
2524
|
+
* The folder (Agent State, Traces, scratchpads, temporary Workspaces) is moved to
|
|
2525
|
+
* `agents/.deleting/<id>-<time>` in one rename and the index row dropped: from then on no list
|
|
2526
|
+
* shows the Agent and no route accepts it, and a new Agent may take its id. The move is the
|
|
2527
|
+
* whole of what the caller waits for — the contents are removed in the background, reported by
|
|
2528
|
+
* the deletion returned (and by `agentDeletion` as it goes). A folder that cannot be moved is
|
|
2529
|
+
* refused with nothing deleted (409 `agent_folder_busy`). Usage records are kept (historical
|
|
2530
|
+
* stats are unaffected); the caller drops the Agent's other index rows.
|
|
2531
|
+
*/
|
|
2532
|
+
deleteAgent(projectId: string, agentId: string): Promise<AgentDeletionInfo>;
|
|
2533
|
+
agentDeletion(projectId: string, deletionId: string): AgentDeletionInfo | null;
|
|
2534
|
+
/**
|
|
2535
|
+
* Every folder left under a Project's `agents/.deleting/` — a deletion the last process did
|
|
2536
|
+
* not finish, or one that met an entry it could not remove — is removed again, one after
|
|
2537
|
+
* another. Folders a deletion of this process is already removing are left to it.
|
|
2458
2538
|
*/
|
|
2459
|
-
|
|
2539
|
+
resumeDeletions(): Promise<void>;
|
|
2540
|
+
/**
|
|
2541
|
+
* Renames the Agent's folder into `.deleting/`. Null when there was no folder to move; a
|
|
2542
|
+
* folder a program keeps holding is refused with nothing moved.
|
|
2543
|
+
*/
|
|
2544
|
+
private moveAside;
|
|
2545
|
+
/** Starts removing `.deleting/<deletionId>` in the background; answers its first reading. */
|
|
2546
|
+
private startPurge;
|
|
2460
2547
|
/**
|
|
2461
2548
|
* Create an Agent: the id is chosen by the creator (a semantic id, checked for
|
|
2462
2549
|
* duplicates against both the DB and the directory within the Project — a 409
|
|
@@ -2844,7 +2931,7 @@ type AppEnv = {
|
|
|
2844
2931
|
/** Minimal dependency on SessionManager (eases test doubles; mirrors ScheduleTaskRunner). */
|
|
2845
2932
|
interface MessagingTaskRunnerShape {
|
|
2846
2933
|
statusOf(sessionId: string): string;
|
|
2847
|
-
startTask(sessionId: string, input:
|
|
2934
|
+
startTask(sessionId: string, input: AmspRecord[],
|
|
2848
2935
|
/**
|
|
2849
2936
|
* `recall` is what a queued follow-up hands back when the user withdraws it in the Web
|
|
2850
2937
|
* App. It is optional because the manager derives one from the input for every caller
|
|
@@ -3322,9 +3409,18 @@ interface PluginConfigSlots {
|
|
|
3322
3409
|
groups: Slot<SettingsGroupDecl>;
|
|
3323
3410
|
}
|
|
3324
3411
|
|
|
3325
|
-
/**
|
|
3412
|
+
/**
|
|
3413
|
+
* The assembled business surface: one request in, one response (or a decline) out.
|
|
3414
|
+
*
|
|
3415
|
+
* `fetchAs` is the same surface entered as a user already established by other means — the
|
|
3416
|
+
* API socket (socket/serve.ts), whose handshake the runtime authenticated and whose owner it
|
|
3417
|
+
* checked before the platform ever saw the socket. Those requests carry no cookie, so the
|
|
3418
|
+
* gate in front of the routes is not the cookie one but "this user": the routes themselves,
|
|
3419
|
+
* their authorization and their errors are identical.
|
|
3420
|
+
*/
|
|
3326
3421
|
declare abstract class Http {
|
|
3327
3422
|
abstract fetch(request: Opaque<"Request", Request>): Promise<Opaque<"Response", Response>>;
|
|
3423
|
+
abstract fetchAs(userId: string, request: Opaque<"Request", Request>): Promise<Opaque<"Response", Response>>;
|
|
3328
3424
|
}
|
|
3329
3425
|
interface HttpSlots {
|
|
3330
3426
|
/**
|