@prismshadow/penguin-server 0.2.16 → 0.2.17

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.
Files changed (108) hide show
  1. package/README.md +1 -1
  2. package/dist/api/types.d.ts +233 -47
  3. package/dist/api/types.js +9 -3
  4. package/dist/auth-token.js +1 -1
  5. package/dist/{chunk-HMTT2PX4.js → chunk-2LZDP26O.js} +8 -5
  6. package/dist/chunk-2LZDP26O.js.map +1 -0
  7. package/dist/{chunk-LPPVGHYD.js → chunk-BL4U7GYY.js} +2 -2
  8. package/dist/chunk-BL4U7GYY.js.map +1 -0
  9. package/dist/chunk-GGIINEEK.js +3401 -0
  10. package/dist/chunk-GGIINEEK.js.map +1 -0
  11. package/dist/chunk-HDBZRVA5.js +29 -0
  12. package/dist/chunk-HDBZRVA5.js.map +1 -0
  13. package/dist/{chunk-3SFJKLQU.js → chunk-HPOHMZCH.js} +679 -559
  14. package/dist/chunk-HPOHMZCH.js.map +1 -0
  15. package/dist/{chunk-QFV3ERQO.js → chunk-OQZDL3TR.js} +2 -2
  16. package/dist/hmr/manifest.js +1 -1
  17. package/dist/index.js +7701 -4814
  18. package/dist/index.js.map +1 -1
  19. package/dist/machine-status.js +2 -2
  20. package/dist/model-catalog.d.ts +610 -0
  21. package/dist/model-catalog.js +108 -0
  22. package/dist/model-catalog.js.map +1 -0
  23. package/dist/plugin/index.d.ts +113 -58
  24. package/dist/reset-admin-password.js +1 -1
  25. package/dist/version-report.js +2 -2
  26. package/package.json +14 -9
  27. package/web-dist/assets/{abnfDiagram-VCTEODGH-0AKFiyig.js → abnfDiagram-VCTEODGH-DMzkb4l4.js} +1 -1
  28. package/web-dist/assets/{addon-clipboard-BovFnNVg.js → addon-clipboard-BtD2BVSi.js} +1 -1
  29. package/web-dist/assets/{addon-fit-B1npgxQk.js → addon-fit-Dr6HWsi_.js} +1 -1
  30. package/web-dist/assets/{addon-web-links-D88QHj7A.js → addon-web-links-VEE3YLzQ.js} +1 -1
  31. package/web-dist/assets/{arc-Beox1Cgf.js → arc-CvMPOU_B.js} +1 -1
  32. package/web-dist/assets/{architectureDiagram-5GKGNRK7-CC1sLMY1.js → architectureDiagram-5GKGNRK7-Bk65mIBz.js} +1 -1
  33. package/web-dist/assets/{blockDiagram-I7D4REHJ-B8BY1PkZ.js → blockDiagram-I7D4REHJ-D54-XSNs.js} +1 -1
  34. package/web-dist/assets/{c4Diagram-7LVT6UL2-yjY0BkxQ.js → c4Diagram-7LVT6UL2-Dm954LSt.js} +1 -1
  35. package/web-dist/assets/channel-CVHI75kz.js +1 -0
  36. package/web-dist/assets/{chunk-2Q5K7J3B-DdgIvETg.js → chunk-2Q5K7J3B-D_LJ_7Cn.js} +1 -1
  37. package/web-dist/assets/{chunk-5VM5RSS4-BE38k1Rs.js → chunk-5VM5RSS4-B8RI4tl3.js} +1 -1
  38. package/web-dist/assets/{chunk-F27PBJKO-D4YXmaqQ.js → chunk-F27PBJKO-aVSYH9JV.js} +1 -1
  39. package/web-dist/assets/{chunk-IMKFNOWR-CyJFdThc.js → chunk-IMKFNOWR-DnkdWeq2.js} +1 -1
  40. package/web-dist/assets/{chunk-JWPE2WC7-BAM_oEUU.js → chunk-JWPE2WC7-C2pJzKuW.js} +1 -1
  41. package/web-dist/assets/{chunk-POPQ4Y6H-BP3D0FVi.js → chunk-POPQ4Y6H-Bx7Iikzx.js} +1 -1
  42. package/web-dist/assets/{chunk-SVP7TREG-Clk8PdKZ.js → chunk-SVP7TREG-qJC2SMqr.js} +1 -1
  43. package/web-dist/assets/{chunk-TICWLB2K-EvWPnEGg.js → chunk-TICWLB2K-Crl_BgKI.js} +1 -1
  44. package/web-dist/assets/{chunk-XXDRQBXY-6p5D0UB1.js → chunk-XXDRQBXY-BFFemuGm.js} +1 -1
  45. package/web-dist/assets/classDiagram-ZZMXUADV-CBdzAPFu.js +1 -0
  46. package/web-dist/assets/classDiagram-v2-VYDZK3BY-CBdzAPFu.js +1 -0
  47. package/web-dist/assets/{cose-bilkent-JH36ORCC-bpkI-tLJ.js → cose-bilkent-JH36ORCC-Bmh2Kx7h.js} +1 -1
  48. package/web-dist/assets/{cynefin-OW5HDTMX-srLaqJ4e.js → cynefin-OW5HDTMX-BveNWnUV.js} +1 -1
  49. package/web-dist/assets/{cynefinDiagram-5FMLGOSQ-BPfpHSPc.js → cynefinDiagram-5FMLGOSQ-85itazbJ.js} +1 -1
  50. package/web-dist/assets/{dagre-GXQ25YYZ-C4fF5-j7.js → dagre-GXQ25YYZ-DIZT-KY_.js} +1 -1
  51. package/web-dist/assets/{diagram-S7CK7UJ4-BzBLb_9-.js → diagram-S7CK7UJ4-Dum-g63f.js} +1 -1
  52. package/web-dist/assets/{diagram-UQ7AKVKN-BJuJ1o_T.js → diagram-UQ7AKVKN-DallMKJl.js} +1 -1
  53. package/web-dist/assets/{diagram-VSXAHHWV-DFelN9i9.js → diagram-VSXAHHWV-DWELqxfN.js} +1 -1
  54. package/web-dist/assets/{diagram-VX7I27RA-BgrEoPyp.js → diagram-VX7I27RA-BNs0gB9E.js} +1 -1
  55. package/web-dist/assets/{diagram-Z3DM3KII-C71KiMiX.js → diagram-Z3DM3KII-C9mF9xAd.js} +1 -1
  56. package/web-dist/assets/{ebnfDiagram-PWID7BFC-EYteyp1b.js → ebnfDiagram-PWID7BFC-D_Diy9HH.js} +1 -1
  57. package/web-dist/assets/{erDiagram-RLTQ6QDP-B6n6-sz6.js → erDiagram-RLTQ6QDP-4QTS5VIh.js} +1 -1
  58. package/web-dist/assets/{flowDiagram-HODETNUW-BtoMTdyT.js → flowDiagram-HODETNUW-CliTRrtV.js} +1 -1
  59. package/web-dist/assets/{ganttDiagram-EL5Y4UJY-CbOAa3vS.js → ganttDiagram-EL5Y4UJY-DCRd-Ss4.js} +1 -1
  60. package/web-dist/assets/{gitGraphDiagram-WWUBYQGX-B7-8sszH.js → gitGraphDiagram-WWUBYQGX-CTz13GjS.js} +1 -1
  61. package/web-dist/assets/highlighter-BScH1Ud3.js +2 -0
  62. package/web-dist/assets/{highlighter-core-CMXoD8ze.js → highlighter-core-DKz8Z6-I.js} +1 -1
  63. package/web-dist/assets/{highlighter.worker-D6D9fPma.js → highlighter.worker-CKF6ok1g.js} +1 -1
  64. package/web-dist/assets/index-BUvJ5Ctt.js +1299 -0
  65. package/web-dist/assets/index-DRj7nvPY.css +1 -0
  66. package/web-dist/assets/{infoDiagram-27XIBGKW-BBjf6pkP.js → infoDiagram-27XIBGKW-DNfTEPAV.js} +1 -1
  67. package/web-dist/assets/{ishikawaDiagram-5VMMS53U-BBSvCv45.js → ishikawaDiagram-5VMMS53U-B7aCjjG1.js} +1 -1
  68. package/web-dist/assets/{journeyDiagram-3NMN7TZE-CuHHl5zk.js → journeyDiagram-3NMN7TZE-COmDALVr.js} +1 -1
  69. package/web-dist/assets/{kanban-definition-UXKFOSKX-DJyP4Myw.js → kanban-definition-UXKFOSKX-BzUfPINh.js} +1 -1
  70. package/web-dist/assets/{layout-Bqqhdwtt.js → layout-BwzuPU4M.js} +1 -1
  71. package/web-dist/assets/{linear-BZfUSIf8.js → linear-WPZTYjz3.js} +1 -1
  72. package/web-dist/assets/mermaid.core-zKzlwpkw.js +310 -0
  73. package/web-dist/assets/{mindmap-definition-YA3MSWOX-BtyMD4wz.js → mindmap-definition-YA3MSWOX-DCRg7eAx.js} +1 -1
  74. package/web-dist/assets/{pegDiagram-XKGWAZYB-BUF_GJ0B.js → pegDiagram-XKGWAZYB-DyphzDLU.js} +1 -1
  75. package/web-dist/assets/{pieDiagram-E7YTZNPT-nweubbsU.js → pieDiagram-E7YTZNPT-BI5DueGA.js} +1 -1
  76. package/web-dist/assets/powershell-DXrKVo3G.js +1 -0
  77. package/web-dist/assets/powershell-Dpen1YoG.js +1 -0
  78. package/web-dist/assets/{quadrantDiagram-AXDQQJYC-B_r4Wkxy.js → quadrantDiagram-AXDQQJYC-GZxSMY2Z.js} +1 -1
  79. package/web-dist/assets/{railroadDiagram-O6MQD6OU-Dn7nm0MX.js → railroadDiagram-O6MQD6OU-DEFCigBf.js} +1 -1
  80. package/web-dist/assets/{requirementDiagram-BXWQKSXE-DaagYJ49.js → requirementDiagram-BXWQKSXE-Br0thc4j.js} +1 -1
  81. package/web-dist/assets/{sankeyDiagram-P5KCCOFB-CqEX6H-B.js → sankeyDiagram-P5KCCOFB-DYf0pY67.js} +1 -1
  82. package/web-dist/assets/{sequenceDiagram-WJ2MYXX4-BzLfQO55.js → sequenceDiagram-WJ2MYXX4-1EFMboX4.js} +1 -1
  83. package/web-dist/assets/{sizeCapture-INFHLROL-BcUuVH2L.js → sizeCapture-INFHLROL-BuOFv-5q.js} +1 -1
  84. package/web-dist/assets/{stateDiagram-D77RDMKH-BO3LWLvT.js → stateDiagram-D77RDMKH-Bg3H1tjX.js} +1 -1
  85. package/web-dist/assets/stateDiagram-v2-MP3YSRHH-DfaDaPAd.js +1 -0
  86. package/web-dist/assets/{swimlanes-42K2YHIH-etP_hkIB.js → swimlanes-42K2YHIH-BuOa6Osb.js} +1 -1
  87. package/web-dist/assets/swimlanesDiagram-VR7AAH4N-BopAC7b8.js +8 -0
  88. package/web-dist/assets/{timeline-definition-24CTP7MA-CTLt2XCT.js → timeline-definition-24CTP7MA-BDekfdDT.js} +1 -1
  89. package/web-dist/assets/{vennDiagram-4TSXK5OY-DPO6ZSvH.js → vennDiagram-4TSXK5OY-DnC09UI4.js} +1 -1
  90. package/web-dist/assets/{wardleyDiagram-VM6X3IG4-DFofGg8b.js → wardleyDiagram-VM6X3IG4-BXKvxuZQ.js} +1 -1
  91. package/web-dist/assets/{xterm-RdyTuaAH.js → xterm-oY4DYg5s.js} +1 -1
  92. package/web-dist/assets/{xychartDiagram-S5SC5T6Z-Bgtb34Gu.js → xychartDiagram-S5SC5T6Z-DdDC1VLb.js} +1 -1
  93. package/web-dist/index.html +6 -5
  94. package/dist/chunk-3SFJKLQU.js.map +0 -1
  95. package/dist/chunk-HMTT2PX4.js.map +0 -1
  96. package/dist/chunk-LPPVGHYD.js.map +0 -1
  97. package/dist/chunk-W7JNIJ25.js +0 -19
  98. package/dist/chunk-W7JNIJ25.js.map +0 -1
  99. package/web-dist/assets/channel-mfsAVJLE.js +0 -1
  100. package/web-dist/assets/classDiagram-ZZMXUADV-BPVO1m8i.js +0 -1
  101. package/web-dist/assets/classDiagram-v2-VYDZK3BY-BPVO1m8i.js +0 -1
  102. package/web-dist/assets/highlighter-Bj5l2XH_.js +0 -2
  103. package/web-dist/assets/index-BOCqRT4e.css +0 -1
  104. package/web-dist/assets/index-BrMpjp2s.js +0 -1286
  105. package/web-dist/assets/mermaid.core-BlUspEsI.js +0 -310
  106. package/web-dist/assets/stateDiagram-v2-MP3YSRHH-B-EuucjM.js +0 -1
  107. package/web-dist/assets/swimlanesDiagram-VR7AAH4N-0JbFdDbQ.js +0 -8
  108. /package/dist/{chunk-QFV3ERQO.js.map → chunk-OQZDL3TR.js.map} +0 -0
@@ -1,10 +1,10 @@
1
- import { SpawnConfiner, OmniMessage, ThinkingLevelName, ToolCallPayload, ApprovalDecision, ProjectConfig, ModelRef, PluginTables, ListEndpointModelsOptions, ModelRequestContext, ProxyEnvPolicy, ControlEnvContext, AgentAssembly, ApproveFn, StopReason, CompactAvailability, SessionTitleResult, BackgroundCommandInfo, ToolDetachResult, BackgroundSubagentInfo, SubagentMessageOptions, SubagentMessageOutcome } from '@prismshadow/penguin-core';
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
3
  import { Slot, Opaque } from '@prismshadow/penguin-core/kernel';
4
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';
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/penguin-core/omnimessage';
7
+ import { SessionSource } from '@prismshadow/amsp';
8
8
  import { Hono } from 'hono';
9
9
  import '@prismshadow/penguin-hmr';
10
10
 
@@ -197,6 +197,12 @@ interface CreateTerminalSessionOptions {
197
197
  cwd: string;
198
198
  /** Owning user id — a shell is the most privileged thing this server hands out. */
199
199
  ownerUserId: string;
200
+ /**
201
+ * The conversation (PenguinHarness Session) this shell was opened for — not this object's own
202
+ * id. A label the Web App files the shell under, so each conversation lists only its own; null
203
+ * for a shell no conversation asked for (the API, the CLI, the standalone /terminal page).
204
+ */
205
+ sessionId?: string | null;
200
206
  /**
201
207
  * Stable per-user display number (tmux-style), assigned by the manager at creation. It
202
208
  * travels with the terminal for its whole life — UI numbering must never depend on list
@@ -256,6 +262,8 @@ interface TerminalSessionInfo {
256
262
  name: string;
257
263
  cwd: string;
258
264
  ownerUserId: string;
265
+ /** The conversation the shell belongs to, or null (see CreateTerminalSessionOptions.sessionId). */
266
+ sessionId: string | null;
259
267
  title: string | null;
260
268
  cols: number;
261
269
  rows: number;
@@ -274,6 +282,8 @@ declare class TerminalSession {
274
282
  readonly ownerUserId: string;
275
283
  readonly createdAt: Date;
276
284
  private name;
285
+ /** The conversation this shell belongs to; changes only when that conversation's id does. */
286
+ private owningSession;
277
287
  private readonly terminal;
278
288
  private readonly ptyProcess;
279
289
  private readonly inputMode;
@@ -293,6 +303,8 @@ declare class TerminalSession {
293
303
  get exit(): TerminalExitInfo | null;
294
304
  info(): TerminalSessionInfo;
295
305
  rename(name: string): void;
306
+ /** Files the shell under another conversation — the same one, once its id has self-healed. */
307
+ setSession(sessionId: string | null): void;
296
308
  write(data: string): void;
297
309
  /**
298
310
  * Applies a size request under the claim/update ownership rule, resizing both the pty and
@@ -324,6 +336,8 @@ declare class TerminalSession {
324
336
  interface CreateTerminalRequest {
325
337
  cwd: string;
326
338
  ownerUserId: string;
339
+ /** The conversation the shell is opened for; absent or null for none. */
340
+ sessionId?: string | null;
327
341
  name?: string;
328
342
  cols?: number;
329
343
  rows?: number;
@@ -372,8 +386,8 @@ interface RecallableFile {
372
386
 
373
387
  /** The open streaming fragments of running sessions, as their holder uses them — what {@link LiveTailTracker} implements. */
374
388
  interface LiveTail {
375
- observe(sessionId: string, msg: OmniMessage): void;
376
- fragments(sessionId: string): OmniMessage[];
389
+ observe(sessionId: string, msg: AmspRecord): void;
390
+ fragments(sessionId: string): AmspRecord[];
377
391
  clear(sessionId: string): void;
378
392
  }
379
393
 
@@ -527,14 +541,14 @@ interface SessionRow {
527
541
  */
528
542
 
529
543
  interface PendingApproval {
530
- toolCall: OmniMessage<ToolCallPayload>;
544
+ toolCall: AmspRecord<ToolCallPayload>;
531
545
  origin?: string[];
532
546
  }
533
547
  /** A Session runtime's pending approvals, as its holder uses them — what {@link ApprovalRegistry} implements. */
534
548
  interface Approvals {
535
549
  readonly size: number;
536
550
  list(): PendingApproval[];
537
- wait(toolCall: OmniMessage<ToolCallPayload>): Promise<ApprovalDecision>;
551
+ wait(toolCall: AmspRecord<ToolCallPayload>): Promise<ApprovalDecision>;
538
552
  decide(toolCallId: string, decision: ApprovalDecision): boolean;
539
553
  denyAll(): void;
540
554
  denyMain(): void;
@@ -543,7 +557,7 @@ interface Approvals {
543
557
  /** A numbered channel event; `id` is `<epoch>-<seq>`, `data` is serialized single-line JSON. */
544
558
  interface ChannelEvent {
545
559
  id: string;
546
- /** SSE event name; omitted (OmniMessage) means no `event:` line. */
560
+ /** SSE event name; omitted (a record) means no `event:` line. */
547
561
  event?: string;
548
562
  data: string;
549
563
  }
@@ -768,6 +782,13 @@ interface TitleNotifier {
768
782
  * written before the source was required, which records none.
769
783
  */
770
784
  type RecordedSource = SessionSource | null;
785
+ /**
786
+ * Who is reading a list, as far as the listing rule cares: a server that adopted this one as a
787
+ * machine at `adoptedAt` (read from {@link ADOPTED_AT_HEADER}), or anyone else (`{}`).
788
+ */
789
+ interface ListingView {
790
+ adoptedAt?: string;
791
+ }
771
792
 
772
793
  /** One indexed Trace shard. */
773
794
  interface TraceFileRow {
@@ -834,7 +855,7 @@ declare abstract class TraceIndex {
834
855
  fileIndex: number;
835
856
  date: string;
836
857
  sizeBytes: number;
837
- records: OmniMessage[];
858
+ records: AmspRecord[];
838
859
  }): void;
839
860
  abstract removeSession(projectId: string, agentId: string, sessionId: string): void;
840
861
  abstract removeAgent(projectId: string, agentId: string): void;
@@ -868,7 +889,7 @@ interface PlatformModelCatalog {
868
889
  models: PlatformCatalogModel[];
869
890
  }
870
891
  /**
871
- * Catalog merge result. `updated` counts route migrations; existing metadata is preserved.
892
+ * Catalog merge result. `updated` counts changes to existing prices, promotions or routes.
872
893
  */
873
894
  interface PlatformModelApplyResult {
874
895
  added: number;
@@ -896,6 +917,8 @@ type UtilityCompletion = {
896
917
  /** ProjectConfigStore: the mechanism ProjectConfigService implements. */
897
918
  declare abstract class ProjectConfigStore {
898
919
  abstract readRaw(projectId: string): Promise<RawTable>;
920
+ /** 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. */
921
+ abstract migrateStoredConfigs(): Promise<void>;
899
922
  abstract loadConfig(projectId: string): Promise<ProjectConfig>;
900
923
  abstract writeRaw(projectId: string, data: RawTable): Promise<void>;
901
924
  abstract writeInitialConfig(projectId: string, name: string): Promise<void>;
@@ -943,9 +966,8 @@ declare abstract class ProjectConfigStore {
943
966
  abstract getModelApiKey(projectId: string, provider: string, modelId: string): Promise<string | undefined>;
944
967
  /**
945
968
  * The key a group's account balance is read with: the group key (never a row's own), or
946
- * else the environment key a Session on one of the group's rows would use on its effective
947
- * endpoint, when that variable's official endpoint is the balance endpoint's own host.
948
- * Server-side only.
969
+ * else the vendor's environment key where MMSP's vendor client reads it for the group's base
970
+ * URL (none, or the vendor's own default endpoint). Server-side only.
949
971
  */
950
972
  abstract getGroupBalanceKey(projectId: string, provider: string): Promise<string | undefined>;
951
973
  abstract setModelApiKeyResolver(resolver: (context: ModelRequestContext) => Promise<string | undefined>): void;
@@ -1103,9 +1125,11 @@ declare class SessionService {
1103
1125
  * Session the user never kept reads archived, and a subagent with a stray mark does not.
1104
1126
  *
1105
1127
  * `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.
1128
+ * organization is a point lookup, which is what the single-Session paths want. `view` is who
1129
+ * is reading (sourceSeenBy): a server that adopted this one sees its earlier Sessions as CLI
1130
+ * tasks, in `source` and `archived` alike.
1107
1131
  */
1108
- toInfo(row: SessionRow, hasTrace: boolean, orgIds?: ReadonlyMap<string, string>): Promise<SessionInfo>;
1132
+ toInfo(row: SessionRow, hasTrace: boolean, orgIds?: ReadonlyMap<string, string>, view?: ListingView): Promise<SessionInfo>;
1109
1133
  /**
1110
1134
  * A Session's source, with session_meta as the single source of truth: the in-process
1111
1135
  * registry answers first (populated at creation / subagent registration / forks / adoption /
@@ -1115,9 +1139,11 @@ declare class SessionService {
1115
1139
  * no source is read with the row's client (readRecordedSource). A Session with no Trace yet
1116
1140
  * is NOT cached — its meta appears with the first run — and reads as its row says
1117
1141
  * (unrunSource): the organization runtime's as `company`, the Agent API's as `api`, any other
1118
- * as unknown.
1142
+ * as unknown. What the reader sees of it (sourceSeenBy) is applied last and never cached.
1119
1143
  */
1120
1144
  private sourceOf;
1145
+ /** The source as recorded (see sourceOf), whoever reads it. */
1146
+ private recordedSourceOf;
1121
1147
  /** Whether this Session already has a Trace record (a Task has been run): answered by the index (reconciled first). */
1122
1148
  hasTrace(row: SessionRow): Promise<boolean>;
1123
1149
  /**
@@ -1132,7 +1158,7 @@ declare class SessionService {
1132
1158
  * through the trace index once (hasTrace reconciles the Agent), so a subagent Session is
1133
1159
  * known for one even before any list has walked it.
1134
1160
  */
1135
- listingOf(row: SessionRow): Promise<SessionCategory | null>;
1161
+ listingOf(row: SessionRow, view?: ListingView): Promise<SessionCategory | null>;
1136
1162
  /**
1137
1163
  * List, sorted by createdAt descending — or, with `order: "activity"`, by lastActiveAt
1138
1164
  * descending (ties by sessionId, see {@link compareActivityDesc}). Every row is served
@@ -1189,6 +1215,9 @@ declare class SessionService {
1189
1215
  * stays `user`, and a row the organization caches name before the reconcile pass stamps it
1190
1216
  * reads as `user`. Without the flag every row is served, whichever client created it, but
1191
1217
  * for that rule.
1218
+ *
1219
+ * `view` is who reads the list (sourceSeenBy): every row is classified and served as that
1220
+ * reader sees it.
1192
1221
  */
1193
1222
  listSessions(projectId: string, agentId: string, opts?: {
1194
1223
  paging?: SessionListPaging;
@@ -1197,6 +1226,7 @@ declare class SessionService {
1197
1226
  workspaceGroup?: string;
1198
1227
  withCounts?: boolean;
1199
1228
  excludeOrg?: boolean;
1229
+ view?: ListingView;
1200
1230
  }): Promise<{
1201
1231
  sessions: SessionInfo[];
1202
1232
  counts?: SessionCategoryCounts;
@@ -1210,9 +1240,9 @@ declare class SessionService {
1210
1240
  * and `excludeOrg`, classified the same way — with the source each was classified by and
1211
1241
  * whether it has a Trace. It builds no SessionInfo: the page makes one (toInfo) only for the
1212
1242
  * rows a response carries, so a request costs a classification per archived row, not a full
1213
- * row view per archived row.
1243
+ * row view per archived row. `view` is who reads it, as for listSessions.
1214
1244
  */
1215
- archivedRows(projectId: string, agentId: string): Promise<ArchivedRow[]>;
1245
+ archivedRows(projectId: string, agentId: string, view?: ListingView): Promise<ArchivedRow[]>;
1216
1246
  /**
1217
1247
  * The rows a list walk starts from: the Agent's index rows, an organization's left out when
1218
1248
  * `excludeOrg` asks (see listSessions), with the Project's organization map; and when any row
@@ -1382,7 +1412,7 @@ declare class ModelScopeAuthService {
1382
1412
  private sweep;
1383
1413
  private evictOldest;
1384
1414
  }
1385
- declare const ModelScopeAuth_base: (abstract new () => Pick<ModelScopeAuthService, "status" | "start" | "retryApply" | "cancel" | "ensureFresh">) & (<C>(target: C, context: ClassDecoratorContext) => C);
1415
+ declare const ModelScopeAuth_base: (abstract new () => Pick<ModelScopeAuthService, "status" | "start" | "cancel" | "retryApply" | "ensureFresh">) & (<C>(target: C, context: ClassDecoratorContext) => C);
1386
1416
  /** The per-App ModelScope key authorization capability consumed by Project model routes. */
1387
1417
  declare abstract class ModelScopeAuth extends ModelScopeAuth_base {
1388
1418
  }
@@ -1395,10 +1425,10 @@ type RunOpts = {
1395
1425
  };
1396
1426
  interface RuntimeSession {
1397
1427
  readonly sessionId: string;
1398
- run(newMessages: OmniMessage[], opts: RunOpts): AsyncGenerator<OmniMessage>;
1428
+ run(newMessages: AmspRecord[], opts: RunOpts): AsyncGenerator<AmspRecord>;
1399
1429
  compact(opts: {
1400
1430
  signal: AbortSignal;
1401
- }): AsyncGenerator<OmniMessage>;
1431
+ }): AsyncGenerator<AmspRecord>;
1402
1432
  /**
1403
1433
  * The running context's model (core `Session.provider` / `Session.modelId`, getters over
1404
1434
  * the context's session_meta): the row's pair at creation, moved by each in-session switch
@@ -1419,7 +1449,7 @@ interface RuntimeSession {
1419
1449
  provider: string;
1420
1450
  modelId: string;
1421
1451
  signal: AbortSignal;
1422
- }): AsyncGenerator<OmniMessage, StopReason>;
1452
+ }): AsyncGenerator<AmspRecord, StopReason>;
1423
1453
  /**
1424
1454
  * The Session's thinking level (core `Session.thinkingLevel`, plain state): soft-limited —
1425
1455
  * an assignment applies from the Session's very next LLM request. Optional: test fakes may
@@ -1429,14 +1459,14 @@ interface RuntimeSession {
1429
1459
  /** Whether compaction is possible and why; when not ok, compact() yields no messages (see core ContextEngine.compactability). */
1430
1460
  compactability(): CompactAvailability;
1431
1461
  /** Queues a mid-run steering input (core `Session.steer`); false when no Task is running. */
1432
- steer(input: OmniMessage[]): boolean;
1462
+ steer(input: AmspRecord[]): boolean;
1433
1463
  /**
1434
1464
  * Withdraws a steering input queued via `steer` before core delivers it (core
1435
1465
  * `Session.unsteer`, matched by input-list identity); false when it is no longer queued —
1436
1466
  * already delivered, or the run exited. Optional: test fakes may omit it, in which case
1437
1467
  * every recall reports "already delivered".
1438
1468
  */
1439
- unsteer?(input: OmniMessage[]): boolean;
1469
+ unsteer?(input: AmspRecord[]): boolean;
1440
1470
  /** Skips the in-progress reconnect backoff, firing the next retry immediately (core `Session.skipReconnectWait`); false when no wait is in progress. */
1441
1471
  skipReconnectWait(): boolean;
1442
1472
  /**
@@ -1446,6 +1476,13 @@ interface RuntimeSession {
1446
1476
  * Optional: test fakes may omit it, reading as nothing held.
1447
1477
  */
1448
1478
  hasPendingInput?(): boolean;
1479
+ /**
1480
+ * Whether the next Task opens a new Trace file (core `Session.contextOpenPending`): a
1481
+ * compaction left the next context's file to its first write, so that Task streams the new
1482
+ * `session_meta` behind its `task_begin`, and the input echo waits for it (see InputEcho).
1483
+ * Optional: test fakes may omit it, reading as no.
1484
+ */
1485
+ contextOpenPending?(): boolean;
1449
1486
  /**
1450
1487
  * Runs the named package's `user_prompt` hook (core `Session.runUserPromptHook` — hooks
1451
1488
  * run in core and nowhere else); null = the package is not installed or names no such
@@ -1477,13 +1514,13 @@ interface RuntimeSession {
1477
1514
  */
1478
1515
  onBackgroundNotice?(listener: () => void): void;
1479
1516
  /** Takes the queued background completion notices as task input (core `Session.takeBackgroundNotices`). Optional, like onBackgroundNotice. */
1480
- takeBackgroundNotices?(): OmniMessage[];
1517
+ takeBackgroundNotices?(): AmspRecord[];
1481
1518
  /** Whether completion notices are still queued (core `Session.hasPendingBackgroundNotices`); pins the entry against idle eviction. Optional, like onBackgroundNotice. */
1482
1519
  hasPendingBackgroundNotices?(): boolean;
1483
1520
  /** Refreshes the listen-port probes behind the process list's `serviceUrl` (core `Session.probeBackgroundCommandServices`). Optional: test fakes may omit it. */
1484
1521
  probeBackgroundCommandServices?(): Promise<void>;
1485
1522
  /** 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: OmniMessage) => void): void;
1523
+ onBackgroundMessage?(listener: (msg: AmspRecord) => void): void;
1487
1524
  /** Background command processes owned by the Session's environment (core `Session.listBackgroundCommands`). Optional: test fakes may omit it. */
1488
1525
  listBackgroundCommands?(): BackgroundCommandInfo[];
1489
1526
  /** Kills one background command process (core `Session.killBackgroundCommand`); false when the id is unknown. Optional, like listBackgroundCommands. */
@@ -1495,7 +1532,7 @@ interface RuntimeSession {
1495
1532
  /** All live subagent child sessions of the Session's environment (core `Session.listBackgroundSubagents`). Optional, like listBackgroundCommands. */
1496
1533
  listBackgroundSubagents?(): BackgroundSubagentInfo[];
1497
1534
  /** 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: OmniMessage[], opts?: SubagentMessageOptions): Promise<SubagentMessageOutcome>;
1535
+ sendToBackgroundSubagent?(childSessionId: string, messages: AmspRecord[], opts?: SubagentMessageOptions): Promise<SubagentMessageOutcome>;
1499
1536
  /** Subscribes the host's session-lifetime fallback approval sink for child sessions (core `Session.setSubagentApprovalFallback`). Optional. */
1500
1537
  setSubagentApprovalFallback?(approve: ApproveFn): void;
1501
1538
  /** Aborts one child session's current run, keeping the session (core `Session.abortBackgroundSubagentRun`); false when unknown or idle. Optional. */
@@ -1513,13 +1550,13 @@ interface RuntimeSession {
1513
1550
  interface SessionLoader {
1514
1551
  /**
1515
1552
  * Load a runtime Session from an index row: recover (with a Trace) or self-heal
1516
- * rebuild (no Trace, session_id will change). Throws HttpError(409) for unrecoverable
1553
+ * rebuild (no Trace, under the row's session_id). Throws HttpError(409) for unrecoverable
1517
1554
  * cases such as a missing Workspace.
1518
1555
  */
1519
1556
  load(row: SessionRow): Promise<RuntimeSession>;
1520
1557
  }
1521
1558
  interface UsageRecorderLike {
1522
- record(ctx: UsageContext, msg: OmniMessage): Promise<void>;
1559
+ record(ctx: UsageContext, msg: AmspRecord): Promise<void>;
1523
1560
  }
1524
1561
  interface SessionManagerDeps {
1525
1562
  /** 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 +1567,12 @@ interface SessionManagerDeps {
1530
1567
  /** Session-origin registry (session_meta is the single source of truth; subagent registration records the forwarded meta's source here). */
1531
1568
  sources: SessionOrigins;
1532
1569
  recorder: UsageRecorderLike;
1570
+ /**
1571
+ * The data root, for what is read off an Agent's state on disk before a Session is loaded
1572
+ * (startGoal's goal-plugin check). Optional: a manager built without one — unit tests on a
1573
+ * fake loader — skips those reads, and the loaded Session's own answer decides.
1574
+ */
1575
+ root?: string;
1533
1576
  /** Automatic Session title generation (optional: not injected in tests or when disabled). */
1534
1577
  titles?: TitleNotifier;
1535
1578
  /** Error persistence (optional: without it, only logs — same as before this was wired up). */
@@ -1576,7 +1619,7 @@ interface RecallStore {
1576
1619
  interface QueuedFollowUp {
1577
1620
  /** Recall handle (PendingFollowUpInfo.id), assigned at queue time. */
1578
1621
  id: string;
1579
- input: OmniMessage[];
1622
+ input: AmspRecord[];
1580
1623
  /**
1581
1624
  * Original content for recall, and the content `task_state` shows on the queued line.
1582
1625
  * Always present: a caller that knows more than the input carries (the HTTP route, which
@@ -1589,7 +1632,7 @@ interface QueuedFollowUp {
1589
1632
  /** 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
1633
  interface PendingSteeringEntry {
1591
1634
  info: PendingSteeringInfo;
1592
- input: OmniMessage[];
1635
+ input: AmspRecord[];
1593
1636
  recall: RecallStore;
1594
1637
  }
1595
1638
  /** Active-table entry: a loaded runtime Session plus its running state. */
@@ -1631,7 +1674,7 @@ interface RuntimeEntry {
1631
1674
  * the input publish, so the live channel cannot backfill it either. GET /messages
1632
1675
  * appends the ones the Trace has not caught up to yet (exact-envelope dedup).
1633
1676
  */
1634
- pendingInputs: OmniMessage[];
1677
+ pendingInputs: AmspRecord[];
1635
1678
  /**
1636
1679
  * The running Task's streamed bootstrap records (mcp_connect begin/end,
1637
1680
  * tool_list_ready), held until the run ends. Their Trace writes are deferred by the
@@ -1640,7 +1683,7 @@ interface RuntimeEntry {
1640
1683
  * otherwise show nothing at all (a silent blank while a slow server times out).
1641
1684
  * GET /messages appends whichever of them the Trace has not caught up to.
1642
1685
  */
1643
- pendingBootstrap: OmniMessage[];
1686
+ pendingBootstrap: AmspRecord[];
1644
1687
  /**
1645
1688
  * Steering messages queued on core but not yet delivered to the model — a display mirror
1646
1689
  * of core's steering queue (same FIFO order), so the composer's "steering queued" hint and
@@ -1736,7 +1779,7 @@ declare class SessionManager {
1736
1779
  * the resume fallback names the child's owning Agent from its own session row, which must
1737
1780
  * belong to the parent's project.
1738
1781
  */
1739
- sendToSubagent(sessionId: string, childSessionId: string, messages: OmniMessage[]): Promise<SubagentMessageOutcome>;
1782
+ sendToSubagent(sessionId: string, childSessionId: string, messages: AmspRecord[]): Promise<SubagentMessageOutcome>;
1740
1783
  /**
1741
1784
  * Sets a Session's thinking level on its loaded runtime (core `Session.thinkingLevel`,
1742
1785
  * plain state): the row's value is what the loader applies at load, so this only needs to
@@ -1752,12 +1795,12 @@ declare class SessionManager {
1752
1795
  /** Queued follow-up tasks awaiting auto-start, as their display/recall info (id + content summary). */
1753
1796
  pendingFollowUpsOf(sessionId: string): PendingFollowUpInfo[];
1754
1797
  /**
1755
- * Live tail of a running session: one synthetic `partial_* start` OmniMessage per open
1798
+ * Live tail of a running session: one synthetic `partial_* start` AmspRecord per open
1756
1799
  * streaming fragment, carrying the full accumulated content so far (see live-tail.ts).
1757
1800
  * Empty when idle or when nothing is streaming. GET /messages attaches this (with a
1758
1801
  * channel cursor) so a client joining mid-stream can render the in-progress message.
1759
1802
  */
1760
- liveFragments(sessionId: string): OmniMessage[];
1803
+ liveFragments(sessionId: string): AmspRecord[];
1761
1804
  /**
1762
1805
  * The running Task's input messages as published at launch; empty when idle. The engine
1763
1806
  * writes these exact envelopes to the Trace only after the first run's bootstrap (MCP
@@ -1765,9 +1808,9 @@ declare class SessionManager {
1765
1808
  * not caught up to yet — without this, a client rebuilding history during the connect
1766
1809
  * (the draft flow subscribes only after the input publish) loses the user's own message.
1767
1810
  */
1768
- pendingInputs(sessionId: string): OmniMessage[];
1811
+ pendingInputs(sessionId: string): AmspRecord[];
1769
1812
  /** The running Task's streamed bootstrap records (see RuntimeEntry.pendingBootstrap); empty when idle. */
1770
- pendingBootstrap(sessionId: string): OmniMessage[];
1813
+ pendingBootstrap(sessionId: string): AmspRecord[];
1771
1814
  /** Number of Sessions for this Agent that are currently running / compacting. */
1772
1815
  activeCountForAgent(projectId: string, agentId: string): number;
1773
1816
  /** Add a newly created Session to the active table (status idle), avoiding a redundant load on the next Task. */
@@ -1855,7 +1898,7 @@ declare class SessionManager {
1855
1898
  * caller's store is read off the input, so a queued follow-up is recallable and shows
1856
1899
  * its content whichever path queued it.
1857
1900
  */
1858
- startTask(sessionId: string, input: OmniMessage[], opts?: {
1901
+ startTask(sessionId: string, input: AmspRecord[], opts?: {
1859
1902
  queueIfBusy?: boolean;
1860
1903
  recall?: RecallStore;
1861
1904
  }): Promise<{
@@ -1885,13 +1928,15 @@ declare class SessionManager {
1885
1928
  * `user_prompt` hook (hooks run in core and nowhere else — `Session.runUserPromptHook`)
1886
1929
  * writes the Session's goal file and answers the round-1 protocol message; it runs under
1887
1930
  * the session lock AFTER the idle check, since it overwrites the goal file a running goal
1888
- * is reading. Not installed (null) is the route's 409; an empty answer a 500. Round inputs
1931
+ * is reading. An Agent without the goal plugin's hook package is refused with the route's
1932
+ * 409 before the Session is even loaded (goal-plugin.ts); a loaded Session whose hook
1933
+ * answers null is the same 409, and an empty answer a 500. Round inputs
1889
1934
  * are yielded by core and published like any streamed message; progress additionally goes
1890
1935
  * out as goal_* server events (the run state itself is the goal file the plugin maintains).
1891
1936
  */
1892
1937
  startGoal(sessionId: string, args: {
1893
1938
  /** The user's own message(s) exactly as submitted — text and images, no wrapping. */
1894
- messages: OmniMessage[];
1939
+ messages: AmspRecord[];
1895
1940
  /** The user's own objective text (leading marker blocks stripped): what the plugin records, the goal_started event and the title material. */
1896
1941
  objective: string;
1897
1942
  budget: number;
@@ -1901,7 +1946,7 @@ declare class SessionManager {
1901
1946
  /**
1902
1947
  * Taps a goal run's stream for `drive`: round boundaries become goal_round events —
1903
1948
  * round 1 from the seeded input (core never yields a run's initial input, so it is
1904
- * counted here, where startGoal published it), later rounds from the stop-hook continues
1949
+ * counted here, from what startGoal echoes), later rounds from the stop-hook continues
1905
1950
  * core yields, each announced by the hook's `continue` event; a harness-stamped input
1906
1951
  * nothing announced is another package's user_prompt context riding behind the
1907
1952
  * objective, not a round — and the goal hook's `stop` event becomes the
@@ -1914,9 +1959,9 @@ declare class SessionManager {
1914
1959
  /** Closes a goal as aborted for the UI (stream cut off / infrastructure failure). */
1915
1960
  private finishAborted;
1916
1961
  /**
1917
- * Shared task launch (fresh tasks, auto-started follow-ups and retries): flips to running,
1918
- * publishes the input, and drives the run. Caller holds the session lock and has verified
1919
- * idle. A retry's input is empty: nothing is published or held, and drive gets no title
1962
+ * Shared task launch (fresh tasks, auto-started follow-ups and retries): flips to running
1963
+ * and drives the run, which echoes the input. Caller holds the session lock and has verified
1964
+ * idle. A retry's input is empty: nothing is echoed or held, and drive gets no title
1920
1965
  * material — the turn it resends already offered its text when it was first sent.
1921
1966
  */
1922
1967
  private launchTask;
@@ -1996,7 +2041,7 @@ declare class SessionManager {
1996
2041
  * keeps the composer's "steering queued" hint, content included, alive across reloads —
1997
2042
  * and the content itself is what a recall (recallSteering) hands back to the composer.
1998
2043
  */
1999
- steer(sessionId: string, input: OmniMessage[], recall: RecallStore): void;
2044
+ steer(sessionId: string, input: AmspRecord[], recall: RecallStore): void;
2000
2045
  /**
2001
2046
  * Recall an undelivered steering message (#287): withdraw it from core's queue and the
2002
2047
  * display mirror, re-broadcast state, and hand back its original content for the composer
@@ -2152,12 +2197,10 @@ declare class SessionManager {
2152
2197
  * a Task arriving mid-load waits for this load instead of starting a second one.
2153
2198
  *
2154
2199
  * 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. So does one with no Trace yet,
2156
- * because loading it is a self-heal REBUILD under a new session id — that would move the
2157
- * Session out from under the binding that asked, and earlier than any Task would. The row's
2158
- * `hasTrace` is a cache, so a row that has not caught up only misses the warm-up. Any other
2159
- * load failure rejects; the first Task meets the same failure and reports it where a person
2160
- * will see it.
2200
+ * nothing to warm and the caller has nothing to do about it. One that never ran is rebuilt
2201
+ * under its own id (see createCoreSessionLoader), so the binding that asked keeps its Session.
2202
+ * Any other load failure rejects; the first Task meets the same failure and reports it where a
2203
+ * person will see it.
2161
2204
  */
2162
2205
  preload(sessionId: string): Promise<void>;
2163
2206
  private assertOpen;
@@ -2168,7 +2211,9 @@ declare class SessionManager {
2168
2211
  private assertIdle;
2169
2212
  private generationOf;
2170
2213
  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 on self-heal. */
2214
+ /** 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. */
2215
+ /** startGoal's check before the load (goal-plugin.ts); an unknown id is left to ensureEntry's 404. */
2216
+ private assertGoalPluginInstalled;
2172
2217
  private ensureEntry;
2173
2218
  /**
2174
2219
  * Auto-start of queued background completion notices: called when core signals an
@@ -2182,7 +2227,8 @@ declare class SessionManager {
2182
2227
  * Drive the output stream in the background: publish each message + persist usage +
2183
2228
  * persist LLM/tool errors; on completion (including errors) resets to idle and pushes
2184
2229
  * 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.
2230
+ * a title): its user text drives automatic title generation at run start, and its `echo`
2231
+ * is the run's input, published right behind the run's first `task_begin` (see InputEcho).
2186
2232
  */
2187
2233
  private drive;
2188
2234
  /**
@@ -2357,7 +2403,7 @@ interface AgentListItem {
2357
2403
  kernelOutdated: boolean;
2358
2404
  /** Number of vault keys. */
2359
2405
  vaultKeyCount: number;
2360
- /** Number of scheduled tasks (count of .toml files under schedule/, including invalid ones). */
2406
+ /** Number of scheduled tasks (count of .toml files directly under schedule/, including invalid ones; archived files under schedule/expired/ are not counted). */
2361
2407
  scheduleCount: number;
2362
2408
  /** Workbench folders with a manifest, including ones with a load error. */
2363
2409
  workbenchCount: number;
@@ -2388,7 +2434,7 @@ declare class AgentService implements AgentLifecycle {
2388
2434
  takenAgentIds(projectId: string): Promise<string[]>;
2389
2435
  /** Number of vault keys (falls back to 0 on read failure). */
2390
2436
  private vaultKeyCount;
2391
- /** Number of scheduled tasks: count of .toml files under schedule/ (0 if the directory doesn't exist). */
2437
+ /** 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
2438
  private scheduleCount;
2393
2439
  /**
2394
2440
  * One pass over `skills/` and one over `hooks/`, answering the card's questions: how many
@@ -2844,7 +2890,7 @@ type AppEnv = {
2844
2890
  /** Minimal dependency on SessionManager (eases test doubles; mirrors ScheduleTaskRunner). */
2845
2891
  interface MessagingTaskRunnerShape {
2846
2892
  statusOf(sessionId: string): string;
2847
- startTask(sessionId: string, input: OmniMessage[],
2893
+ startTask(sessionId: string, input: AmspRecord[],
2848
2894
  /**
2849
2895
  * `recall` is what a queued follow-up hands back when the user withdraws it in the Web
2850
2896
  * App. It is optional because the manager derives one from the input for every caller
@@ -3322,9 +3368,18 @@ interface PluginConfigSlots {
3322
3368
  groups: Slot<SettingsGroupDecl>;
3323
3369
  }
3324
3370
 
3325
- /** The assembled business surface: one request in, one response (or a decline) out. */
3371
+ /**
3372
+ * The assembled business surface: one request in, one response (or a decline) out.
3373
+ *
3374
+ * `fetchAs` is the same surface entered as a user already established by other means — the
3375
+ * API socket (socket/serve.ts), whose handshake the runtime authenticated and whose owner it
3376
+ * checked before the platform ever saw the socket. Those requests carry no cookie, so the
3377
+ * gate in front of the routes is not the cookie one but "this user": the routes themselves,
3378
+ * their authorization and their errors are identical.
3379
+ */
3326
3380
  declare abstract class Http {
3327
3381
  abstract fetch(request: Opaque<"Request", Request>): Promise<Opaque<"Response", Response>>;
3382
+ abstract fetchAs(userId: string, request: Opaque<"Request", Request>): Promise<Opaque<"Response", Response>>;
3328
3383
  }
3329
3384
  interface HttpSlots {
3330
3385
  /**
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-G7GY7PJU.js";
16
16
  import {
17
17
  openDatabase
18
- } from "./chunk-3SFJKLQU.js";
18
+ } from "./chunk-HPOHMZCH.js";
19
19
  import "./chunk-B5IP37ZQ.js";
20
20
 
21
21
  // src/reset-admin-password.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  versionReport
3
- } from "./chunk-QFV3ERQO.js";
4
- import "./chunk-LPPVGHYD.js";
3
+ } from "./chunk-OQZDL3TR.js";
4
+ import "./chunk-BL4U7GYY.js";
5
5
  import "./chunk-B5IP37ZQ.js";
6
6
  export {
7
7
  versionReport
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismshadow/penguin-server",
3
- "version": "0.2.16",
3
+ "version": "0.2.17",
4
4
  "type": "module",
5
5
  "description": "PenguinHarness web server: multi-user authentication and authorization, Session execution with SSE streaming, and usage accounting, built on @prismshadow/penguin-core.",
6
6
  "license": "Apache-2.0",
@@ -18,6 +18,10 @@
18
18
  "types": "./dist/api/types.d.ts",
19
19
  "import": "./dist/api/types.js"
20
20
  },
21
+ "./model-catalog": {
22
+ "types": "./dist/model-catalog.d.ts",
23
+ "import": "./dist/model-catalog.js"
24
+ },
21
25
  "./machine-status": {
22
26
  "types": "./dist/machine-status.d.ts",
23
27
  "import": "./dist/machine-status.js"
@@ -63,32 +67,33 @@
63
67
  "dependencies": {
64
68
  "@hono/node-server": "^2.0.5",
65
69
  "@larksuiteoapi/node-sdk": "^1.73.0",
70
+ "@prismshadow/mmsp": "^0.5.6",
66
71
  "@xterm/headless": "^5.5.0",
67
72
  "dotenv": "^17.0.0",
68
73
  "fflate": "^0.8.3",
69
- "hono": "^4.12.34",
74
+ "hono": "^4.13.11",
70
75
  "node-pty": "^1.1.0",
71
76
  "remark-gfm": "^4.0.0",
72
77
  "remark-parse": "^11.0.0",
73
- "smol-toml": "^1.3.0",
78
+ "smol-toml": "^1.9.1",
74
79
  "tar": "^7.5.21",
75
80
  "typescript": "^5.6.0",
76
- "undici": "^7.29.0",
81
+ "undici": "^7.29.1",
77
82
  "unified": "^11.0.5",
78
83
  "ws": "^8.18.3",
79
84
  "yaml": "^2.5.0",
80
- "@prismshadow/amsp": "0.2.16",
81
- "@prismshadow/penguin-core": "0.2.16"
85
+ "@prismshadow/penguin-core": "0.2.17",
86
+ "@prismshadow/amsp": "0.2.17"
82
87
  },
83
88
  "devDependencies": {
84
89
  "@types/mdast": "^4.0.4",
85
90
  "@types/node": "^24.0.0",
86
91
  "@types/ws": "^8.18.1",
87
- "@vitest/coverage-v8": "^3.2.6",
92
+ "@vitest/coverage-v8": "4.1.12",
88
93
  "tsup": "^8.3.0",
89
94
  "tsx": "^4.20.0",
90
- "vitest": "^3.2.6",
91
- "@prismshadow/penguin-hmr": "0.2.16"
95
+ "vitest": "^4.1.12",
96
+ "@prismshadow/penguin-hmr": "0.2.17"
92
97
  },
93
98
  "files": [
94
99
  "dist",
@@ -1 +1 @@
1
- import{g as p,r as u,d as a}from"./chunk-SVP7TREG-Clk8PdKZ.js";import{p as f}from"./chunk-JWPE2WC7-BAM_oEUU.js";import{_ as n,l as o}from"./mermaid.core-BlUspEsI.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-srLaqJ4e.js";import"./index-BrMpjp2s.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
1
+ import{g as p,r as u,d as a}from"./chunk-SVP7TREG-qJC2SMqr.js";import{p as f}from"./chunk-JWPE2WC7-C2pJzKuW.js";import{_ as n,l as o}from"./mermaid.core-zKzlwpkw.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-BveNWnUV.js";import"./index-BUvJ5Ctt.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};