@prismshadow/penguin-server 0.1.0 → 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.
- package/dist/api/types.d.ts +75 -4
- package/dist/index.js +661 -114
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/web-dist/assets/index-BwOLjdOw.css +1 -0
- package/web-dist/assets/index-Ddrpqgqu.js +104 -0
- package/web-dist/assets/{index-B-18IFfR.js → index-zCEa-kcQ.js} +1 -1
- package/web-dist/index.html +2 -2
- package/web-dist/assets/index-BfFhfbzq.css +0 -1
- package/web-dist/assets/index-BhliHHUc.js +0 -101
package/dist/api/types.d.ts
CHANGED
|
@@ -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;
|
|
@@ -159,6 +168,13 @@ interface ModelInfo {
|
|
|
159
168
|
* unset (= treated as supported).
|
|
160
169
|
*/
|
|
161
170
|
vision?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Per-model max output tokens (TOML `max_tokens` annotation; user-only, never preset by the
|
|
173
|
+
* built-in catalog): when set it wins over the Agent's `system_config.model.max_tokens`;
|
|
174
|
+
* unset = inherit the Agent value. Lets a small-context model cap its output below the
|
|
175
|
+
* seeded per-Agent default (32000), which cannot fit into e.g. a 32k context window.
|
|
176
|
+
*/
|
|
177
|
+
maxTokens?: number;
|
|
162
178
|
pricing?: ModelPricingDto;
|
|
163
179
|
/** Environment variable name to fall back to when api_key is empty (e.g. ANTHROPIC_API_KEY); unset if no known fallback. */
|
|
164
180
|
envKey?: string;
|
|
@@ -192,6 +208,8 @@ interface ModelUpdateEntry {
|
|
|
192
208
|
clientType?: string;
|
|
193
209
|
/** Whether image input (vision/multimodal) is supported; omitted = supported (not persisted). */
|
|
194
210
|
vision?: boolean;
|
|
211
|
+
/** Per-model max output tokens, a positive integer (wins over the Agent config); omitted = inherit the Agent value (the annotation is cleared). */
|
|
212
|
+
maxTokens?: number;
|
|
195
213
|
pricing?: ModelPricingDto;
|
|
196
214
|
/** Providing it overwrites and updates createdAt; omitting it keeps the existing value. */
|
|
197
215
|
apiKey?: string;
|
|
@@ -367,19 +385,46 @@ interface SessionInfo {
|
|
|
367
385
|
approvalMode: ApprovalMode;
|
|
368
386
|
/** Short title auto-generated by the model after the first turn; unset until generated (frontend shows "New Chat"). */
|
|
369
387
|
title?: string;
|
|
370
|
-
/** Session source (for list badges); unset for user-created sessions. */
|
|
388
|
+
/** Session source (for list badges/folders), derived from core session_meta — the single source of truth (not stored in the DB); unset for user-created sessions. */
|
|
371
389
|
source?: SessionSource;
|
|
372
390
|
createdAt: string;
|
|
373
391
|
status: SessionStatus;
|
|
374
392
|
/** Number of approvals awaiting human decision (a persisted count outside server events, for list badges). */
|
|
375
393
|
pendingApprovalCount: number;
|
|
394
|
+
/** Number of queued follow-up tasks (`queueIfBusy`) awaiting auto-start once the session is idle. */
|
|
395
|
+
pendingFollowUpCount: number;
|
|
376
396
|
/** Whether a Trace record exists (a Task has been started). */
|
|
377
397
|
hasTrace: boolean;
|
|
378
398
|
/** Whether archived (hidden from the default list, grouped under "Archived"). */
|
|
379
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;
|
|
380
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>;
|
|
381
417
|
interface SessionsResponse {
|
|
382
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>;
|
|
383
428
|
}
|
|
384
429
|
/** Server directory browsing (advanced new-Workspace picker): starts from the home directory by default, can navigate up to the root. */
|
|
385
430
|
interface DirEntryInfo {
|
|
@@ -439,10 +484,35 @@ type TaskInputPart = {
|
|
|
439
484
|
};
|
|
440
485
|
interface TaskCreateRequest {
|
|
441
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;
|
|
442
500
|
}
|
|
443
501
|
interface TaskCreateResponse {
|
|
444
502
|
/** Current actual session_id: a Trace-less invalid Session self-heals and returns a new id; the frontend updates its route accordingly. */
|
|
445
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;
|
|
446
516
|
}
|
|
447
517
|
interface ApprovalDecisionRequest {
|
|
448
518
|
decision: "allow" | "deny";
|
|
@@ -458,10 +528,11 @@ type ServerEvent =
|
|
|
458
528
|
toolCall: OmniMessage<ToolCallPayload>;
|
|
459
529
|
origin?: string[];
|
|
460
530
|
}
|
|
461
|
-
/** 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). */
|
|
462
532
|
| {
|
|
463
533
|
type: "task_state";
|
|
464
534
|
state: SessionStatus;
|
|
535
|
+
queued?: number;
|
|
465
536
|
}
|
|
466
537
|
/** The model-generated title after the first turn has been persisted (for in-place list updates). */
|
|
467
538
|
| {
|
|
@@ -573,7 +644,7 @@ interface TraceTaskStats {
|
|
|
573
644
|
/**
|
|
574
645
|
* This turn's duration span: `startTs` = the moment of this turn's **first `request_begin`**
|
|
575
646
|
* — duration only looks at LLM requests, not the timestamp of user text like the user
|
|
576
|
-
* Prompt / compaction summary (
|
|
647
|
+
* Prompt / compaction summary (`[context_summary]` is created during compaction but only
|
|
577
648
|
* persisted on the next run; resuming the next day would inflate the first turn by a whole
|
|
578
649
|
* day for no reason); `endTs` = the moment of the last non-session_meta message in the
|
|
579
650
|
* range. For a degenerate turn with no Request at all (interrupted right after sending),
|
|
@@ -975,4 +1046,4 @@ interface SkillInstallRequest {
|
|
|
975
1046
|
names: string[];
|
|
976
1047
|
}
|
|
977
1048
|
|
|
978
|
-
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 };
|