@agimon-ai/po-task 0.0.0-alpha.0

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 (161) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +131 -0
  3. package/dist/apiContracts.cjs +54 -0
  4. package/dist/apiContracts.cjs.map +1 -0
  5. package/dist/apiContracts.d.mts +53 -0
  6. package/dist/apiContracts.d.mts.map +1 -0
  7. package/dist/apiContracts.mjs +49 -0
  8. package/dist/apiContracts.mjs.map +1 -0
  9. package/dist/config-CFSs3iku.mjs +72 -0
  10. package/dist/config-CFSs3iku.mjs.map +1 -0
  11. package/dist/config-CdX-Bv8q.cjs +173 -0
  12. package/dist/config-CdX-Bv8q.cjs.map +1 -0
  13. package/dist/config.cjs +19 -0
  14. package/dist/config.d.mts +2 -0
  15. package/dist/config.mjs +2 -0
  16. package/dist/delegation-BiOy3_7g.mjs +7 -0
  17. package/dist/delegation-BiOy3_7g.mjs.map +1 -0
  18. package/dist/delegation-CdMqOZB4.mjs +626 -0
  19. package/dist/delegation-CdMqOZB4.mjs.map +1 -0
  20. package/dist/delegation-DsnKjMbJ.cjs +661 -0
  21. package/dist/delegation-DsnKjMbJ.cjs.map +1 -0
  22. package/dist/delegation-LDpHP2CC.cjs +12 -0
  23. package/dist/delegation-LDpHP2CC.cjs.map +1 -0
  24. package/dist/delegationManager.cjs +10 -0
  25. package/dist/delegationManager.d.mts +2 -0
  26. package/dist/delegationManager.mjs +3 -0
  27. package/dist/extensions/mcp-ui.mjs +23 -0
  28. package/dist/extensions/mcp-ui.mjs.map +1 -0
  29. package/dist/extensions/mcp.cjs +1144 -0
  30. package/dist/extensions/mcp.cjs.map +1 -0
  31. package/dist/extensions/mcp.d.mts +5 -0
  32. package/dist/extensions/mcp.d.mts.map +1 -0
  33. package/dist/extensions/mcp.mjs +1115 -0
  34. package/dist/extensions/mcp.mjs.map +1 -0
  35. package/dist/extensions/native.mjs +1175 -0
  36. package/dist/extensions/native.mjs.map +1 -0
  37. package/dist/extensions/server.cjs +569 -0
  38. package/dist/extensions/server.cjs.map +1 -0
  39. package/dist/extensions/server.d.mts +5 -0
  40. package/dist/extensions/server.d.mts.map +1 -0
  41. package/dist/extensions/server.mjs +563 -0
  42. package/dist/extensions/server.mjs.map +1 -0
  43. package/dist/extensions/web.mjs +1018 -0
  44. package/dist/extensions/web.mjs.map +1 -0
  45. package/dist/index-B-3sCF2S.d.mts +43 -0
  46. package/dist/index-B-3sCF2S.d.mts.map +1 -0
  47. package/dist/index-B1JPJdpZ.d.mts +51 -0
  48. package/dist/index-B1JPJdpZ.d.mts.map +1 -0
  49. package/dist/index-CUWCvh-E.d.mts +72 -0
  50. package/dist/index-CUWCvh-E.d.mts.map +1 -0
  51. package/dist/index-DlmXKyhQ.d.mts +34 -0
  52. package/dist/index-DlmXKyhQ.d.mts.map +1 -0
  53. package/dist/index-Dvb8X_qB.d.mts +67 -0
  54. package/dist/index-Dvb8X_qB.d.mts.map +1 -0
  55. package/dist/index-XY9VPmfm.d.mts +26 -0
  56. package/dist/index-XY9VPmfm.d.mts.map +1 -0
  57. package/dist/index-teIf67qQ.d.mts +196 -0
  58. package/dist/index-teIf67qQ.d.mts.map +1 -0
  59. package/dist/index.cjs +93 -0
  60. package/dist/index.d.mts +11 -0
  61. package/dist/index.mjs +12 -0
  62. package/dist/invariants-DhjEjBPU.cjs +79 -0
  63. package/dist/invariants-DhjEjBPU.cjs.map +1 -0
  64. package/dist/invariants-q_UamF7D.mjs +62 -0
  65. package/dist/invariants-q_UamF7D.mjs.map +1 -0
  66. package/dist/logSinkTelemetry-B23qGiP-.cjs +52 -0
  67. package/dist/logSinkTelemetry-B23qGiP-.cjs.map +1 -0
  68. package/dist/logSinkTelemetry-BMBsC54p.mjs +41 -0
  69. package/dist/logSinkTelemetry-BMBsC54p.mjs.map +1 -0
  70. package/dist/logSinkTelemetry.cjs +6 -0
  71. package/dist/logSinkTelemetry.d.mts +23 -0
  72. package/dist/logSinkTelemetry.d.mts.map +1 -0
  73. package/dist/logSinkTelemetry.mjs +3 -0
  74. package/dist/paths-CSya2l9_.cjs +308 -0
  75. package/dist/paths-CSya2l9_.cjs.map +1 -0
  76. package/dist/paths-Cah1vFGv.mjs +207 -0
  77. package/dist/paths-Cah1vFGv.mjs.map +1 -0
  78. package/dist/processLiveness-Ccd9wenT.mjs +20 -0
  79. package/dist/processLiveness-Ccd9wenT.mjs.map +1 -0
  80. package/dist/processLiveness-umpNgsPR.cjs +25 -0
  81. package/dist/processLiveness-umpNgsPR.cjs.map +1 -0
  82. package/dist/reconcile-BcD-hTbd.mjs +63 -0
  83. package/dist/reconcile-BcD-hTbd.mjs.map +1 -0
  84. package/dist/reconcile-cRL0NjDr.cjs +80 -0
  85. package/dist/reconcile-cRL0NjDr.cjs.map +1 -0
  86. package/dist/reducer-BEfJFM5L.mjs +345 -0
  87. package/dist/reducer-BEfJFM5L.mjs.map +1 -0
  88. package/dist/reducer-BV0YIZ2o.cjs +380 -0
  89. package/dist/reducer-BV0YIZ2o.cjs.map +1 -0
  90. package/dist/storeInvariants.cjs +5 -0
  91. package/dist/storeInvariants.d.mts +23 -0
  92. package/dist/storeInvariants.d.mts.map +1 -0
  93. package/dist/storeInvariants.mjs +2 -0
  94. package/dist/storePaths.cjs +14 -0
  95. package/dist/storePaths.d.mts +2 -0
  96. package/dist/storePaths.mjs +2 -0
  97. package/dist/storeProcessLiveness.cjs +3 -0
  98. package/dist/storeProcessLiveness.d.mts +11 -0
  99. package/dist/storeProcessLiveness.d.mts.map +1 -0
  100. package/dist/storeProcessLiveness.mjs +2 -0
  101. package/dist/storeReconcile.cjs +5 -0
  102. package/dist/storeReconcile.d.mts +2 -0
  103. package/dist/storeReconcile.mjs +2 -0
  104. package/dist/storeReducer.cjs +8 -0
  105. package/dist/storeReducer.d.mts +2 -0
  106. package/dist/storeReducer.mjs +2 -0
  107. package/dist/storeTaskGraph.cjs +7 -0
  108. package/dist/storeTaskGraph.d.mts +2 -0
  109. package/dist/storeTaskGraph.mjs +2 -0
  110. package/dist/storeTaskStore.cjs +3 -0
  111. package/dist/storeTaskStore.d.mts +2 -0
  112. package/dist/storeTaskStore.mjs +2 -0
  113. package/dist/storeTypes.cjs +6 -0
  114. package/dist/storeTypes.d.mts +2 -0
  115. package/dist/storeTypes.mjs +2 -0
  116. package/dist/task-CXF9VULl.cjs +49 -0
  117. package/dist/task-CXF9VULl.cjs.map +1 -0
  118. package/dist/task-DJpTteeJ.d.mts +187 -0
  119. package/dist/task-DJpTteeJ.d.mts.map +1 -0
  120. package/dist/task-DO0TwZ0z.mjs +132 -0
  121. package/dist/task-DO0TwZ0z.mjs.map +1 -0
  122. package/dist/task-Dhta7JyA.d.mts +126 -0
  123. package/dist/task-Dhta7JyA.d.mts.map +1 -0
  124. package/dist/task-UvW877Ez.cjs +227 -0
  125. package/dist/task-UvW877Ez.cjs.map +1 -0
  126. package/dist/task-giCbpKzV.mjs +26 -0
  127. package/dist/task-giCbpKzV.mjs.map +1 -0
  128. package/dist/taskGraph-BOQvT0-M.mjs +63 -0
  129. package/dist/taskGraph-BOQvT0-M.mjs.map +1 -0
  130. package/dist/taskGraph-BskRslrr.cjs +92 -0
  131. package/dist/taskGraph-BskRslrr.cjs.map +1 -0
  132. package/dist/taskGraph-D0zFHF2p.d.mts +25 -0
  133. package/dist/taskGraph-D0zFHF2p.d.mts.map +1 -0
  134. package/dist/taskResult-D2G7b4w-.cjs +224 -0
  135. package/dist/taskResult-D2G7b4w-.cjs.map +1 -0
  136. package/dist/taskResult-edBAAKSH.mjs +165 -0
  137. package/dist/taskResult-edBAAKSH.mjs.map +1 -0
  138. package/dist/taskStore-DjU60rMm.cjs +215 -0
  139. package/dist/taskStore-DjU60rMm.cjs.map +1 -0
  140. package/dist/taskStore-pAJ971Ml.mjs +208 -0
  141. package/dist/taskStore-pAJ971Ml.mjs.map +1 -0
  142. package/dist/telemetry-Ca0I3Tqo.cjs +30 -0
  143. package/dist/telemetry-Ca0I3Tqo.cjs.map +1 -0
  144. package/dist/telemetry-DyS44zAD.mjs +25 -0
  145. package/dist/telemetry-DyS44zAD.mjs.map +1 -0
  146. package/dist/telemetry-FMGRovb4.d.mts +35 -0
  147. package/dist/telemetry-FMGRovb4.d.mts.map +1 -0
  148. package/dist/toolPromptGuidelines.cjs +27 -0
  149. package/dist/toolPromptGuidelines.cjs.map +1 -0
  150. package/dist/toolPromptGuidelines.d.mts +13 -0
  151. package/dist/toolPromptGuidelines.d.mts.map +1 -0
  152. package/dist/toolPromptGuidelines.mjs +26 -0
  153. package/dist/toolPromptGuidelines.mjs.map +1 -0
  154. package/dist/toolResponseEnvelope.cjs +12 -0
  155. package/dist/toolResponseEnvelope.d.mts +2 -0
  156. package/dist/toolResponseEnvelope.mjs +2 -0
  157. package/dist/toolSchema.cjs +18 -0
  158. package/dist/toolSchema.d.mts +2 -0
  159. package/dist/toolSchema.mjs +2 -0
  160. package/package.json +223 -0
  161. package/src/types/webTasks.ts +24 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vuong Ngo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # @agimon-ai/po-task
2
+
3
+ Track persistent, dependency-aware tasks in Po and optionally delegate them through Po Team.
4
+
5
+ Part of the [Po distribution](https://www.npmjs.com/package/@agimon-ai/po).
6
+
7
+ Task owns task records and `tasks.json`. Team owns agents and runs. When both are loaded, Task delegates pending work through Team without merging their stored state.
8
+
9
+ > **Alpha:** task and delegation contracts may change between releases.
10
+
11
+ ## Requirements
12
+
13
+ - Node.js 24 or newer
14
+ - A Po native server host
15
+
16
+ ## Install
17
+
18
+ Define a layer and select it in `.po/modes.yaml`:
19
+
20
+ ```yaml
21
+ layers:
22
+ task:
23
+ packages: ['@agimon-ai/po-task']
24
+
25
+ majorMode:
26
+ minimal:
27
+ description: Lean mode with persistent tasks.
28
+ layers: [task]
29
+ ```
30
+
31
+ Run `po sync` after selecting the package. No standalone Pi entry is published.
32
+
33
+ Task works without Team for local graph management. Add `@agimon-ai/po-team` to the same
34
+ selected mode when `assign` and `cancel` should launch or control subagents.
35
+
36
+ ## Use the `task` tool
37
+
38
+ Supported actions are:
39
+
40
+ | Action | Purpose |
41
+ | ------------- | ------------------------------------------------------------------ |
42
+ | `upsert` | Create tasks or update status, metadata, dependencies, and details |
43
+ | `list`, `get` | Read the graph or one task |
44
+ | `delete` | Tombstone a task |
45
+ | `clear` | Close and reset the graph after active delegations stop |
46
+ | `assign` | Delegate a pending, unblocked task through Team |
47
+ | `cancel` | Stop a delegated run and return its task to pending |
48
+
49
+ ```json
50
+ {
51
+ "action": "upsert",
52
+ "tasks": [
53
+ { "ref": "design", "subject": "Design the API" },
54
+ {
55
+ "subject": "Implement the API",
56
+ "blockedBy": ["design"]
57
+ }
58
+ ]
59
+ }
60
+ ```
61
+
62
+ The reducer enforces lifecycle transitions and rejects dependency cycles. A graph allows 15
63
+ non-deleted tasks by default; updates still apply when full, but new tasks are rejected until space
64
+ is freed.
65
+
66
+ ## Presentation
67
+
68
+ The browser owns the task view and renderer. Terminal task shortcuts and overlays are retired; the native `task` tool remains available.
69
+
70
+ ## Storage and cleanup
71
+
72
+ The default session-tree store is:
73
+
74
+ ```text
75
+ ~/.po/agent/doom-task/<session>/tasks.json
76
+ ```
77
+
78
+ Task is authoritative across transcript compaction because the graph is file-backed. This does not
79
+ mean Task persists Team membership, intercom, or child-process state.
80
+
81
+ Defaults and overrides:
82
+
83
+ | Setting | Default | Purpose |
84
+ | --------------------------------- | ---------- | ------------------------------------------ |
85
+ | `DOOM_TASK_MAX_TASKS` | `15` | Maximum non-deleted tasks |
86
+ | `DOOM_TASK_STORE_TTL_MS` | 30 days | Retention for inactive session-tree stores |
87
+ | `DOOM_TASK_DELEGATION_TIMEOUT_MS` | 20 minutes | Delegated-run result timeout |
88
+ | `DOOM_TASK_STORE` | Unset | Override the complete store file path |
89
+
90
+ Startup reconciliation removes expired stores and repairs delegation records whose owning process
91
+ is no longer live.
92
+
93
+ ## Task and Team together
94
+
95
+ Task uses Team's delegation service and records its lifecycle events on the task. It also contributes
96
+ pending assignments through `doom/background-work`. Team discovers the selected agent, applies
97
+ model and tool policy, owns the run, and returns completion or failure. If Team unloads or is
98
+ replaced, both connections are removed and rebound without leaving a process-global registration.
99
+ Intercom and Team membership remain Team state; `tasks.json` remains Task state.
100
+
101
+ ## Public API
102
+
103
+ ```ts
104
+ import { detectCycle, isBlocked, TaskStore } from '@agimon-ai/po-task';
105
+ import type { Task, TaskStatus } from '@agimon-ai/po-task';
106
+ ```
107
+
108
+ Focused subpaths include `/toolSchema`, `/storeReducer`, `/storeTaskStore`, and `/delegationManager`. Native metadata selects server, browser, and explicit MCP facets; terminal facades are removed.
109
+
110
+ ## Source layout
111
+
112
+ The generated host entries read routed declarations under `src/extensions`. The native session root owns store initialization, delegation, background work, watches, and cleanup. Browser routes own the cockpit channel, Activity dock section, and task renderer. Shared rules and persistence stay in services; flat `src/exports` modules only forward public symbols.
113
+
114
+ ## Development
115
+
116
+ Run from this package directory in the workspace:
117
+
118
+ ```bash
119
+ pnpm build
120
+ pnpm typecheck
121
+ pnpm test
122
+ pnpm lint
123
+ ```
124
+
125
+ Maintained by [Agimon](https://agimon.ai/about).
126
+
127
+ ## License
128
+
129
+ MIT
130
+
131
+ Native server routes live in `src/extensions`; browser routes own presentation. Services own persistence, delegation, and configuration, while models hold durable task documents and graphs. Public entries are flat, forwarding-only files in `src/exports`. Scope lifecycle cleanup belongs to the native server root, not a Pi factory. Terminal task overlays and their public facades are retired.
@@ -0,0 +1,54 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
6
+ let typebox = require("typebox");
7
+ //#region src/schemas/apiContracts.ts
8
+ const S = typebox.Type.String();
9
+ const N = typebox.Type.Number();
10
+ const O = typebox.Type.Optional;
11
+ const literals = (values) => typebox.Type.Union(values.map((value) => typebox.Type.Literal(value)));
12
+ const TasksPayloadSchema = typebox.Type.Object({
13
+ tasks: typebox.Type.Array(typebox.Type.Object({
14
+ id: N,
15
+ subject: S,
16
+ description: O(S),
17
+ activeForm: O(S),
18
+ status: literals([
19
+ "pending",
20
+ "in_progress",
21
+ "completed",
22
+ "failed",
23
+ "deleted"
24
+ ]),
25
+ blockedBy: typebox.Type.Array(N),
26
+ owner: O(S),
27
+ updatedAt: O(S),
28
+ delegation: O(typebox.Type.Object({
29
+ agent: O(S),
30
+ state: O(S)
31
+ }))
32
+ })),
33
+ rev: N
34
+ });
35
+ const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
36
+ version: 1,
37
+ http: [],
38
+ dynamic: [],
39
+ sockets: ["global", "workspace"].map((scope) => ({
40
+ id: "tasks.channel",
41
+ scope,
42
+ service: "po.hub.v1",
43
+ member: "task_graph",
44
+ kind: "channel",
45
+ direction: "server-to-client",
46
+ description: "Task graph channel payload.",
47
+ input: TasksPayloadSchema
48
+ }))
49
+ });
50
+ //#endregion
51
+ exports.apiContracts = apiContracts;
52
+ exports.default = apiContracts;
53
+
54
+ //# sourceMappingURL=apiContracts.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiContracts.cjs","names":["Type","defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst N = Type.Number();\nconst O = Type.Optional;\nconst literals = <T extends string>(values: T[]) => Type.Union(values.map((value) => Type.Literal(value)));\nexport const TasksPayloadSchema = Type.Object({\n tasks: Type.Array(\n Type.Object({\n id: N,\n subject: S,\n description: O(S),\n activeForm: O(S),\n status: literals(['pending', 'in_progress', 'completed', 'failed', 'deleted']),\n blockedBy: Type.Array(N),\n owner: O(S),\n updatedAt: O(S),\n delegation: O(Type.Object({ agent: O(S), state: O(S) })),\n }),\n ),\n rev: N,\n});\nexport const apiContracts = defineApiContract({\n version: 1,\n http: [],\n dynamic: [],\n sockets: (['global', 'workspace'] as const).map((scope) => ({\n id: 'tasks.channel',\n scope,\n service: 'po.hub.v1',\n member: 'task_graph',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Task graph channel payload.',\n input: TasksPayloadSchema,\n })),\n});\nexport default apiContracts;\n"],"mappings":";;;;;;;AAGA,MAAM,IAAIA,QAAAA,KAAK,OAAO;AACtB,MAAM,IAAIA,QAAAA,KAAK,OAAO;AACtB,MAAM,IAAIA,QAAAA,KAAK;AACf,MAAM,YAA8B,WAAgBA,QAAAA,KAAK,MAAM,OAAO,KAAK,UAAUA,QAAAA,KAAK,QAAQ,KAAK,CAAC,CAAC;AACzG,MAAa,qBAAqBA,QAAAA,KAAK,OAAO;CAC5C,OAAOA,QAAAA,KAAK,MACVA,QAAAA,KAAK,OAAO;EACV,IAAI;EACJ,SAAS;EACT,aAAa,EAAE,CAAC;EAChB,YAAY,EAAE,CAAC;EACf,QAAQ,SAAS;GAAC;GAAW;GAAe;GAAa;GAAU;EAAS,CAAC;EAC7E,WAAWA,QAAAA,KAAK,MAAM,CAAC;EACvB,OAAO,EAAE,CAAC;EACV,WAAW,EAAE,CAAC;EACd,YAAY,EAAEA,QAAAA,KAAK,OAAO;GAAE,OAAO,EAAE,CAAC;GAAG,OAAO,EAAE,CAAC;EAAE,CAAC,CAAC;CACzD,CAAC,CACH;CACA,KAAK;AACP,CAAC;AACD,MAAa,gBAAA,GAAeC,gCAAAA,kBAAAA,CAAkB;CAC5C,SAAS;CACT,MAAM,CAAC;CACP,SAAS,CAAC;CACV,SAAU,CAAC,UAAU,WAAW,CAAC,CAAW,KAAK,WAAW;EAC1D,IAAI;EACJ;EACA,SAAS;EACT,QAAQ;EACR,MAAM;EACN,WAAW;EACX,aAAa;EACb,OAAO;CACT,EAAE;AACJ,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { Type } from "typebox";
2
+ //#region src/schemas/apiContracts.d.ts
3
+ export declare const apiContracts: {
4
+ version: 1;
5
+ protocols?: Record<string, string> | undefined;
6
+ schemas?: Record<string, boolean | object> | undefined;
7
+ http: {
8
+ id: string;
9
+ scope: "global" | "session" | "workspace";
10
+ basePath?: string | undefined;
11
+ path: string;
12
+ method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
13
+ description: string;
14
+ availability?: string | undefined;
15
+ authentication: "device" | "none" | "owner";
16
+ parameters?: {
17
+ name: string;
18
+ in: "header" | "path" | "query";
19
+ required: boolean;
20
+ schema: boolean | object;
21
+ }[] | undefined;
22
+ body?: {
23
+ contentType: string;
24
+ contentTypes?: string[] | undefined;
25
+ required: boolean;
26
+ schema: boolean | object;
27
+ } | undefined;
28
+ responses: Record<string, {
29
+ description: string;
30
+ contentType?: string | undefined;
31
+ schema?: boolean | object | undefined;
32
+ events?: Record<string, boolean | object> | undefined;
33
+ }>;
34
+ }[];
35
+ sockets: {
36
+ id: string;
37
+ scope: "global" | "session" | "workspace";
38
+ description: string;
39
+ availability?: string | undefined;
40
+ service: string;
41
+ member: string;
42
+ direction: "client-to-server" | "server-to-client";
43
+ kind: "channel" | "method" | "state";
44
+ input: boolean | object;
45
+ output?: boolean | object | undefined;
46
+ errors?: boolean | object | undefined;
47
+ }[];
48
+ dynamic: string[];
49
+ gaps?: string[] | undefined;
50
+ };
51
+ //#endregion
52
+ export { apiContracts as default };
53
+ //# sourceMappingURL=apiContracts.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAuBa"}
@@ -0,0 +1,49 @@
1
+ import { defineApiContract } from "@agimon-ai/po-core/apiContracts";
2
+ import { Type } from "typebox";
3
+ //#region src/schemas/apiContracts.ts
4
+ const S = Type.String();
5
+ const N = Type.Number();
6
+ const O = Type.Optional;
7
+ const literals = (values) => Type.Union(values.map((value) => Type.Literal(value)));
8
+ const TasksPayloadSchema = Type.Object({
9
+ tasks: Type.Array(Type.Object({
10
+ id: N,
11
+ subject: S,
12
+ description: O(S),
13
+ activeForm: O(S),
14
+ status: literals([
15
+ "pending",
16
+ "in_progress",
17
+ "completed",
18
+ "failed",
19
+ "deleted"
20
+ ]),
21
+ blockedBy: Type.Array(N),
22
+ owner: O(S),
23
+ updatedAt: O(S),
24
+ delegation: O(Type.Object({
25
+ agent: O(S),
26
+ state: O(S)
27
+ }))
28
+ })),
29
+ rev: N
30
+ });
31
+ const apiContracts = defineApiContract({
32
+ version: 1,
33
+ http: [],
34
+ dynamic: [],
35
+ sockets: ["global", "workspace"].map((scope) => ({
36
+ id: "tasks.channel",
37
+ scope,
38
+ service: "po.hub.v1",
39
+ member: "task_graph",
40
+ kind: "channel",
41
+ direction: "server-to-client",
42
+ description: "Task graph channel payload.",
43
+ input: TasksPayloadSchema
44
+ }))
45
+ });
46
+ //#endregion
47
+ export { apiContracts, apiContracts as default };
48
+
49
+ //# sourceMappingURL=apiContracts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\nimport { Type } from 'typebox';\n\nconst S = Type.String();\nconst N = Type.Number();\nconst O = Type.Optional;\nconst literals = <T extends string>(values: T[]) => Type.Union(values.map((value) => Type.Literal(value)));\nexport const TasksPayloadSchema = Type.Object({\n tasks: Type.Array(\n Type.Object({\n id: N,\n subject: S,\n description: O(S),\n activeForm: O(S),\n status: literals(['pending', 'in_progress', 'completed', 'failed', 'deleted']),\n blockedBy: Type.Array(N),\n owner: O(S),\n updatedAt: O(S),\n delegation: O(Type.Object({ agent: O(S), state: O(S) })),\n }),\n ),\n rev: N,\n});\nexport const apiContracts = defineApiContract({\n version: 1,\n http: [],\n dynamic: [],\n sockets: (['global', 'workspace'] as const).map((scope) => ({\n id: 'tasks.channel',\n scope,\n service: 'po.hub.v1',\n member: 'task_graph',\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Task graph channel payload.',\n input: TasksPayloadSchema,\n })),\n});\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAM,IAAI,KAAK,OAAO;AACtB,MAAM,IAAI,KAAK,OAAO;AACtB,MAAM,IAAI,KAAK;AACf,MAAM,YAA8B,WAAgB,KAAK,MAAM,OAAO,KAAK,UAAU,KAAK,QAAQ,KAAK,CAAC,CAAC;AACzG,MAAa,qBAAqB,KAAK,OAAO;CAC5C,OAAO,KAAK,MACV,KAAK,OAAO;EACV,IAAI;EACJ,SAAS;EACT,aAAa,EAAE,CAAC;EAChB,YAAY,EAAE,CAAC;EACf,QAAQ,SAAS;GAAC;GAAW;GAAe;GAAa;GAAU;EAAS,CAAC;EAC7E,WAAW,KAAK,MAAM,CAAC;EACvB,OAAO,EAAE,CAAC;EACV,WAAW,EAAE,CAAC;EACd,YAAY,EAAE,KAAK,OAAO;GAAE,OAAO,EAAE,CAAC;GAAG,OAAO,EAAE,CAAC;EAAE,CAAC,CAAC;CACzD,CAAC,CACH;CACA,KAAK;AACP,CAAC;AACD,MAAa,eAAe,kBAAkB;CAC5C,SAAS;CACT,MAAM,CAAC;CACP,SAAS,CAAC;CACV,SAAU,CAAC,UAAU,WAAW,CAAC,CAAW,KAAK,WAAW;EAC1D,IAAI;EACJ;EACA,SAAS;EACT,QAAQ;EACR,MAAM;EACN,WAAW;EACX,aAAa;EACb,OAAO;CACT,EAAE;AACJ,CAAC"}
@@ -0,0 +1,72 @@
1
+ //#region src/services/config/index.ts
2
+ /**
3
+ * Extension configuration, read from the environment.
4
+ *
5
+ * Env rather than a config file: po already carries per-launch state to Pi
6
+ * through env vars, so this keeps doom-task consistent with how the harness
7
+ * configures the rest of the extension set.
8
+ */
9
+ const MAX_WIDGET_LINES_ENV = "DOOM_TASK_MAX_WIDGET_LINES";
10
+ const MAX_TASKS_ENV = "DOOM_TASK_MAX_TASKS";
11
+ const COLLAPSE_KEY_ENV = "DOOM_TASK_COLLAPSE_KEY";
12
+ const STORE_TTL_MS_ENV = "DOOM_TASK_STORE_TTL_MS";
13
+ const DELEGATION_TIMEOUT_MS_ENV = "DOOM_TASK_DELEGATION_TIMEOUT_MS";
14
+ const DEFAULT_MAX_WIDGET_LINES = 12;
15
+ const DEFAULT_MAX_TASKS = 15;
16
+ const DEFAULT_COLLAPSE_KEY = "ctrl+shift+t";
17
+ const DEFAULT_STORE_TTL_MS = 2592e6;
18
+ /** Deliberately under the subagents auto-drain ceiling (30 min) so a headless
19
+ * session still gets the failure and a model turn before draining gives up. */
20
+ const DEFAULT_DELEGATION_TIMEOUT_MS = 12e5;
21
+ const COLLAPSE_KEY_OFF = "off";
22
+ const MIN_WIDGET_LINES = 3;
23
+ const MAX_WIDGET_LINES = 60;
24
+ function configRecord(value) {
25
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
26
+ }
27
+ /** Parse configuration only after the Pi host has applied its project-trust policy. */
28
+ function parsePiTaskConfig(value) {
29
+ const config = configRecord(value);
30
+ const maxWidgetLines = typeof config.maxWidgetLines === "number" && Number.isFinite(config.maxWidgetLines) ? Math.min(Math.max(config.maxWidgetLines, MIN_WIDGET_LINES), MAX_WIDGET_LINES) : 12;
31
+ const maxTasks = typeof config.maxTasks === "number" && Number.isSafeInteger(config.maxTasks) && config.maxTasks > 0 ? config.maxTasks : 15;
32
+ const storeTtlMs = typeof config.storeTtlMs === "number" && Number.isFinite(config.storeTtlMs) && config.storeTtlMs > 0 ? config.storeTtlMs : DEFAULT_STORE_TTL_MS;
33
+ const delegationTimeoutMs = typeof config.delegationTimeoutMs === "number" && Number.isFinite(config.delegationTimeoutMs) && config.delegationTimeoutMs > 0 ? config.delegationTimeoutMs : DEFAULT_DELEGATION_TIMEOUT_MS;
34
+ return {
35
+ maxWidgetLines,
36
+ maxTasks,
37
+ storeTtlMs,
38
+ collapseKey: typeof config.collapseKey === "string" && config.collapseKey.trim() ? config.collapseKey.trim().toLowerCase() === "off" ? "off" : config.collapseKey.trim() : DEFAULT_COLLAPSE_KEY,
39
+ delegationTimeoutMs
40
+ };
41
+ }
42
+ /** Rows the overlay may use for content, clamped to a sane range. */
43
+ function getMaxWidgetLines(env = process.env) {
44
+ const raw = Number.parseInt(env["DOOM_TASK_MAX_WIDGET_LINES"] ?? "", 10);
45
+ if (!Number.isFinite(raw)) return 12;
46
+ return Math.min(Math.max(raw, MIN_WIDGET_LINES), MAX_WIDGET_LINES);
47
+ }
48
+ /** Maximum number of non-deleted tasks retained on one board. */
49
+ function getMaxTasks(env = process.env) {
50
+ const raw = Number(env[MAX_TASKS_ENV]);
51
+ return Number.isSafeInteger(raw) && raw > 0 ? raw : 15;
52
+ }
53
+ /** Retention window for inactive session-tree stores. */
54
+ function getStoreTtlMs(env = process.env) {
55
+ const raw = Number(env[STORE_TTL_MS_ENV]);
56
+ return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_STORE_TTL_MS;
57
+ }
58
+ /** How long a delegated run may go without reporting a result. */
59
+ function getDelegationTimeoutMs(env = process.env) {
60
+ const raw = Number(env[DELEGATION_TIMEOUT_MS_ENV]);
61
+ return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_DELEGATION_TIMEOUT_MS;
62
+ }
63
+ /** Collapse shortcut, or the `off` sentinel when the user disabled it. */
64
+ function resolveCollapseKey(env = process.env) {
65
+ const configured = env[COLLAPSE_KEY_ENV]?.trim();
66
+ if (!configured) return DEFAULT_COLLAPSE_KEY;
67
+ return configured.toLowerCase() === "off" ? "off" : configured;
68
+ }
69
+ //#endregion
70
+ export { resolveCollapseKey as _, DEFAULT_MAX_TASKS as a, DELEGATION_TIMEOUT_MS_ENV as c, STORE_TTL_MS_ENV as d, getDelegationTimeoutMs as f, parsePiTaskConfig as g, getStoreTtlMs as h, DEFAULT_DELEGATION_TIMEOUT_MS as i, MAX_TASKS_ENV as l, getMaxWidgetLines as m, COLLAPSE_KEY_OFF as n, DEFAULT_MAX_WIDGET_LINES as o, getMaxTasks as p, DEFAULT_COLLAPSE_KEY as r, DEFAULT_STORE_TTL_MS as s, COLLAPSE_KEY_ENV as t, MAX_WIDGET_LINES_ENV as u };
71
+
72
+ //# sourceMappingURL=config-CFSs3iku.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-CFSs3iku.mjs","names":[],"sources":["../src/services/config/index.ts"],"sourcesContent":["/**\n * Extension configuration, read from the environment.\n *\n * Env rather than a config file: po already carries per-launch state to Pi\n * through env vars, so this keeps doom-task consistent with how the harness\n * configures the rest of the extension set.\n */\n\nexport const MAX_WIDGET_LINES_ENV = 'DOOM_TASK_MAX_WIDGET_LINES';\nexport const MAX_TASKS_ENV = 'DOOM_TASK_MAX_TASKS';\nexport const COLLAPSE_KEY_ENV = 'DOOM_TASK_COLLAPSE_KEY';\nexport const STORE_TTL_MS_ENV = 'DOOM_TASK_STORE_TTL_MS';\nexport const DELEGATION_TIMEOUT_MS_ENV = 'DOOM_TASK_DELEGATION_TIMEOUT_MS';\n\nexport const DEFAULT_MAX_WIDGET_LINES = 12;\nexport const DEFAULT_MAX_TASKS = 15;\nexport const DEFAULT_COLLAPSE_KEY = 'ctrl+shift+t';\nexport const DEFAULT_STORE_TTL_MS = 30 * 24 * 60 * 60 * 1000;\n/** Deliberately under the subagents auto-drain ceiling (30 min) so a headless\n * session still gets the failure and a model turn before draining gives up. */\nexport const DEFAULT_DELEGATION_TIMEOUT_MS = 20 * 60 * 1000;\nexport const COLLAPSE_KEY_OFF = 'off';\n\nconst MIN_WIDGET_LINES = 3;\nconst MAX_WIDGET_LINES = 60;\n\nexport interface PiTaskConfig {\n maxWidgetLines: number;\n maxTasks: number;\n storeTtlMs: number;\n collapseKey: string;\n delegationTimeoutMs: number;\n}\n\nfunction configRecord(value: unknown): Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value) ? (value as Record<string, unknown>) : {};\n}\n\n/** Parse configuration only after the Pi host has applied its project-trust policy. */\nexport function parsePiTaskConfig(value: unknown): PiTaskConfig {\n const config = configRecord(value);\n const maxWidgetLines =\n typeof config.maxWidgetLines === 'number' && Number.isFinite(config.maxWidgetLines)\n ? Math.min(Math.max(config.maxWidgetLines, MIN_WIDGET_LINES), MAX_WIDGET_LINES)\n : DEFAULT_MAX_WIDGET_LINES;\n const maxTasks =\n typeof config.maxTasks === 'number' && Number.isSafeInteger(config.maxTasks) && config.maxTasks > 0\n ? config.maxTasks\n : DEFAULT_MAX_TASKS;\n const storeTtlMs =\n typeof config.storeTtlMs === 'number' && Number.isFinite(config.storeTtlMs) && config.storeTtlMs > 0\n ? config.storeTtlMs\n : DEFAULT_STORE_TTL_MS;\n const delegationTimeoutMs =\n typeof config.delegationTimeoutMs === 'number' &&\n Number.isFinite(config.delegationTimeoutMs) &&\n config.delegationTimeoutMs > 0\n ? config.delegationTimeoutMs\n : DEFAULT_DELEGATION_TIMEOUT_MS;\n const collapseKey =\n typeof config.collapseKey === 'string' && config.collapseKey.trim()\n ? config.collapseKey.trim().toLowerCase() === COLLAPSE_KEY_OFF\n ? COLLAPSE_KEY_OFF\n : config.collapseKey.trim()\n : DEFAULT_COLLAPSE_KEY;\n\n return { maxWidgetLines, maxTasks, storeTtlMs, collapseKey, delegationTimeoutMs };\n}\n\n/** Rows the overlay may use for content, clamped to a sane range. */\nexport function getMaxWidgetLines(env: NodeJS.ProcessEnv = process.env): number {\n const raw = Number.parseInt(env[MAX_WIDGET_LINES_ENV] ?? '', 10);\n if (!Number.isFinite(raw)) return DEFAULT_MAX_WIDGET_LINES;\n return Math.min(Math.max(raw, MIN_WIDGET_LINES), MAX_WIDGET_LINES);\n}\n\n/** Maximum number of non-deleted tasks retained on one board. */\nexport function getMaxTasks(env: NodeJS.ProcessEnv = process.env): number {\n const raw = Number(env[MAX_TASKS_ENV]);\n return Number.isSafeInteger(raw) && raw > 0 ? raw : DEFAULT_MAX_TASKS;\n}\n\n/** Retention window for inactive session-tree stores. */\nexport function getStoreTtlMs(env: NodeJS.ProcessEnv = process.env): number {\n const raw = Number(env[STORE_TTL_MS_ENV]);\n return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_STORE_TTL_MS;\n}\n\n/** How long a delegated run may go without reporting a result. */\nexport function getDelegationTimeoutMs(env: NodeJS.ProcessEnv = process.env): number {\n const raw = Number(env[DELEGATION_TIMEOUT_MS_ENV]);\n return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_DELEGATION_TIMEOUT_MS;\n}\n\n/** Collapse shortcut, or the `off` sentinel when the user disabled it. */\nexport function resolveCollapseKey(env: NodeJS.ProcessEnv = process.env): string {\n const configured = env[COLLAPSE_KEY_ENV]?.trim();\n if (!configured) return DEFAULT_COLLAPSE_KEY;\n return configured.toLowerCase() === COLLAPSE_KEY_OFF ? COLLAPSE_KEY_OFF : configured;\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,uBAAuB;AACpC,MAAa,gBAAgB;AAC7B,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,4BAA4B;AAEzC,MAAa,2BAA2B;AACxC,MAAa,oBAAoB;AACjC,MAAa,uBAAuB;AACpC,MAAa,uBAAuB;;;AAGpC,MAAa,gCAAgC;AAC7C,MAAa,mBAAmB;AAEhC,MAAM,mBAAmB;AACzB,MAAM,mBAAmB;AAUzB,SAAS,aAAa,OAAyC;CAC7D,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAK,QAAoC,CAAC;AACtH;;AAGA,SAAgB,kBAAkB,OAA8B;CAC9D,MAAM,SAAS,aAAa,KAAK;CACjC,MAAM,iBACJ,OAAO,OAAO,mBAAmB,YAAY,OAAO,SAAS,OAAO,cAAc,IAC9E,KAAK,IAAI,KAAK,IAAI,OAAO,gBAAgB,gBAAgB,GAAG,gBAAgB,IAAA;CAElF,MAAM,WACJ,OAAO,OAAO,aAAa,YAAY,OAAO,cAAc,OAAO,QAAQ,KAAK,OAAO,WAAW,IAC9F,OAAO,WAAA;CAEb,MAAM,aACJ,OAAO,OAAO,eAAe,YAAY,OAAO,SAAS,OAAO,UAAU,KAAK,OAAO,aAAa,IAC/F,OAAO,aACP;CACN,MAAM,sBACJ,OAAO,OAAO,wBAAwB,YACtC,OAAO,SAAS,OAAO,mBAAmB,KAC1C,OAAO,sBAAsB,IACzB,OAAO,sBACP;CAQN,OAAO;EAAE;EAAgB;EAAU;EAAY,aAN7C,OAAO,OAAO,gBAAgB,YAAY,OAAO,YAAY,KAAK,IAC9D,OAAO,YAAY,KAAK,CAAC,CAAC,YAAY,MAAA,QAAA,QAEpC,OAAO,YAAY,KAAK,IAC1B;EAEsD;CAAoB;AAClF;;AAGA,SAAgB,kBAAkB,MAAyB,QAAQ,KAAa;CAC9E,MAAM,MAAM,OAAO,SAAS,IAAA,iCAA6B,IAAI,EAAE;CAC/D,IAAI,CAAC,OAAO,SAAS,GAAG,GAAG,OAAA;CAC3B,OAAO,KAAK,IAAI,KAAK,IAAI,KAAK,gBAAgB,GAAG,gBAAgB;AACnE;;AAGA,SAAgB,YAAY,MAAyB,QAAQ,KAAa;CACxE,MAAM,MAAM,OAAO,IAAI,cAAc;CACrC,OAAO,OAAO,cAAc,GAAG,KAAK,MAAM,IAAI,MAAA;AAChD;;AAGA,SAAgB,cAAc,MAAyB,QAAQ,KAAa;CAC1E,MAAM,MAAM,OAAO,IAAI,iBAAiB;CACxC,OAAO,OAAO,SAAS,GAAG,KAAK,MAAM,IAAI,MAAM;AACjD;;AAGA,SAAgB,uBAAuB,MAAyB,QAAQ,KAAa;CACnF,MAAM,MAAM,OAAO,IAAI,0BAA0B;CACjD,OAAO,OAAO,SAAS,GAAG,KAAK,MAAM,IAAI,MAAM;AACjD;;AAGA,SAAgB,mBAAmB,MAAyB,QAAQ,KAAa;CAC/E,MAAM,aAAa,IAAI,iBAAiB,EAAE,KAAK;CAC/C,IAAI,CAAC,YAAY,OAAO;CACxB,OAAO,WAAW,YAAY,MAAA,QAAA,QAA4C;AAC5E"}
@@ -0,0 +1,173 @@
1
+ //#region src/services/config/index.ts
2
+ /**
3
+ * Extension configuration, read from the environment.
4
+ *
5
+ * Env rather than a config file: po already carries per-launch state to Pi
6
+ * through env vars, so this keeps doom-task consistent with how the harness
7
+ * configures the rest of the extension set.
8
+ */
9
+ const MAX_WIDGET_LINES_ENV = "DOOM_TASK_MAX_WIDGET_LINES";
10
+ const MAX_TASKS_ENV = "DOOM_TASK_MAX_TASKS";
11
+ const COLLAPSE_KEY_ENV = "DOOM_TASK_COLLAPSE_KEY";
12
+ const STORE_TTL_MS_ENV = "DOOM_TASK_STORE_TTL_MS";
13
+ const DELEGATION_TIMEOUT_MS_ENV = "DOOM_TASK_DELEGATION_TIMEOUT_MS";
14
+ const DEFAULT_MAX_WIDGET_LINES = 12;
15
+ const DEFAULT_MAX_TASKS = 15;
16
+ const DEFAULT_COLLAPSE_KEY = "ctrl+shift+t";
17
+ const DEFAULT_STORE_TTL_MS = 2592e6;
18
+ /** Deliberately under the subagents auto-drain ceiling (30 min) so a headless
19
+ * session still gets the failure and a model turn before draining gives up. */
20
+ const DEFAULT_DELEGATION_TIMEOUT_MS = 12e5;
21
+ const COLLAPSE_KEY_OFF = "off";
22
+ const MIN_WIDGET_LINES = 3;
23
+ const MAX_WIDGET_LINES = 60;
24
+ function configRecord(value) {
25
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
26
+ }
27
+ /** Parse configuration only after the Pi host has applied its project-trust policy. */
28
+ function parsePiTaskConfig(value) {
29
+ const config = configRecord(value);
30
+ const maxWidgetLines = typeof config.maxWidgetLines === "number" && Number.isFinite(config.maxWidgetLines) ? Math.min(Math.max(config.maxWidgetLines, MIN_WIDGET_LINES), MAX_WIDGET_LINES) : 12;
31
+ const maxTasks = typeof config.maxTasks === "number" && Number.isSafeInteger(config.maxTasks) && config.maxTasks > 0 ? config.maxTasks : 15;
32
+ const storeTtlMs = typeof config.storeTtlMs === "number" && Number.isFinite(config.storeTtlMs) && config.storeTtlMs > 0 ? config.storeTtlMs : DEFAULT_STORE_TTL_MS;
33
+ const delegationTimeoutMs = typeof config.delegationTimeoutMs === "number" && Number.isFinite(config.delegationTimeoutMs) && config.delegationTimeoutMs > 0 ? config.delegationTimeoutMs : DEFAULT_DELEGATION_TIMEOUT_MS;
34
+ return {
35
+ maxWidgetLines,
36
+ maxTasks,
37
+ storeTtlMs,
38
+ collapseKey: typeof config.collapseKey === "string" && config.collapseKey.trim() ? config.collapseKey.trim().toLowerCase() === "off" ? "off" : config.collapseKey.trim() : DEFAULT_COLLAPSE_KEY,
39
+ delegationTimeoutMs
40
+ };
41
+ }
42
+ /** Rows the overlay may use for content, clamped to a sane range. */
43
+ function getMaxWidgetLines(env = process.env) {
44
+ const raw = Number.parseInt(env["DOOM_TASK_MAX_WIDGET_LINES"] ?? "", 10);
45
+ if (!Number.isFinite(raw)) return 12;
46
+ return Math.min(Math.max(raw, MIN_WIDGET_LINES), MAX_WIDGET_LINES);
47
+ }
48
+ /** Maximum number of non-deleted tasks retained on one board. */
49
+ function getMaxTasks(env = process.env) {
50
+ const raw = Number(env[MAX_TASKS_ENV]);
51
+ return Number.isSafeInteger(raw) && raw > 0 ? raw : 15;
52
+ }
53
+ /** Retention window for inactive session-tree stores. */
54
+ function getStoreTtlMs(env = process.env) {
55
+ const raw = Number(env[STORE_TTL_MS_ENV]);
56
+ return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_STORE_TTL_MS;
57
+ }
58
+ /** How long a delegated run may go without reporting a result. */
59
+ function getDelegationTimeoutMs(env = process.env) {
60
+ const raw = Number(env[DELEGATION_TIMEOUT_MS_ENV]);
61
+ return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_DELEGATION_TIMEOUT_MS;
62
+ }
63
+ /** Collapse shortcut, or the `off` sentinel when the user disabled it. */
64
+ function resolveCollapseKey(env = process.env) {
65
+ const configured = env[COLLAPSE_KEY_ENV]?.trim();
66
+ if (!configured) return DEFAULT_COLLAPSE_KEY;
67
+ return configured.toLowerCase() === "off" ? "off" : configured;
68
+ }
69
+ //#endregion
70
+ Object.defineProperty(exports, "COLLAPSE_KEY_ENV", {
71
+ enumerable: true,
72
+ get: function() {
73
+ return COLLAPSE_KEY_ENV;
74
+ }
75
+ });
76
+ Object.defineProperty(exports, "COLLAPSE_KEY_OFF", {
77
+ enumerable: true,
78
+ get: function() {
79
+ return COLLAPSE_KEY_OFF;
80
+ }
81
+ });
82
+ Object.defineProperty(exports, "DEFAULT_COLLAPSE_KEY", {
83
+ enumerable: true,
84
+ get: function() {
85
+ return DEFAULT_COLLAPSE_KEY;
86
+ }
87
+ });
88
+ Object.defineProperty(exports, "DEFAULT_DELEGATION_TIMEOUT_MS", {
89
+ enumerable: true,
90
+ get: function() {
91
+ return DEFAULT_DELEGATION_TIMEOUT_MS;
92
+ }
93
+ });
94
+ Object.defineProperty(exports, "DEFAULT_MAX_TASKS", {
95
+ enumerable: true,
96
+ get: function() {
97
+ return DEFAULT_MAX_TASKS;
98
+ }
99
+ });
100
+ Object.defineProperty(exports, "DEFAULT_MAX_WIDGET_LINES", {
101
+ enumerable: true,
102
+ get: function() {
103
+ return DEFAULT_MAX_WIDGET_LINES;
104
+ }
105
+ });
106
+ Object.defineProperty(exports, "DEFAULT_STORE_TTL_MS", {
107
+ enumerable: true,
108
+ get: function() {
109
+ return DEFAULT_STORE_TTL_MS;
110
+ }
111
+ });
112
+ Object.defineProperty(exports, "DELEGATION_TIMEOUT_MS_ENV", {
113
+ enumerable: true,
114
+ get: function() {
115
+ return DELEGATION_TIMEOUT_MS_ENV;
116
+ }
117
+ });
118
+ Object.defineProperty(exports, "MAX_TASKS_ENV", {
119
+ enumerable: true,
120
+ get: function() {
121
+ return MAX_TASKS_ENV;
122
+ }
123
+ });
124
+ Object.defineProperty(exports, "MAX_WIDGET_LINES_ENV", {
125
+ enumerable: true,
126
+ get: function() {
127
+ return MAX_WIDGET_LINES_ENV;
128
+ }
129
+ });
130
+ Object.defineProperty(exports, "STORE_TTL_MS_ENV", {
131
+ enumerable: true,
132
+ get: function() {
133
+ return STORE_TTL_MS_ENV;
134
+ }
135
+ });
136
+ Object.defineProperty(exports, "getDelegationTimeoutMs", {
137
+ enumerable: true,
138
+ get: function() {
139
+ return getDelegationTimeoutMs;
140
+ }
141
+ });
142
+ Object.defineProperty(exports, "getMaxTasks", {
143
+ enumerable: true,
144
+ get: function() {
145
+ return getMaxTasks;
146
+ }
147
+ });
148
+ Object.defineProperty(exports, "getMaxWidgetLines", {
149
+ enumerable: true,
150
+ get: function() {
151
+ return getMaxWidgetLines;
152
+ }
153
+ });
154
+ Object.defineProperty(exports, "getStoreTtlMs", {
155
+ enumerable: true,
156
+ get: function() {
157
+ return getStoreTtlMs;
158
+ }
159
+ });
160
+ Object.defineProperty(exports, "parsePiTaskConfig", {
161
+ enumerable: true,
162
+ get: function() {
163
+ return parsePiTaskConfig;
164
+ }
165
+ });
166
+ Object.defineProperty(exports, "resolveCollapseKey", {
167
+ enumerable: true,
168
+ get: function() {
169
+ return resolveCollapseKey;
170
+ }
171
+ });
172
+
173
+ //# sourceMappingURL=config-CdX-Bv8q.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-CdX-Bv8q.cjs","names":[],"sources":["../src/services/config/index.ts"],"sourcesContent":["/**\n * Extension configuration, read from the environment.\n *\n * Env rather than a config file: po already carries per-launch state to Pi\n * through env vars, so this keeps doom-task consistent with how the harness\n * configures the rest of the extension set.\n */\n\nexport const MAX_WIDGET_LINES_ENV = 'DOOM_TASK_MAX_WIDGET_LINES';\nexport const MAX_TASKS_ENV = 'DOOM_TASK_MAX_TASKS';\nexport const COLLAPSE_KEY_ENV = 'DOOM_TASK_COLLAPSE_KEY';\nexport const STORE_TTL_MS_ENV = 'DOOM_TASK_STORE_TTL_MS';\nexport const DELEGATION_TIMEOUT_MS_ENV = 'DOOM_TASK_DELEGATION_TIMEOUT_MS';\n\nexport const DEFAULT_MAX_WIDGET_LINES = 12;\nexport const DEFAULT_MAX_TASKS = 15;\nexport const DEFAULT_COLLAPSE_KEY = 'ctrl+shift+t';\nexport const DEFAULT_STORE_TTL_MS = 30 * 24 * 60 * 60 * 1000;\n/** Deliberately under the subagents auto-drain ceiling (30 min) so a headless\n * session still gets the failure and a model turn before draining gives up. */\nexport const DEFAULT_DELEGATION_TIMEOUT_MS = 20 * 60 * 1000;\nexport const COLLAPSE_KEY_OFF = 'off';\n\nconst MIN_WIDGET_LINES = 3;\nconst MAX_WIDGET_LINES = 60;\n\nexport interface PiTaskConfig {\n maxWidgetLines: number;\n maxTasks: number;\n storeTtlMs: number;\n collapseKey: string;\n delegationTimeoutMs: number;\n}\n\nfunction configRecord(value: unknown): Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value) ? (value as Record<string, unknown>) : {};\n}\n\n/** Parse configuration only after the Pi host has applied its project-trust policy. */\nexport function parsePiTaskConfig(value: unknown): PiTaskConfig {\n const config = configRecord(value);\n const maxWidgetLines =\n typeof config.maxWidgetLines === 'number' && Number.isFinite(config.maxWidgetLines)\n ? Math.min(Math.max(config.maxWidgetLines, MIN_WIDGET_LINES), MAX_WIDGET_LINES)\n : DEFAULT_MAX_WIDGET_LINES;\n const maxTasks =\n typeof config.maxTasks === 'number' && Number.isSafeInteger(config.maxTasks) && config.maxTasks > 0\n ? config.maxTasks\n : DEFAULT_MAX_TASKS;\n const storeTtlMs =\n typeof config.storeTtlMs === 'number' && Number.isFinite(config.storeTtlMs) && config.storeTtlMs > 0\n ? config.storeTtlMs\n : DEFAULT_STORE_TTL_MS;\n const delegationTimeoutMs =\n typeof config.delegationTimeoutMs === 'number' &&\n Number.isFinite(config.delegationTimeoutMs) &&\n config.delegationTimeoutMs > 0\n ? config.delegationTimeoutMs\n : DEFAULT_DELEGATION_TIMEOUT_MS;\n const collapseKey =\n typeof config.collapseKey === 'string' && config.collapseKey.trim()\n ? config.collapseKey.trim().toLowerCase() === COLLAPSE_KEY_OFF\n ? COLLAPSE_KEY_OFF\n : config.collapseKey.trim()\n : DEFAULT_COLLAPSE_KEY;\n\n return { maxWidgetLines, maxTasks, storeTtlMs, collapseKey, delegationTimeoutMs };\n}\n\n/** Rows the overlay may use for content, clamped to a sane range. */\nexport function getMaxWidgetLines(env: NodeJS.ProcessEnv = process.env): number {\n const raw = Number.parseInt(env[MAX_WIDGET_LINES_ENV] ?? '', 10);\n if (!Number.isFinite(raw)) return DEFAULT_MAX_WIDGET_LINES;\n return Math.min(Math.max(raw, MIN_WIDGET_LINES), MAX_WIDGET_LINES);\n}\n\n/** Maximum number of non-deleted tasks retained on one board. */\nexport function getMaxTasks(env: NodeJS.ProcessEnv = process.env): number {\n const raw = Number(env[MAX_TASKS_ENV]);\n return Number.isSafeInteger(raw) && raw > 0 ? raw : DEFAULT_MAX_TASKS;\n}\n\n/** Retention window for inactive session-tree stores. */\nexport function getStoreTtlMs(env: NodeJS.ProcessEnv = process.env): number {\n const raw = Number(env[STORE_TTL_MS_ENV]);\n return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_STORE_TTL_MS;\n}\n\n/** How long a delegated run may go without reporting a result. */\nexport function getDelegationTimeoutMs(env: NodeJS.ProcessEnv = process.env): number {\n const raw = Number(env[DELEGATION_TIMEOUT_MS_ENV]);\n return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_DELEGATION_TIMEOUT_MS;\n}\n\n/** Collapse shortcut, or the `off` sentinel when the user disabled it. */\nexport function resolveCollapseKey(env: NodeJS.ProcessEnv = process.env): string {\n const configured = env[COLLAPSE_KEY_ENV]?.trim();\n if (!configured) return DEFAULT_COLLAPSE_KEY;\n return configured.toLowerCase() === COLLAPSE_KEY_OFF ? COLLAPSE_KEY_OFF : configured;\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,uBAAuB;AACpC,MAAa,gBAAgB;AAC7B,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAChC,MAAa,4BAA4B;AAEzC,MAAa,2BAA2B;AACxC,MAAa,oBAAoB;AACjC,MAAa,uBAAuB;AACpC,MAAa,uBAAuB;;;AAGpC,MAAa,gCAAgC;AAC7C,MAAa,mBAAmB;AAEhC,MAAM,mBAAmB;AACzB,MAAM,mBAAmB;AAUzB,SAAS,aAAa,OAAyC;CAC7D,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAK,QAAoC,CAAC;AACtH;;AAGA,SAAgB,kBAAkB,OAA8B;CAC9D,MAAM,SAAS,aAAa,KAAK;CACjC,MAAM,iBACJ,OAAO,OAAO,mBAAmB,YAAY,OAAO,SAAS,OAAO,cAAc,IAC9E,KAAK,IAAI,KAAK,IAAI,OAAO,gBAAgB,gBAAgB,GAAG,gBAAgB,IAAA;CAElF,MAAM,WACJ,OAAO,OAAO,aAAa,YAAY,OAAO,cAAc,OAAO,QAAQ,KAAK,OAAO,WAAW,IAC9F,OAAO,WAAA;CAEb,MAAM,aACJ,OAAO,OAAO,eAAe,YAAY,OAAO,SAAS,OAAO,UAAU,KAAK,OAAO,aAAa,IAC/F,OAAO,aACP;CACN,MAAM,sBACJ,OAAO,OAAO,wBAAwB,YACtC,OAAO,SAAS,OAAO,mBAAmB,KAC1C,OAAO,sBAAsB,IACzB,OAAO,sBACP;CAQN,OAAO;EAAE;EAAgB;EAAU;EAAY,aAN7C,OAAO,OAAO,gBAAgB,YAAY,OAAO,YAAY,KAAK,IAC9D,OAAO,YAAY,KAAK,CAAC,CAAC,YAAY,MAAA,QAAA,QAEpC,OAAO,YAAY,KAAK,IAC1B;EAEsD;CAAoB;AAClF;;AAGA,SAAgB,kBAAkB,MAAyB,QAAQ,KAAa;CAC9E,MAAM,MAAM,OAAO,SAAS,IAAA,iCAA6B,IAAI,EAAE;CAC/D,IAAI,CAAC,OAAO,SAAS,GAAG,GAAG,OAAA;CAC3B,OAAO,KAAK,IAAI,KAAK,IAAI,KAAK,gBAAgB,GAAG,gBAAgB;AACnE;;AAGA,SAAgB,YAAY,MAAyB,QAAQ,KAAa;CACxE,MAAM,MAAM,OAAO,IAAI,cAAc;CACrC,OAAO,OAAO,cAAc,GAAG,KAAK,MAAM,IAAI,MAAA;AAChD;;AAGA,SAAgB,cAAc,MAAyB,QAAQ,KAAa;CAC1E,MAAM,MAAM,OAAO,IAAI,iBAAiB;CACxC,OAAO,OAAO,SAAS,GAAG,KAAK,MAAM,IAAI,MAAM;AACjD;;AAGA,SAAgB,uBAAuB,MAAyB,QAAQ,KAAa;CACnF,MAAM,MAAM,OAAO,IAAI,0BAA0B;CACjD,OAAO,OAAO,SAAS,GAAG,KAAK,MAAM,IAAI,MAAM;AACjD;;AAGA,SAAgB,mBAAmB,MAAyB,QAAQ,KAAa;CAC/E,MAAM,aAAa,IAAI,iBAAiB,EAAE,KAAK;CAC/C,IAAI,CAAC,YAAY,OAAO;CACxB,OAAO,WAAW,YAAY,MAAA,QAAA,QAA4C;AAC5E"}
@@ -0,0 +1,19 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_config = require("./config-CdX-Bv8q.cjs");
3
+ exports.COLLAPSE_KEY_ENV = require_config.COLLAPSE_KEY_ENV;
4
+ exports.COLLAPSE_KEY_OFF = require_config.COLLAPSE_KEY_OFF;
5
+ exports.DEFAULT_COLLAPSE_KEY = require_config.DEFAULT_COLLAPSE_KEY;
6
+ exports.DEFAULT_DELEGATION_TIMEOUT_MS = require_config.DEFAULT_DELEGATION_TIMEOUT_MS;
7
+ exports.DEFAULT_MAX_TASKS = require_config.DEFAULT_MAX_TASKS;
8
+ exports.DEFAULT_MAX_WIDGET_LINES = require_config.DEFAULT_MAX_WIDGET_LINES;
9
+ exports.DEFAULT_STORE_TTL_MS = require_config.DEFAULT_STORE_TTL_MS;
10
+ exports.DELEGATION_TIMEOUT_MS_ENV = require_config.DELEGATION_TIMEOUT_MS_ENV;
11
+ exports.MAX_TASKS_ENV = require_config.MAX_TASKS_ENV;
12
+ exports.MAX_WIDGET_LINES_ENV = require_config.MAX_WIDGET_LINES_ENV;
13
+ exports.STORE_TTL_MS_ENV = require_config.STORE_TTL_MS_ENV;
14
+ exports.getDelegationTimeoutMs = require_config.getDelegationTimeoutMs;
15
+ exports.getMaxTasks = require_config.getMaxTasks;
16
+ exports.getMaxWidgetLines = require_config.getMaxWidgetLines;
17
+ exports.getStoreTtlMs = require_config.getStoreTtlMs;
18
+ exports.parsePiTaskConfig = require_config.parsePiTaskConfig;
19
+ exports.resolveCollapseKey = require_config.resolveCollapseKey;
@@ -0,0 +1,2 @@
1
+ import { _ as parsePiTaskConfig, a as DEFAULT_MAX_TASKS, c as DELEGATION_TIMEOUT_MS_ENV, d as PiTaskConfig, f as STORE_TTL_MS_ENV, g as getStoreTtlMs, h as getMaxWidgetLines, i as DEFAULT_DELEGATION_TIMEOUT_MS, l as MAX_TASKS_ENV, m as getMaxTasks, n as COLLAPSE_KEY_OFF, o as DEFAULT_MAX_WIDGET_LINES, p as getDelegationTimeoutMs, r as DEFAULT_COLLAPSE_KEY, s as DEFAULT_STORE_TTL_MS, t as COLLAPSE_KEY_ENV, u as MAX_WIDGET_LINES_ENV, v as resolveCollapseKey } from "./index-B-3sCF2S.mjs";
2
+ export { COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, MAX_TASKS_ENV, MAX_WIDGET_LINES_ENV, PiTaskConfig, STORE_TTL_MS_ENV, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, parsePiTaskConfig, resolveCollapseKey };
@@ -0,0 +1,2 @@
1
+ import { _ as resolveCollapseKey, a as DEFAULT_MAX_TASKS, c as DELEGATION_TIMEOUT_MS_ENV, d as STORE_TTL_MS_ENV, f as getDelegationTimeoutMs, g as parsePiTaskConfig, h as getStoreTtlMs, i as DEFAULT_DELEGATION_TIMEOUT_MS, l as MAX_TASKS_ENV, m as getMaxWidgetLines, n as COLLAPSE_KEY_OFF, o as DEFAULT_MAX_WIDGET_LINES, p as getMaxTasks, r as DEFAULT_COLLAPSE_KEY, s as DEFAULT_STORE_TTL_MS, t as COLLAPSE_KEY_ENV, u as MAX_WIDGET_LINES_ENV } from "./config-CFSs3iku.mjs";
2
+ export { COLLAPSE_KEY_ENV, COLLAPSE_KEY_OFF, DEFAULT_COLLAPSE_KEY, DEFAULT_DELEGATION_TIMEOUT_MS, DEFAULT_MAX_TASKS, DEFAULT_MAX_WIDGET_LINES, DEFAULT_STORE_TTL_MS, DELEGATION_TIMEOUT_MS_ENV, MAX_TASKS_ENV, MAX_WIDGET_LINES_ENV, STORE_TTL_MS_ENV, getDelegationTimeoutMs, getMaxTasks, getMaxWidgetLines, getStoreTtlMs, parsePiTaskConfig, resolveCollapseKey };
@@ -0,0 +1,7 @@
1
+ //#region src/types/delegation.ts
2
+ /** Most context files carried in a delegation brief. */
3
+ const MAX_BRIEF_FILES = 12;
4
+ //#endregion
5
+ export { MAX_BRIEF_FILES as t };
6
+
7
+ //# sourceMappingURL=delegation-BiOy3_7g.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegation-BiOy3_7g.mjs","names":[],"sources":["../src/types/delegation.ts"],"sourcesContent":["/** Most context files carried in a delegation brief. */\nexport const MAX_BRIEF_FILES = 12;\n"],"mappings":";;AACA,MAAa,kBAAkB"}