@evandu/super-pi-server 0.0.0-stage → 0.1.260
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 +250 -3
- package/agents/code-auditor.md +64 -0
- package/agents/code-designer.md +64 -0
- package/agents/coder.md +24 -0
- package/agents/critic.md +24 -0
- package/agents/document-organizer.md +48 -0
- package/agents/patcher.md +27 -0
- package/agents/planner.md +30 -0
- package/agents/project-leader.md +28 -0
- package/agents/reviewer.md +27 -0
- package/agents/scout.md +27 -0
- package/agents/solution-designer.md +62 -0
- package/agents/super-pi-documents/index.ts +92 -0
- package/agents/super-pi-feishu/index.ts +88 -0
- package/agents/super-pi-knowledge/index.ts +70 -0
- package/agents/super-pi-managed-model/index.ts +9 -0
- package/agents/super-pi-memory/index.ts +75 -0
- package/agents/super-pi-native-tools/index.ts +1 -0
- package/agents/super-pi-task/core.ts +2262 -0
- package/agents/super-pi-task/index.ts +814 -0
- package/agents/super-pi-task/workflow-schema.ts +34 -0
- package/agents/super-pi-web/index.ts +32 -0
- package/agents/verifier.md +25 -0
- package/assets/fonts/LICENSE +92 -0
- package/assets/fonts/NotoSansSC-Bold.otf +0 -0
- package/assets/fonts/NotoSansSC-Regular.otf +0 -0
- package/assets/knowledge-model/README.md +37 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/config.json +31 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/onnx/model_quantized.onnx +0 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/special_tokens_map.json +7 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/tokenizer.json +21278 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/tokenizer_config.json +15 -0
- package/assets/knowledge-model/Xenova/bge-small-zh-v1.5/vocab.txt +21128 -0
- package/bin/npm-prefix.d.ts +1 -0
- package/bin/npm-prefix.js +10 -0
- package/bin/super-pi.js +349 -0
- package/dist/client/.super-pi-client-sources.json +82 -0
- package/dist/client/assets/CodeMirrorEditor-mi9rGUce.js +2 -0
- package/dist/client/assets/GitDiffEditor-CpoDDQrA.css +1 -0
- package/dist/client/assets/GitDiffEditor-FQBfGxOY.js +29 -0
- package/dist/client/assets/diff-ChtP43wD.js +1 -0
- package/dist/client/assets/dist-AW5lyI3I.js +1 -0
- package/dist/client/assets/dist-B3-a6uF0.js +7 -0
- package/dist/client/assets/dist-BGxkyh6e.js +1 -0
- package/dist/client/assets/dist-BJxfd7yb.js +11 -0
- package/dist/client/assets/dist-BRVQKlcp.js +1 -0
- package/dist/client/assets/dist-BV64A9Ji.js +1 -0
- package/dist/client/assets/dist-BXAOrsjq.js +1 -0
- package/dist/client/assets/dist-CKF2Jksy.js +1 -0
- package/dist/client/assets/dist-CX_Hm4GS.js +1 -0
- package/dist/client/assets/dist-Cus6_oaF.js +2 -0
- package/dist/client/assets/dist-Cx00EZKR.js +23 -0
- package/dist/client/assets/dist-D71y2EI1.js +1 -0
- package/dist/client/assets/dist-D978o95T.js +5 -0
- package/dist/client/assets/dist-Dc1MBGAG.js +1 -0
- package/dist/client/assets/dist-Dds-qLxY.js +9 -0
- package/dist/client/assets/dist-DeD9copn.js +1 -0
- package/dist/client/assets/dist-DuvGReu-.js +6 -0
- package/dist/client/assets/dist-Dvb0SqcK.js +2 -0
- package/dist/client/assets/dist-J6XWqRpB.js +3 -0
- package/dist/client/assets/dist-QzbOCAU6.js +1 -0
- package/dist/client/assets/dist-moiMRpw_.js +1 -0
- package/dist/client/assets/dist-scBkrwv-.js +2 -0
- package/dist/client/assets/dockerfile-BDePf5PZ.js +1 -0
- package/dist/client/assets/index-Cn7hdrDw.js +350 -0
- package/dist/client/assets/index-UfzqdECL.css +1 -0
- package/dist/client/assets/powershell-D8WpQPaX.js +1 -0
- package/dist/client/assets/properties-C357ku5U.js +1 -0
- package/dist/client/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/client/assets/ruby-ChfNwlCY.js +1 -0
- package/dist/client/assets/shell-DwuoZtxw.js +1 -0
- package/dist/client/assets/swift-DKB6_1j6.js +1 -0
- package/dist/client/assets/toml-BPTmHmyx.js +1 -0
- package/dist/client/favicon.ico +0 -0
- package/dist/client/favicon.png +0 -0
- package/dist/client/favicon.svg +10 -0
- package/dist/client/index.html +18 -0
- package/dist/extension.d.ts +15 -0
- package/dist/extension.js +126 -0
- package/dist/server/active-memory.d.ts +247 -0
- package/dist/server/active-memory.js +669 -0
- package/dist/server/agents.d.ts +245 -0
- package/dist/server/agents.js +701 -0
- package/dist/server/application/catalog-service.d.ts +98 -0
- package/dist/server/application/catalog-service.js +245 -0
- package/dist/server/application/conversation-service.d.ts +245 -0
- package/dist/server/application/conversation-service.js +654 -0
- package/dist/server/application/document-service.d.ts +68 -0
- package/dist/server/application/document-service.js +120 -0
- package/dist/server/application/extension-ui-service.d.ts +44 -0
- package/dist/server/application/extension-ui-service.js +135 -0
- package/dist/server/application/feishu-service.d.ts +179 -0
- package/dist/server/application/feishu-service.js +358 -0
- package/dist/server/application/group-chat-service.d.ts +75 -0
- package/dist/server/application/group-chat-service.js +953 -0
- package/dist/server/application/group-execution.d.ts +15 -0
- package/dist/server/application/group-execution.js +77 -0
- package/dist/server/application/project-service.d.ts +464 -0
- package/dist/server/application/project-service.js +2523 -0
- package/dist/server/application/provider-service.d.ts +174 -0
- package/dist/server/application/provider-service.js +510 -0
- package/dist/server/application/run-service.d.ts +547 -0
- package/dist/server/application/run-service.js +2683 -0
- package/dist/server/application/scheduled-task-service.d.ts +184 -0
- package/dist/server/application/scheduled-task-service.js +391 -0
- package/dist/server/application/session-orchestrator-service.d.ts +388 -0
- package/dist/server/application/session-orchestrator-service.js +1146 -0
- package/dist/server/application/session-reminder-service.d.ts +59 -0
- package/dist/server/application/session-reminder-service.js +141 -0
- package/dist/server/application/session-watchdog.d.ts +171 -0
- package/dist/server/application/session-watchdog.js +284 -0
- package/dist/server/application/workspace-service.d.ts +52 -0
- package/dist/server/application/workspace-service.js +186 -0
- package/dist/server/application/worktree-service.d.ts +13 -0
- package/dist/server/application/worktree-service.js +76 -0
- package/dist/server/browser-access.d.ts +34 -0
- package/dist/server/browser-access.js +89 -0
- package/dist/server/capability.d.ts +105 -0
- package/dist/server/capability.js +170 -0
- package/dist/server/command-handler.d.ts +93 -0
- package/dist/server/command-handler.js +540 -0
- package/dist/server/content-search.d.ts +16 -0
- package/dist/server/content-search.js +235 -0
- package/dist/server/conversation-usage.d.ts +22 -0
- package/dist/server/conversation-usage.js +43 -0
- package/dist/server/documents.d.ts +152 -0
- package/dist/server/documents.js +998 -0
- package/dist/server/engineering-learning.d.ts +30 -0
- package/dist/server/engineering-learning.js +106 -0
- package/dist/server/exec-service.d.ts +45 -0
- package/dist/server/exec-service.js +167 -0
- package/dist/server/explicit-file-open.d.ts +34 -0
- package/dist/server/explicit-file-open.js +105 -0
- package/dist/server/failure-text.d.ts +18 -0
- package/dist/server/failure-text.js +44 -0
- package/dist/server/feishu-cli.d.ts +223 -0
- package/dist/server/feishu-cli.js +464 -0
- package/dist/server/file-changes.d.ts +119 -0
- package/dist/server/file-changes.js +280 -0
- package/dist/server/file-diff.d.ts +41 -0
- package/dist/server/file-diff.js +97 -0
- package/dist/server/file-index.d.ts +100 -0
- package/dist/server/file-index.js +296 -0
- package/dist/server/file-name-index.d.ts +160 -0
- package/dist/server/file-name-index.js +411 -0
- package/dist/server/files.d.ts +269 -0
- package/dist/server/files.js +748 -0
- package/dist/server/git.d.ts +245 -0
- package/dist/server/git.js +903 -0
- package/dist/server/http-server.d.ts +45 -0
- package/dist/server/http-server.js +3830 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +485 -0
- package/dist/server/inline-thinking.d.ts +90 -0
- package/dist/server/inline-thinking.js +181 -0
- package/dist/server/json-comments.d.ts +14 -0
- package/dist/server/json-comments.js +71 -0
- package/dist/server/knowledge-embedding-worker.d.ts +1 -0
- package/dist/server/knowledge-embedding-worker.js +27 -0
- package/dist/server/knowledge-vectors.d.ts +150 -0
- package/dist/server/knowledge-vectors.js +385 -0
- package/dist/server/knowledge.d.ts +273 -0
- package/dist/server/knowledge.js +848 -0
- package/dist/server/length-continuation.d.ts +83 -0
- package/dist/server/length-continuation.js +118 -0
- package/dist/server/logging.d.ts +32 -0
- package/dist/server/logging.js +185 -0
- package/dist/server/managed-http-tunnel.d.ts +6 -0
- package/dist/server/managed-http-tunnel.js +85 -0
- package/dist/server/managed-http.d.ts +4 -0
- package/dist/server/managed-http.js +85 -0
- package/dist/server/managed-model-adapter.d.ts +17 -0
- package/dist/server/managed-model-adapter.js +75 -0
- package/dist/server/managed-model-gateway.d.ts +49 -0
- package/dist/server/managed-model-gateway.js +73 -0
- package/dist/server/managed-servers.d.ts +55 -0
- package/dist/server/managed-servers.js +396 -0
- package/dist/server/managed-ssh.d.ts +26 -0
- package/dist/server/managed-ssh.js +73 -0
- package/dist/server/manager-vault.d.ts +11 -0
- package/dist/server/manager-vault.js +67 -0
- package/dist/server/memory-recall.d.ts +25 -0
- package/dist/server/memory-recall.js +45 -0
- package/dist/server/memory.d.ts +67 -0
- package/dist/server/memory.js +216 -0
- package/dist/server/message-media.d.ts +7 -0
- package/dist/server/message-media.js +54 -0
- package/dist/server/model-context-window.d.ts +186 -0
- package/dist/server/model-context-window.js +444 -0
- package/dist/server/model-filter.d.ts +23 -0
- package/dist/server/model-filter.js +48 -0
- package/dist/server/models-store.d.ts +36 -0
- package/dist/server/models-store.js +132 -0
- package/dist/server/native-tool-settings.d.ts +25 -0
- package/dist/server/native-tool-settings.js +41 -0
- package/dist/server/native-tools-extension.d.ts +2 -0
- package/dist/server/native-tools-extension.js +39 -0
- package/dist/server/native-tools-service.d.ts +39 -0
- package/dist/server/native-tools-service.js +240 -0
- package/dist/server/persistence/app-state-repository.d.ts +65 -0
- package/dist/server/persistence/app-state-repository.js +1 -0
- package/dist/server/persistence/json-state-repository.d.ts +14 -0
- package/dist/server/persistence/json-state-repository.js +43 -0
- package/dist/server/persistence/open-state-store.d.ts +3 -0
- package/dist/server/persistence/open-state-store.js +35 -0
- package/dist/server/persistence/rename.d.ts +22 -0
- package/dist/server/persistence/rename.js +44 -0
- package/dist/server/persistence/sqlite-state-repository.d.ts +12 -0
- package/dist/server/persistence/sqlite-state-repository.js +264 -0
- package/dist/server/pi-command.d.ts +94 -0
- package/dist/server/pi-command.js +265 -0
- package/dist/server/pi-native.d.ts +12 -0
- package/dist/server/pi-native.js +16 -0
- package/dist/server/pi-session-events.d.ts +158 -0
- package/dist/server/pi-session-events.js +373 -0
- package/dist/server/pi-session-pool.d.ts +233 -0
- package/dist/server/pi-session-pool.js +382 -0
- package/dist/server/pi-session.d.ts +642 -0
- package/dist/server/pi-session.js +655 -0
- package/dist/server/presentations/schema.d.ts +120 -0
- package/dist/server/presentations/schema.js +128 -0
- package/dist/server/provider-network.d.ts +16 -0
- package/dist/server/provider-network.js +106 -0
- package/dist/server/provider-proxy.d.ts +18 -0
- package/dist/server/provider-proxy.js +200 -0
- package/dist/server/providers.d.ts +333 -0
- package/dist/server/providers.js +989 -0
- package/dist/server/remote-bootstrap.d.ts +17 -0
- package/dist/server/remote-bootstrap.js +119 -0
- package/dist/server/rpc-channel.d.ts +131 -0
- package/dist/server/rpc-channel.js +135 -0
- package/dist/server/runtime.d.ts +1393 -0
- package/dist/server/runtime.js +3286 -0
- package/dist/server/scheduled-tasks.d.ts +101 -0
- package/dist/server/scheduled-tasks.js +138 -0
- package/dist/server/server-context.d.ts +119 -0
- package/dist/server/server-context.js +1 -0
- package/dist/server/session-cwd.d.ts +19 -0
- package/dist/server/session-cwd.js +58 -0
- package/dist/server/session-ledger.d.ts +67 -0
- package/dist/server/session-ledger.js +76 -0
- package/dist/server/session-memory-scope.d.ts +4 -0
- package/dist/server/session-memory-scope.js +30 -0
- package/dist/server/session-repository.d.ts +100 -0
- package/dist/server/session-repository.js +246 -0
- package/dist/server/session-tree-scope.d.ts +125 -0
- package/dist/server/session-tree-scope.js +337 -0
- package/dist/server/skills.d.ts +23 -0
- package/dist/server/skills.js +190 -0
- package/dist/server/store.d.ts +1062 -0
- package/dist/server/store.js +3305 -0
- package/dist/server/subagent-runs.d.ts +185 -0
- package/dist/server/subagent-runs.js +383 -0
- package/dist/server/subagents.d.ts +200 -0
- package/dist/server/subagents.js +619 -0
- package/dist/server/task-tool.d.ts +282 -0
- package/dist/server/task-tool.js +507 -0
- package/dist/server/tavily.d.ts +32 -0
- package/dist/server/tavily.js +136 -0
- package/dist/server/team-context.d.ts +12 -0
- package/dist/server/team-context.js +180 -0
- package/dist/server/terminal.d.ts +163 -0
- package/dist/server/terminal.js +557 -0
- package/dist/server/thinking-level-discovery.d.ts +38 -0
- package/dist/server/thinking-level-discovery.js +183 -0
- package/dist/server/time-zone.d.ts +20 -0
- package/dist/server/time-zone.js +32 -0
- package/dist/server/tool-calls.d.ts +130 -0
- package/dist/server/tool-calls.js +341 -0
- package/dist/server/tool-llm.d.ts +72 -0
- package/dist/server/tool-llm.js +146 -0
- package/dist/server/tool-registry.d.ts +129 -0
- package/dist/server/tool-registry.js +249 -0
- package/dist/server/tool-runner.d.ts +112 -0
- package/dist/server/tool-runner.js +306 -0
- package/dist/server/turn-failure.d.ts +48 -0
- package/dist/server/turn-failure.js +148 -0
- package/dist/server/types.d.ts +2315 -0
- package/dist/server/types.js +11 -0
- package/dist/server/update-status.d.ts +14 -0
- package/dist/server/update-status.js +69 -0
- package/dist/server/update.d.ts +46 -0
- package/dist/server/update.js +104 -0
- package/dist/server/upload.d.ts +35 -0
- package/dist/server/upload.js +177 -0
- package/dist/server/version.d.ts +33 -0
- package/dist/server/version.js +111 -0
- package/dist/server/web.d.ts +27 -0
- package/dist/server/web.js +183 -0
- package/dist/server/workflow-engine.d.ts +47 -0
- package/dist/server/workflow-engine.js +255 -0
- package/dist/server/workflow.d.ts +329 -0
- package/dist/server/workflow.js +469 -0
- package/dist/server/workspace-file-indexes.d.ts +2 -0
- package/dist/server/workspace-file-indexes.js +61 -0
- package/dist/server/workspace-file-operations.d.ts +36 -0
- package/dist/server/workspace-file-operations.js +281 -0
- package/dist/server/workspace-file-response.d.ts +7 -0
- package/dist/server/workspace-file-response.js +79 -0
- package/dist/server/ws-server.d.ts +149 -0
- package/dist/server/ws-server.js +640 -0
- package/dist/shared/agent-order.d.ts +44 -0
- package/dist/shared/agent-order.js +50 -0
- package/dist/shared/archive-decisions.d.ts +44 -0
- package/dist/shared/archive-decisions.js +98 -0
- package/dist/shared/background-task.d.ts +25 -0
- package/dist/shared/background-task.js +183 -0
- package/dist/shared/child-session-lock.d.ts +37 -0
- package/dist/shared/child-session-lock.js +59 -0
- package/dist/shared/content-search.d.ts +22 -0
- package/dist/shared/content-search.js +1 -0
- package/dist/shared/conversation-title.d.ts +4 -0
- package/dist/shared/conversation-title.js +4 -0
- package/dist/shared/file-mentions.d.ts +17 -0
- package/dist/shared/file-mentions.js +91 -0
- package/dist/shared/git-commit.d.ts +11 -0
- package/dist/shared/git-commit.js +1 -0
- package/dist/shared/git-graph.d.ts +42 -0
- package/dist/shared/git-graph.js +30 -0
- package/dist/shared/group-chat.d.ts +132 -0
- package/dist/shared/group-chat.js +6 -0
- package/dist/shared/managed-servers.d.ts +36 -0
- package/dist/shared/managed-servers.js +1 -0
- package/dist/shared/message-media.d.ts +12 -0
- package/dist/shared/message-media.js +27 -0
- package/dist/shared/model-window-label.d.ts +39 -0
- package/dist/shared/model-window-label.js +55 -0
- package/dist/shared/native-tools.d.ts +43 -0
- package/dist/shared/native-tools.js +1 -0
- package/dist/shared/pi-cache-warming.d.ts +9 -0
- package/dist/shared/pi-cache-warming.js +4 -0
- package/dist/shared/project-overview.d.ts +107 -0
- package/dist/shared/project-overview.js +92 -0
- package/dist/shared/project-presentation.d.ts +55 -0
- package/dist/shared/project-presentation.js +111 -0
- package/dist/shared/provider-network.d.ts +30 -0
- package/dist/shared/provider-network.js +1 -0
- package/dist/shared/session-reporting.d.ts +40 -0
- package/dist/shared/session-reporting.js +97 -0
- package/dist/shared/session-search.d.ts +14 -0
- package/dist/shared/session-search.js +1 -0
- package/dist/shared/team-context-view.d.ts +33 -0
- package/dist/shared/team-context-view.js +49 -0
- package/dist/shared/team-context.d.ts +59 -0
- package/dist/shared/team-context.js +3 -0
- package/dist/shared/terminal-protocol.d.ts +71 -0
- package/dist/shared/terminal-protocol.js +1 -0
- package/dist/shared/thinking-levels.d.ts +53 -0
- package/dist/shared/thinking-levels.js +85 -0
- package/dist/shared/tool-glyph.d.ts +7 -0
- package/dist/shared/tool-glyph.js +19 -0
- package/dist/shared/transcript-order.d.ts +7 -0
- package/dist/shared/transcript-order.js +12 -0
- package/dist/shared/update-status.d.ts +28 -0
- package/dist/shared/update-status.js +1 -0
- package/dist/shared/workspace-file-preview.d.ts +4 -0
- package/dist/shared/workspace-file-preview.js +28 -0
- package/package.json +450 -4
- package/scripts/diagnose.mjs +603 -0
- package/scripts/patch-brace-expansion.mjs +260 -0
- package/scripts/restart-server.mjs +104 -0
- package/skills/presentation/SKILL.md +30 -0
- package/skills/presentation/references/data.md +10 -0
- package/skills/presentation/references/quality.md +12 -0
- package/skills/presentation/references/story.md +12 -0
- package/skills/presentation/references/templates-and-editing.md +11 -0
- package/skills/presentation/references/visual-system.md +10 -0
- package/skills/super-pi-agent-development/SKILL.md +25 -0
- package/skills/super-pi-development/SKILL.md +31 -0
- package/skills/super-pi-tool-development/SKILL.md +39 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export declare const MAX_TERMINAL_SLOTS = 5;
|
|
2
|
+
export interface TerminalScope {
|
|
3
|
+
workspaceId: string;
|
|
4
|
+
conversationId?: string;
|
|
5
|
+
}
|
|
6
|
+
interface TerminalSize {
|
|
7
|
+
cols?: number;
|
|
8
|
+
rows?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface TerminalSlot extends Required<TerminalSize> {
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
exitCode?: number;
|
|
14
|
+
reason?: string;
|
|
15
|
+
}
|
|
16
|
+
export type TerminalCommand = ({
|
|
17
|
+
type: "terminal.sync";
|
|
18
|
+
ownerId: string;
|
|
19
|
+
cwd?: string;
|
|
20
|
+
initialize?: boolean;
|
|
21
|
+
} & TerminalScope & TerminalSize) | {
|
|
22
|
+
type: "terminal.detach";
|
|
23
|
+
} | ({
|
|
24
|
+
type: "terminal.open";
|
|
25
|
+
sessionId?: string;
|
|
26
|
+
} & TerminalSize) | {
|
|
27
|
+
type: "terminal.input";
|
|
28
|
+
sessionId: string;
|
|
29
|
+
data: string;
|
|
30
|
+
} | {
|
|
31
|
+
type: "terminal.resize";
|
|
32
|
+
sessionId: string;
|
|
33
|
+
cols: number;
|
|
34
|
+
rows: number;
|
|
35
|
+
} | {
|
|
36
|
+
type: "terminal.close";
|
|
37
|
+
sessionId: string;
|
|
38
|
+
};
|
|
39
|
+
export type TerminalEvent = ({
|
|
40
|
+
type: "terminal.sessions";
|
|
41
|
+
sessions: TerminalSlot[];
|
|
42
|
+
replay: boolean;
|
|
43
|
+
activate?: string;
|
|
44
|
+
} & TerminalScope) | {
|
|
45
|
+
type: "terminal.replay";
|
|
46
|
+
sessionId: string;
|
|
47
|
+
data: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: "terminal.size";
|
|
50
|
+
sessionId: string;
|
|
51
|
+
cols: number;
|
|
52
|
+
rows: number;
|
|
53
|
+
} | {
|
|
54
|
+
type: "terminal.output";
|
|
55
|
+
sessionId: string;
|
|
56
|
+
data: string;
|
|
57
|
+
} | {
|
|
58
|
+
type: "terminal.exit";
|
|
59
|
+
sessionId: string;
|
|
60
|
+
exitCode: number;
|
|
61
|
+
reason?: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: "terminal.error";
|
|
64
|
+
sessionId?: string;
|
|
65
|
+
message: string;
|
|
66
|
+
} | {
|
|
67
|
+
type: "terminal.status";
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
reason?: string;
|
|
70
|
+
};
|
|
71
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MAX_TERMINAL_SLOTS = 5;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE THINKING LEVELS A MODEL OFFERS, in Pi's own vocabulary.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS IS A SHARED FILE. The seven levels are Pi's, not Super Pi's. Pi decides which levels a
|
|
5
|
+
* model offers by reading the model object (`getSupportedThinkingLevels`), and the thing that
|
|
6
|
+
* decides it is `thinkingLevelMap` in Pi's `models.json`. So the server writes those names and the
|
|
7
|
+
* browser shows them, and a second list of names anywhere else is a second chance to be wrong.
|
|
8
|
+
*
|
|
9
|
+
* WHAT A MAP SAYS. Each key is one of Pi's levels; each value is the string that level is SENT as.
|
|
10
|
+
* `null` means "this model does not have this level at all".
|
|
11
|
+
*
|
|
12
|
+
* WHY THE NULLS ARE THE POINT. Pi ENABLES the ordinary levels - minimal, low, medium, high - when
|
|
13
|
+
* the map says nothing about them, and it offers `xhigh`/`max` only when the map names them. So a
|
|
14
|
+
* map that only says `{"low": "low", "high": "high"}` would still offer medium, and a map that says
|
|
15
|
+
* nothing at all offers everything. A map that means "this model has exactly these levels" has to
|
|
16
|
+
* name all seven, with `null` for the ones that are not there.
|
|
17
|
+
*/
|
|
18
|
+
/** Pi's seven thinking levels, in Pi's own order. */
|
|
19
|
+
export declare const PI_THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
20
|
+
/** One of Pi's seven thinking levels. */
|
|
21
|
+
export type ThinkingLevel = (typeof PI_THINKING_LEVELS)[number];
|
|
22
|
+
/**
|
|
23
|
+
* What each level is sent as, per model. `null` marks a level the model does NOT have.
|
|
24
|
+
*
|
|
25
|
+
* A level that is simply ABSENT means "nobody said" - which is not the same thing, because Pi reads
|
|
26
|
+
* an absent level as "the model has it".
|
|
27
|
+
*/
|
|
28
|
+
export type ThinkingLevelMap = Partial<Record<ThinkingLevel, string | null>>;
|
|
29
|
+
/** The same endpoint can be written with or without a trailing slash. */
|
|
30
|
+
export declare function thinkingLevelsEndpoint(baseUrl: string, api: string): string;
|
|
31
|
+
/** TRUE when the name is one of Pi's seven levels. */
|
|
32
|
+
export declare function isThinkingLevel(name: string): name is ThinkingLevel;
|
|
33
|
+
/**
|
|
34
|
+
* Reads a raw object into a map Pi would accept.
|
|
35
|
+
*
|
|
36
|
+
* LENIENT ON PURPOSE, because this is what reads files other people wrote: an entry that is not a
|
|
37
|
+
* level Pi knows, or a value that is neither a string nor `null`, is DROPPED rather than guessed
|
|
38
|
+
* at. The strict version of this check lives in the validator, which is where a form is checked.
|
|
39
|
+
*
|
|
40
|
+
* Returns `undefined` when there is nothing usable in it - "no map" and "an empty map" are
|
|
41
|
+
* different, and only the second one is a statement.
|
|
42
|
+
*/
|
|
43
|
+
export declare function readThinkingLevelMap(raw: unknown): ThinkingLevelMap | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* The levels a map actually offers - the ones that are not `null` - in Pi's order.
|
|
46
|
+
*
|
|
47
|
+
* This is what the panel shows and what the picker offers, so it reads the map the way Pi reads
|
|
48
|
+
* it: a level the map does not mention is NOT offered, because a map that means "exactly these"
|
|
49
|
+
* names all seven.
|
|
50
|
+
*/
|
|
51
|
+
export declare function offeredThinkingLevels(map: ThinkingLevelMap | null | undefined): ThinkingLevel[];
|
|
52
|
+
/** The levels a map offers, in the words a reader uses: 「low / medium / high」. */
|
|
53
|
+
export declare function describeThinkingLevels(map: ThinkingLevelMap | null | undefined): string;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE THINKING LEVELS A MODEL OFFERS, in Pi's own vocabulary.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS IS A SHARED FILE. The seven levels are Pi's, not Super Pi's. Pi decides which levels a
|
|
5
|
+
* model offers by reading the model object (`getSupportedThinkingLevels`), and the thing that
|
|
6
|
+
* decides it is `thinkingLevelMap` in Pi's `models.json`. So the server writes those names and the
|
|
7
|
+
* browser shows them, and a second list of names anywhere else is a second chance to be wrong.
|
|
8
|
+
*
|
|
9
|
+
* WHAT A MAP SAYS. Each key is one of Pi's levels; each value is the string that level is SENT as.
|
|
10
|
+
* `null` means "this model does not have this level at all".
|
|
11
|
+
*
|
|
12
|
+
* WHY THE NULLS ARE THE POINT. Pi ENABLES the ordinary levels - minimal, low, medium, high - when
|
|
13
|
+
* the map says nothing about them, and it offers `xhigh`/`max` only when the map names them. So a
|
|
14
|
+
* map that only says `{"low": "low", "high": "high"}` would still offer medium, and a map that says
|
|
15
|
+
* nothing at all offers everything. A map that means "this model has exactly these levels" has to
|
|
16
|
+
* name all seven, with `null` for the ones that are not there.
|
|
17
|
+
*/
|
|
18
|
+
/** Pi's seven thinking levels, in Pi's own order. */
|
|
19
|
+
export const PI_THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
20
|
+
/** The same endpoint can be written with or without a trailing slash. */
|
|
21
|
+
export function thinkingLevelsEndpoint(baseUrl, api) {
|
|
22
|
+
const trimmed = baseUrl.trim();
|
|
23
|
+
let address = trimmed.replace(/\/+$/, "");
|
|
24
|
+
try {
|
|
25
|
+
const url = new URL(trimmed);
|
|
26
|
+
address = `${url.origin}${url.pathname.replace(/\/+$/, "")}${url.search}`;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// The form may call this while the URL is being entered.
|
|
30
|
+
}
|
|
31
|
+
return `${address}|${api.trim() || "openai-completions"}`;
|
|
32
|
+
}
|
|
33
|
+
/** TRUE when the name is one of Pi's seven levels. */
|
|
34
|
+
export function isThinkingLevel(name) {
|
|
35
|
+
return PI_THINKING_LEVELS.includes(name);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Reads a raw object into a map Pi would accept.
|
|
39
|
+
*
|
|
40
|
+
* LENIENT ON PURPOSE, because this is what reads files other people wrote: an entry that is not a
|
|
41
|
+
* level Pi knows, or a value that is neither a string nor `null`, is DROPPED rather than guessed
|
|
42
|
+
* at. The strict version of this check lives in the validator, which is where a form is checked.
|
|
43
|
+
*
|
|
44
|
+
* Returns `undefined` when there is nothing usable in it - "no map" and "an empty map" are
|
|
45
|
+
* different, and only the second one is a statement.
|
|
46
|
+
*/
|
|
47
|
+
export function readThinkingLevelMap(raw) {
|
|
48
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
49
|
+
return undefined;
|
|
50
|
+
const map = {};
|
|
51
|
+
let found = false;
|
|
52
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
53
|
+
if (!isThinkingLevel(key))
|
|
54
|
+
continue;
|
|
55
|
+
if (value === null) {
|
|
56
|
+
map[key] = null;
|
|
57
|
+
found = true;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (typeof value !== "string" || !value.trim())
|
|
61
|
+
continue;
|
|
62
|
+
map[key] = value;
|
|
63
|
+
found = true;
|
|
64
|
+
}
|
|
65
|
+
return found ? map : undefined;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The levels a map actually offers - the ones that are not `null` - in Pi's order.
|
|
69
|
+
*
|
|
70
|
+
* This is what the panel shows and what the picker offers, so it reads the map the way Pi reads
|
|
71
|
+
* it: a level the map does not mention is NOT offered, because a map that means "exactly these"
|
|
72
|
+
* names all seven.
|
|
73
|
+
*/
|
|
74
|
+
export function offeredThinkingLevels(map) {
|
|
75
|
+
if (!map)
|
|
76
|
+
return [];
|
|
77
|
+
return PI_THINKING_LEVELS.filter((level) => {
|
|
78
|
+
const mapped = map[level];
|
|
79
|
+
return mapped !== null && mapped !== undefined;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/** The levels a map offers, in the words a reader uses: 「low / medium / high」. */
|
|
83
|
+
export function describeThinkingLevels(map) {
|
|
84
|
+
return offeredThinkingLevels(map).join(" / ");
|
|
85
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Plain text only: the same identity survives registration, sharing and browser rendering. */
|
|
2
|
+
export declare function validateToolGlyph(value: unknown): string | undefined;
|
|
3
|
+
export declare function mountedToolGlyph(tool: {
|
|
4
|
+
name: string;
|
|
5
|
+
slug?: string;
|
|
6
|
+
glyph?: string;
|
|
7
|
+
}): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Plain text only: the same identity survives registration, sharing and browser rendering. */
|
|
2
|
+
export function validateToolGlyph(value) {
|
|
3
|
+
if (value === undefined)
|
|
4
|
+
return undefined;
|
|
5
|
+
if (typeof value !== "string" || !value.trim() || Array.from(value.trim()).length > 4 || /[<>\u0000-\u001f\u007f]/.test(value))
|
|
6
|
+
throw new Error("工具图标须为 1 至 4 个字符的文字或符号");
|
|
7
|
+
return value.trim();
|
|
8
|
+
}
|
|
9
|
+
export function mountedToolGlyph(tool) {
|
|
10
|
+
try {
|
|
11
|
+
const glyph = validateToolGlyph(tool.glyph);
|
|
12
|
+
if (glyph)
|
|
13
|
+
return glyph;
|
|
14
|
+
}
|
|
15
|
+
catch { /* Old records still receive a readable fallback. */ }
|
|
16
|
+
const name = `${tool.name} ${tool.slug ?? ""}`.toLowerCase();
|
|
17
|
+
const symbols = [[/json/, "{}"], [/正则|regex/, ".*"], [/计算|calc/, "∑"], [/时间|timestamp|date/, "◷"], [/差异|diff/, "±"], [/markdown/, "M↓"], [/图像|图片|image/, "▧"], [/表格|csv|excel/, "▦"], [/颜色|color/, "◐"], [/base64/, "64"], [/hash|哈希/, "#"], [/git/, "⑂"]];
|
|
18
|
+
return symbols.find(([pattern]) => pattern.test(name))?.[1] ?? (Array.from(tool.name.trim()).slice(0, 2).join("") || "◇");
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Preserve persisted message order while placing unanchored activity cards by time. */
|
|
2
|
+
export function orderTranscriptItems(items) {
|
|
3
|
+
let messageTime = 0;
|
|
4
|
+
return items.map(item => {
|
|
5
|
+
if (!item.key.startsWith("m:"))
|
|
6
|
+
return item;
|
|
7
|
+
// Queue acceptance can predate an earlier reply. Use a monotonic placement time without
|
|
8
|
+
// changing the message's real timestamp or breaking the server's causal ordering.
|
|
9
|
+
messageTime = Math.max(messageTime, Number.isFinite(item.at) ? item.at : 0);
|
|
10
|
+
return { ...item, at: messageTime };
|
|
11
|
+
}).sort((a, b) => a.at - b.at || a.seq - b.seq).map(item => item.key);
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type UpdateVersions = {
|
|
2
|
+
runningVersion: string;
|
|
3
|
+
diskVersion: string;
|
|
4
|
+
needsRestart: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type UpdatePhase = "installing" | "restarting" | "completed" | "failed";
|
|
7
|
+
export type UpdateOperation = {
|
|
8
|
+
id: string;
|
|
9
|
+
action: "update" | "restart";
|
|
10
|
+
phase: UpdatePhase;
|
|
11
|
+
fromVersion: string;
|
|
12
|
+
targetVersion?: string;
|
|
13
|
+
startedAt: string;
|
|
14
|
+
changedAt: string;
|
|
15
|
+
failure?: {
|
|
16
|
+
step: "installing" | "restarting";
|
|
17
|
+
message: string;
|
|
18
|
+
code?: number;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export type UpdateStatus = UpdateVersions & {
|
|
22
|
+
operation: UpdateOperation | null;
|
|
23
|
+
};
|
|
24
|
+
export type UpdateCheck = UpdateStatus & {
|
|
25
|
+
latestVersion?: string;
|
|
26
|
+
updateAvailable: boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare const updateIsActive: (operation?: UpdateOperation | null) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const updateIsActive = (operation) => operation?.phase === "installing" || operation?.phase === "restarting";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type WorkspacePreviewKind = "image" | "pdf" | "audio" | "video" | "table" | "document" | "download";
|
|
2
|
+
export declare function workspaceFileExtension(path: string): string;
|
|
3
|
+
export declare function workspaceFileMime(path: string): string | undefined;
|
|
4
|
+
export declare function workspacePreviewKind(path: string): WorkspacePreviewKind | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const types = {
|
|
2
|
+
png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", gif: "image/gif", webp: "image/webp", avif: "image/avif",
|
|
3
|
+
pdf: "application/pdf", mp3: "audio/mpeg", wav: "audio/wav", ogg: "audio/ogg", m4a: "audio/mp4",
|
|
4
|
+
mp4: "video/mp4", webm: "video/webm", ogv: "video/ogg",
|
|
5
|
+
};
|
|
6
|
+
export function workspaceFileExtension(path) {
|
|
7
|
+
return /\.([^./]+)$/.exec(path)?.[1].toLowerCase() ?? "";
|
|
8
|
+
}
|
|
9
|
+
export function workspaceFileMime(path) {
|
|
10
|
+
const extension = workspaceFileExtension(path);
|
|
11
|
+
return Object.hasOwn(types, extension) ? types[extension] : undefined;
|
|
12
|
+
}
|
|
13
|
+
export function workspacePreviewKind(path) {
|
|
14
|
+
const mime = workspaceFileMime(path);
|
|
15
|
+
if (mime === "application/pdf")
|
|
16
|
+
return "pdf";
|
|
17
|
+
if (mime?.startsWith("image/"))
|
|
18
|
+
return "image";
|
|
19
|
+
if (mime?.startsWith("audio/"))
|
|
20
|
+
return "audio";
|
|
21
|
+
if (mime?.startsWith("video/"))
|
|
22
|
+
return "video";
|
|
23
|
+
if (/\.(csv|tsv)$/i.test(path))
|
|
24
|
+
return "table";
|
|
25
|
+
if (/\.docx$/i.test(path))
|
|
26
|
+
return "document";
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|