@bolloon/bolloon-agent 0.2.9 → 0.2.10

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 (268) hide show
  1. package/README.md +467 -467
  2. package/bin/bolloon-cli.cjs +183 -183
  3. package/bin/bolloon.cjs +0 -0
  4. package/bin/bolloon.js +157 -0
  5. package/dist/agents/agent-manifest-protocol.js +0 -52
  6. package/dist/agents/constraint-layer.js +19 -19
  7. package/dist/agents/pi-sdk.js +287 -1213
  8. package/dist/agents/shell-guard.js +2 -2
  9. package/dist/agents/workflow-pivot-loop.js +2 -81
  10. package/dist/bollharness/src/scripts/deploy-guard.js +8 -8
  11. package/dist/bollharness-integration/context-router-judgment.js +4 -4
  12. package/dist/bollharness-integration/context-router.js +292 -292
  13. package/dist/bollharness-integration/gate-state-machine.js +13 -26
  14. package/dist/bollharness-integration/integration.js +0 -71
  15. package/dist/bollharness-integration/llm-judgment-engine.js +134 -134
  16. package/dist/bollharness-integration/skill-adapter.js +127 -52
  17. package/dist/bootstrap/context-collector.js +3 -6
  18. package/dist/bootstrap/lifecycle-hooks.js +1 -15
  19. package/dist/cli-entry.js +35 -39
  20. package/dist/constraint-runtime/src/_archive_helper.js +9 -0
  21. package/dist/constraint-runtime/src/agent/coordinator.js +48 -0
  22. package/dist/constraint-runtime/src/agent/index.js +1 -0
  23. package/dist/constraint-runtime/src/assistant/index.js +12 -0
  24. package/dist/constraint-runtime/src/bootstrap/index.js +12 -0
  25. package/dist/constraint-runtime/src/bootstrap_graph.js +13 -0
  26. package/dist/constraint-runtime/src/bridge/index.js +12 -0
  27. package/dist/constraint-runtime/src/buddy/index.js +12 -0
  28. package/dist/constraint-runtime/src/cli/index.js +12 -0
  29. package/dist/constraint-runtime/src/command_graph.js +10 -0
  30. package/dist/constraint-runtime/src/commands.js +60 -0
  31. package/dist/constraint-runtime/src/components/index.js +12 -0
  32. package/dist/constraint-runtime/src/constants/index.js +12 -0
  33. package/dist/constraint-runtime/src/constraint/budget.js +22 -0
  34. package/dist/constraint-runtime/src/constraint/index.js +2 -0
  35. package/dist/constraint-runtime/src/constraint/permission.js +20 -0
  36. package/dist/constraint-runtime/src/context.js +30 -0
  37. package/dist/constraint-runtime/src/coordinator/index.js +12 -0
  38. package/dist/constraint-runtime/src/cost_hook.js +4 -0
  39. package/dist/constraint-runtime/src/cost_tracker.js +8 -0
  40. package/dist/constraint-runtime/src/deferred_init.js +10 -0
  41. package/dist/constraint-runtime/src/direct_modes.js +6 -0
  42. package/dist/constraint-runtime/src/dynamic-tool-loader.js +85 -0
  43. package/dist/constraint-runtime/src/entrypoints/index.js +12 -0
  44. package/dist/constraint-runtime/src/execution_registry.js +44 -0
  45. package/dist/constraint-runtime/src/history.js +9 -0
  46. package/dist/constraint-runtime/src/hooks/index.js +12 -0
  47. package/dist/constraint-runtime/src/index.js +26 -0
  48. package/dist/constraint-runtime/src/ink.js +4 -0
  49. package/dist/constraint-runtime/src/keybindings/index.js +12 -0
  50. package/dist/constraint-runtime/src/memdir/index.js +12 -0
  51. package/dist/constraint-runtime/src/migrations/index.js +12 -0
  52. package/dist/constraint-runtime/src/models.js +1 -0
  53. package/dist/constraint-runtime/src/moreright/index.js +12 -0
  54. package/dist/constraint-runtime/src/native_ts/index.js +12 -0
  55. package/dist/constraint-runtime/src/output_styles/index.js +12 -0
  56. package/dist/constraint-runtime/src/parity_audit.js +12 -0
  57. package/dist/constraint-runtime/src/plugins/index.js +12 -0
  58. package/dist/constraint-runtime/src/port_manifest.js +11 -0
  59. package/dist/constraint-runtime/src/prefetch.js +9 -0
  60. package/dist/constraint-runtime/src/query.js +1 -0
  61. package/dist/constraint-runtime/src/remote/index.js +12 -0
  62. package/dist/constraint-runtime/src/remote_runtime.js +9 -0
  63. package/dist/constraint-runtime/src/runtime/index.js +1 -0
  64. package/dist/constraint-runtime/src/runtime/session.js +35 -0
  65. package/dist/constraint-runtime/src/schemas/index.js +12 -0
  66. package/dist/constraint-runtime/src/screens/index.js +12 -0
  67. package/dist/constraint-runtime/src/server/index.js +12 -0
  68. package/dist/constraint-runtime/src/services/index.js +12 -0
  69. package/dist/constraint-runtime/src/session_store.js +22 -0
  70. package/dist/constraint-runtime/src/setup.js +30 -0
  71. package/dist/constraint-runtime/src/skills/index.js +1 -0
  72. package/dist/constraint-runtime/src/skills/skill-registry.js +28 -0
  73. package/dist/constraint-runtime/src/state/index.js +12 -0
  74. package/dist/constraint-runtime/src/system_init.js +20 -0
  75. package/dist/constraint-runtime/src/thinking/engine.js +42 -0
  76. package/dist/constraint-runtime/src/thinking/index.js +1 -0
  77. package/dist/constraint-runtime/src/tool_pool.js +8 -0
  78. package/dist/constraint-runtime/src/tools/OpenCLI/execAdapter.js +7 -0
  79. package/dist/constraint-runtime/src/tools/OpenCLI/listAdapters.js +7 -0
  80. package/dist/constraint-runtime/src/tools/OpenCLI/runCommand.js +7 -0
  81. package/dist/constraint-runtime/src/tools/SafeSDK/confirmTransaction.js +6 -0
  82. package/dist/constraint-runtime/src/tools/SafeSDK/createTransaction.js +8 -0
  83. package/dist/constraint-runtime/src/tools/SafeSDK/executeTransaction.js +6 -0
  84. package/dist/constraint-runtime/src/tools/SafeSDK/getBalance.js +6 -0
  85. package/dist/constraint-runtime/src/tools/SafeSDK/getPendingTransactions.js +6 -0
  86. package/dist/constraint-runtime/src/tools/SafeSDK/proposeTransaction.js +6 -0
  87. package/dist/constraint-runtime/src/tools.js +80 -0
  88. package/dist/constraint-runtime/src/transcript.js +19 -0
  89. package/dist/constraint-runtime/src/types/index.js +12 -0
  90. package/dist/constraint-runtime/src/upstream_proxy/index.js +12 -0
  91. package/dist/constraint-runtime/src/utils/index.js +12 -0
  92. package/dist/constraint-runtime/src/vim/index.js +12 -0
  93. package/dist/constraint-runtime/src/voice/index.js +12 -0
  94. package/dist/constraint-runtime/tests/agent.test.js +16 -0
  95. package/dist/constraint-runtime/tests/constraint.test.js +41 -0
  96. package/dist/constraint-runtime/tests/skill.test.js +19 -0
  97. package/dist/constraint-runtime/tests/thinking.test.js +22 -0
  98. package/dist/context-compaction/auto-compact.js +7 -7
  99. package/dist/electron-preload.js +1 -18
  100. package/dist/electron-preload.js.map +1 -1
  101. package/dist/electron.js +168 -3
  102. package/dist/electron.js.map +1 -1
  103. package/dist/index.js +116 -136
  104. package/dist/llm/config-store.js +8 -24
  105. package/dist/llm/llm-judgment-client.js +102 -102
  106. package/dist/llm/pi-ai.js +85 -126
  107. package/dist/llm/system-prompt/layers/channel/local.md +14 -14
  108. package/dist/llm/system-prompt/layers/channel/p2p-agent.md +18 -18
  109. package/dist/llm/system-prompt/layers/channel/p2p-visitor.md +19 -19
  110. package/dist/llm/system-prompt/layers/core/artifacts_storage.md +89 -89
  111. package/dist/llm/system-prompt/layers/core/evenhandedness.md +21 -21
  112. package/dist/llm/system-prompt/layers/core/hibs_reminders.md +15 -15
  113. package/dist/llm/system-prompt/layers/core/identity.md +37 -37
  114. package/dist/llm/system-prompt/layers/core/knowledge.md +17 -17
  115. package/dist/llm/system-prompt/layers/core/memory_system.md +12 -12
  116. package/dist/llm/system-prompt/layers/core/network_filesystem.md +28 -28
  117. package/dist/llm/system-prompt/layers/core/refusal.md +37 -37
  118. package/dist/llm/system-prompt/layers/core/tone.md +31 -31
  119. package/dist/llm/system-prompt/layers/core/tools.thin.md +13 -13
  120. package/dist/llm/system-prompt/layers/core/wellbeing.md +41 -41
  121. package/dist/llm/system-prompt/layers/role/architect.md +20 -20
  122. package/dist/llm/system-prompt/layers/role/expert.md +19 -19
  123. package/dist/llm/system-prompt/layers/role/implementer.md +15 -15
  124. package/dist/llm/system-prompt/layers/role/security.md +15 -15
  125. package/dist/llm/system-prompt/layers/tool/artifacts.md +72 -72
  126. package/dist/llm/system-prompt/layers/tool/bash.md +25 -25
  127. package/dist/llm/system-prompt/layers/tool/hibs_api.md +171 -171
  128. package/dist/llm/system-prompt/layers/tool/image_search.md +70 -70
  129. package/dist/llm/system-prompt/layers/tool/manifest.md +89 -89
  130. package/dist/llm/system-prompt/layers/tool/mcp_apps.md +53 -53
  131. package/dist/llm/system-prompt/layers/tool/web_search.md +83 -83
  132. package/dist/llm/tool-manifest/ask_user_input.js +1 -1
  133. package/dist/llm/tool-manifest/bash.js +3 -3
  134. package/dist/llm/tool-manifest/create_file.js +4 -4
  135. package/dist/llm/tool-manifest/fetch_sports_data.js +3 -3
  136. package/dist/llm/tool-manifest/image_search.js +2 -2
  137. package/dist/llm/tool-manifest/mcp.js +2 -2
  138. package/dist/llm/tool-manifest/message_compose.js +3 -3
  139. package/dist/llm/tool-manifest/places.js +2 -2
  140. package/dist/llm/tool-manifest/present_files.js +1 -1
  141. package/dist/llm/tool-manifest/recipe.js +2 -2
  142. package/dist/llm/tool-manifest/str_replace.js +5 -5
  143. package/dist/llm/tool-manifest/view.js +3 -3
  144. package/dist/llm/tool-manifest/weather.js +4 -4
  145. package/dist/llm/tool-manifest/web.js +4 -4
  146. package/dist/pi-ecosystem-colony/index.js +365 -0
  147. package/dist/pi-ecosystem-judgment/causal-judge.js +51 -51
  148. package/dist/pi-ecosystem-judgment/distill-prompt.js +42 -42
  149. package/dist/pi-ecosystem-judgment/distillation.js +14 -14
  150. package/dist/pi-ecosystem-judgment/monitor-gate.js +28 -28
  151. package/dist/pi-ecosystem-judgment/value-injection.js +102 -102
  152. package/dist/security/context-router-tool.js +15 -15
  153. package/dist/security/tool-gate.js +0 -11
  154. package/dist/social/ant-colony/AdaptiveHeartbeat.js +101 -0
  155. package/dist/social/ant-colony/PheromoneEngine.js +227 -0
  156. package/dist/social/ant-colony/index.js +6 -0
  157. package/dist/social/ant-colony/types.js +24 -0
  158. package/dist/test/ai-judgment-test.js +80 -0
  159. package/dist/test/bollharness-integration.test.js +318 -0
  160. package/dist/test/channel-agent-multi-dialogue.js +205 -0
  161. package/dist/test/channel-heartbeat-agent-test.js +201 -0
  162. package/dist/test/constraint-layer.test.js +164 -0
  163. package/dist/test/diap-identity-test.js +172 -0
  164. package/dist/test/diap-quick-test.js +62 -0
  165. package/dist/test/global-shared-context.test.js +315 -0
  166. package/dist/test/harness-judgment-injection.test.js +246 -0
  167. package/dist/test/harness-workflow-integrator-test.js +228 -0
  168. package/dist/test/human-value-store.test.js +243 -0
  169. package/dist/test/hybrid-integration-test.js +118 -0
  170. package/dist/test/hybrid-messenger-verify.js +55 -0
  171. package/dist/test/iroh-bistream-debug.js +38 -0
  172. package/dist/test/iroh-communication.test.js +66 -0
  173. package/dist/test/iroh-debug-test.js +57 -0
  174. package/dist/test/iroh-diap-test.js +71 -0
  175. package/dist/test/iroh-direct-connect.js +55 -0
  176. package/dist/test/iroh-e2e-fixed.js +89 -0
  177. package/dist/test/iroh-e2e-same-process.js +63 -0
  178. package/dist/test/iroh-e2e.js +66 -0
  179. package/dist/test/iroh-final-e2e.js +72 -0
  180. package/dist/test/iroh-relay-test.js +37 -0
  181. package/dist/test/iroh-simple-test.js +41 -0
  182. package/dist/test/iroh-transport-verify.js +54 -0
  183. package/dist/test/iroh-transport.test.js +37 -0
  184. package/dist/test/iroh-two-nodes.js +70 -0
  185. package/dist/test/iroh-verify.js +44 -0
  186. package/dist/test/judgment-decision.test.js +219 -0
  187. package/dist/test/llm-judgment-integration.test.js +220 -0
  188. package/dist/test/p2p-agent-complex-dialogue.js +385 -0
  189. package/dist/test/p2p-agent-dialogue.js +341 -0
  190. package/dist/test/p2p-agent-full-bidirectional.js +510 -0
  191. package/dist/test/p2p-agent-harness-flow.js +437 -0
  192. package/dist/test/p2p-agent-harness-single.js +143 -0
  193. package/dist/test/p2p-ai-dialogue-test.js +318 -0
  194. package/dist/test/p2p-cid-connect-test.js +195 -0
  195. package/dist/test/p2p-connect-receiver.js +69 -0
  196. package/dist/test/p2p-doc-transfer.js +110 -0
  197. package/dist/test/p2p-identity-page-test.js +77 -0
  198. package/dist/test/p2p-iroh-test.js +171 -0
  199. package/dist/test/p2p-minimal-test.js +241 -0
  200. package/dist/test/p2p-node-1.js +148 -0
  201. package/dist/test/p2p-node-2.js +148 -0
  202. package/dist/test/p2p-server.js +281 -0
  203. package/dist/test/p2p-two-nodes-test.js +438 -0
  204. package/dist/test/pi-sdk.test.js +44 -0
  205. package/dist/test/set-persona.js +40 -0
  206. package/dist/test/simple.test.js +9 -0
  207. package/dist/test/storage-integration.test.js +150 -0
  208. package/dist/test/subagent-manager.test.js +276 -0
  209. package/dist/test/test-gate-flow.test.js +81 -0
  210. package/dist/test/workflow-engine.test.js +87 -0
  211. package/dist/test/workflow-pivot-loop.test.js +246 -0
  212. package/dist/web/api-config.html +520 -520
  213. package/dist/web/client.js +2917 -3791
  214. package/dist/web/components/p2p/index.js +234 -276
  215. package/dist/web/components/wallet-viem.mjs +118 -118
  216. package/dist/web/index.html +374 -373
  217. package/dist/web/manifest.json +20 -20
  218. package/dist/web/server.js +23 -775
  219. package/dist/web/style.css +4737 -4737
  220. package/dist/web/ui/message-renderer.js +373 -451
  221. package/dist/web/ui/step-timeline.js +255 -351
  222. package/package.json +160 -160
  223. package/scripts/build-cli.js +215 -215
  224. package/scripts/build-web.ts +125 -125
  225. package/scripts/postinstall.js +152 -152
  226. package/bin/bolloon-daemon.sh +0 -207
  227. package/bin/ipfs +0 -0
  228. package/dist/agents/chat-segmenter.js +0 -298
  229. package/dist/agents/judgment-protocol.js +0 -479
  230. package/dist/agents/parse-tool-call.js +0 -304
  231. package/dist/agents/peer-manifest-loader.js +0 -210
  232. package/dist/agents/react-loop.js +0 -120
  233. package/dist/agents/session-store.js +0 -171
  234. package/dist/agents/tool-registry.js +0 -136
  235. package/dist/bootstrap/chat-archiver.js +0 -276
  236. package/dist/bootstrap/memory-compressor.js +0 -170
  237. package/dist/bootstrap/persona-loader.js +0 -94
  238. package/dist/electron/config.js +0 -16
  239. package/dist/electron/config.js.map +0 -1
  240. package/dist/electron/dialogs.js +0 -71
  241. package/dist/electron/dialogs.js.map +0 -1
  242. package/dist/electron/first-run.js +0 -129
  243. package/dist/electron/first-run.js.map +0 -1
  244. package/dist/electron/ipc.js +0 -16
  245. package/dist/electron/ipc.js.map +0 -1
  246. package/dist/electron/logger.js +0 -77
  247. package/dist/electron/logger.js.map +0 -1
  248. package/dist/electron/main.js +0 -60
  249. package/dist/electron/main.js.map +0 -1
  250. package/dist/electron/menu.js +0 -140
  251. package/dist/electron/menu.js.map +0 -1
  252. package/dist/electron/paths.js +0 -33
  253. package/dist/electron/paths.js.map +0 -1
  254. package/dist/electron/server.js +0 -74
  255. package/dist/electron/server.js.map +0 -1
  256. package/dist/electron/tray.js +0 -73
  257. package/dist/electron/tray.js.map +0 -1
  258. package/dist/electron/window.js +0 -69
  259. package/dist/electron/window.js.map +0 -1
  260. package/dist/network/local-inbox-bus.js +0 -73
  261. package/dist/network/p2p-outbox.js +0 -161
  262. package/dist/network/peer-fs.js +0 -420
  263. package/dist/network/peer-resource-bridge.js +0 -216
  264. package/dist/web/components/p2p/P2PModal.js +0 -188
  265. package/dist/web/components/p2p/p2p-modal.js +0 -664
  266. package/dist/web/components/p2p/p2p-tools.js +0 -248
  267. package/dist/web/input-validator.js +0 -103
  268. package/dist/web/util/safe-name.js +0 -32
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('hooks');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,26 @@
1
+ export * from './constraint/index.js';
2
+ export * from './thinking/index.js';
3
+ export * from './agent/index.js';
4
+ export * from './skills/index.js';
5
+ export * from './runtime/index.js';
6
+ export { ToolPermissionContext } from './constraint/permission.js';
7
+ export { BudgetTracker } from './constraint/budget.js';
8
+ export { DeepThinkingEngine } from './thinking/engine.js';
9
+ export { AgentCoordinator } from './agent/coordinator.js';
10
+ export { SkillRegistry } from './skills/skill-registry.js';
11
+ export { Session } from './runtime/session.js';
12
+ export * from './models.js';
13
+ export { HistoryLog } from './history.js';
14
+ export { TranscriptStore } from './transcript.js';
15
+ export { CostTracker } from './cost_tracker.js';
16
+ export { buildSetup, runSetup } from './setup.js';
17
+ export { buildPortContext } from './context.js';
18
+ export { buildCommandGraph } from './command_graph.js';
19
+ export { buildBootstrapGraph } from './bootstrap_graph.js';
20
+ export { runParityAudit } from './parity_audit.js';
21
+ export { runRemoteMode, runSshMode, runTeleportMode } from './remote_runtime.js';
22
+ export { runDirectConnect, runDeepLink } from './direct_modes.js';
23
+ export { assembleToolPool } from './tool_pool.js';
24
+ export { saveSession, loadSession } from './session_store.js';
25
+ export const VERSION = '0.1.0';
26
+ export const NAME = '@bolloon/constraint-runtime';
@@ -0,0 +1,4 @@
1
+ export function renderMarkdownPanel(text) {
2
+ const border = '='.repeat(40);
3
+ return `${border}\n${text}\n${border}`;
4
+ }
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('keybindings');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('memdir');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('migrations');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('moreright');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('native_ts');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('outputstyles');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,12 @@
1
+ export function runParityAudit() {
2
+ return {
3
+ archivePresent: false,
4
+ rootFileCoverage: [0, 0],
5
+ directoryCoverage: [0, 0],
6
+ totalFileRatio: [0, 0],
7
+ commandEntryRatio: [0, 0],
8
+ toolEntryRatio: [0, 0],
9
+ missingRootTargets: [],
10
+ missingDirectoryTargets: [],
11
+ };
12
+ }
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('plugins');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,11 @@
1
+ import * as path from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ const __filename = fileURLToPath(import.meta.url);
4
+ const __dirname = path.dirname(__filename);
5
+ export function buildPortManifest(srcRoot) {
6
+ return {
7
+ srcRoot: srcRoot || __dirname,
8
+ totalPythonFiles: 0,
9
+ topLevelModules: [],
10
+ };
11
+ }
@@ -0,0 +1,9 @@
1
+ export function startMdmRawRead() {
2
+ return { name: 'mdm_raw_read', started: true, detail: 'Simulated MDM raw-read prefetch for workspace bootstrap' };
3
+ }
4
+ export function startKeychainPrefetch() {
5
+ return { name: 'keychain_prefetch', started: true, detail: 'Simulated keychain prefetch for trusted startup path' };
6
+ }
7
+ export function startProjectScan(root) {
8
+ return { name: 'project_scan', started: true, detail: `Scanned project root ${root}` };
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('remote');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,9 @@
1
+ export function runRemoteMode(target) {
2
+ return { mode: 'remote', connected: true, detail: `Remote control placeholder prepared for ${target}` };
3
+ }
4
+ export function runSshMode(target) {
5
+ return { mode: 'ssh', connected: true, detail: `SSH proxy placeholder prepared for ${target}` };
6
+ }
7
+ export function runTeleportMode(target) {
8
+ return { mode: 'teleport', connected: true, detail: `Teleport resume/create placeholder prepared for ${target}` };
9
+ }
@@ -0,0 +1 @@
1
+ export { Session } from './session.js';
@@ -0,0 +1,35 @@
1
+ import { ToolPermissionContext } from '../constraint/permission.js';
2
+ import { BudgetTracker } from '../constraint/budget.js';
3
+ export class Session {
4
+ sessionId;
5
+ messages;
6
+ context;
7
+ turnCount;
8
+ permissionContext;
9
+ budget;
10
+ constructor(sessionId, messages = [], context = {}, turnCount = 0, permissionContext = ToolPermissionContext.fromIterables(), budget = new BudgetTracker()) {
11
+ this.sessionId = sessionId;
12
+ this.messages = messages;
13
+ this.context = context;
14
+ this.turnCount = turnCount;
15
+ this.permissionContext = permissionContext;
16
+ this.budget = budget;
17
+ }
18
+ addMessage(msg) {
19
+ this.messages.push(msg);
20
+ this.turnCount++;
21
+ }
22
+ get history() {
23
+ return [...this.messages];
24
+ }
25
+ clear() {
26
+ this.messages = [];
27
+ this.turnCount = 0;
28
+ }
29
+ setContext(key, value) {
30
+ this.context[key] = value;
31
+ }
32
+ getContext(key) {
33
+ return this.context[key];
34
+ }
35
+ }
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('schemas');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('screens');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('server');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('services');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,22 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ const SESSION_DIR = '.port_sessions';
4
+ export function saveSession(session) {
5
+ const targetDir = path.join(process.cwd(), SESSION_DIR);
6
+ if (!fs.existsSync(targetDir)) {
7
+ fs.mkdirSync(targetDir, { recursive: true });
8
+ }
9
+ const filePath = path.join(targetDir, `${session.sessionId}.json`);
10
+ fs.writeFileSync(filePath, JSON.stringify(session, null, 2));
11
+ return filePath;
12
+ }
13
+ export function loadSession(sessionId) {
14
+ const filePath = path.join(process.cwd(), SESSION_DIR, `${sessionId}.json`);
15
+ const data = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
16
+ return {
17
+ sessionId: data.sessionId,
18
+ messages: data.messages,
19
+ inputTokens: data.inputTokens,
20
+ outputTokens: data.outputTokens,
21
+ };
22
+ }
@@ -0,0 +1,30 @@
1
+ import * as platform from 'platform';
2
+ import { runDeferredInit } from './deferred_init.js';
3
+ import { startMdmRawRead, startKeychainPrefetch, startProjectScan } from './prefetch.js';
4
+ export function buildWorkspaceSetup() {
5
+ return {
6
+ pythonVersion: `${platform.version}`,
7
+ implementation: platform.name || 'unknown',
8
+ platformName: platform.os?.toString() || 'unknown',
9
+ testCommand: 'npm test',
10
+ startupSteps: [
11
+ 'start top-level prefetch side effects',
12
+ 'build workspace context',
13
+ 'load mirrored command snapshot',
14
+ 'load mirrored tool snapshot',
15
+ 'prepare parity audit hooks',
16
+ 'apply trust-gated deferred init',
17
+ ],
18
+ };
19
+ }
20
+ export function runSetup(cwd, trusted = true) {
21
+ const root = cwd || process.cwd();
22
+ return {
23
+ setup: buildWorkspaceSetup(),
24
+ prefetches: [startMdmRawRead(), startKeychainPrefetch(), startProjectScan(root)],
25
+ deferredInit: runDeferredInit(trusted),
26
+ trusted,
27
+ cwd: root,
28
+ };
29
+ }
30
+ export { buildWorkspaceSetup as buildSetup };
@@ -0,0 +1 @@
1
+ export { SkillRegistry } from './skill-registry.js';
@@ -0,0 +1,28 @@
1
+ export class SkillRegistry {
2
+ skills = new Map();
3
+ register(skill) {
4
+ if (this.skills.has(skill.name)) {
5
+ throw new Error(`Skill already registered: ${skill.name}`);
6
+ }
7
+ this.skills.set(skill.name, skill);
8
+ }
9
+ unregister(name) {
10
+ return this.skills.delete(name);
11
+ }
12
+ get(name) {
13
+ return this.skills.get(name);
14
+ }
15
+ list() {
16
+ return Array.from(this.skills.values());
17
+ }
18
+ has(name) {
19
+ return this.skills.has(name);
20
+ }
21
+ async execute(name, params) {
22
+ const skill = this.skills.get(name);
23
+ if (!skill) {
24
+ throw new Error(`Skill not found: ${name}`);
25
+ }
26
+ return skill.execute(params);
27
+ }
28
+ }
@@ -0,0 +1,12 @@
1
+ import { loadArchiveMetadata } from '../_archive_helper.js';
2
+ const SNAPSHOT = loadArchiveMetadata('state');
3
+ export const ARCHIVE_NAME = SNAPSHOT['archive_name'];
4
+ export const MODULE_COUNT = SNAPSHOT['module_count'];
5
+ export const SAMPLE_FILES = SNAPSHOT['sample_files'];
6
+ export const PORTING_NOTE = `Python placeholder package for '${ARCHIVE_NAME}' with ${MODULE_COUNT} archived module references.`;
7
+ export default {
8
+ ARCHIVE_NAME,
9
+ MODULE_COUNT,
10
+ PORTING_NOTE,
11
+ SAMPLE_FILES,
12
+ };
@@ -0,0 +1,20 @@
1
+ import { getCommands, builtInCommandNames } from './commands.js';
2
+ import { getTools } from './tools.js';
3
+ import { runSetup } from './setup.js';
4
+ export function buildSystemInitMessage(trusted = true) {
5
+ const setup = runSetup(undefined, trusted);
6
+ const commands = getCommands();
7
+ const tools = getTools();
8
+ const lines = [
9
+ '# System Init',
10
+ '',
11
+ `Trusted: ${setup.trusted}`,
12
+ `Built-in command names: ${builtInCommandNames().size}`,
13
+ `Loaded command entries: ${commands.length}`,
14
+ `Loaded tool entries: ${tools.length}`,
15
+ '',
16
+ 'Startup steps:',
17
+ ...setup.setup.startupSteps.map(step => `- ${step}`),
18
+ ];
19
+ return lines.join('\n');
20
+ }
@@ -0,0 +1,42 @@
1
+ export class DeepThinkingEngine {
2
+ maxDepth;
3
+ constructor(maxDepth = 3) {
4
+ this.maxDepth = maxDepth;
5
+ }
6
+ async think(prompt) {
7
+ const steps = [];
8
+ let current = prompt;
9
+ for (let i = 0; i < this.maxDepth; i++) {
10
+ const thought = await this.generateThought(current, i);
11
+ const reflection = await this.reflect(thought, current, i);
12
+ steps.push({
13
+ step: i + 1,
14
+ thought,
15
+ reflection: reflection.question,
16
+ improvement: reflection.improvement
17
+ });
18
+ if (reflection.improvement) {
19
+ current = reflection.improvement;
20
+ }
21
+ }
22
+ return {
23
+ originalPrompt: prompt,
24
+ steps,
25
+ finalOutput: steps[steps.length - 1]?.improvement ?? current,
26
+ depth: this.maxDepth
27
+ };
28
+ }
29
+ async generateThought(prompt, step) {
30
+ return `[Step ${step + 1}] Analysis of: ${prompt}`;
31
+ }
32
+ async reflect(thought, original, step) {
33
+ const isLastStep = step === this.maxDepth - 1;
34
+ return {
35
+ question: `Review: Is "${thought}" comprehensive and accurate?`,
36
+ improvement: isLastStep ? undefined : `${thought} (refined)`
37
+ };
38
+ }
39
+ setDepth(depth) {
40
+ this.maxDepth = Math.max(1, Math.min(depth, 10));
41
+ }
42
+ }
@@ -0,0 +1 @@
1
+ export { DeepThinkingEngine } from './engine.js';
@@ -0,0 +1,8 @@
1
+ import { getTools } from './tools.js';
2
+ export function assembleToolPool(simpleMode = false, includeMcp = true, permissionContext) {
3
+ return {
4
+ tools: getTools(simpleMode),
5
+ simpleMode,
6
+ includeMcp,
7
+ };
8
+ }
@@ -0,0 +1,7 @@
1
+ export async function execAdapter(params) {
2
+ return {
3
+ success: false,
4
+ result: null,
5
+ error: `OpenCLI adapter '${params.adapter}' requires OpenCLI CLI to be installed and configured.`,
6
+ };
7
+ }
@@ -0,0 +1,7 @@
1
+ export async function listAdapters() {
2
+ return [
3
+ { name: 'twitter', description: 'Twitter/X adapter' },
4
+ { name: 'reddit', description: 'Reddit adapter' },
5
+ { name: 'bilibili', description: 'Bilibili adapter' },
6
+ ];
7
+ }
@@ -0,0 +1,7 @@
1
+ export async function runCommand(params) {
2
+ return {
3
+ success: false,
4
+ output: '',
5
+ error: 'OpenCLI is a command-line tool and should be invoked via shell command: opencli <command>',
6
+ };
7
+ }
@@ -0,0 +1,6 @@
1
+ export async function confirmTransaction(params) {
2
+ return {
3
+ success: false,
4
+ message: 'Safe transaction confirmation requires protocol kit with signer configured.',
5
+ };
6
+ }
@@ -0,0 +1,8 @@
1
+ export async function createTransaction(params) {
2
+ return {
3
+ to: params.to,
4
+ value: params.value,
5
+ data: params.data,
6
+ operation: params.operation ?? 0,
7
+ };
8
+ }
@@ -0,0 +1,6 @@
1
+ export async function executeTransaction(params) {
2
+ return {
3
+ success: false,
4
+ message: 'Safe transaction execution requires protocol kit with executor and signer configured.',
5
+ };
6
+ }
@@ -0,0 +1,6 @@
1
+ export async function getBalance(params) {
2
+ return {
3
+ balance: '0',
4
+ message: 'Balance retrieval requires protocol kit with RPC provider configured.',
5
+ };
6
+ }
@@ -0,0 +1,6 @@
1
+ export async function getPendingTransactions(params) {
2
+ return {
3
+ transactions: [],
4
+ message: 'Pending transaction retrieval requires Safe API Kit with transaction service URL configured.',
5
+ };
6
+ }
@@ -0,0 +1,6 @@
1
+ export async function proposeSafeTransaction(params) {
2
+ return {
3
+ success: false,
4
+ message: 'Safe transaction proposal requires Safe API Kit with transaction service URL configured.',
5
+ };
6
+ }
@@ -0,0 +1,80 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { executeToolFromSnapshot } from './dynamic-tool-loader.js';
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+ const SNAPSHOT_PATH = path.join(__dirname, 'reference_data', 'tools_snapshot.json');
8
+ function loadToolSnapshot() {
9
+ try {
10
+ if (!fs.existsSync(SNAPSHOT_PATH)) {
11
+ console.warn(`[tools] Snapshot not found: ${SNAPSHOT_PATH}, using empty list`);
12
+ return [];
13
+ }
14
+ const raw = JSON.parse(fs.readFileSync(SNAPSHOT_PATH, 'utf-8'));
15
+ return raw.map((e) => ({
16
+ name: e.name,
17
+ responsibility: e.responsibility,
18
+ sourceHint: e.source_hint,
19
+ status: 'mirrored',
20
+ }));
21
+ }
22
+ catch (error) {
23
+ console.warn(`[tools] Failed to load snapshot: ${error}, using empty list`);
24
+ return [];
25
+ }
26
+ }
27
+ export const PORTED_TOOLS = loadToolSnapshot();
28
+ export function getTool(name) {
29
+ const needle = name.toLowerCase();
30
+ return PORTED_TOOLS.find(m => m.name.toLowerCase() === needle);
31
+ }
32
+ export function getTools(simpleMode = false) {
33
+ let tools = [...PORTED_TOOLS];
34
+ if (simpleMode) {
35
+ tools = tools.filter(m => ['BashTool', 'FileReadTool', 'FileEditTool'].includes(m.name));
36
+ }
37
+ return tools;
38
+ }
39
+ export function findTools(query, limit = 20) {
40
+ const needle = query.toLowerCase();
41
+ return PORTED_TOOLS.filter(m => m.name.toLowerCase().includes(needle) || m.sourceHint.toLowerCase().includes(needle)).slice(0, limit);
42
+ }
43
+ export async function executeTool(name, payload = '') {
44
+ const module = getTool(name);
45
+ if (!module) {
46
+ return { name, sourceHint: '', payload, handled: false, message: `Unknown mirrored tool: ${name}` };
47
+ }
48
+ let params = {};
49
+ try {
50
+ params = payload ? JSON.parse(payload) : {};
51
+ }
52
+ catch {
53
+ return {
54
+ name: module.name,
55
+ sourceHint: module.sourceHint,
56
+ payload,
57
+ handled: false,
58
+ message: `Invalid JSON payload for tool '${module.name}'`,
59
+ };
60
+ }
61
+ const result = await executeToolFromSnapshot(module.sourceHint, params);
62
+ if (result.success) {
63
+ return {
64
+ name: module.name,
65
+ sourceHint: module.sourceHint,
66
+ payload: JSON.stringify(result.data),
67
+ handled: true,
68
+ message: `Tool '${module.name}' executed successfully`,
69
+ };
70
+ }
71
+ else {
72
+ return {
73
+ name: module.name,
74
+ sourceHint: module.sourceHint,
75
+ payload,
76
+ handled: false,
77
+ message: `Tool '${module.name}' failed: ${result.error}`,
78
+ };
79
+ }
80
+ }