@prismshadow/penguin-server 0.1.1 → 0.1.2

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.
@@ -48,6 +48,15 @@ interface AuthResponse {
48
48
  }
49
49
  interface MeResponse {
50
50
  user: UserInfo;
51
+ /**
52
+ * Whether Workspace HTML previews open on a separate origin (see design §
53
+ * "Workspace 文件预览"). False means this deployment has no usable preview origin —
54
+ * the App is reached on something other than a loopback name and
55
+ * PENGUIN_PREVIEW_ORIGIN is unset — so previews fall back to the same-origin sandbox,
56
+ * where `localStorage`, cookies and third-party embeds do not work. Computed per
57
+ * request, since it depends on the host the caller is using.
58
+ */
59
+ previewIsolated: boolean;
51
60
  }
52
61
  interface PasswordChangeRequest {
53
62
  oldPassword: string;
@@ -382,13 +391,40 @@ interface SessionInfo {
382
391
  status: SessionStatus;
383
392
  /** Number of approvals awaiting human decision (a persisted count outside server events, for list badges). */
384
393
  pendingApprovalCount: number;
394
+ /** Number of queued follow-up tasks (`queueIfBusy`) awaiting auto-start once the session is idle. */
395
+ pendingFollowUpCount: number;
385
396
  /** Whether a Trace record exists (a Task has been started). */
386
397
  hasTrace: boolean;
387
398
  /** Whether archived (hidden from the default list, grouped under "Archived"). */
388
399
  archived: boolean;
400
+ /**
401
+ * Absolute path of the session's latest Trace file (the current context shard); absent
402
+ * when no Trace exists yet. Populated on the **single-session GET only** — list rows omit
403
+ * it (locating it costs a directory walk per Session). The web's `/model` switch puts it
404
+ * into the new session's `[model_switch_from]` block so the model can read the source
405
+ * history itself when it needs it.
406
+ */
407
+ tracePath?: string;
389
408
  }
409
+ /**
410
+ * Session list category, the sidebar's four-way split applied server-side: archived wins
411
+ * regardless of origin (archiving is an explicit user action), then the origin's bucket,
412
+ * and a Session with no (or an unknown) source is `active` — user-created rows.
413
+ */
414
+ type SessionCategory = "active" | SessionSource | "archived";
415
+ /** Per-category totals across an Agent's whole Session list (returned when the list is requested with counts). */
416
+ type SessionCategoryCounts = Record<SessionCategory, number>;
390
417
  interface SessionsResponse {
391
418
  sessions: SessionInfo[];
419
+ /** Present when the request asked for counts (`counts=1`): totals per category over the full list, not just the returned page. */
420
+ counts?: SessionCategoryCounts;
421
+ /**
422
+ * Present with `counts`: the same totals broken down by Workspace path (only paths
423
+ * with at least one Session appear). The sidebar's workspace grouping decides each
424
+ * group's folders and "More" from its own share, so a group never advertises
425
+ * content that lives in other Workspaces.
426
+ */
427
+ workspaceCounts?: Record<string, SessionCategoryCounts>;
392
428
  }
393
429
  /** Server directory browsing (advanced new-Workspace picker): starts from the home directory by default, can navigate up to the root. */
394
430
  interface DirEntryInfo {
@@ -448,10 +484,35 @@ type TaskInputPart = {
448
484
  };
449
485
  interface TaskCreateRequest {
450
486
  input: TaskInputPart[];
487
+ /**
488
+ * Thinking level for this Task's LLM requests (a per-turn parameter; one of
489
+ * `none | low | medium | high | xhigh`, anything else is a 400). Omitted = falls back to
490
+ * the session's default (the Agent config's `model.thinking_level`). A queued follow-up
491
+ * (`queueIfBusy`) keeps its level and applies it when it auto-starts.
492
+ */
493
+ thinkingLevel?: ThinkingLevelName;
494
+ /**
495
+ * Queue instead of 409 when a Task/compaction is already in progress: the input is held
496
+ * server-side and auto-starts as an ordinary next task once the session returns to idle
497
+ * (in queue order, one at a time). The response then carries `queued: true`.
498
+ */
499
+ queueIfBusy?: boolean;
451
500
  }
452
501
  interface TaskCreateResponse {
453
502
  /** Current actual session_id: a Trace-less invalid Session self-heals and returns a new id; the frontend updates its route accordingly. */
454
503
  sessionId: string;
504
+ /** True when `queueIfBusy` enqueued the input as a follow-up instead of starting it (absent/false: the task started). */
505
+ queued?: boolean;
506
+ }
507
+ /**
508
+ * Mid-run steering (POST /api/sessions/:id/steer): a user message for the **running** Task,
509
+ * delivered by core between turns as a standalone `[user_steering]` user message. 202 on
510
+ * queue; 409 `not_running` when no Task is in progress (the frontend falls back to a normal
511
+ * task POST).
512
+ */
513
+ interface SteerRequest {
514
+ /** Non-empty message text (trimmed server-side). */
515
+ text: string;
455
516
  }
456
517
  interface ApprovalDecisionRequest {
457
518
  decision: "allow" | "deny";
@@ -467,10 +528,11 @@ type ServerEvent =
467
528
  toolCall: OmniMessage<ToolCallPayload>;
468
529
  origin?: string[];
469
530
  }
470
- /** Session run status flip (for toggling the input area and list). */
531
+ /** Session run status flip (for toggling the input area and list); `queued` = queued follow-up count (see TaskCreateRequest.queueIfBusy). */
471
532
  | {
472
533
  type: "task_state";
473
534
  state: SessionStatus;
535
+ queued?: number;
474
536
  }
475
537
  /** The model-generated title after the first turn has been persisted (for in-place list updates). */
476
538
  | {
@@ -582,7 +644,7 @@ interface TraceTaskStats {
582
644
  /**
583
645
  * This turn's duration span: `startTs` = the moment of this turn's **first `request_begin`**
584
646
  * — duration only looks at LLM requests, not the timestamp of user text like the user
585
- * Prompt / compaction summary (`<context_summary>` is created during compaction but only
647
+ * Prompt / compaction summary (`[context_summary]` is created during compaction but only
586
648
  * persisted on the next run; resuming the next day would inflate the first turn by a whole
587
649
  * day for no reason); `endTs` = the moment of the last non-session_meta message in the
588
650
  * range. For a degenerate turn with no Request at all (interrupted right after sending),
@@ -984,4 +1046,4 @@ interface SkillInstallRequest {
984
1046
  names: string[];
985
1047
  }
986
1048
 
987
- export type { AdminPasswordResetRequest, AdminUserCreateRequest, AdminUserCreateResponse, AdminUsersResponse, AgentCompactionConfigDto, AgentConfigDto, AgentConfigResponse, AgentConfigUpdateRequest, AgentCreateRequest, AgentCreateResponse, AgentImportRequest, AgentImportResponse, AgentModelConfigDto, AgentSkillsResponse, AgentSummary, AgentTraceDateGroup, AgentTraceFileRef, AgentTraceSessionGroup, AgentTracesResponse, AgentsResponse, ApprovalDecisionRequest, ApprovalMode, AuthLoginRequest, AuthResponse, BenchmarkCaseScore, BenchmarkEvaluation, BenchmarkRunScore, BenchmarkSummary, BenchmarksResponse, CredentialInfo, DirEntryInfo, DirListResponse, ErrorBody, FilesStatRequest, FilesStatResponse, MeResponse, MemberAddRequest, MemberAddResponse, MemberInfo, MembersResponse, MessagesResponse, ModelInfo, ModelPricingDto, ModelRefDto, ModelTestRequest, ModelTestResponse, ModelUpdateEntry, ModelsResponse, ModelsUpdateRequest, PasswordChangeRequest, PrefsResponse, ProjectCreateRequest, ProjectCreateResponse, ProjectRole, ProjectSummary, ProjectsResponse, RequestSpan, ScheduleItem, ScheduleServerEvent, ScheduleStatus, ScheduleUpsertRequest, SchedulesResponse, ServerEvent, SessionCreateRequest, SessionCreateResponse, SessionInfo, SessionPatchRequest, SessionResponse, SessionSource, SessionStatus, SessionTracesResponse, SessionsResponse, SkillGroupItem, SkillInstallRequest, SkillLibraryResponse, SkillMetadataItem, TaskCreateRequest, TaskCreateResponse, TaskInputPart, ToolCallSpan, TraceAnalysisResponse, TraceEventsResponse, TraceFileInfo, TraceModelSegment, TraceTaskStats, TraceToolSpan, UiPrefs, UsageAgentCount, UsageBucket, UsageErrorCount, UsageErrorItem, UsageErrors, UsageGroupBy, UsageGroupRow, UsageResponse, UsageSuccessRate, UsageTrendPoint, UsageTrendPointInTrace, UserInfo, VaultEntryInfo, VaultEntryUpdate, VaultResponse, VaultUpdateRequest, WorkspaceFileEntry, WorkspaceFilesResponse };
1049
+ export type { AdminPasswordResetRequest, AdminUserCreateRequest, AdminUserCreateResponse, AdminUsersResponse, AgentCompactionConfigDto, AgentConfigDto, AgentConfigResponse, AgentConfigUpdateRequest, AgentCreateRequest, AgentCreateResponse, AgentImportRequest, AgentImportResponse, AgentModelConfigDto, AgentSkillsResponse, AgentSummary, AgentTraceDateGroup, AgentTraceFileRef, AgentTraceSessionGroup, AgentTracesResponse, AgentsResponse, ApprovalDecisionRequest, ApprovalMode, AuthLoginRequest, AuthResponse, BenchmarkCaseScore, BenchmarkEvaluation, BenchmarkRunScore, BenchmarkSummary, BenchmarksResponse, CredentialInfo, DirEntryInfo, DirListResponse, ErrorBody, FilesStatRequest, FilesStatResponse, MeResponse, MemberAddRequest, MemberAddResponse, MemberInfo, MembersResponse, MessagesResponse, ModelInfo, ModelPricingDto, ModelRefDto, ModelTestRequest, ModelTestResponse, ModelUpdateEntry, ModelsResponse, ModelsUpdateRequest, PasswordChangeRequest, PrefsResponse, ProjectCreateRequest, ProjectCreateResponse, ProjectRole, ProjectSummary, ProjectsResponse, RequestSpan, ScheduleItem, ScheduleServerEvent, ScheduleStatus, ScheduleUpsertRequest, SchedulesResponse, ServerEvent, SessionCategory, SessionCategoryCounts, SessionCreateRequest, SessionCreateResponse, SessionInfo, SessionPatchRequest, SessionResponse, SessionSource, SessionStatus, SessionTracesResponse, SessionsResponse, SkillGroupItem, SkillInstallRequest, SkillLibraryResponse, SkillMetadataItem, SteerRequest, TaskCreateRequest, TaskCreateResponse, TaskInputPart, ToolCallSpan, TraceAnalysisResponse, TraceEventsResponse, TraceFileInfo, TraceModelSegment, TraceTaskStats, TraceToolSpan, UiPrefs, UsageAgentCount, UsageBucket, UsageErrorCount, UsageErrorItem, UsageErrors, UsageGroupBy, UsageGroupRow, UsageResponse, UsageSuccessRate, UsageTrendPoint, UsageTrendPointInTrace, UserInfo, VaultEntryInfo, VaultEntryUpdate, VaultResponse, VaultUpdateRequest, WorkspaceFileEntry, WorkspaceFilesResponse };