@evandu/super-pi 0.1.164 → 0.1.165

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 (32) hide show
  1. package/agents/super-pi-task/core.ts +1 -1
  2. package/dist/client/.super-pi-client-sources.json +3 -3
  3. package/dist/client/assets/{CodeMirrorEditor-B7hhyG33.js → CodeMirrorEditor-B3-4Qpd1.js} +2 -2
  4. package/dist/client/assets/{dist-BmeBkDNB.js → dist-2Ax3GOhT.js} +1 -1
  5. package/dist/client/assets/{dist-CF9zuubZ.js → dist-BD4w6y25.js} +1 -1
  6. package/dist/client/assets/{dist-qqDS87aN.js → dist-BIqjsoet.js} +1 -1
  7. package/dist/client/assets/{dist-DaUyp_NN.js → dist-BWsed8P8.js} +1 -1
  8. package/dist/client/assets/{dist-ByEzPyEi.js → dist-Bh9jVMEA.js} +1 -1
  9. package/dist/client/assets/{dist-BhouAfNI.js → dist-BhiW2HYK.js} +1 -1
  10. package/dist/client/assets/{dist-D607J8oC.js → dist-C2mhG_5m.js} +1 -1
  11. package/dist/client/assets/{dist-BjlmPyRl.js → dist-CL9_Ff9R.js} +1 -1
  12. package/dist/client/assets/{dist-BDy5Nw4_.js → dist-CN6rdrJA.js} +1 -1
  13. package/dist/client/assets/{dist-CGO5Bn1x.js → dist-Cn4Q7-eG.js} +1 -1
  14. package/dist/client/assets/{dist-CdpuBRoy.js → dist-D45Y5G5v.js} +1 -1
  15. package/dist/client/assets/{dist-BLhPsVFt.js → dist-DF05sEDO.js} +1 -1
  16. package/dist/client/assets/{dist-BBfDBMAk.js → dist-DGOgW2hA.js} +1 -1
  17. package/dist/client/assets/{dist-C4ql8ak8.js → dist-DQnuHIqA.js} +1 -1
  18. package/dist/client/assets/{dist-D6nsZZd3.js → dist-DRgOr5sP.js} +1 -1
  19. package/dist/client/assets/{dist-Foaz_oK2.js → dist-Di8I1Dsi.js} +1 -1
  20. package/dist/client/assets/{dist-B5xG-jTK.js → dist-Do72hsvz.js} +1 -1
  21. package/dist/client/assets/{dist-DJ4sWDSy.js → dist-DtNwDyK1.js} +1 -1
  22. package/dist/client/assets/{dist-CrJV_eES.js → dist-QTqWnNGE.js} +1 -1
  23. package/dist/client/assets/{dist-7Nz91m3a.js → dist-hUAwe2Kn.js} +1 -1
  24. package/dist/client/assets/{dist-CxZb6ATc.js → dist-rFG_iRW3.js} +1 -1
  25. package/dist/client/assets/{dist-CsBiEr54.js → dist-wW-2h0X5.js} +1 -1
  26. package/dist/client/assets/{index-1hS3wVqF.js → index-BUTxkA3D.js} +4 -4
  27. package/dist/client/index.html +1 -1
  28. package/dist/server/application/project-service.d.ts +95 -4
  29. package/dist/server/application/project-service.js +316 -70
  30. package/dist/server/http-server.js +7 -0
  31. package/dist/server/types.d.ts +4 -0
  32. package/package.json +3 -1
@@ -8,7 +8,7 @@
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-1hS3wVqF.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-BUTxkA3D.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-Wtlj0s4R.css">
13
13
  </head>
14
14
  <body>
@@ -1,8 +1,39 @@
1
1
  import type { Store } from "../store.js";
2
2
  import type { Project, ProjectEscalation, ProjectMode, ProjectReport, ProjectRisk, ProjectSummary, ProjectTask, SessionProfile } from "../types.js";
3
3
  import type { SessionOrchestratorService } from "./session-orchestrator-service.js";
4
+ /**
5
+ * WHAT THE PROJECT LEADER IS TOLD WHEN IT STARTS.
6
+ *
7
+ * The two prompts are kept apart on purpose. The standard one is the shape the project flow has
8
+ * always had - decompose, delegate, review. The lightweight one is a different set of
9
+ * instructions about a different shape: one session, no decomposition, no reviewer. Writing one
10
+ * prompt with holes in it would mean every sentence had to carry a condition, and the model would
11
+ * have to work out which shape it was in.
12
+ *
13
+ * THE ESCALATION RULE IS SAID ONCE, IN ONE VOICE. The standard leader used to be told two
14
+ * opposite things about the same event - "your subordinates' escalations come to you first, you
15
+ * decide whether to handle them yourself or report them up" AND "you must not resolve escalations
16
+ * yourself" - and a model reading both has no way to pick, so it hesitates between them. The
17
+ * rule is now one sentence with three parts: handle it at your own level, escalate only what
18
+ * really needs the Boss, and never decide for the Boss or drop an escalation. The lightweight
19
+ * leader has no subordinates at all, so it is told the second half only - it must not decide
20
+ * alone either - and is never told about subordinates it does not have.
21
+ */
22
+ export declare const STANDARD_LEADER_PROMPT = "\u4F60\u662F\u76F4\u63A5\u5411 Boss \u8D1F\u8D23\u7684\u9879\u76EE Leader\uFF0C\u517C\u4EFB\u79D8\u4E66\u3002\u5148\u8C03\u7528 project(action=get, projectId) \u4E86\u89E3\u6700\u65B0\u72B6\u6001\u3002\u5C0F\u9879\u76EE\u53EA\u62C6\u6700\u5C11\u5FC5\u8981\u4EFB\u52A1\uFF0C\u5927\u9879\u76EE\u6309\u4EA4\u4ED8\u8FB9\u754C\u5206\u5DE5\u3002\u7528 add_task \u767B\u8BB0\u4EFB\u52A1\uFF08\u660E\u786E\u76EE\u6807\u3001\u4EA4\u4ED8\u7269\u3001\u9A8C\u6536\u6807\u51C6\u3001\u4F9D\u8D56\uFF09\uFF1Badd_task / update_task \u65F6\u53EF\u4EE5\u5E26 executorProfile \u4E0E reviewerProfile\uFF08\u652F\u6301\u6307\u5B9A agentId\u3001cwd\u3001model\u3001thinkingLevel\u3001watchdogTimeoutSeconds\uFF09\uFF0C\u6309\u4EFB\u52A1\u6027\u8D28\u5C06\u6267\u884C\u4E0E\u590D\u6838\u59D4\u6D3E\u7ED9\u6700\u5408\u9002\u7684\u5458\u5DE5\uFF0C\u4E0D\u6307\u5B9A\u5219\u7EE7\u627F\u9879\u76EE\u9ED8\u8BA4\uFF1B\u9700\u8981\u7EE7\u7EED\u62C6\u89E3\u7684\u5DE5\u4F5C\u8BBE role=leader\uFF0C\u53F6\u5B50\u6267\u884C\u4EFB\u52A1\u8BBE role=executor\uFF0C\u5B50 Leader \u7528 parentTaskId \u767B\u8BB0\u81EA\u5DF1\u7684\u5B50\u4EFB\u52A1\uFF0Cdispatch \u542F\u52A8\u6267\u884C\u5B50\u4F1A\u8BDD\uFF1B\u4E0D\u8981\u7528 session_spawn/session_dispatch \u6216 task/workflow \u7ED5\u8FC7\u9879\u76EE\u8D44\u6E90\u9650\u5236\u3002\u6536\u5230\u4EA4\u4ED8\u540E\u7528 request_review \u542F\u52A8\u72EC\u7ACB\u590D\u6838\u3002\u5B50\u4F1A\u8BDD\u7ED3\u675F\u4F1A\u81EA\u52A8\u56DE\u62A5\u7ED9\u4F60\uFF0C\u5C4A\u65F6\u7EE7\u7EED\u6D3E\u53D1 ready \u4EFB\u52A1\u3001\u590D\u6838\u5F85\u9A8C\u6536\u4EFB\u52A1\u6216\u6309 review.summary \u8FD4\u5DE5\u3002\u4E0D\u8981\u8F6E\u8BE2\u7B49\u5F85\uFF0C\u4E0D\u8981\u53CD\u590D\u65E0\u8FDB\u5C55\u91CD\u8BD5\uFF0C\u5E76\u53D1\u6EE1\u65F6\u7ED3\u675F\u5F53\u524D\u56DE\u590D\u7B49\u5F85\u56DE\u62A5\u3002\u7528 report \u767B\u8BB0\u5173\u952E\u8FDB\u5C55\u3002\u4F60\u7684\u4E0B\u5C5E\u7684\u5347\u7EA7\u5148\u5230\u4F60\u8FD9\u91CC\uFF1A\u4F60\u5728\u81EA\u5DF1\u8FD9\u4E00\u5C42\u5904\u7406\uFF0C\u80FD\u81EA\u5DF1\u89E3\u51B3\u7684\u81EA\u5DF1\u89E3\u51B3\uFF1B\u53EA\u6709\u786E\u5B9E\u9700\u8981 Boss \u51B3\u7B56\u7684\uFF08\u91CD\u5927\u504F\u5DEE\u3001\u6743\u9650\u6216\u9884\u7B97\u95EE\u9898\uFF09\u624D\u7528 escalate \u4EA4\u7ED9 Boss\u3002\u4F60\u4E0D\u80FD\u66FF Boss \u505A\u51B3\u5B9A\uFF0C\u4E5F\u4E0D\u8981\u628A\u6CA1\u5904\u7406\u7684\u5347\u7EA7\u538B\u4E0B\u53BB\u4E0D\u7406\u3002\u6240\u6709\u4EFB\u52A1\u9A8C\u6536\u540E\uFF0C\u7528 complete \u63D0\u4EA4\u5E26\u8BC1\u636E\u7684\u6700\u7EC8\u4EA4\u4ED8\u603B\u7ED3\u3002\u4E0A\u4E0B\u6587\u6709\u9650\uFF0C\u660E\u786E\u5047\u8BBE\uFF0C\u4E3B\u52A8\u5BFB\u627E\u53CD\u8BC1\u3002\u53EA\u5728\u672C\u6B21\u89E6\u53D1\u8303\u56F4\u5185\u5DE5\u4F5C\u3002";
23
+ export declare const LIGHTWEIGHT_LEADER_PROMPT = "\u4F60\u662F\u76F4\u63A5\u5411 Boss \u8D1F\u8D23\u7684\u9879\u76EE Leader\uFF0C\u8FD9\u662F\u4E00\u4E2A\u8F7B\u91CF\u9879\u76EE\uFF1A\u8FD9\u4E2A\u9879\u76EE\u7531\u4F60\u4EB2\u81EA\u5B8C\u6210\uFF0C\u4E0D\u8981\u62C6\u5B50\u4EFB\u52A1\u3001\u4E0D\u8981\u6D3E\u53D1\u7ED9\u522B\u4EBA\u3001\u4E5F\u6CA1\u6709\u72EC\u7ACB\u590D\u6838\u3002\u5148\u8C03\u7528 project(action=get, projectId) \u4E86\u89E3\u6700\u65B0\u72B6\u6001\u3002\u7528 add_task \u767B\u8BB0\u4EFB\u52A1\uFF08\u660E\u786E\u76EE\u6807\u3001\u4EA4\u4ED8\u7269\u3001\u9A8C\u6536\u6807\u51C6\u3001\u4F9D\u8D56\uFF09\uFF0C\u4EFB\u52A1\u4E00\u5F8B\u767B\u8BB0\u4E3A\u6267\u884C\u4EFB\u52A1\uFF1Arole=leader \u6216\u5E26 parentTaskId \u90FD\u4F1A\u88AB\u62D2\u7EDD\u3002dispatch \u4F1A\u628A\u4EFB\u52A1\u4EA4\u56DE\u7ED9\u4F60\u81EA\u5DF1\uFF0C\u4F60\u4EB2\u81EA\u505A\u5B8C\uFF1B\u505A\u5B8C\u540E\u8C03\u7528 project(action=submit, projectId, taskId, output, evidenceRefs) \u63D0\u4EA4\u4EA4\u4ED8\uFF0C\u63D0\u4EA4\u5373\u5B8C\u6210\uFF0C\u4E0D\u4F1A\u6709\u4EBA\u56DE\u6765\u590D\u6838\uFF0C\u8BC1\u636E\u5FC5\u987B\u9644\u4E0A\u3002\u4E0D\u8981\u7528 session_spawn/session_dispatch \u6216 task/workflow \u7ED5\u8FC7\u9879\u76EE\u8D44\u6E90\u9650\u5236\u3002\u4E0D\u8981\u8F6E\u8BE2\u7B49\u5F85\uFF0C\u4E0D\u8981\u53CD\u590D\u65E0\u8FDB\u5C55\u91CD\u8BD5\u3002\u7528 report \u767B\u8BB0\u5173\u952E\u8FDB\u5C55\uFF0C\u7528 escalate \u5C06\u91CD\u5927\u504F\u5DEE\u3001\u6743\u9650\u6216\u9884\u7B97\u95EE\u9898\u4EA4\u7ED9 Boss\uFF0C\u4E0D\u5F97\u81EA\u884C\u89E3\u51B3\u5347\u7EA7\u4E8B\u9879\u3002\u6240\u6709\u4EFB\u52A1\u4EA4\u4ED8\u540E\uFF0C\u7528 complete \u63D0\u4EA4\u5E26\u8BC1\u636E\u7684\u6700\u7EC8\u4EA4\u4ED8\u603B\u7ED3\u3002\u4E0A\u4E0B\u6587\u6709\u9650\uFF0C\u660E\u786E\u5047\u8BBE\uFF0C\u4E3B\u52A8\u5BFB\u627E\u53CD\u8BC1\u3002\u53EA\u5728\u672C\u6B21\u89E6\u53D1\u8303\u56F4\u5185\u5DE5\u4F5C\u3002";
4
24
  export declare const profile: (value: unknown, label: string) => SessionProfile | undefined;
5
25
  export declare const mergeProfile: (taskProfile?: SessionProfile, projectDefault?: SessionProfile) => SessionProfile | undefined;
26
+ /**
27
+ * THE PROJECTS ONE LIST CALL ANSWERS WITH, AND HOW MANY THERE REALLY ARE.
28
+ *
29
+ * `projects` is the capped list, newest update first. `total` is how many projects the session
30
+ * is related to, counted BEFORE the cap, and `returned` is how many of them are in the list.
31
+ */
32
+ export type ProjectListPage = {
33
+ projects: ProjectSummary[];
34
+ total: number;
35
+ returned: number;
36
+ };
6
37
  export type CreateProjectInput = {
7
38
  workspaceId: string;
8
39
  title: string;
@@ -56,6 +87,7 @@ export declare class ProjectService {
56
87
  private readonly queues;
57
88
  constructor(store: Store, orchestrator?: (Pick<SessionOrchestratorService, "spawn" | "dispatch"> & Partial<Pick<SessionOrchestratorService, "stopSubtree">>) | undefined);
58
89
  static taskView(task: ProjectTask, project: Pick<Project, "defaultExecutorProfile" | "defaultReviewerProfile">): ProjectTask;
90
+ private filterEscalations;
59
91
  private projectView;
60
92
  /**
61
93
  * THE NUMBER THE ONE-CLICK PATH OFFERS.
@@ -72,6 +104,25 @@ export declare class ProjectService {
72
104
  private event;
73
105
  private change;
74
106
  private live;
107
+ /**
108
+ * WAKING THE OTHER SIDE MUST NOT TAKE THE REPORT DOWN WITH IT.
109
+ *
110
+ * The report, the escalation or the decision is already written to the store by the time the
111
+ * other side is woken, so a dispatch that fails - a session that was archived, stopped or never
112
+ * existed - must NOT fail the request. It would: the caller would be told the whole thing
113
+ * failed although it succeeded, it would try again, and the same report would be written twice.
114
+ *
115
+ * So the wake is wrapped, the failure is written down, and the record is returned as the
116
+ * success it is.
117
+ *
118
+ * AND THE FAILURE IS NOT SILENT. A report nobody was told about is a report nobody will ever
119
+ * handle, so the project's own timeline gets an event saying exactly that, and the log line
120
+ * names the project and the escalation so the case can be found again later.
121
+ */
122
+ private wake;
123
+ /** THE TIMELINE SAYS THAT NOBODY COULD BE TOLD. Written after the fact, so it never loses the
124
+ * record that was already saved. */
125
+ private noteUnreachable;
75
126
  private leader;
76
127
  private topLevelAuthor;
77
128
  private manager;
@@ -92,14 +143,54 @@ export declare class ProjectService {
92
143
  private requiredComplete;
93
144
  private task;
94
145
  private member;
146
+ isMember(p: Project, actor?: string): boolean;
147
+ directSupervisor(p: Project, actor?: string, taskId?: string): string | undefined;
148
+ /**
149
+ * THE PROJECT A SESSION BELONGS TO RIGHT NOW.
150
+ *
151
+ * `projectForSession` answers a different question - "which project is this session part of" -
152
+ * and it counts the finished projects too, because the history of a project has to stay visible
153
+ * to the people who worked on it. This method answers the narrower question the QUESTION path
154
+ * needs: "is this session inside a project that is still running".
155
+ *
156
+ * WHY THAT DISTINCTION MATTERS. A conversation that took part in a project which has since been
157
+ * completed is not a project member any more - it is a conversation that happens to have a
158
+ * finished project in its history. The old lookup mixed the two, so asking the Boss a question
159
+ * from such a conversation was refused with "a project member may not ask the Boss directly",
160
+ * which is not what was true: the project was over, and nobody was being bypassed. The finished
161
+ * project is still found and still visible in the history; it just does not block the question.
162
+ *
163
+ * A session that is in a running project AND in a finished one belongs to the running one - it
164
+ * is the one that is still in charge of it.
165
+ */
166
+ private liveProjectForSession;
167
+ canAskQuestion(conversationId: string): {
168
+ ok: boolean;
169
+ reason?: string;
170
+ };
95
171
  private reconcile;
96
172
  private resources;
97
173
  list(workspaceId?: string): Project[];
98
- headline(p: Project): string;
174
+ headline(p: Project, actor?: string): string;
99
175
  private isActorRelated;
100
176
  private projectSummary;
101
- listForActor(workspaceId: string, actor: string): ProjectSummary[];
102
- get(id: string, workspaceId?: string): Project;
177
+ /**
178
+ * THE PROJECTS AN ACTOR IS PART OF, AND HOW MANY OF THEM THERE ARE.
179
+ *
180
+ * The list is capped, because the list is what goes into an agent's context: a workspace that
181
+ * has been alive for a year has hundreds of finished projects, and handing all of them over
182
+ * answers the question "how are my projects doing" with a wall of history. The cap is on the
183
+ * RECENT ones - the same order the list has always had, newest update first - so what the
184
+ * agent reads first is what actually changed.
185
+ *
186
+ * AND THE COUNT IS TOLD, NOT IMPLIED. `total` is how many projects the session is really
187
+ * related to, counted BEFORE the cut, and `returned` is how many came back. An agent that sees
188
+ * total 57 and returned 20 knows the workspace has more history than it was shown, and says so
189
+ * instead of telling the Boss the workspace only has 20 projects. A silently truncated list
190
+ * would be a lie the agent could not see through.
191
+ */
192
+ listForActor(workspaceId: string, actor: string, limit?: number): ProjectListPage;
193
+ get(id: string, workspaceId?: string, actor?: string): Project;
103
194
  /**
104
195
  * THE PROJECT AS A REPORT A HUMAN CAN READ.
105
196
  *
@@ -175,7 +266,7 @@ export declare class ProjectService {
175
266
  raiseBudgetAndContinue(id: string, workspaceId: string, callerConversationId?: string): Promise<BudgetRaiseResult>;
176
267
  addReport(id: string, input: Omit<ProjectReport, "id" | "projectId" | "createdAt">, workspaceId?: string, actor?: string): Promise<ProjectReport>;
177
268
  addEscalation(id: string, input: Pick<ProjectEscalation, "reason" | "severity" | "taskId">, workspaceId?: string, actor?: string): Promise<ProjectEscalation>;
178
- resolveEscalation(id: string, escalationId: string, decision: string, status: "resolved" | "dismissed", workspaceId?: string): Promise<ProjectEscalation>;
269
+ resolveEscalation(id: string, escalationId: string, decision: string, status: "resolved" | "dismissed", workspaceId?: string, actor?: string): Promise<ProjectEscalation>;
179
270
  complete(id: string, summary: string, evidenceRefs: unknown, workspaceId: string, actor?: string): Promise<Project>;
180
271
  /**
181
272
  * The tasks an initiator hands over with create. A dependency names the TITLE of another task in