funolio-agent 1.0.75 → 1.1.65

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 (236) hide show
  1. package/dist/auth/credential-reader.d.ts.map +1 -1
  2. package/dist/auth/credential-reader.js +4 -3
  3. package/dist/auth/credential-reader.js.map +1 -1
  4. package/dist/auth/token-refresh.d.ts +8 -0
  5. package/dist/auth/token-refresh.d.ts.map +1 -1
  6. package/dist/auth/token-refresh.js +82 -52
  7. package/dist/auth/token-refresh.js.map +1 -1
  8. package/dist/auto-organizer.d.ts.map +1 -1
  9. package/dist/auto-organizer.js +6 -7
  10. package/dist/auto-organizer.js.map +1 -1
  11. package/dist/bench-prefix.d.ts +16 -0
  12. package/dist/bench-prefix.d.ts.map +1 -0
  13. package/dist/bench-prefix.js +25 -0
  14. package/dist/bench-prefix.js.map +1 -0
  15. package/dist/bot-manager.d.ts.map +1 -1
  16. package/dist/bot-manager.js +23 -14
  17. package/dist/bot-manager.js.map +1 -1
  18. package/dist/chat-sync.d.ts +42 -0
  19. package/dist/chat-sync.d.ts.map +1 -0
  20. package/dist/chat-sync.js +95 -0
  21. package/dist/chat-sync.js.map +1 -0
  22. package/dist/clerk-model.d.ts +7 -0
  23. package/dist/clerk-model.d.ts.map +1 -1
  24. package/dist/clerk-model.js +42 -8
  25. package/dist/clerk-model.js.map +1 -1
  26. package/dist/cli-bootstrap-history.d.ts +10 -0
  27. package/dist/cli-bootstrap-history.d.ts.map +1 -0
  28. package/dist/cli-bootstrap-history.js +112 -0
  29. package/dist/cli-bootstrap-history.js.map +1 -0
  30. package/dist/cli-models.d.ts +8 -0
  31. package/dist/cli-models.d.ts.map +1 -0
  32. package/dist/cli-models.js +91 -0
  33. package/dist/cli-models.js.map +1 -0
  34. package/dist/cli-session-epoch.d.ts +13 -3
  35. package/dist/cli-session-epoch.d.ts.map +1 -1
  36. package/dist/cli-session-epoch.js +53 -4
  37. package/dist/cli-session-epoch.js.map +1 -1
  38. package/dist/codex-app-server-manager.d.ts +64 -4
  39. package/dist/codex-app-server-manager.d.ts.map +1 -1
  40. package/dist/codex-app-server-manager.js +755 -55
  41. package/dist/codex-app-server-manager.js.map +1 -1
  42. package/dist/commands/pool.d.ts +32 -0
  43. package/dist/commands/pool.d.ts.map +1 -1
  44. package/dist/commands/pool.js +145 -66
  45. package/dist/commands/pool.js.map +1 -1
  46. package/dist/commands/start.d.ts +21 -0
  47. package/dist/commands/start.d.ts.map +1 -1
  48. package/dist/commands/start.js +484 -63
  49. package/dist/commands/start.js.map +1 -1
  50. package/dist/commands/status.d.ts.map +1 -1
  51. package/dist/commands/status.js +5 -2
  52. package/dist/commands/status.js.map +1 -1
  53. package/dist/config.d.ts +1 -0
  54. package/dist/config.d.ts.map +1 -1
  55. package/dist/config.js +170 -58
  56. package/dist/config.js.map +1 -1
  57. package/dist/context-window.d.ts +37 -1
  58. package/dist/context-window.d.ts.map +1 -1
  59. package/dist/context-window.js +202 -16
  60. package/dist/context-window.js.map +1 -1
  61. package/dist/live-activity.d.ts +3 -1
  62. package/dist/live-activity.d.ts.map +1 -1
  63. package/dist/live-activity.js.map +1 -1
  64. package/dist/local-chat-execution.d.ts +114 -0
  65. package/dist/local-chat-execution.d.ts.map +1 -0
  66. package/dist/local-chat-execution.js +349 -0
  67. package/dist/local-chat-execution.js.map +1 -0
  68. package/dist/local-cli-pty-manager.d.ts +138 -3
  69. package/dist/local-cli-pty-manager.d.ts.map +1 -1
  70. package/dist/local-cli-pty-manager.js +1415 -111
  71. package/dist/local-cli-pty-manager.js.map +1 -1
  72. package/dist/local-conversation-gateway.d.ts +110 -0
  73. package/dist/local-conversation-gateway.d.ts.map +1 -0
  74. package/dist/local-conversation-gateway.js +175 -0
  75. package/dist/local-conversation-gateway.js.map +1 -0
  76. package/dist/local-data.d.ts +235 -5
  77. package/dist/local-data.d.ts.map +1 -1
  78. package/dist/local-data.js +1066 -87
  79. package/dist/local-data.js.map +1 -1
  80. package/dist/local-db.d.ts +6 -0
  81. package/dist/local-db.d.ts.map +1 -1
  82. package/dist/local-db.js +376 -4
  83. package/dist/local-db.js.map +1 -1
  84. package/dist/local-funnel.d.ts.map +1 -1
  85. package/dist/local-funnel.js +6 -5
  86. package/dist/local-funnel.js.map +1 -1
  87. package/dist/local-server.d.ts +30 -0
  88. package/dist/local-server.d.ts.map +1 -1
  89. package/dist/local-server.js +2898 -319
  90. package/dist/local-server.js.map +1 -1
  91. package/dist/managed-process-registry.d.ts +59 -0
  92. package/dist/managed-process-registry.d.ts.map +1 -0
  93. package/dist/managed-process-registry.js +390 -0
  94. package/dist/managed-process-registry.js.map +1 -0
  95. package/dist/mcp/claude-config-writer.d.ts +5 -5
  96. package/dist/mcp/claude-config-writer.d.ts.map +1 -1
  97. package/dist/mcp/claude-config-writer.js +19 -11
  98. package/dist/mcp/claude-config-writer.js.map +1 -1
  99. package/dist/mcp/index.d.ts +4 -2
  100. package/dist/mcp/index.d.ts.map +1 -1
  101. package/dist/mcp/index.js.map +1 -1
  102. package/dist/mcp/sync-cli-config.d.ts +42 -4
  103. package/dist/mcp/sync-cli-config.d.ts.map +1 -1
  104. package/dist/mcp/sync-cli-config.js +497 -17
  105. package/dist/mcp/sync-cli-config.js.map +1 -1
  106. package/dist/message-loop.d.ts.map +1 -1
  107. package/dist/message-loop.js +43 -1
  108. package/dist/message-loop.js.map +1 -1
  109. package/dist/mqtt-client.d.ts +34 -0
  110. package/dist/mqtt-client.d.ts.map +1 -1
  111. package/dist/mqtt-client.js +270 -45
  112. package/dist/mqtt-client.js.map +1 -1
  113. package/dist/mqtt-data-relay.d.ts +44 -0
  114. package/dist/mqtt-data-relay.d.ts.map +1 -0
  115. package/dist/mqtt-data-relay.js +106 -0
  116. package/dist/mqtt-data-relay.js.map +1 -0
  117. package/dist/orchestration/capabilities.d.ts +13 -0
  118. package/dist/orchestration/capabilities.d.ts.map +1 -0
  119. package/dist/orchestration/capabilities.js +152 -0
  120. package/dist/orchestration/capabilities.js.map +1 -0
  121. package/dist/orchestration/dispatch-executor.d.ts +83 -0
  122. package/dist/orchestration/dispatch-executor.d.ts.map +1 -0
  123. package/dist/orchestration/dispatch-executor.js +266 -0
  124. package/dist/orchestration/dispatch-executor.js.map +1 -0
  125. package/dist/orchestration/dispatch-hint.d.ts +134 -0
  126. package/dist/orchestration/dispatch-hint.d.ts.map +1 -0
  127. package/dist/orchestration/dispatch-hint.js +247 -0
  128. package/dist/orchestration/dispatch-hint.js.map +1 -0
  129. package/dist/orchestration/dispatch-runner.d.ts +106 -0
  130. package/dist/orchestration/dispatch-runner.d.ts.map +1 -0
  131. package/dist/orchestration/dispatch-runner.js +604 -0
  132. package/dist/orchestration/dispatch-runner.js.map +1 -0
  133. package/dist/orchestration/dispatch-tools.d.ts +167 -0
  134. package/dist/orchestration/dispatch-tools.d.ts.map +1 -0
  135. package/dist/orchestration/dispatch-tools.js +328 -0
  136. package/dist/orchestration/dispatch-tools.js.map +1 -0
  137. package/dist/orchestration/front-door-policy.d.ts +35 -10
  138. package/dist/orchestration/front-door-policy.d.ts.map +1 -1
  139. package/dist/orchestration/front-door-policy.js +30 -267
  140. package/dist/orchestration/front-door-policy.js.map +1 -1
  141. package/dist/orchestration/orchestrator-dispatch-prompt.d.ts +43 -0
  142. package/dist/orchestration/orchestrator-dispatch-prompt.d.ts.map +1 -0
  143. package/dist/orchestration/orchestrator-dispatch-prompt.js +267 -0
  144. package/dist/orchestration/orchestrator-dispatch-prompt.js.map +1 -0
  145. package/dist/orchestration/orchestrator-operating-prompt.d.ts +14 -0
  146. package/dist/orchestration/orchestrator-operating-prompt.d.ts.map +1 -1
  147. package/dist/orchestration/orchestrator-operating-prompt.js +157 -31
  148. package/dist/orchestration/orchestrator-operating-prompt.js.map +1 -1
  149. package/dist/orchestration/plan-import.d.ts +39 -0
  150. package/dist/orchestration/plan-import.d.ts.map +1 -0
  151. package/dist/orchestration/plan-import.js +547 -0
  152. package/dist/orchestration/plan-import.js.map +1 -0
  153. package/dist/orchestration/worker-operating-prompt.d.ts +2 -0
  154. package/dist/orchestration/worker-operating-prompt.d.ts.map +1 -1
  155. package/dist/orchestration/worker-operating-prompt.js +36 -46
  156. package/dist/orchestration/worker-operating-prompt.js.map +1 -1
  157. package/dist/orchestrator.d.ts +195 -3
  158. package/dist/orchestrator.d.ts.map +1 -1
  159. package/dist/orchestrator.js +1970 -432
  160. package/dist/orchestrator.js.map +1 -1
  161. package/dist/providers/anthropic.d.ts.map +1 -1
  162. package/dist/providers/anthropic.js +8 -4
  163. package/dist/providers/anthropic.js.map +1 -1
  164. package/dist/providers/claude-cli.d.ts.map +1 -1
  165. package/dist/providers/claude-cli.js +28 -3
  166. package/dist/providers/claude-cli.js.map +1 -1
  167. package/dist/providers/codex-cli.d.ts +10 -6
  168. package/dist/providers/codex-cli.d.ts.map +1 -1
  169. package/dist/providers/codex-cli.js +190 -17
  170. package/dist/providers/codex-cli.js.map +1 -1
  171. package/dist/providers/google.d.ts.map +1 -1
  172. package/dist/providers/google.js +15 -5
  173. package/dist/providers/google.js.map +1 -1
  174. package/dist/providers/index.d.ts +15 -1
  175. package/dist/providers/index.d.ts.map +1 -1
  176. package/dist/providers/index.js.map +1 -1
  177. package/dist/providers/openai.d.ts +1 -1
  178. package/dist/providers/openai.d.ts.map +1 -1
  179. package/dist/providers/openai.js +13 -5
  180. package/dist/providers/openai.js.map +1 -1
  181. package/dist/server-adapter.d.ts +8 -0
  182. package/dist/server-adapter.d.ts.map +1 -1
  183. package/dist/server-adapter.js +7 -0
  184. package/dist/server-adapter.js.map +1 -1
  185. package/dist/service-mode.d.ts +1 -1
  186. package/dist/service-mode.d.ts.map +1 -1
  187. package/dist/service-mode.js +64 -1
  188. package/dist/service-mode.js.map +1 -1
  189. package/dist/service-setup-only.d.ts +8 -0
  190. package/dist/service-setup-only.d.ts.map +1 -0
  191. package/dist/service-setup-only.js +37 -0
  192. package/dist/service-setup-only.js.map +1 -0
  193. package/dist/slash-commands.d.ts +21 -0
  194. package/dist/slash-commands.d.ts.map +1 -0
  195. package/dist/slash-commands.js +99 -0
  196. package/dist/slash-commands.js.map +1 -0
  197. package/dist/subagent/index.d.ts +4 -2
  198. package/dist/subagent/index.d.ts.map +1 -1
  199. package/dist/subagent/index.js.map +1 -1
  200. package/dist/summarization-pipeline.d.ts.map +1 -1
  201. package/dist/summarization-pipeline.js +1 -9
  202. package/dist/summarization-pipeline.js.map +1 -1
  203. package/dist/token-counter.d.ts.map +1 -1
  204. package/dist/token-counter.js +11 -4
  205. package/dist/token-counter.js.map +1 -1
  206. package/dist/tool-filter.d.ts.map +1 -1
  207. package/dist/tool-filter.js +10 -6
  208. package/dist/tool-filter.js.map +1 -1
  209. package/dist/tools/admin-tools.d.ts.map +1 -1
  210. package/dist/tools/admin-tools.js +13 -4
  211. package/dist/tools/admin-tools.js.map +1 -1
  212. package/dist/tools/run-command.d.ts.map +1 -1
  213. package/dist/tools/run-command.js +5 -1
  214. package/dist/tools/run-command.js.map +1 -1
  215. package/dist/tools/search-conversation-history.d.ts.map +1 -1
  216. package/dist/tools/search-conversation-history.js +12 -2
  217. package/dist/tools/search-conversation-history.js.map +1 -1
  218. package/dist/tools/todo-tasks.d.ts.map +1 -1
  219. package/dist/tools/todo-tasks.js +77 -5
  220. package/dist/tools/todo-tasks.js.map +1 -1
  221. package/dist/usage-log.d.ts +62 -0
  222. package/dist/usage-log.d.ts.map +1 -0
  223. package/dist/usage-log.js +98 -0
  224. package/dist/usage-log.js.map +1 -0
  225. package/dist/wizard-state.d.ts +13 -0
  226. package/dist/wizard-state.d.ts.map +1 -1
  227. package/dist/wizard-state.js +61 -3
  228. package/dist/wizard-state.js.map +1 -1
  229. package/dist/wizard-support.d.ts.map +1 -1
  230. package/dist/wizard-support.js +27 -1
  231. package/dist/wizard-support.js.map +1 -1
  232. package/dist/workflow-engine.d.ts +40 -1
  233. package/dist/workflow-engine.d.ts.map +1 -1
  234. package/dist/workflow-engine.js +753 -93
  235. package/dist/workflow-engine.js.map +1 -1
  236. package/package.json +2 -2
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.LocalConversationGateway = void 0;
37
+ const data = __importStar(require("./local-data"));
38
+ // ---------------------------------------------------------------------------
39
+ // Helpers
40
+ // ---------------------------------------------------------------------------
41
+ function rowToSummary(r) {
42
+ const botId = r.initial_bot_id ?? r.bot_id ?? null;
43
+ return {
44
+ id: r.id,
45
+ title: r.title,
46
+ source: r.source ?? null,
47
+ sourceModel: r.source_model ?? null,
48
+ projectId: r.project_id ?? null,
49
+ botId,
50
+ messageCount: r.message_count ?? 0,
51
+ tokenCount: r.token_count ?? 0,
52
+ isArchived: r.is_archived === 1,
53
+ createdAt: r.created_at,
54
+ updatedAt: r.updated_at,
55
+ bot: botId ? { id: botId, name: null } : null,
56
+ job_status: null,
57
+ };
58
+ }
59
+ function rowToDetail(r) {
60
+ return {
61
+ id: r.id,
62
+ title: r.title,
63
+ sourceModel: r.source_model ?? null,
64
+ projectId: r.project_id ?? null,
65
+ messageCount: r.message_count ?? 0,
66
+ tokenCount: r.token_count ?? 0,
67
+ isArchived: r.is_archived === 1,
68
+ createdAt: r.created_at,
69
+ updatedAt: r.updated_at,
70
+ };
71
+ }
72
+ function msgRowToMessage(m) {
73
+ let attachments = undefined;
74
+ if (m.attachments_json) {
75
+ try {
76
+ attachments = JSON.parse(m.attachments_json);
77
+ }
78
+ catch { /* skip */ }
79
+ }
80
+ return {
81
+ id: m.id,
82
+ role: m.role,
83
+ content: m.content,
84
+ sequenceNumber: m.seq,
85
+ model: m.model ?? null,
86
+ botId: m.bot_id ?? null,
87
+ tokenCount: m.token_count ?? null,
88
+ promptTokens: null,
89
+ completionTokens: null,
90
+ responseTime: null,
91
+ llmCalls: null,
92
+ promptSnapshot: null,
93
+ ragSnapshot: null,
94
+ timestamp: m.created_at,
95
+ codeBlocks: null,
96
+ attachments,
97
+ };
98
+ }
99
+ // ---------------------------------------------------------------------------
100
+ // Implementation
101
+ // ---------------------------------------------------------------------------
102
+ class LocalConversationGateway {
103
+ agentId;
104
+ constructor(agentId) {
105
+ this.agentId = agentId;
106
+ }
107
+ async listConversations(params) {
108
+ const limit = Math.min(params.limit ?? 50, 100);
109
+ const rows = data.listConversations({ limit: limit + 1 });
110
+ const hasMore = rows.length > limit;
111
+ const items = hasMore ? rows.slice(0, limit) : rows;
112
+ const nextCursor = hasMore ? items[items.length - 1]?.id : undefined;
113
+ return {
114
+ conversations: items.map(rowToSummary),
115
+ nextCursor,
116
+ };
117
+ }
118
+ async createConversation(params) {
119
+ const row = data.createConversation(this.agentId, params.title || 'New Conversation', 'web-chat', { projectId: params.projectId ?? null });
120
+ return {
121
+ id: row.id,
122
+ title: row.title ?? 'New Conversation',
123
+ sourceModel: params.model ?? null,
124
+ projectId: row.project_id ?? null,
125
+ createdAt: row.created_at,
126
+ };
127
+ }
128
+ async getConversation(conversationId) {
129
+ const row = data.getConversation(conversationId);
130
+ if (!row)
131
+ throw new Error('Conversation not found');
132
+ return rowToDetail(row);
133
+ }
134
+ async updateConversation(conversationId, params) {
135
+ const existing = data.getConversation(conversationId);
136
+ if (!existing)
137
+ throw new Error('Conversation not found');
138
+ const fields = {};
139
+ if (params.title !== undefined)
140
+ fields.title = params.title;
141
+ if (params.isArchived !== undefined)
142
+ fields.isArchived = params.isArchived;
143
+ if (params.projectId !== undefined)
144
+ fields.projectId = params.projectId || undefined;
145
+ data.updateConversation(conversationId, fields);
146
+ const updated = data.getConversation(conversationId);
147
+ return {
148
+ id: conversationId,
149
+ title: updated?.title ?? existing.title,
150
+ isArchived: (updated?.is_archived ?? existing.is_archived) === 1,
151
+ projectId: updated?.project_id ?? existing.project_id ?? null,
152
+ updatedAt: updated?.updated_at ?? existing.updated_at,
153
+ };
154
+ }
155
+ async deleteConversation(conversationId) {
156
+ const deleted = data.deleteConversation(conversationId);
157
+ return { deleted };
158
+ }
159
+ async listMessages(conversationId, params) {
160
+ const limit = Math.min(params.limit ?? 100, 500);
161
+ let rows;
162
+ if (params.before) {
163
+ rows = data.getMessagesBefore(conversationId, parseInt(params.before), limit);
164
+ }
165
+ else {
166
+ rows = data.getMessages(conversationId, { limit });
167
+ }
168
+ return {
169
+ messages: rows.map(msgRowToMessage),
170
+ hasMore: rows.length === limit,
171
+ };
172
+ }
173
+ }
174
+ exports.LocalConversationGateway = LocalConversationGateway;
175
+ //# sourceMappingURL=local-conversation-gateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-conversation-gateway.js","sourceRoot":"","sources":["../src/local-conversation-gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAqC;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uB,CAAC;QAC5B,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC;QAChF,CAAC;aAAM,CAAC;YACN,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACrD,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC;YACnC,OAAO,EAAE,IAAI,CAAC,MAAM,KAAK,KAAK;SAC/B,CAAC;IACJ,CAAC;CACF;AAlFD,4DAkFC"}
@@ -2,6 +2,8 @@
2
2
  export declare function getDb(): any;
3
3
  /** Close the shared database connection */
4
4
  export declare function closeDb(): void;
5
+ export declare function getAgentOrchestrationRoleClass(agent: Pick<AgentProfileRow, 'orchestration_role_class' | 'orchestration_role_label' | 'role_class' | 'role_label'> | null | undefined): string | null;
6
+ export declare function getAgentOrchestrationRoleLabel(agent: Pick<AgentProfileRow, 'orchestration_role_label' | 'orchestration_role_class' | 'role_label' | 'role_class'> | null | undefined): string | null;
5
7
  export interface AgentProfileRow {
6
8
  id: string;
7
9
  provider: string;
@@ -18,6 +20,9 @@ export interface AgentProfileRow {
18
20
  updated_at: string;
19
21
  role_label: string | null;
20
22
  role_class: string | null;
23
+ orchestration_role_label: string | null;
24
+ orchestration_role_class: string | null;
25
+ orchestration_include_user_prompt: number;
21
26
  is_active: number;
22
27
  priority: number;
23
28
  provider_connection_id: string | null;
@@ -35,8 +40,40 @@ export interface AgentProfileRow {
35
40
  codex_service_tier: string;
36
41
  codex_sandbox_policy: string;
37
42
  codex_approval_policy: string;
43
+ claude_effort_level: string;
44
+ claude_output_style: string;
45
+ claude_fast_mode: number;
46
+ claude_permissions_json: string | null;
47
+ /**
48
+ * Orchestration role priority list — ordered array of role labels.
49
+ * Position 0 = primary capability. Lower index = higher priority.
50
+ * Source of truth going forward. Nullable during additive migration window;
51
+ * code should use `getAgentRolePriorities()` helper to read, which falls
52
+ * back to parsing `orchestration_role_class` when this field is empty.
53
+ */
54
+ orchestration_roles_json: string | null;
38
55
  }
56
+ /**
57
+ * Read a bot's role priority list, dual-reading new and old columns.
58
+ * Used everywhere role-based dispatch or display is needed.
59
+ *
60
+ * Reads `orchestration_roles_json` first (authoritative). If empty/missing,
61
+ * falls back to parsing `orchestration_role_class` (comma-separated, left-
62
+ * to-right priority). Returns empty array if neither source has content.
63
+ *
64
+ * Normalization (per Decision 2): trim each entry, drop empties. Does NOT
65
+ * lower-case or canonicalize the role text — comparisons are the caller's
66
+ * responsibility.
67
+ */
68
+ export declare function getAgentRolePriorities(row: Pick<AgentProfileRow, 'orchestration_roles_json' | 'orchestration_role_class'>): string[];
69
+ /**
70
+ * Compare two role strings for equality per Decision 2 matching rules:
71
+ * case-insensitive + whitespace-normalized. NO alias table.
72
+ * "QA" == "qa" == " QA " == "qa ". "QA" != "Quality Assurance".
73
+ */
74
+ export declare function rolesMatch(a: string | null | undefined, b: string | null | undefined): boolean;
39
75
  export declare function createAgentProfile(p: {
76
+ id?: string;
40
77
  provider: string;
41
78
  model: string;
42
79
  name: string;
@@ -51,6 +88,9 @@ export declare function createAgentProfile(p: {
51
88
  roleClass?: string;
52
89
  isActive?: boolean;
53
90
  priority?: number;
91
+ orchestrationRoleLabel?: string;
92
+ orchestrationRoleClass?: string;
93
+ orchestrationIncludeUserPrompt?: boolean;
54
94
  providerConnectionId?: string;
55
95
  color?: string;
56
96
  purposeMd?: string;
@@ -65,6 +105,12 @@ export declare function createAgentProfile(p: {
65
105
  codexServiceTier?: string;
66
106
  codexSandboxPolicy?: string;
67
107
  codexApprovalPolicy?: string;
108
+ claudeEffortLevel?: string;
109
+ claudeOutputStyle?: string;
110
+ claudeFastMode?: boolean;
111
+ claudePermissionsJson?: string | null;
112
+ /** Ordered role priority list. If provided, also derives orchestration_role_class as comma-separated for compat. */
113
+ orchestrationRolesJson?: string[] | null;
68
114
  }): AgentProfileRow;
69
115
  export declare function getAgentProfile(id: string): AgentProfileRow | undefined;
70
116
  export declare function getDefaultAgentProfile(): AgentProfileRow | undefined;
@@ -80,6 +126,13 @@ export declare function getCurrentOrchestratorSelection(): {
80
126
  } | {
81
127
  type: 'none';
82
128
  };
129
+ export declare function getResolvedClerkConfigInfo(): {
130
+ provider: string | null;
131
+ model: string | null;
132
+ hasSecret: boolean;
133
+ configured: boolean;
134
+ providerConnectionId: string | null;
135
+ };
83
136
  export declare function listAgentProfiles(): AgentProfileRow[];
84
137
  /**
85
138
  * One-time migration helper:
@@ -104,6 +157,9 @@ export declare function updateAgentProfile(id: string, fields: Partial<{
104
157
  roleClass: string;
105
158
  isActive: boolean;
106
159
  priority: number;
160
+ orchestrationRoleLabel: string;
161
+ orchestrationRoleClass: string;
162
+ orchestrationIncludeUserPrompt: boolean;
107
163
  providerConnectionId: string;
108
164
  color: string;
109
165
  purposeMd: string;
@@ -119,10 +175,31 @@ export declare function updateAgentProfile(id: string, fields: Partial<{
119
175
  codexServiceTier: string;
120
176
  codexSandboxPolicy: string;
121
177
  codexApprovalPolicy: string;
178
+ claudeEffortLevel: string;
179
+ claudeOutputStyle: string;
180
+ claudeFastMode: boolean;
181
+ claudePermissionsJson: string | null;
182
+ /** Ordered role priority list. Writing this also updates orchestration_role_class to a derived comma-separated string. */
183
+ orchestrationRolesJson: string[] | null;
122
184
  }>): AgentProfileRow | undefined;
123
185
  export declare function setOrchestratorBot(botId: string): AgentProfileRow | undefined;
124
186
  export declare function setDefaultAgentProfile(botId: string): AgentProfileRow | undefined;
125
187
  export declare function isClerkOrchestratorEnabled(): boolean;
188
+ /**
189
+ * Phase B of orchestration-plan.txt: LLM-tool-dispatch is the only
190
+ * orchestration path in local_desktop mode. The feature flag introduced
191
+ * in Phase A has been retired — new path is always active, no user toggle.
192
+ * These helpers are kept for a brief deprecation window so any external
193
+ * callers (settings UI, HTTP endpoints) still compile while they are
194
+ * removed. Do not use in new code.
195
+ *
196
+ * @deprecated Phase B — tool dispatch is the only path.
197
+ */
198
+ export declare function isOrchestrationToolDispatchEnabled(): boolean;
199
+ /**
200
+ * @deprecated Phase B — no-op. Tool dispatch is the only path.
201
+ */
202
+ export declare function setOrchestrationToolDispatchEnabled(_enabled: boolean): void;
126
203
  export declare function setClerkAsOrchestrator(enabled: boolean): void;
127
204
  export interface ProviderConnectionRow {
128
205
  id: string;
@@ -198,6 +275,9 @@ export declare function deleteAgentProfile(id: string): boolean;
198
275
  export interface ConversationRow {
199
276
  id: string;
200
277
  agent_id: string;
278
+ initial_bot_id: string | null;
279
+ active_bot_ids_json: string | null;
280
+ active_bot_ids: string[];
201
281
  title: string | null;
202
282
  source: string;
203
283
  imported_from: string | null;
@@ -205,6 +285,7 @@ export interface ConversationRow {
205
285
  sentiment: string | null;
206
286
  complexity: string | null;
207
287
  message_count: number;
288
+ sync_revision: number;
208
289
  processing_status: string;
209
290
  created_at: string;
210
291
  updated_at: string;
@@ -244,7 +325,11 @@ export interface ConversationRow {
244
325
  export declare function createConversation(agentId: string, title?: string, source?: string, opts?: {
245
326
  projectId?: string | null;
246
327
  projectName?: string | null;
328
+ botIds?: string[] | null;
329
+ initialBotId?: string | null;
247
330
  }): ConversationRow;
331
+ export declare function getConversationParticipantBotIds(conversationId: string, conversation?: ConversationRow | null): string[];
332
+ export declare function getConversationPrimaryBotId(conversationId: string, conversation?: ConversationRow | null): string | null;
248
333
  export declare function getConversation(id: string): ConversationRow | undefined;
249
334
  export declare function listConversations(opts?: {
250
335
  limit?: number;
@@ -258,6 +343,11 @@ export interface BotConversationActivityRow extends ConversationRow {
258
343
  bot_last_message_at: string | null;
259
344
  }
260
345
  export declare function countMessagesForBot(botId: string): number;
346
+ export declare function countMessagesForBotSince(botId: string, since: string): number;
347
+ export declare function countDecisionsForBot(botId: string): number;
348
+ export declare function countBotActiveDays(botId: string): number;
349
+ export declare function countBotConversationsUpdatedBetween(botId: string, from: string, to?: string): number;
350
+ export declare function sumBotTokenUsageSince(botId: string, since: string): number;
261
351
  export declare function listBotConversationActivity(botId: string, limit?: number): BotConversationActivityRow[];
262
352
  export declare function updateConversation(id: string, fields: Partial<{
263
353
  title: string;
@@ -299,8 +389,15 @@ export declare function updateConversation(id: string, fields: Partial<{
299
389
  forkedFromId: string;
300
390
  createdAt: string;
301
391
  updatedAt: string;
392
+ initialBotId: string;
393
+ activeBotIdsJson: string;
302
394
  }>): void;
395
+ export declare function syncConversationParticipants(conversationId: string, botIds: Array<string | null | undefined>, opts?: {
396
+ replace?: boolean;
397
+ initialBotId?: string | null;
398
+ }): void;
303
399
  export declare function touchConversationActivity(id: string, ts?: string): void;
400
+ export declare function bumpConversationSyncRevision(id: string, ts?: string): number;
304
401
  export declare function deleteConversation(id: string): boolean;
305
402
  export interface MessageRow {
306
403
  id: string;
@@ -308,6 +405,7 @@ export interface MessageRow {
308
405
  seq: number;
309
406
  role: string;
310
407
  content: string;
408
+ attachments_json: string | null;
311
409
  model: string | null;
312
410
  token_count: number | null;
313
411
  tool_calls_json: string | null;
@@ -324,7 +422,7 @@ export interface ChatJobRow {
324
422
  user_message_id: string;
325
423
  assistant_message_id: string;
326
424
  bot_id: string;
327
- status: 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
425
+ status: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'cancelled' | 'interrupted';
328
426
  request_json: string | null;
329
427
  error: string | null;
330
428
  created_at: string;
@@ -336,9 +434,11 @@ export interface ChatJobRow {
336
434
  export interface CliSessionEpochRow {
337
435
  id: string;
338
436
  conversation_id: string;
437
+ session_scope_key: string;
339
438
  bot_id: string;
340
439
  provider: string;
341
440
  session_id: string;
441
+ topic_id: string | null;
342
442
  epoch_turn_count: number;
343
443
  last_input_tokens: number | null;
344
444
  last_output_tokens: number | null;
@@ -348,6 +448,24 @@ export interface CliSessionEpochRow {
348
448
  created_at: string;
349
449
  updated_at: string;
350
450
  }
451
+ export interface WarmSessionBindingKey {
452
+ conversationId: string;
453
+ botId: string;
454
+ }
455
+ export interface WarmCliSessionInfo {
456
+ conversationId: string;
457
+ sessionScopeKey: string;
458
+ botId: string;
459
+ provider: string;
460
+ sessionId: string;
461
+ topicId: string | null;
462
+ epochTurnCount: number;
463
+ lastUsedAt: string;
464
+ resetReason: string | null;
465
+ }
466
+ export declare function toWarmSessionBindingKey(conversationId: string, botId: string): string;
467
+ export declare function parseWarmSessionBindingKey(key: string): WarmSessionBindingKey | null;
468
+ export declare function epochRowToWarmInfo(row: CliSessionEpochRow): WarmCliSessionInfo;
351
469
  export interface MessageActivityRow {
352
470
  id: string;
353
471
  conversation_id: string;
@@ -361,9 +479,10 @@ export interface MessageActivityRow {
361
479
  created_at: string;
362
480
  expires_at: string | null;
363
481
  }
364
- export declare function addMessage(conversationId: string, role: string, content: string, model?: string, toolCallsJson?: string, botId?: string, agentName?: string, createdAt?: string): MessageRow;
482
+ export declare function addMessage(conversationId: string, role: string, content: string, model?: string, toolCallsJson?: string, botId?: string, agentName?: string, createdAt?: string, attachmentsJson?: string | null): MessageRow;
365
483
  export declare function updateMessage(id: string, fields: Partial<{
366
484
  content: string;
485
+ attachmentsJson: string | null;
367
486
  model: string | null;
368
487
  toolCallsJson: string | null;
369
488
  botId: string | null;
@@ -380,12 +499,14 @@ export declare function createChatJob(input: {
380
499
  requestJson?: string | null;
381
500
  status?: ChatJobRow['status'];
382
501
  }): ChatJobRow;
383
- export declare function getCliSessionEpoch(conversationId: string, botId: string): CliSessionEpochRow | undefined;
502
+ export declare function getCliSessionEpoch(conversationId: string, botId: string, sessionScopeKey?: string | null): CliSessionEpochRow | undefined;
384
503
  export declare function upsertCliSessionEpoch(input: {
385
504
  conversationId: string;
505
+ sessionScopeKey?: string | null;
386
506
  botId: string;
387
507
  provider: string;
388
508
  sessionId: string;
509
+ topicId?: string | null;
389
510
  epochTurnCount: number;
390
511
  lastInputTokens?: number | null;
391
512
  lastOutputTokens?: number | null;
@@ -393,7 +514,10 @@ export declare function upsertCliSessionEpoch(input: {
393
514
  epochStartedAt?: string;
394
515
  lastUsedAt?: string;
395
516
  }): CliSessionEpochRow;
396
- export declare function deleteCliSessionEpoch(conversationId: string, botId: string): boolean;
517
+ export declare function deleteCliSessionEpoch(conversationId: string, botId: string, sessionScopeKey?: string | null): boolean;
518
+ export declare function clearCliSessionEpochIfMatches(conversationId: string, botId: string, sessionId: string | null | undefined, sessionScopeKey?: string | null): boolean;
519
+ export declare function cleanupPoisonedClaudePrewarmSessionRows(): number;
520
+ export declare function getCliSessionEpochsByConversation(conversationId: string): CliSessionEpochRow[];
397
521
  /**
398
522
  * Generate the next sequential Funolio session ID.
399
523
  * Format: fff00000-0000-4000-8000-NNNNNNNNNNNN
@@ -416,6 +540,29 @@ export declare function updateChatJob(id: string, fields: Partial<{
416
540
  cancelledAt: string | null;
417
541
  }>): ChatJobRow | undefined;
418
542
  export declare function markRunningChatJobsInterrupted(reason?: string): number;
543
+ export interface CrashRecoveryResult {
544
+ recoveredJobs: Array<{
545
+ jobId: string;
546
+ previousStatus: string;
547
+ }>;
548
+ totalRecovered: number;
549
+ }
550
+ export interface WorkflowCrashRecoveryResult {
551
+ recoveredWorkflowExecutions: Array<{
552
+ workflowId: string;
553
+ conversationId: string | null;
554
+ previousStatus: string;
555
+ }>;
556
+ recoveredImportedPlanRuns: Array<{
557
+ runId: string;
558
+ conversationId: string;
559
+ previousStatus: string;
560
+ remainingTaskCount: number;
561
+ }>;
562
+ totalRecovered: number;
563
+ }
564
+ export declare function recoverInterruptedChatJobs(): CrashRecoveryResult;
565
+ export declare function recoverInterruptedWorkflowRuns(reason?: string): WorkflowCrashRecoveryResult;
419
566
  export declare function createMessageActivity(activity: {
420
567
  conversationId: string;
421
568
  messageId?: string | null;
@@ -648,6 +795,68 @@ export declare function updateImportJobItem(id: string, fields: Partial<{
648
795
  attemptCount: number;
649
796
  nextAttemptAt: string;
650
797
  }>): void;
798
+ type ImportedPlanStageRecord = {
799
+ role: string;
800
+ botId: string;
801
+ };
802
+ type ImportedPlanOptionsRecord = {
803
+ plannerInstructions?: string | null;
804
+ executionOrder?: 'per_item_pipeline' | 'batch_by_stage' | null;
805
+ };
806
+ export interface ImportedPlanRunRow {
807
+ id: string;
808
+ conversation_id: string;
809
+ project_id: string | null;
810
+ source_file_path: string;
811
+ source_file_name: string;
812
+ planner_bot_id: string | null;
813
+ planner_agent_name: string | null;
814
+ planner_provider: string | null;
815
+ planner_model: string | null;
816
+ requested_stages: ImportedPlanStageRecord[];
817
+ requested_options: ImportedPlanOptionsRecord;
818
+ task_ids: number[];
819
+ status: 'paused' | 'running' | 'completed' | 'discarded';
820
+ created_at: string;
821
+ updated_at: string;
822
+ started_at: string | null;
823
+ completed_at: string | null;
824
+ discarded_at: string | null;
825
+ last_error: string | null;
826
+ }
827
+ export declare function createImportedPlanRun(params: {
828
+ conversationId: string;
829
+ projectId?: string | null;
830
+ sourceFilePath: string;
831
+ sourceFileName: string;
832
+ plannerBotId?: string | null;
833
+ plannerAgentName?: string | null;
834
+ plannerProvider?: string | null;
835
+ plannerModel?: string | null;
836
+ requestedStages: ImportedPlanStageRecord[];
837
+ requestedOptions: ImportedPlanOptionsRecord;
838
+ taskIds: number[];
839
+ status?: ImportedPlanRunRow['status'];
840
+ }): ImportedPlanRunRow;
841
+ export declare function getImportedPlanRun(id: string): ImportedPlanRunRow | undefined;
842
+ export declare function listImportedPlanRunsForConversation(conversationId: string): ImportedPlanRunRow[];
843
+ export declare function getLatestImportedPlanRunForConversation(conversationId: string, opts?: {
844
+ includeDiscarded?: boolean;
845
+ includeCompleted?: boolean;
846
+ }): ImportedPlanRunRow | undefined;
847
+ export declare function updateImportedPlanRun(id: string, fields: Partial<{
848
+ taskIds: number[];
849
+ status: ImportedPlanRunRow['status'];
850
+ startedAt: string | null;
851
+ completedAt: string | null;
852
+ discardedAt: string | null;
853
+ lastError: string | null;
854
+ }>): ImportedPlanRunRow | undefined;
855
+ export declare function touchImportedPlanRun(id: string): ImportedPlanRunRow | undefined;
856
+ export declare function getImportedPlanRunTasks(id: string): TodoTaskRow[];
857
+ export declare function getImportedPlanRunRemainingTaskIds(id: string): number[];
858
+ export declare function getImportedPlanRunCurrentTask(id: string): TodoTaskRow | undefined;
859
+ export declare function deleteImportedPlanRunSelectedTasks(id: string, selectedTaskIds: number[], actor: TodoActor): ImportedPlanRunRow | undefined;
651
860
  export interface OutboxEventRow {
652
861
  id: string;
653
862
  event_type: string;
@@ -833,6 +1042,7 @@ export interface TodoActor {
833
1042
  export interface TodoTaskRow {
834
1043
  id: number;
835
1044
  project_id: string | null;
1045
+ topic_id: string | null;
836
1046
  conversation_id: string | null;
837
1047
  origin: string | null;
838
1048
  created_by_bot_id: string | null;
@@ -988,12 +1198,25 @@ export declare function completeTodoTaskByWorker(taskId: number, params: {
988
1198
  outputSummary?: string;
989
1199
  artifactRefs?: Array<string | TodoArtifactRefInput>;
990
1200
  handoffPrompt?: string;
1201
+ /** Structured QA pass/fail signal. "pass" or "not_applicable" never auto-create fix tasks. "fail" auto-creates a fix task for the previous worker unless `requiresFixTask === false`. */
1202
+ qaResult?: 'pass' | 'fail' | 'not_applicable';
1203
+ /** Required when qaResult === 'fail'. Used as the auto-created fix task's taskPrompt. */
1204
+ findings?: string[];
1205
+ /** Defaults to true when qaResult === 'fail'. Set false to signal a failure without creating a fix task. */
1206
+ requiresFixTask?: boolean;
991
1207
  insertTask?: TodoWorkerInsertionInput;
992
1208
  expectedVersion?: number;
993
1209
  expectedLastUpdated?: string;
994
1210
  actor: TodoActor;
995
1211
  }): TodoWorkerCompletionResult;
996
1212
  export declare function blockTodoTaskByWorker(taskId: number, params: TodoWorkerBlockedInput): TodoWorkerBlockedResult;
1213
+ export declare function markTodoTaskRuntimeBlocked(taskId: number, params: {
1214
+ actor: TodoActor;
1215
+ blockerSummary: string;
1216
+ checkedContext?: string;
1217
+ userQuestion?: string;
1218
+ reasonCode?: string;
1219
+ }): TodoTaskRow;
997
1220
  export declare function deleteTodoTask(taskId: number, params: {
998
1221
  actor: TodoActor;
999
1222
  state?: 'active' | 'completed';
@@ -1013,6 +1236,12 @@ export declare function moveNullTodoTasksToUnassigned(): {
1013
1236
  export declare function getLatestActiveTodoForConversation(conversationId: string): TodoTaskRow | undefined;
1014
1237
  export declare function getNextActiveTodoForConversation(conversationId: string): TodoTaskRow | undefined;
1015
1238
  export declare function listCompletedTodoTasksForConversation(conversationId: string): TodoTaskRow[];
1239
+ /**
1240
+ * List all active (non-completed) TODOs for a conversation in creation order.
1241
+ * Used by the orchestration dispatch-runner to feed `existing_todos` into
1242
+ * the orchestrator hint so the LLM can see what's already queued.
1243
+ */
1244
+ export declare function listActiveTodoTasksForConversation(conversationId: string): TodoTaskRow[];
1016
1245
  export interface ProjectRow {
1017
1246
  id: string;
1018
1247
  name: string;
@@ -1114,7 +1343,7 @@ export interface TopicRow {
1114
1343
  export interface ConversationWithPreview extends ConversationRow {
1115
1344
  summary_text: string | null;
1116
1345
  first_user_message: string | null;
1117
- job_status: 'working' | 'queued' | 'done' | 'failed' | 'cancelled' | null;
1346
+ job_status: 'pending' | 'working' | 'queued' | 'done' | 'failed' | 'cancelled' | 'interrupted' | null;
1118
1347
  }
1119
1348
  export interface TopicSegmentRow {
1120
1349
  id: string;
@@ -1444,4 +1673,5 @@ export declare function getDbStats(): DbStats;
1444
1673
  * Keeps agent_profile, bot config, settings, and optionally projects.
1445
1674
  */
1446
1675
  export declare function resetDerivedData(keepProjects: boolean): Record<string, number>;
1676
+ export {};
1447
1677
  //# sourceMappingURL=local-data.d.ts.map