@bolloon/bolloon-agent 0.3.29 → 0.3.31

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 (217) hide show
  1. package/dist/agents/pi-sdk-tools.js +128 -0
  2. package/dist/constraint-runtime/_archive_helper.d.ts +1 -0
  3. package/dist/constraint-runtime/_archive_helper.js +9 -0
  4. package/dist/constraint-runtime/agent/coordinator.d.ts +19 -0
  5. package/dist/constraint-runtime/agent/coordinator.js +48 -0
  6. package/dist/constraint-runtime/agent/index.d.ts +1 -0
  7. package/dist/constraint-runtime/agent/index.js +1 -0
  8. package/dist/constraint-runtime/assistant/index.d.ts +11 -0
  9. package/dist/constraint-runtime/assistant/index.js +12 -0
  10. package/dist/constraint-runtime/bootstrap/index.d.ts +11 -0
  11. package/dist/constraint-runtime/bootstrap/index.js +12 -0
  12. package/dist/constraint-runtime/bootstrap_graph.d.ts +4 -0
  13. package/dist/constraint-runtime/bootstrap_graph.js +13 -0
  14. package/dist/constraint-runtime/bridge/index.d.ts +11 -0
  15. package/dist/constraint-runtime/bridge/index.js +12 -0
  16. package/dist/constraint-runtime/buddy/index.d.ts +11 -0
  17. package/dist/constraint-runtime/buddy/index.js +12 -0
  18. package/dist/constraint-runtime/cli/index.d.ts +11 -0
  19. package/dist/constraint-runtime/cli/index.js +12 -0
  20. package/dist/constraint-runtime/command_graph.d.ts +7 -0
  21. package/dist/constraint-runtime/command_graph.js +10 -0
  22. package/dist/constraint-runtime/commands.d.ts +15 -0
  23. package/dist/constraint-runtime/commands.js +60 -0
  24. package/dist/constraint-runtime/components/index.d.ts +11 -0
  25. package/dist/constraint-runtime/components/index.js +12 -0
  26. package/dist/constraint-runtime/constants/index.d.ts +11 -0
  27. package/dist/constraint-runtime/constants/index.js +12 -0
  28. package/dist/constraint-runtime/constraint/budget.d.ts +11 -0
  29. package/dist/constraint-runtime/constraint/budget.js +22 -0
  30. package/dist/constraint-runtime/constraint/index.d.ts +3 -0
  31. package/dist/constraint-runtime/constraint/index.js +2 -0
  32. package/dist/constraint-runtime/constraint/permission.d.ts +9 -0
  33. package/dist/constraint-runtime/constraint/permission.js +20 -0
  34. package/dist/constraint-runtime/context.d.ts +12 -0
  35. package/dist/constraint-runtime/context.js +30 -0
  36. package/dist/constraint-runtime/coordinator/index.d.ts +11 -0
  37. package/dist/constraint-runtime/coordinator/index.js +12 -0
  38. package/dist/constraint-runtime/cost_hook.d.ts +2 -0
  39. package/dist/constraint-runtime/cost_hook.js +4 -0
  40. package/dist/constraint-runtime/cost_tracker.d.ts +5 -0
  41. package/dist/constraint-runtime/cost_tracker.js +8 -0
  42. package/dist/constraint-runtime/deferred_init.d.ts +8 -0
  43. package/dist/constraint-runtime/deferred_init.js +10 -0
  44. package/dist/constraint-runtime/direct_modes.d.ts +7 -0
  45. package/dist/constraint-runtime/direct_modes.js +6 -0
  46. package/dist/constraint-runtime/dynamic-tool-loader.d.ts +13 -0
  47. package/dist/constraint-runtime/dynamic-tool-loader.js +85 -0
  48. package/dist/constraint-runtime/entrypoints/index.d.ts +11 -0
  49. package/dist/constraint-runtime/entrypoints/index.js +12 -0
  50. package/dist/constraint-runtime/execution_registry.d.ts +20 -0
  51. package/dist/constraint-runtime/execution_registry.js +44 -0
  52. package/dist/constraint-runtime/history.d.ts +9 -0
  53. package/dist/constraint-runtime/history.js +9 -0
  54. package/dist/constraint-runtime/hooks/index.d.ts +11 -0
  55. package/dist/constraint-runtime/hooks/index.js +12 -0
  56. package/dist/constraint-runtime/index.d.ts +26 -0
  57. package/dist/constraint-runtime/index.js +26 -0
  58. package/dist/constraint-runtime/ink.d.ts +1 -0
  59. package/dist/constraint-runtime/ink.js +4 -0
  60. package/dist/constraint-runtime/keybindings/index.d.ts +11 -0
  61. package/dist/constraint-runtime/keybindings/index.js +12 -0
  62. package/dist/constraint-runtime/memdir/index.d.ts +11 -0
  63. package/dist/constraint-runtime/memdir/index.js +12 -0
  64. package/dist/constraint-runtime/migrations/index.d.ts +11 -0
  65. package/dist/constraint-runtime/migrations/index.js +12 -0
  66. package/dist/constraint-runtime/models.d.ts +42 -0
  67. package/dist/constraint-runtime/models.js +1 -0
  68. package/dist/constraint-runtime/moreright/index.d.ts +11 -0
  69. package/dist/constraint-runtime/moreright/index.js +12 -0
  70. package/dist/constraint-runtime/native_ts/index.d.ts +11 -0
  71. package/dist/constraint-runtime/native_ts/index.js +12 -0
  72. package/dist/constraint-runtime/output_styles/index.d.ts +11 -0
  73. package/dist/constraint-runtime/output_styles/index.js +12 -0
  74. package/dist/constraint-runtime/parity_audit.d.ts +11 -0
  75. package/dist/constraint-runtime/parity_audit.js +12 -0
  76. package/dist/constraint-runtime/plugins/index.d.ts +11 -0
  77. package/dist/constraint-runtime/plugins/index.js +12 -0
  78. package/dist/constraint-runtime/port_manifest.d.ts +7 -0
  79. package/dist/constraint-runtime/port_manifest.js +11 -0
  80. package/dist/constraint-runtime/prefetch.d.ts +8 -0
  81. package/dist/constraint-runtime/prefetch.js +9 -0
  82. package/dist/constraint-runtime/query.d.ts +6 -0
  83. package/dist/constraint-runtime/query.js +1 -0
  84. package/dist/constraint-runtime/reference_data/archive_surface_snapshot.json +63 -0
  85. package/dist/constraint-runtime/reference_data/commands_snapshot.json +1037 -0
  86. package/dist/constraint-runtime/reference_data/subsystems/assistant.json +8 -0
  87. package/dist/constraint-runtime/reference_data/subsystems/bootstrap.json +8 -0
  88. package/dist/constraint-runtime/reference_data/subsystems/bridge.json +32 -0
  89. package/dist/constraint-runtime/reference_data/subsystems/buddy.json +13 -0
  90. package/dist/constraint-runtime/reference_data/subsystems/cli.json +26 -0
  91. package/dist/constraint-runtime/reference_data/subsystems/components.json +32 -0
  92. package/dist/constraint-runtime/reference_data/subsystems/constants.json +28 -0
  93. package/dist/constraint-runtime/reference_data/subsystems/coordinator.json +8 -0
  94. package/dist/constraint-runtime/reference_data/subsystems/entrypoints.json +15 -0
  95. package/dist/constraint-runtime/reference_data/subsystems/hooks.json +32 -0
  96. package/dist/constraint-runtime/reference_data/subsystems/keybindings.json +21 -0
  97. package/dist/constraint-runtime/reference_data/subsystems/memdir.json +15 -0
  98. package/dist/constraint-runtime/reference_data/subsystems/migrations.json +18 -0
  99. package/dist/constraint-runtime/reference_data/subsystems/moreright.json +8 -0
  100. package/dist/constraint-runtime/reference_data/subsystems/native_ts.json +11 -0
  101. package/dist/constraint-runtime/reference_data/subsystems/outputStyles.json +8 -0
  102. package/dist/constraint-runtime/reference_data/subsystems/plugins.json +9 -0
  103. package/dist/constraint-runtime/reference_data/subsystems/remote.json +11 -0
  104. package/dist/constraint-runtime/reference_data/subsystems/schemas.json +8 -0
  105. package/dist/constraint-runtime/reference_data/subsystems/screens.json +10 -0
  106. package/dist/constraint-runtime/reference_data/subsystems/server.json +10 -0
  107. package/dist/constraint-runtime/reference_data/subsystems/services.json +32 -0
  108. package/dist/constraint-runtime/reference_data/subsystems/skills.json +27 -0
  109. package/dist/constraint-runtime/reference_data/subsystems/state.json +13 -0
  110. package/dist/constraint-runtime/reference_data/subsystems/types.json +18 -0
  111. package/dist/constraint-runtime/reference_data/subsystems/upstreamproxy.json +9 -0
  112. package/dist/constraint-runtime/reference_data/subsystems/utils.json +32 -0
  113. package/dist/constraint-runtime/reference_data/subsystems/vim.json +12 -0
  114. package/dist/constraint-runtime/reference_data/subsystems/voice.json +8 -0
  115. package/dist/constraint-runtime/reference_data/tools_snapshot.json +922 -0
  116. package/dist/constraint-runtime/remote/index.d.ts +11 -0
  117. package/dist/constraint-runtime/remote/index.js +12 -0
  118. package/dist/constraint-runtime/remote_runtime.d.ts +8 -0
  119. package/dist/constraint-runtime/remote_runtime.js +9 -0
  120. package/dist/constraint-runtime/runtime/index.d.ts +1 -0
  121. package/dist/constraint-runtime/runtime/index.js +1 -0
  122. package/dist/constraint-runtime/runtime/session.d.ts +22 -0
  123. package/dist/constraint-runtime/runtime/session.js +35 -0
  124. package/dist/constraint-runtime/schemas/index.d.ts +11 -0
  125. package/dist/constraint-runtime/schemas/index.js +12 -0
  126. package/dist/constraint-runtime/screens/index.d.ts +11 -0
  127. package/dist/constraint-runtime/screens/index.js +12 -0
  128. package/dist/constraint-runtime/server/index.d.ts +11 -0
  129. package/dist/constraint-runtime/server/index.js +12 -0
  130. package/dist/constraint-runtime/services/index.d.ts +11 -0
  131. package/dist/constraint-runtime/services/index.js +12 -0
  132. package/dist/constraint-runtime/session_store.d.ts +8 -0
  133. package/dist/constraint-runtime/session_store.js +22 -0
  134. package/dist/constraint-runtime/setup.d.ts +19 -0
  135. package/dist/constraint-runtime/setup.js +30 -0
  136. package/dist/constraint-runtime/skills/index.d.ts +1 -0
  137. package/dist/constraint-runtime/skills/index.js +1 -0
  138. package/dist/constraint-runtime/skills/skill-registry.d.ts +14 -0
  139. package/dist/constraint-runtime/skills/skill-registry.js +28 -0
  140. package/dist/constraint-runtime/state/index.d.ts +11 -0
  141. package/dist/constraint-runtime/state/index.js +12 -0
  142. package/dist/constraint-runtime/system_init.d.ts +1 -0
  143. package/dist/constraint-runtime/system_init.js +20 -0
  144. package/dist/constraint-runtime/thinking/engine.d.ts +20 -0
  145. package/dist/constraint-runtime/thinking/engine.js +42 -0
  146. package/dist/constraint-runtime/thinking/index.d.ts +1 -0
  147. package/dist/constraint-runtime/thinking/index.js +1 -0
  148. package/dist/constraint-runtime/tool_pool.d.ts +8 -0
  149. package/dist/constraint-runtime/tool_pool.js +8 -0
  150. package/dist/constraint-runtime/tools/OpenCLI/execAdapter.d.ts +9 -0
  151. package/dist/constraint-runtime/tools/OpenCLI/execAdapter.js +7 -0
  152. package/dist/constraint-runtime/tools/OpenCLI/listAdapters.d.ts +5 -0
  153. package/dist/constraint-runtime/tools/OpenCLI/listAdapters.js +7 -0
  154. package/dist/constraint-runtime/tools/OpenCLI/runCommand.d.ts +10 -0
  155. package/dist/constraint-runtime/tools/OpenCLI/runCommand.js +7 -0
  156. package/dist/constraint-runtime/tools/PolymarketSDK/cancelOrder.d.ts +17 -0
  157. package/dist/constraint-runtime/{src/tools → tools}/PolymarketSDK/cancelOrder.js +4 -7
  158. package/dist/constraint-runtime/tools/PolymarketSDK/clobShared.d.ts +50 -0
  159. package/dist/constraint-runtime/tools/PolymarketSDK/clobShared.js +78 -0
  160. package/dist/constraint-runtime/tools/PolymarketSDK/createOrder.d.ts +31 -0
  161. package/dist/constraint-runtime/{src/tools → tools}/PolymarketSDK/createOrder.js +9 -12
  162. package/dist/constraint-runtime/tools/PolymarketSDK/getMarket.d.ts +10 -0
  163. package/dist/constraint-runtime/tools/PolymarketSDK/getMarket.js +16 -0
  164. package/dist/constraint-runtime/tools/PolymarketSDK/getOrders.d.ts +16 -0
  165. package/dist/constraint-runtime/tools/PolymarketSDK/getOrders.js +25 -0
  166. package/dist/constraint-runtime/tools/PolymarketSDK/listMarkets.d.ts +23 -0
  167. package/dist/constraint-runtime/tools/PolymarketSDK/listMarkets.js +24 -0
  168. package/dist/constraint-runtime/tools/SafeSDK/confirmTransaction.d.ts +10 -0
  169. package/dist/constraint-runtime/tools/SafeSDK/confirmTransaction.js +6 -0
  170. package/dist/constraint-runtime/tools/SafeSDK/createTransaction.d.ts +14 -0
  171. package/dist/constraint-runtime/tools/SafeSDK/createTransaction.js +8 -0
  172. package/dist/constraint-runtime/tools/SafeSDK/deploySafe.d.ts +10 -0
  173. package/dist/constraint-runtime/tools/SafeSDK/executeTransaction.d.ts +9 -0
  174. package/dist/constraint-runtime/tools/SafeSDK/executeTransaction.js +6 -0
  175. package/dist/constraint-runtime/tools/SafeSDK/getBalance.d.ts +7 -0
  176. package/dist/constraint-runtime/tools/SafeSDK/getBalance.js +6 -0
  177. package/dist/constraint-runtime/tools/SafeSDK/getPendingTransactions.d.ts +7 -0
  178. package/dist/constraint-runtime/tools/SafeSDK/getPendingTransactions.js +6 -0
  179. package/dist/constraint-runtime/tools/SafeSDK/proposeTransaction.d.ts +11 -0
  180. package/dist/constraint-runtime/tools/SafeSDK/proposeTransaction.js +6 -0
  181. package/dist/constraint-runtime/tools/WalletTools/autoPay.d.ts +26 -0
  182. package/dist/constraint-runtime/tools/WalletTools/createWallet.d.ts +7 -0
  183. package/dist/constraint-runtime/tools/WalletTools/getBalance.d.ts +11 -0
  184. package/dist/constraint-runtime/tools/WalletTools/importWallet.d.ts +10 -0
  185. package/dist/constraint-runtime/tools/WalletTools/sendTransaction.d.ts +20 -0
  186. package/dist/constraint-runtime/tools/WalletTools/signMessage.d.ts +10 -0
  187. package/dist/constraint-runtime/tools/WalletTools/transferToken.d.ts +17 -0
  188. package/dist/constraint-runtime/tools.d.ts +14 -0
  189. package/dist/constraint-runtime/tools.js +80 -0
  190. package/dist/constraint-runtime/transcript.d.ts +8 -0
  191. package/dist/constraint-runtime/transcript.js +19 -0
  192. package/dist/constraint-runtime/types/index.d.ts +11 -0
  193. package/dist/constraint-runtime/types/index.js +12 -0
  194. package/dist/constraint-runtime/upstream_proxy/index.d.ts +11 -0
  195. package/dist/constraint-runtime/upstream_proxy/index.js +12 -0
  196. package/dist/constraint-runtime/utils/index.d.ts +11 -0
  197. package/dist/constraint-runtime/utils/index.js +12 -0
  198. package/dist/constraint-runtime/vim/index.d.ts +11 -0
  199. package/dist/constraint-runtime/vim/index.js +12 -0
  200. package/dist/constraint-runtime/voice/index.d.ts +11 -0
  201. package/dist/constraint-runtime/voice/index.js +12 -0
  202. package/dist/llm/config-store.js +39 -28
  203. package/dist/llm/pi-ai.js +83 -36
  204. package/dist/security/tool-gate.js +4 -18
  205. package/package.json +3 -2
  206. package/dist/constraint-runtime/src/tools/PolymarketSDK/clobShared.js +0 -104
  207. package/dist/constraint-runtime/src/tools/PolymarketSDK/getMarket.js +0 -5
  208. package/dist/constraint-runtime/src/tools/PolymarketSDK/getOrders.js +0 -19
  209. package/dist/constraint-runtime/src/tools/PolymarketSDK/listMarkets.js +0 -4
  210. /package/dist/constraint-runtime/{src/tools → tools}/SafeSDK/deploySafe.js +0 -0
  211. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/autoPay.js +0 -0
  212. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/createWallet.js +0 -0
  213. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/getBalance.js +0 -0
  214. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/importWallet.js +0 -0
  215. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/sendTransaction.js +0 -0
  216. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/signMessage.js +0 -0
  217. /package/dist/constraint-runtime/{src/tools → tools}/WalletTools/transferToken.js +0 -0
@@ -0,0 +1,11 @@
1
+ export declare const ARCHIVE_NAME: string;
2
+ export declare const MODULE_COUNT: number;
3
+ export declare const SAMPLE_FILES: string[];
4
+ export declare const PORTING_NOTE: string;
5
+ declare const _default: {
6
+ ARCHIVE_NAME: string;
7
+ MODULE_COUNT: number;
8
+ PORTING_NOTE: string;
9
+ SAMPLE_FILES: string[];
10
+ };
11
+ export default _default;
@@ -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,8 @@
1
+ export interface RuntimeModeReport {
2
+ mode: string;
3
+ connected: boolean;
4
+ detail: string;
5
+ }
6
+ export declare function runRemoteMode(target: string): RuntimeModeReport;
7
+ export declare function runSshMode(target: string): RuntimeModeReport;
8
+ export declare function runTeleportMode(target: string): RuntimeModeReport;
@@ -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, type RuntimeSession } from './session.js';
@@ -0,0 +1 @@
1
+ export { Session } from './session.js';
@@ -0,0 +1,22 @@
1
+ import { ToolPermissionContext } from '../constraint/permission.js';
2
+ import { BudgetTracker } from '../constraint/budget.js';
3
+ export interface RuntimeSession {
4
+ sessionId: string;
5
+ messages: string[];
6
+ context: Record<string, unknown>;
7
+ turnCount: number;
8
+ }
9
+ export declare class Session implements RuntimeSession {
10
+ sessionId: string;
11
+ messages: string[];
12
+ context: Record<string, unknown>;
13
+ turnCount: number;
14
+ permissionContext: ToolPermissionContext;
15
+ budget: BudgetTracker;
16
+ constructor(sessionId: string, messages?: string[], context?: Record<string, unknown>, turnCount?: number, permissionContext?: ToolPermissionContext, budget?: BudgetTracker);
17
+ addMessage(msg: string): void;
18
+ get history(): string[];
19
+ clear(): void;
20
+ setContext(key: string, value: unknown): void;
21
+ getContext(key: string): unknown;
22
+ }
@@ -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,11 @@
1
+ export declare const ARCHIVE_NAME: string;
2
+ export declare const MODULE_COUNT: number;
3
+ export declare const SAMPLE_FILES: string[];
4
+ export declare const PORTING_NOTE: string;
5
+ declare const _default: {
6
+ ARCHIVE_NAME: string;
7
+ MODULE_COUNT: number;
8
+ PORTING_NOTE: string;
9
+ SAMPLE_FILES: string[];
10
+ };
11
+ export default _default;
@@ -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,11 @@
1
+ export declare const ARCHIVE_NAME: string;
2
+ export declare const MODULE_COUNT: number;
3
+ export declare const SAMPLE_FILES: string[];
4
+ export declare const PORTING_NOTE: string;
5
+ declare const _default: {
6
+ ARCHIVE_NAME: string;
7
+ MODULE_COUNT: number;
8
+ PORTING_NOTE: string;
9
+ SAMPLE_FILES: string[];
10
+ };
11
+ export default _default;
@@ -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,11 @@
1
+ export declare const ARCHIVE_NAME: string;
2
+ export declare const MODULE_COUNT: number;
3
+ export declare const SAMPLE_FILES: string[];
4
+ export declare const PORTING_NOTE: string;
5
+ declare const _default: {
6
+ ARCHIVE_NAME: string;
7
+ MODULE_COUNT: number;
8
+ PORTING_NOTE: string;
9
+ SAMPLE_FILES: string[];
10
+ };
11
+ export default _default;
@@ -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,11 @@
1
+ export declare const ARCHIVE_NAME: string;
2
+ export declare const MODULE_COUNT: number;
3
+ export declare const SAMPLE_FILES: string[];
4
+ export declare const PORTING_NOTE: string;
5
+ declare const _default: {
6
+ ARCHIVE_NAME: string;
7
+ MODULE_COUNT: number;
8
+ PORTING_NOTE: string;
9
+ SAMPLE_FILES: string[];
10
+ };
11
+ export default _default;
@@ -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,8 @@
1
+ export interface StoredSession {
2
+ sessionId: string;
3
+ messages: string[];
4
+ inputTokens: number;
5
+ outputTokens: number;
6
+ }
7
+ export declare function saveSession(session: StoredSession): string;
8
+ export declare function loadSession(sessionId: string): StoredSession;
@@ -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,19 @@
1
+ import { DeferredInitResult } from './deferred_init.js';
2
+ import { PrefetchResult } from './prefetch.js';
3
+ export interface WorkspaceSetup {
4
+ pythonVersion: string;
5
+ implementation: string;
6
+ platformName: string;
7
+ testCommand: string;
8
+ startupSteps: string[];
9
+ }
10
+ export interface SetupReport {
11
+ setup: WorkspaceSetup;
12
+ prefetches: PrefetchResult[];
13
+ deferredInit: DeferredInitResult;
14
+ trusted: boolean;
15
+ cwd: string;
16
+ }
17
+ export declare function buildWorkspaceSetup(): WorkspaceSetup;
18
+ export declare function runSetup(cwd?: string, trusted?: boolean): SetupReport;
19
+ export { buildWorkspaceSetup as buildSetup };
@@ -0,0 +1,30 @@
1
+ import 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, type Skill } from './skill-registry.js';
@@ -0,0 +1 @@
1
+ export { SkillRegistry } from './skill-registry.js';
@@ -0,0 +1,14 @@
1
+ export interface Skill {
2
+ name: string;
3
+ description: string;
4
+ execute(params: Record<string, unknown>): Promise<string>;
5
+ }
6
+ export declare class SkillRegistry {
7
+ private skills;
8
+ register(skill: Skill): void;
9
+ unregister(name: string): boolean;
10
+ get(name: string): Skill | undefined;
11
+ list(): Skill[];
12
+ has(name: string): boolean;
13
+ execute(name: string, params: Record<string, unknown>): Promise<string>;
14
+ }
@@ -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,11 @@
1
+ export declare const ARCHIVE_NAME: string;
2
+ export declare const MODULE_COUNT: number;
3
+ export declare const SAMPLE_FILES: string[];
4
+ export declare const PORTING_NOTE: string;
5
+ declare const _default: {
6
+ ARCHIVE_NAME: string;
7
+ MODULE_COUNT: number;
8
+ PORTING_NOTE: string;
9
+ SAMPLE_FILES: string[];
10
+ };
11
+ export default _default;
@@ -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 @@
1
+ export declare function buildSystemInitMessage(trusted?: boolean): string;
@@ -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,20 @@
1
+ export interface ThinkStep {
2
+ step: number;
3
+ thought: string;
4
+ reflection?: string;
5
+ improvement?: string;
6
+ }
7
+ export interface ThinkResult {
8
+ originalPrompt: string;
9
+ steps: ThinkStep[];
10
+ finalOutput: string;
11
+ depth: number;
12
+ }
13
+ export declare class DeepThinkingEngine {
14
+ private maxDepth;
15
+ constructor(maxDepth?: number);
16
+ think(prompt: string): Promise<ThinkResult>;
17
+ private generateThought;
18
+ private reflect;
19
+ setDepth(depth: number): void;
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, type ThinkResult, type ThinkStep } from './engine.js';
@@ -0,0 +1 @@
1
+ export { DeepThinkingEngine } from './engine.js';
@@ -0,0 +1,8 @@
1
+ import { PortingModule } from './tools.js';
2
+ import { ToolPermissionContext } from './constraint/permission.js';
3
+ export interface ToolPool {
4
+ tools: PortingModule[];
5
+ simpleMode: boolean;
6
+ includeMcp: boolean;
7
+ }
8
+ export declare function assembleToolPool(simpleMode?: boolean, includeMcp?: boolean, permissionContext?: ToolPermissionContext): ToolPool;
@@ -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,9 @@
1
+ export interface ExecAdapterParams {
2
+ adapter: string;
3
+ params?: Record<string, any>;
4
+ }
5
+ export declare function execAdapter(params: ExecAdapterParams): Promise<{
6
+ success: boolean;
7
+ result: any;
8
+ error?: string;
9
+ }>;
@@ -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,5 @@
1
+ export interface Adapter {
2
+ name: string;
3
+ description: string;
4
+ }
5
+ export declare function listAdapters(): Promise<Adapter[]>;
@@ -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,10 @@
1
+ export interface RunCommandParams {
2
+ command: string;
3
+ adapter?: string;
4
+ timeout?: number;
5
+ }
6
+ export declare function runCommand(params: RunCommandParams): Promise<{
7
+ success: boolean;
8
+ output: string;
9
+ error?: string;
10
+ }>;
@@ -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,17 @@
1
+ export interface CancelOrderParams {
2
+ /** 取消订单的钱包私钥 */
3
+ privateKey: string;
4
+ /** 要取消的订单 ID (orderId) */
5
+ orderId: string;
6
+ apiKey?: string;
7
+ apiSecret?: string;
8
+ apiPassphrase?: string;
9
+ funder?: string;
10
+ }
11
+ export interface CancelOrderResult {
12
+ success: boolean;
13
+ message?: string;
14
+ raw?: any;
15
+ }
16
+ /** 撤单 (@polymarket/client 统一 SDK cancelOrder, 2026-08-04 迁移). */
17
+ export declare function cancelOrder(params: CancelOrderParams): Promise<CancelOrderResult>;
@@ -1,4 +1,5 @@
1
- import { buildClobClient } from './clobShared.js';
1
+ import { buildSecureClient } from './clobShared.js';
2
+ /** 撤单 (@polymarket/client 统一 SDK cancelOrder, 2026-08-04 迁移). */
2
3
  export async function cancelOrder(params) {
3
4
  if (!params.privateKey) {
4
5
  return { success: false, message: '取消订单需要提供钱包私钥 privateKey' };
@@ -7,12 +8,8 @@ export async function cancelOrder(params) {
7
8
  return { success: false, message: 'orderId 必填' };
8
9
  }
9
10
  try {
10
- const { client } = await buildClobClient({
11
- privateKey: params.privateKey,
12
- creds: { apiKey: params.apiKey, apiSecret: params.apiSecret, apiPassphrase: params.apiPassphrase },
13
- funder: params.funder,
14
- });
15
- const resp = await client.cancelOrder({ orderID: params.orderId });
11
+ const { client } = await buildSecureClient({ privateKey: params.privateKey, funder: params.funder });
12
+ const resp = await client.cancelOrder({ orderId: params.orderId });
16
13
  return { success: true, message: '已提交取消', raw: resp };
17
14
  }
18
15
  catch (e) {
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Polymarket 下单/查单/撤单 共享依赖
3
+ *
4
+ * 2026-08-04: 迁移到官方统一 SDK @polymarket/client (替代已弃用的 @polymarket/clob-client + polymarket-sdk)
5
+ * - 公开数据: createPublicClient() → listMarkets / fetchMarket / fetchOrderBook
6
+ * - 交易: createSecureClient({ signer: privateKey(pk) }) → placeLimitOrder / cancelOrder / listOpenOrders
7
+ * - 签名走 SDK 内部 (EIP-712), 无需手动派生 API key
8
+ *
9
+ * chainId = 137 (Polygon), host = https://clob.polymarket.com
10
+ */
11
+ import { OrderSide } from '@polymarket/client';
12
+ export declare const CLOB_HOST = "https://clob.polymarket.com";
13
+ export declare const CHAIN_ID = 137;
14
+ export interface PolyCreds {
15
+ apiKey?: string;
16
+ apiSecret?: string;
17
+ apiPassphrase?: string;
18
+ }
19
+ export interface MarketMeta {
20
+ clobTokenIds: string[];
21
+ outcomes: string[];
22
+ tickSize: string;
23
+ negRisk: boolean;
24
+ }
25
+ export declare function normalizePrivateKey(pk: string): `0x${string}`;
26
+ /**
27
+ * 从 Gamma 取市场元数据: clobTokenIds / outcomes / tickSize / negRisk.
28
+ */
29
+ export declare function fetchMarketMeta(marketId: string): Promise<MarketMeta>;
30
+ /**
31
+ * 由 outcome (如 "Yes"/"No" 或索引 0/1) 或显式 tokenId 解析出要交易的 tokenID.
32
+ * 都不给 → 默认取第一个 clobTokenId (通常是 "Yes").
33
+ */
34
+ export declare function resolveTokenId(meta: MarketMeta, tokenId?: string, outcome?: string | number): string | undefined;
35
+ export interface BuildClientParams {
36
+ privateKey: string;
37
+ creds?: PolyCreds;
38
+ funder?: string;
39
+ }
40
+ /**
41
+ * 构造已鉴权的 SecureClient (@polymarket/client 统一 SDK).
42
+ * 签名/鉴权全在 SDK 内部处理, creds (旧式 API key) 参数保留兼容但不再需要.
43
+ */
44
+ export declare function buildSecureClient(params: BuildClientParams): Promise<{
45
+ client: any;
46
+ address: string;
47
+ }>;
48
+ /** 兼容旧名 (老调用方) */
49
+ export declare const buildClobClient: typeof buildSecureClient;
50
+ export { OrderSide };