@evandu/super-pi 0.1.245 → 0.1.246
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/agents/super-pi-task/index.ts +7 -58
- package/agents/super-pi-task/workflow-schema.ts +34 -0
- package/dist/client/.super-pi-client-sources.json +4 -4
- package/dist/client/assets/{CodeMirrorEditor-DXz3TlpL.js → CodeMirrorEditor-B3K0I0eS.js} +1 -1
- package/dist/client/assets/{GitDiffEditor-8bvWRIwo.js → GitDiffEditor-DYmMQWS8.js} +1 -1
- package/dist/client/assets/index-DGpbsE3E.css +1 -0
- package/dist/client/assets/{index-CU4rNgq5.js → index-Dx58PQcK.js} +4 -4
- package/dist/client/index.html +2 -2
- package/dist/server/application/conversation-service.js +5 -0
- package/dist/server/application/workspace-service.js +15 -5
- package/dist/server/thinking-level-discovery.js +25 -1
- package/package.json +1 -1
- package/dist/.super-pi-check-inputs.json +0 -4
- package/dist/client/assets/index-E2qh6Qge.css +0 -1
package/dist/client/index.html
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
<link rel="alternate icon" href="/favicon.ico" />
|
|
9
9
|
<link rel="apple-touch-icon" href="/favicon.svg" />
|
|
10
10
|
<title>Super Pi</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-Dx58PQcK.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
|
|
13
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DGpbsE3E.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
|
@@ -309,6 +309,7 @@ export class ConversationService {
|
|
|
309
309
|
* Sets the active model on a conversation, validating against Pi's catalog.
|
|
310
310
|
*/
|
|
311
311
|
async setModel(conversationId, provider, modelId) {
|
|
312
|
+
const previous = this.store.conversation(conversationId);
|
|
312
313
|
const catalog = await this.runtime.catalog();
|
|
313
314
|
const option = catalog.source === "pi"
|
|
314
315
|
? catalog.models.find((model) => model.provider === provider && model.modelId === modelId)
|
|
@@ -324,6 +325,10 @@ export class ConversationService {
|
|
|
324
325
|
throw new Error("找不到这个工作区。");
|
|
325
326
|
assertModelAllowed(this.store.modelFilterRules(), workspace, selection);
|
|
326
327
|
await this.store.setConversationModel(conversationId, selection);
|
|
328
|
+
const thinking = await this.runtime.catalog(selection);
|
|
329
|
+
if (thinking.source === "pi" && previous?.thinkingLevel && !thinking.levels.includes(previous.thinkingLevel)) {
|
|
330
|
+
await this.store.setConversationThinking(conversationId, undefined);
|
|
331
|
+
}
|
|
327
332
|
this.broadcaster.broadcastState();
|
|
328
333
|
await this.catalogService.broadcastCatalog(selection, conversationId);
|
|
329
334
|
}
|
|
@@ -80,10 +80,20 @@ export class WorkspaceService {
|
|
|
80
80
|
? { provider: option.provider, modelId: option.modelId, label: option.label }
|
|
81
81
|
: { provider: requested.provider, modelId: requested.modelId, label: requested.modelId };
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
let thinkingLevel = settings.thinkingLevel ?? undefined;
|
|
84
|
+
if (thinkingLevel) {
|
|
85
|
+
const modelChanged = settings.model !== undefined && (selection?.provider !== workspace.defaultModel?.provider ||
|
|
86
|
+
selection?.modelId !== workspace.defaultModel?.modelId);
|
|
87
|
+
const targetModel = settings.model === null ? undefined : selection ?? workspace.defaultModel;
|
|
88
|
+
const catalog = await this.runtime.catalog(targetModel);
|
|
89
|
+
if (catalog.source === "pi" && !catalog.levels.includes(thinkingLevel)) {
|
|
90
|
+
if (modelChanged) {
|
|
91
|
+
// A saved thinking level belongs to its model; switching models follows Pi's own default.
|
|
92
|
+
thinkingLevel = undefined;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
throw this.catalogService.notOffered(`思考等级 ${thinkingLevel}`, catalog);
|
|
96
|
+
}
|
|
87
97
|
}
|
|
88
98
|
}
|
|
89
99
|
let agentToStore;
|
|
@@ -126,7 +136,7 @@ export class WorkspaceService {
|
|
|
126
136
|
assertModelAllowed(this.store.modelFilterRules(), workspace, selection);
|
|
127
137
|
await this.store.setWorkspaceDefaults(workspaceId, {
|
|
128
138
|
model: selection,
|
|
129
|
-
thinkingLevel
|
|
139
|
+
thinkingLevel,
|
|
130
140
|
agentId: agentToStore,
|
|
131
141
|
});
|
|
132
142
|
this.broadcaster.broadcastState();
|
|
@@ -70,6 +70,18 @@ const MINIMAX_FLASH_LEVELS = {
|
|
|
70
70
|
xhigh: "xhigh",
|
|
71
71
|
max: "max",
|
|
72
72
|
};
|
|
73
|
+
const KIMI_K31_PRO_MODEL = "kimi-k3.1-pro";
|
|
74
|
+
const KIMI_API_ORIGINS = new Set(["https://api.moonshot.ai", "https://api.moonshot.cn"]);
|
|
75
|
+
const KIMI_API_PATHS = new Set(["", "/v1", "/v1/models"]);
|
|
76
|
+
const KIMI_K31_PRO_LEVELS = {
|
|
77
|
+
off: null,
|
|
78
|
+
minimal: null,
|
|
79
|
+
low: "low",
|
|
80
|
+
medium: null,
|
|
81
|
+
high: "high",
|
|
82
|
+
xhigh: null,
|
|
83
|
+
max: "max",
|
|
84
|
+
};
|
|
73
85
|
/**
|
|
74
86
|
* The official endpoint, or undefined.
|
|
75
87
|
*
|
|
@@ -89,6 +101,15 @@ function officialMinimaxEndpoint(baseUrl) {
|
|
|
89
101
|
return false;
|
|
90
102
|
}
|
|
91
103
|
}
|
|
104
|
+
function officialKimiEndpoint(baseUrl) {
|
|
105
|
+
try {
|
|
106
|
+
const parsed = new URL(baseUrl.trim());
|
|
107
|
+
return KIMI_API_ORIGINS.has(parsed.origin) && KIMI_API_PATHS.has(parsed.pathname.replace(/\/+$/, ""));
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
92
113
|
/**
|
|
93
114
|
* The levels a provider DECLARED for a model, when it declared them properly.
|
|
94
115
|
*
|
|
@@ -148,11 +169,14 @@ export function discoverThinkingLevels(entry, context) {
|
|
|
148
169
|
const declared = declaredLevels(entry);
|
|
149
170
|
if (declared)
|
|
150
171
|
return declared;
|
|
172
|
+
const id = typeof entry.id === "string" ? entry.id.trim().toLowerCase() : "";
|
|
173
|
+
if (id === KIMI_K31_PRO_MODEL && officialKimiEndpoint(context.baseUrl)) {
|
|
174
|
+
return { ...KIMI_K31_PRO_LEVELS };
|
|
175
|
+
}
|
|
151
176
|
// THE OFFICIAL MINIMAX ENDPOINT, AND ONLY THAT ONE - the origin and the path both, because a map
|
|
152
177
|
// is only true of the endpoint it was learned from.
|
|
153
178
|
if (!officialMinimaxEndpoint(context.baseUrl))
|
|
154
179
|
return undefined;
|
|
155
|
-
const id = typeof entry.id === "string" ? entry.id.trim().toLowerCase() : "";
|
|
156
180
|
if (id !== MINIMAX_FLASH_MODEL)
|
|
157
181
|
return undefined;
|
|
158
182
|
return { ...MINIMAX_FLASH_LEVELS };
|
package/package.json
CHANGED