create-walle 0.9.25 → 0.9.26

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 (179) hide show
  1. package/README.md +8 -0
  2. package/bin/create-walle.js +815 -45
  3. package/package.json +2 -2
  4. package/template/bin/ctm-dev-cleanup.js +90 -4
  5. package/template/bin/ctm-launch.sh +49 -1
  6. package/template/bin/dev.sh +45 -1
  7. package/template/bin/ensure-stable-node.js +132 -0
  8. package/template/bin/install-service.sh +9 -0
  9. package/template/claude-task-manager/api-prompts.js +899 -119
  10. package/template/claude-task-manager/approval-agent.js +360 -40
  11. package/template/claude-task-manager/bin/ctm-disclaim.c +42 -0
  12. package/template/claude-task-manager/bin/ctm-hotkey.swift +67 -81
  13. package/template/claude-task-manager/bin/ctm-screen-auth.swift +37 -0
  14. package/template/claude-task-manager/bin/install-hotkey.sh +97 -49
  15. package/template/claude-task-manager/bin/restart-ctm.sh +14 -0
  16. package/template/claude-task-manager/db.js +399 -48
  17. package/template/claude-task-manager/docs/approval-hook-sandbox.md +84 -0
  18. package/template/claude-task-manager/docs/codex-app-server-approvals.md +72 -0
  19. package/template/claude-task-manager/docs/codex-native-sandbox.md +47 -0
  20. package/template/claude-task-manager/docs/prompt-editing-tree-design.md +18 -1
  21. package/template/claude-task-manager/lib/approval-hook.js +200 -0
  22. package/template/claude-task-manager/lib/approval-self-adapt.js +1 -0
  23. package/template/claude-task-manager/lib/auth-rules.js +11 -0
  24. package/template/claude-task-manager/lib/background-llm.js +32 -4
  25. package/template/claude-task-manager/lib/codesign-identity.js +140 -0
  26. package/template/claude-task-manager/lib/codex-app-server-client.js +119 -0
  27. package/template/claude-task-manager/lib/codex-approval-bridge.js +118 -0
  28. package/template/claude-task-manager/lib/codex-history-terminal-renderer.js +571 -0
  29. package/template/claude-task-manager/lib/codex-paths.js +73 -0
  30. package/template/claude-task-manager/lib/codex-rollout-snapshot.js +164 -0
  31. package/template/claude-task-manager/lib/codex-rollout-tail.js +72 -0
  32. package/template/claude-task-manager/lib/codex-sandbox-args.js +47 -0
  33. package/template/claude-task-manager/lib/coding-agent-models.js +118 -71
  34. package/template/claude-task-manager/lib/command-targets.js +163 -0
  35. package/template/claude-task-manager/lib/conversation-tail-merge.js +61 -19
  36. package/template/claude-task-manager/lib/db-owner-worker-client.js +29 -1
  37. package/template/claude-task-manager/lib/escalation-review.js +80 -3
  38. package/template/claude-task-manager/lib/flow-control.js +52 -0
  39. package/template/claude-task-manager/lib/fs-watcher.js +24 -15
  40. package/template/claude-task-manager/lib/ingest-cooldown.js +68 -0
  41. package/template/claude-task-manager/lib/jsonl-conversation-parser.js +8 -4
  42. package/template/claude-task-manager/lib/launchd-recovery.js +92 -0
  43. package/template/claude-task-manager/lib/microsoft-dev-tunnel-setup.js +207 -52
  44. package/template/claude-task-manager/lib/mobile-push-store.js +7 -0
  45. package/template/claude-task-manager/lib/model-overview-brain-fallback.js +102 -1
  46. package/template/claude-task-manager/lib/model-overview-cache.js +1 -0
  47. package/template/claude-task-manager/lib/oauth-proxy-supervisor.js +2 -1
  48. package/template/claude-task-manager/lib/perf-tracker.js +29 -2
  49. package/template/claude-task-manager/lib/permission-match.js +146 -16
  50. package/template/claude-task-manager/lib/project-slug.js +33 -0
  51. package/template/claude-task-manager/lib/prompt-intent.js +51 -4
  52. package/template/claude-task-manager/lib/read-pool-client.js +48 -3
  53. package/template/claude-task-manager/lib/real-node.js +73 -0
  54. package/template/claude-task-manager/lib/runtime-work-registry.js +131 -14
  55. package/template/claude-task-manager/lib/session-content-backfill.js +24 -5
  56. package/template/claude-task-manager/lib/session-diagnostics-batch.js +87 -0
  57. package/template/claude-task-manager/lib/session-history.js +5 -7
  58. package/template/claude-task-manager/lib/session-host-manager.js +19 -0
  59. package/template/claude-task-manager/lib/session-jobs.js +6 -0
  60. package/template/claude-task-manager/lib/session-message-response-cache.js +89 -0
  61. package/template/claude-task-manager/lib/session-messages-page.js +211 -0
  62. package/template/claude-task-manager/lib/session-messages-projection.js +170 -0
  63. package/template/claude-task-manager/lib/session-standup.js +8 -0
  64. package/template/claude-task-manager/lib/session-timeline-summary.js +16 -2
  65. package/template/claude-task-manager/lib/session-token-usage.js +30 -8
  66. package/template/claude-task-manager/lib/session-workspace-binding.js +29 -15
  67. package/template/claude-task-manager/lib/storage-migration.js +2 -1
  68. package/template/claude-task-manager/lib/transcript-store.js +179 -12
  69. package/template/claude-task-manager/lib/walle-ctm-history.js +298 -11
  70. package/template/claude-task-manager/lib/walle-permission-reply.js +49 -0
  71. package/template/claude-task-manager/lib/walle-session-cache.js +22 -1
  72. package/template/claude-task-manager/lib/walle-supervisor.js +42 -3
  73. package/template/claude-task-manager/package.json +5 -2
  74. package/template/claude-task-manager/prompt-harvest.js +31 -11
  75. package/template/claude-task-manager/providers/claude-code.js +29 -1
  76. package/template/claude-task-manager/providers/codex.js +13 -1
  77. package/template/claude-task-manager/public/css/setup.css +11 -0
  78. package/template/claude-task-manager/public/css/walle-session.css +132 -4
  79. package/template/claude-task-manager/public/css/walle.css +89 -0
  80. package/template/claude-task-manager/public/icon-16.png +0 -0
  81. package/template/claude-task-manager/public/icon-32.png +0 -0
  82. package/template/claude-task-manager/public/icon-512.png +0 -0
  83. package/template/claude-task-manager/public/index.html +2483 -165
  84. package/template/claude-task-manager/public/js/activation-render-check.js +55 -0
  85. package/template/claude-task-manager/public/js/flow-control-policy.js +52 -0
  86. package/template/claude-task-manager/public/js/message-renderer.js +60 -1
  87. package/template/claude-task-manager/public/js/prompts.js +13 -1
  88. package/template/claude-task-manager/public/js/session-status-precedence.js +9 -3
  89. package/template/claude-task-manager/public/js/setup.js +54 -10
  90. package/template/claude-task-manager/public/js/stream-resize-policy.js +80 -0
  91. package/template/claude-task-manager/public/js/stream-view.js +78 -0
  92. package/template/claude-task-manager/public/js/terminal-reconciler.js +52 -2
  93. package/template/claude-task-manager/public/js/tool-state.js +155 -0
  94. package/template/claude-task-manager/public/js/walle-session.js +887 -326
  95. package/template/claude-task-manager/public/js/walle.js +306 -195
  96. package/template/claude-task-manager/public/m/app.css +1 -0
  97. package/template/claude-task-manager/public/m/app.js +33 -3
  98. package/template/claude-task-manager/queue-engine.js +45 -1
  99. package/template/claude-task-manager/server.js +3367 -540
  100. package/template/claude-task-manager/workers/approval-blocklist.js +130 -17
  101. package/template/claude-task-manager/workers/db-owner-worker.js +31 -1
  102. package/template/claude-task-manager/workers/read-pool-worker.js +92 -5
  103. package/template/claude-task-manager/workers/session-host-process.js +10 -0
  104. package/template/claude-task-manager/workers/state-detectors/codex.js +58 -7
  105. package/template/package.json +2 -3
  106. package/template/shared/icons/AppIcon-ctm.icns +0 -0
  107. package/template/shared/icons/AppIcon-walle.icns +0 -0
  108. package/template/wall-e/agent.js +139 -18
  109. package/template/wall-e/api-walle.js +201 -22
  110. package/template/wall-e/bin/train-gemma-e4b-tooluse.js +1981 -0
  111. package/template/wall-e/brain.js +1049 -39
  112. package/template/wall-e/chat.js +427 -86
  113. package/template/wall-e/coding/acceptance-contract.js +26 -1
  114. package/template/wall-e/coding/action-memory-policy.js +353 -0
  115. package/template/wall-e/coding/action-memory-store.js +814 -0
  116. package/template/wall-e/coding/initial-messages.js +197 -0
  117. package/template/wall-e/coding/no-progress-guard.js +327 -0
  118. package/template/wall-e/coding/permission-service.js +88 -22
  119. package/template/wall-e/coding/session-workspaces.js +81 -0
  120. package/template/wall-e/coding/shell-sandbox.js +124 -0
  121. package/template/wall-e/coding/stream-processor.js +63 -2
  122. package/template/wall-e/coding/tool-execution-controller.js +14 -1
  123. package/template/wall-e/coding/tool-registry.js +1 -1
  124. package/template/wall-e/coding/transcript-writer.js +3 -0
  125. package/template/wall-e/coding-orchestrator.js +636 -35
  126. package/template/wall-e/coding-prompts.js +51 -2
  127. package/template/wall-e/docs/model-routing-policy.md +59 -0
  128. package/template/wall-e/docs/walle-shell-sandbox.md +61 -0
  129. package/template/wall-e/extraction/knowledge-extractor.js +76 -23
  130. package/template/wall-e/http/chat-api.js +30 -12
  131. package/template/wall-e/http/model-admin.js +93 -1
  132. package/template/wall-e/lib/background-lanes.js +133 -0
  133. package/template/wall-e/lib/boot-profile.js +11 -0
  134. package/template/wall-e/lib/brain-owner-worker-client.js +324 -0
  135. package/template/wall-e/lib/brain-read-pool-client.js +311 -0
  136. package/template/wall-e/lib/diagnostics-flags.js +87 -0
  137. package/template/wall-e/lib/event-loop-monitor.js +74 -3
  138. package/template/wall-e/lib/mcp-integration.js +7 -1
  139. package/template/wall-e/lib/real-node.js +98 -0
  140. package/template/wall-e/lib/runtime-health.js +206 -0
  141. package/template/wall-e/lib/runtime-worker-pool.js +101 -0
  142. package/template/wall-e/lib/scheduler-worker-jobs.js +231 -0
  143. package/template/wall-e/lib/scheduler.js +446 -17
  144. package/template/wall-e/lib/service-health.js +61 -2
  145. package/template/wall-e/lib/service-readiness.js +258 -0
  146. package/template/wall-e/lib/usage.js +152 -0
  147. package/template/wall-e/lib/worker-thread-pool.js +389 -0
  148. package/template/wall-e/llm/client.js +81 -4
  149. package/template/wall-e/llm/default-fallback.js +54 -8
  150. package/template/wall-e/llm/mlx.js +536 -73
  151. package/template/wall-e/llm/mlx.plugin.json +1 -1
  152. package/template/wall-e/llm/ollama.js +342 -43
  153. package/template/wall-e/llm/provider-error.js +18 -1
  154. package/template/wall-e/llm/provider-health-state.js +176 -0
  155. package/template/wall-e/llm/routing-policy.js +796 -0
  156. package/template/wall-e/llm/supported-models.js +5 -0
  157. package/template/wall-e/loops/tasks.js +60 -14
  158. package/template/wall-e/loops/think.js +89 -24
  159. package/template/wall-e/mcp-server.js +192 -28
  160. package/template/wall-e/server.js +32 -7
  161. package/template/wall-e/skills/script-skill-runner.js +8 -1
  162. package/template/wall-e/skills/skill-planner.js +64 -1
  163. package/template/wall-e/tools/builtin-middleware.js +67 -2
  164. package/template/wall-e/tools/local-tools.js +116 -26
  165. package/template/wall-e/tools/permission-checker.js +52 -4
  166. package/template/wall-e/tools/permission-rules.js +36 -0
  167. package/template/wall-e/tools/shell-analyzer.js +46 -1
  168. package/template/wall-e/training/gemma-e4b-qlora.js +314 -0
  169. package/template/wall-e/training/real-trajectory-miner.js +2617 -0
  170. package/template/wall-e/training/replay-eval-analysis.js +151 -0
  171. package/template/wall-e/training/run-shell-command-selector.js +277 -0
  172. package/template/wall-e/training/tool-sft-dataset.js +312 -0
  173. package/template/wall-e/training/tool-sft-renderers.js +144 -0
  174. package/template/wall-e/training/tool-trace-harvester.js +1440 -0
  175. package/template/wall-e/training/trajectory-action-selector.js +364 -0
  176. package/template/wall-e/weather-runtime.js +232 -0
  177. package/template/wall-e/workers/brain-owner-worker.js +162 -0
  178. package/template/wall-e/workers/brain-read-worker.js +148 -0
  179. package/template/wall-e/workers/runtime-worker.js +145 -0
@@ -0,0 +1,155 @@
1
+ // Canonical Wall-E tool-state machine — the SINGLE source of truth for how a
2
+ // tool call's status evolves from the progress events Wall-E streams. Both
3
+ // server-side projections (the per-message transcript `toolCalls` in
4
+ // lib/walle-ctm-history.js AND the WORK-bar lib/runtime-work-registry.js) and
5
+ // the browser (public/js/walle-session.js) consume this one module, so they can
6
+ // never disagree about whether a tool is running, awaiting approval, or done.
7
+ //
8
+ // UMD: `module.exports` under Node (the server libs `require()` it), `window
9
+ // .CTMToolState` in the browser (index.html loads it before walle-session.js).
10
+ //
11
+ // Status set (the machine):
12
+ // pending tool announced, not yet executing/approved
13
+ // awaiting_permission blocked on the user's approval (NOT "running")
14
+ // running actively executing
15
+ // completed finished OK
16
+ // error failed, denied, or gateway-blocked
17
+ //
18
+ // Transitions (driven by the actual events emitWalleProgress relays):
19
+ // tool_call -> running (unless already awaiting_permission)
20
+ // permission_request -> awaiting_permission
21
+ // permission_resolved -> running (allow) | error (deny)
22
+ // tool_result/tool_done-> completed | error (on failure/blocked)
23
+ (function (root, factory) {
24
+ if (typeof module === 'object' && module.exports) module.exports = factory();
25
+ else root.CTMToolState = factory();
26
+ })(typeof self !== 'undefined' ? self : this, function () {
27
+ 'use strict';
28
+
29
+ var STATUS = {
30
+ PENDING: 'pending',
31
+ AWAITING_PERMISSION: 'awaiting_permission',
32
+ RUNNING: 'running',
33
+ COMPLETED: 'completed',
34
+ ERROR: 'error',
35
+ };
36
+
37
+ var ACTIVE = { pending: true, awaiting_permission: true, running: true };
38
+ var TERMINAL = { completed: true, error: true };
39
+
40
+ // The five tool-lifecycle event types this machine reacts to. Everything else
41
+ // (thinking, skill_loaded, cancelled, …) is NOT part of a single tool's state
42
+ // and is left to each projection to handle.
43
+ var LIFECYCLE = {
44
+ tool_call: true,
45
+ permission_request: true,
46
+ permission_resolved: true,
47
+ tool_result: true,
48
+ tool_done: true,
49
+ };
50
+
51
+ function isLifecycleEvent(event) {
52
+ return !!(event && LIFECYCLE[String(event.type || '')]);
53
+ }
54
+
55
+ // Canonical id extraction — superset of every variant the two server files and
56
+ // the client used independently.
57
+ function toolEventId(event) {
58
+ if (!event) return '';
59
+ return String(event.id || event.toolCallId || event.tool_call_id || event.callId || event.call_id || '');
60
+ }
61
+
62
+ // Canonical name — returns '' when the event carries no name yet (a bare
63
+ // id-only block open). Callers decide what to do with the empty case (the
64
+ // phantom-'tool' kill skips creating anything until a named event arrives).
65
+ function toolEventName(event) {
66
+ if (!event) return '';
67
+ return String(event.tool || event.name || event.toolName || event.tool_name || event.skill || '');
68
+ }
69
+
70
+ function isFailureResult(event) {
71
+ if (!event) return false;
72
+ if (event.error || event.failed) return true;
73
+ if (String(event.status || '').toLowerCase() === 'error') return true;
74
+ // The stream processor emits a `Blocked <tool>` / `Failed <tool>` summary for
75
+ // gateway-blocked and errored tools.
76
+ return /^(Blocked|Failed)\b/i.test(String(event.summary || ''));
77
+ }
78
+
79
+ function isAllowDecision(event) {
80
+ return String(event && event.decision || '').toLowerCase() === 'allow';
81
+ }
82
+
83
+ // The core transition. Given the PREVIOUS canonical status (or '' if new) and a
84
+ // raw event, return the next canonical status — or null if the event is not a
85
+ // tool-lifecycle event (caller should ignore it for tool-state purposes).
86
+ function nextStatus(prevStatus, event) {
87
+ if (!isLifecycleEvent(event)) return null;
88
+ switch (String(event.type)) {
89
+ case 'tool_call':
90
+ // A tool that's already waiting on approval stays waiting until resolved.
91
+ return prevStatus === STATUS.AWAITING_PERMISSION ? STATUS.AWAITING_PERMISSION : STATUS.RUNNING;
92
+ case 'permission_request':
93
+ return STATUS.AWAITING_PERMISSION;
94
+ case 'permission_resolved':
95
+ return isAllowDecision(event) ? STATUS.RUNNING : STATUS.ERROR;
96
+ case 'tool_result':
97
+ case 'tool_done':
98
+ return isFailureResult(event) ? STATUS.ERROR : STATUS.COMPLETED;
99
+ default:
100
+ return null;
101
+ }
102
+ }
103
+
104
+ function isActive(status) { return !!ACTIVE[status]; }
105
+ function isTerminal(status) { return !!TERMINAL[status]; }
106
+
107
+ // Human label for a status, used identically by the WORK bar and the cards.
108
+ function statusLabel(status, name, command) {
109
+ var n = name || 'tool';
110
+ switch (status) {
111
+ case STATUS.AWAITING_PERMISSION:
112
+ return command ? 'Awaiting approval: ' + command : 'Awaiting approval for ' + n;
113
+ case STATUS.RUNNING:
114
+ case STATUS.PENDING:
115
+ return 'Running ' + n;
116
+ case STATUS.COMPLETED:
117
+ return 'Completed ' + n;
118
+ case STATUS.ERROR:
119
+ return 'Failed ' + n;
120
+ default:
121
+ return n;
122
+ }
123
+ }
124
+
125
+ // Projection mappers — each store keeps its own historical vocabulary; these
126
+ // translate the ONE canonical status into it so the decision stays centralized.
127
+ // WORK-bar registry: running | awaiting_permission | completed | failed.
128
+ function toRegistryStatus(status) {
129
+ if (status === STATUS.ERROR) return 'failed';
130
+ if (status === STATUS.PENDING) return 'running';
131
+ return status; // running | awaiting_permission | completed pass through
132
+ }
133
+ // Per-message transcript toolCalls: working | awaiting_permission | done | error.
134
+ function toLegacyToolStatus(status) {
135
+ if (status === STATUS.COMPLETED) return 'done';
136
+ if (status === STATUS.ERROR) return 'error';
137
+ if (status === STATUS.AWAITING_PERMISSION) return 'awaiting_permission';
138
+ return 'working'; // pending | running
139
+ }
140
+
141
+ return {
142
+ STATUS: STATUS,
143
+ isLifecycleEvent: isLifecycleEvent,
144
+ toolEventId: toolEventId,
145
+ toolEventName: toolEventName,
146
+ isFailureResult: isFailureResult,
147
+ isAllowDecision: isAllowDecision,
148
+ nextStatus: nextStatus,
149
+ isActive: isActive,
150
+ isTerminal: isTerminal,
151
+ statusLabel: statusLabel,
152
+ toRegistryStatus: toRegistryStatus,
153
+ toLegacyToolStatus: toLegacyToolStatus,
154
+ };
155
+ });