@evandu/super-pi 0.1.217 → 0.1.219

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 (62) hide show
  1. package/agents/project-leader.md +1 -1
  2. package/agents/super-pi-task/core.ts +1 -1
  3. package/agents/super-pi-task/index.ts +4 -2
  4. package/dist/client/.super-pi-client-sources.json +7 -7
  5. package/dist/client/assets/{CodeMirrorEditor-Bu2HpCg6.js → CodeMirrorEditor-BoRBaVec.js} +2 -2
  6. package/dist/client/assets/{dist-DeUjsvtg.js → dist-BOC9yjsN.js} +1 -1
  7. package/dist/client/assets/{dist-2N8cRAr1.js → dist-BOF4T7jI.js} +1 -1
  8. package/dist/client/assets/{dist-CaSc7b5q.js → dist-BVVJTFYw.js} +1 -1
  9. package/dist/client/assets/{dist-CgcNjGWq.js → dist-BXOV_xtI.js} +1 -1
  10. package/dist/client/assets/{dist-cckoD98D.js → dist-Bh20DSAa.js} +1 -1
  11. package/dist/client/assets/{dist-BhKjqL1a.js → dist-CIv6vCdn.js} +1 -1
  12. package/dist/client/assets/{dist-CcBbs6jt.js → dist-CMdO3YzL.js} +1 -1
  13. package/dist/client/assets/{dist-BUqWmkxx.js → dist-CPjKkcyd.js} +1 -1
  14. package/dist/client/assets/{dist-CygI57SH.js → dist-CYpk6fXT.js} +1 -1
  15. package/dist/client/assets/{dist-CfdUiqMV.js → dist-CiRgPe6t.js} +1 -1
  16. package/dist/client/assets/{dist-D-HE23hj.js → dist-CjhpwEGf.js} +1 -1
  17. package/dist/client/assets/{dist-D68xvrk-.js → dist-Cp3XgqJR.js} +1 -1
  18. package/dist/client/assets/{dist-CpZQNnTs.js → dist-D1hdxSH6.js} +1 -1
  19. package/dist/client/assets/{dist-CWdNmsfe.js → dist-DLYLxwOe.js} +1 -1
  20. package/dist/client/assets/{dist-WWllmrHS.js → dist-DQ_C0DEU.js} +1 -1
  21. package/dist/client/assets/{dist-Oe-g6uQR.js → dist-DUbHNa35.js} +1 -1
  22. package/dist/client/assets/{dist-DFwdzVqB.js → dist-Digy2Mj0.js} +1 -1
  23. package/dist/client/assets/{dist-CX_2RyPQ.js → dist-DvWgfLRt.js} +1 -1
  24. package/dist/client/assets/{dist-BHl8lGVB.js → dist-Dwsqs8C-.js} +1 -1
  25. package/dist/client/assets/{dist-BgzW1ukH.js → dist-gRtmlyhZ.js} +1 -1
  26. package/dist/client/assets/{dist-BdSsUofL.js → dist-mAA5Fw0-.js} +1 -1
  27. package/dist/client/assets/{dist-DjNZcW3s.js → dist-xb23AFcT.js} +1 -1
  28. package/dist/client/assets/{index-BuAaKh0Q.js → index-DmxXnVfN.js} +20 -20
  29. package/dist/client/assets/index-Nu--gcBs.css +1 -0
  30. package/dist/client/index.html +2 -2
  31. package/dist/server/application/conversation-service.d.ts +7 -2
  32. package/dist/server/application/conversation-service.js +45 -5
  33. package/dist/server/application/project-service.d.ts +8 -4
  34. package/dist/server/application/project-service.js +76 -34
  35. package/dist/server/application/provider-service.js +50 -7
  36. package/dist/server/application/run-service.js +2 -0
  37. package/dist/server/application/session-orchestrator-service.d.ts +3 -0
  38. package/dist/server/application/session-orchestrator-service.js +53 -21
  39. package/dist/server/command-handler.d.ts +3 -1
  40. package/dist/server/command-handler.js +21 -1
  41. package/dist/server/index.js +2 -2
  42. package/dist/server/pi-session.d.ts +26 -5
  43. package/dist/server/pi-session.js +64 -12
  44. package/dist/server/providers.d.ts +22 -1
  45. package/dist/server/providers.js +106 -17
  46. package/dist/server/runtime.js +19 -3
  47. package/dist/server/store.d.ts +7 -1
  48. package/dist/server/store.js +47 -8
  49. package/dist/server/thinking-level-discovery.d.ts +38 -0
  50. package/dist/server/thinking-level-discovery.js +159 -0
  51. package/dist/server/types.d.ts +42 -1
  52. package/dist/server/upload.d.ts +2 -0
  53. package/dist/server/upload.js +19 -2
  54. package/dist/shared/project-overview.d.ts +9 -0
  55. package/dist/shared/project-overview.js +21 -7
  56. package/dist/shared/project-presentation.d.ts +3 -0
  57. package/dist/shared/project-presentation.js +13 -5
  58. package/dist/shared/team-context.d.ts +1 -1
  59. package/dist/shared/thinking-levels.d.ts +53 -0
  60. package/dist/shared/thinking-levels.js +85 -0
  61. package/package.json +1 -1
  62. package/dist/client/assets/index-BGgKzf3Y.css +0 -1
@@ -1,3 +1,4 @@
1
+ import { deliveryCoversTasks, latestProjectDelivery } from "./project-overview.js";
1
2
  export const PROJECT_PHASE_WORDS = {
2
3
  draft: "待澄清", planning: "待规划", planned: "已规划", awaiting_start: "待启动", active: "进行中",
3
4
  pending: "等待依赖", ready: "待派发", assigned: "已委派", in_progress: "执行阶段", interrupted: "已中断",
@@ -21,6 +22,8 @@ export function deriveTaskActivity(task, sessions = [], mode = "standard", tasks
21
22
  case "failed": return activity("failed", "失败", "由直属负责人核对失败原因");
22
23
  case "cancelled": return activity("cancelled", "已取消", "保留已有记录");
23
24
  case "completed":
25
+ if (projectSessionBusy(session?.status) || projectSessionBusy(reviewer?.status))
26
+ return activity("iterating", "正在继续迭代", "继续原会话,已有验收记录保留");
24
27
  if (task.review?.lightweight || mode === "lightweight" && task.review?.verdict === "accepted")
25
28
  return activity("self_delivered", "自评交付", "按轻量项目口径汇总");
26
29
  if (mode !== "lightweight" && task.review?.verdict === "accepted")
@@ -57,7 +60,7 @@ export function deriveTaskActivity(task, sessions = [], mode = "standard", tasks
57
60
  }
58
61
  }
59
62
  export function deriveProjectActivity(project) {
60
- if (["completed", "cancelled", "failed"].includes(project.status))
63
+ if (["cancelled", "failed"].includes(project.status))
61
64
  return activity(project.status, projectPhaseWord(project.status), "查看交付与项目记录");
62
65
  if (["blocked", "awaiting_approval"].includes(project.status))
63
66
  return activity(project.status, projectPhaseWord(project.status), "由项目负责人处理阻塞与升级");
@@ -66,15 +69,20 @@ export function deriveProjectActivity(project) {
66
69
  const leader = sessions.find(session => session.id === project.ownerConversationId);
67
70
  if (!project.ownerConversationId)
68
71
  return activity(tasks.length ? "awaiting_start" : "planning", tasks.length ? "待启动" : "待规划", "由负责人启动项目并安排任务");
69
- if (tasks.length && tasks.every(task => task.required === false || task.status === "completed")) {
70
- return activity(projectSessionBusy(leader?.status) ? "summarizing" : "ready_to_close", projectSessionBusy(leader?.status) ? "汇总交付中" : "待汇总交付", "由项目负责人提交最终交付并关闭项目");
71
- }
72
72
  const activities = tasks.map(task => deriveTaskActivity(task, sessions, project.mode, tasks));
73
- const live = activities.find(item => ["executing", "reviewing", "queued", "review_queued", "background", "review_background"].includes(item.kind));
73
+ const live = activities.find(item => ["executing", "reviewing", "queued", "review_queued", "background", "review_background", "iterating"].includes(item.kind));
74
74
  if (live)
75
75
  return live;
76
76
  if ((project.resources?.activeWorkers ?? 0) > 0 && !sessions.some(session => projectSessionBusy(session.status)))
77
77
  return activity("background", "等待后台结果", "等待项目内的一次性调用返回结果");
78
+ const required = tasks.filter(task => task.required !== false);
79
+ if (required.length && required.every(task => task.status === "completed")) {
80
+ if (!deliveryCoversTasks(latestProjectDelivery(project), required)) {
81
+ return activity(projectSessionBusy(leader?.status) ? "summarizing" : "ready_to_deliver", projectSessionBusy(leader?.status) ? "汇总交付中" : "待汇总交付", "由项目负责人记录本阶段交付");
82
+ }
83
+ if (!projectSessionBusy(leader?.status))
84
+ return activity("ready_for_iteration", "待继续", "可继续安排任务或补充验证");
85
+ }
78
86
  if (projectSessionBusy(leader?.status))
79
87
  return activity("coordinating", "协调中", "项目负责人正在安排后续工作");
80
88
  const awaiting = activities.find(item => ["awaiting_delivery", "awaiting_review_result", "review_interrupted", "awaiting_review_assignment", "interrupted", "awaiting_subordinates", "blocked", "ready", "waiting_dependency"].includes(item.kind));
@@ -1,6 +1,6 @@
1
1
  export type TeamContextKind = "finding" | "decision" | "pitfall" | "hypothesis";
2
2
  export type CoordinationHint = {
3
- action: "dispatch" | "message" | "request_review" | "resolve_escalation" | "complete";
3
+ action: "dispatch" | "message" | "request_review" | "resolve_escalation" | "deliver";
4
4
  taskId?: string;
5
5
  escalationId?: string;
6
6
  targetConversationId?: string;
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evandu/super-pi",
3
- "version": "0.1.217",
3
+ "version": "0.1.219",
4
4
  "description": "Web control plane and companion for Pi",
5
5
  "license": "MIT",
6
6
  "type": "module",