@causyne/agent 1.20.10 → 1.20.12

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 (88) hide show
  1. package/LICENSE +1 -1
  2. package/docs/ARCHITECTURE.md +24 -1
  3. package/package.json +1 -1
  4. package/src/acp/client.js +9 -2
  5. package/src/acp/client.ts +11 -2
  6. package/src/acp/protocol.ts +9 -0
  7. package/src/agentLoop.js +504 -119
  8. package/src/agentLoop.ts +477 -121
  9. package/src/browser/browserRuntime.js +47 -0
  10. package/src/browser/browserRuntime.ts +45 -0
  11. package/src/browser/causyneBrowser.js +60 -31
  12. package/src/browser/causyneBrowser.ts +37 -12
  13. package/src/browser/workspacePreview.js +52 -0
  14. package/src/browser/workspacePreview.ts +49 -0
  15. package/src/core/planCache.js +5 -0
  16. package/src/core/planCache.ts +5 -0
  17. package/src/decisionPolicy.js +9 -0
  18. package/src/decisionPolicy.ts +8 -0
  19. package/src/historyPruner.js +251 -0
  20. package/src/historyPruner.ts +263 -0
  21. package/src/infra/atomicWriter.js +49 -0
  22. package/src/infra/atomicWriter.ts +63 -0
  23. package/src/infra/telemetry.js +38 -0
  24. package/src/infra/telemetry.ts +68 -0
  25. package/src/observer/coldObserver.js +12 -7
  26. package/src/observer/coldObserver.ts +12 -7
  27. package/src/observer/evidence.js +8 -2
  28. package/src/observer/evidence.ts +9 -2
  29. package/src/outputRecovery.js +36 -0
  30. package/src/outputRecovery.ts +33 -0
  31. package/src/providers/acp.js +114 -46
  32. package/src/providers/acp.ts +129 -46
  33. package/src/providers/antigravity.js +262 -91
  34. package/src/providers/antigravity.ts +270 -99
  35. package/src/providers/antigravityBridge.js +58 -0
  36. package/src/providers/antigravityBridge.ts +51 -0
  37. package/src/providers/base.d.ts +9 -0
  38. package/src/providers/budgetEnforcer.js +110 -0
  39. package/src/providers/budgetEnforcer.ts +122 -0
  40. package/src/providers/collaborationPolicy.js +6 -0
  41. package/src/providers/collaborationPolicy.ts +7 -0
  42. package/src/providers/loopGuard.js +84 -0
  43. package/src/providers/loopGuard.ts +105 -0
  44. package/src/providers/pi.js +19 -6
  45. package/src/providers/pi.ts +19 -7
  46. package/src/providers/toolContracts.js +36 -0
  47. package/src/providers/toolContracts.ts +48 -0
  48. package/src/session/sidechainEvents.js +49 -0
  49. package/src/session/sidechainEvents.ts +98 -0
  50. package/src/skillsManager.d.ts +1 -0
  51. package/src/smartToolsUse.js +123 -4
  52. package/src/smartToolsUse.ts +136 -4
  53. package/src/stallGuard.js +3 -12
  54. package/src/stallGuard.ts +3 -12
  55. package/src/subagent/sidechainHarness.js +66 -0
  56. package/src/subagent/sidechainHarness.ts +91 -0
  57. package/src/taskContinuation.js +12 -0
  58. package/src/taskContinuation.ts +13 -0
  59. package/src/tokenTracker.js +406 -539
  60. package/src/tokenTracker.ts +569 -0
  61. package/src/toolPacks.d.ts +2 -0
  62. package/src/toolPacks.js +1 -1
  63. package/src/tools/argumentValidation.js +56 -0
  64. package/src/tools/argumentValidation.ts +50 -0
  65. package/src/tools/browserAutomator.js +2 -2
  66. package/src/tools/browserAutomator.ts +3 -2
  67. package/src/tools/deferredMcpSearch.js +188 -201
  68. package/src/tools/deferredMcpSearch.ts +250 -0
  69. package/src/tools/generateMediaViaApi.js +305 -331
  70. package/src/tools/generateMediaViaApi.ts +330 -0
  71. package/src/tools/historyPruner.js +5 -0
  72. package/src/tools/historyPruner.ts +5 -0
  73. package/src/tools/payloadSanitizer.js +92 -0
  74. package/src/tools/payloadSanitizer.ts +113 -0
  75. package/src/tools/registry.d.ts +1 -0
  76. package/src/tools/sysRun.js +47 -18
  77. package/src/tools/sysRun.ts +52 -20
  78. package/src/tools/toolOutputStore.js +180 -0
  79. package/src/tools/toolOutputStore.ts +209 -0
  80. package/src/tools/toolSelfRepair.js +26 -1
  81. package/src/tools/toolSelfRepair.ts +25 -1
  82. package/src/tui/chatRenderer.d.ts +1 -0
  83. package/src/tui/chatRenderer.js +4 -2
  84. package/src/tui/codeStreamRenderer.js +36 -8
  85. package/src/tui/codeStreamRenderer.ts +38 -8
  86. package/src/tui/stageSurface.js +1 -0
  87. package/src/tui/text.js +4 -1
  88. package/src/tokenTracker.d.ts +0 -1
package/LICENSE CHANGED
@@ -9,7 +9,7 @@ Parameters
9
9
 
10
10
  Licensor: Ikbal Fadilah
11
11
 
12
- Licensed Work: Causyne Agent 1.10.13
12
+ Licensed Work: Causyne Agent 1.20.12
13
13
  The Licensed Work is (c) 2026 Ikbal Fadilah.
14
14
 
15
15
  Additional Use Grant: You may make use of the Licensed Work, provided that
@@ -26,7 +26,30 @@ Peer agents (OpenCode, Claude Code, Codex, Gemini CLI, Cursor, Antigravity) are
26
26
  providers in the same sense as an HTTP API, addressed as `acp/<peer>`: the
27
27
  user's existing CLI login is the credential, the peer's own `models` command
28
28
  supplies the catalogue, and the session is billed by that subscription — Causyne
29
- reports it at zero cost because it never sees the invoice.
29
+ cannot determine the monetary cost when the peer does not expose its invoice.
30
+
31
+ ### Connected-agent capability preservation
32
+
33
+ Causyne is intended for worldwide distribution. Tool routing is independent of
34
+ the developer's machine and complements each connected agent's configured
35
+ capabilities. It does not force a tool-less peer profile or disable inherited
36
+ MCPs, native tools, skills, or project instructions to promote host tools.
37
+
38
+ Antigravity CLI starts in the selected workspace using the user's normal agent
39
+ configuration. ACP permission requests are routed to the host's authorization
40
+ policy; client file operations use scoped, audited host services. Configured
41
+ client MCP servers can be supplied at session creation. Pi RPC retains the
42
+ peer's native tool, extension, MCP, skill, and project-context configuration.
43
+ Native action updates remain visible and budgeted; native actions are not
44
+ silently executed twice through host-tool mapping.
45
+
46
+ Client-provided ACP terminal methods are not yet implemented or advertised;
47
+ this does not disable terminal tools implemented by a peer itself. The
48
+ Antigravity stream-json adapter remains text-only for host image payloads.
49
+ Preserving capabilities does not invent support missing from a transport or
50
+ bypass user authorization. Account settings are not rewritten. Diagnostic
51
+ conversations never define normal-session permissions. Token usage, cache reads,
52
+ and unavailable subscription pricing remain distinct measurements.
30
53
 
31
54
  `LocalCLIConnection` is a local rendering/event adapter, not an inbound network
32
55
  connection. `emitEvent` feeds the terminal. Tools can execute host commands;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@causyne/agent",
3
- "version": "1.20.10",
3
+ "version": "1.20.12",
4
4
  "description": "Agentic AI for software, tools, and computer workflows",
5
5
  "main": "bin/causyne.js",
6
6
  "type": "module",
package/src/acp/client.js CHANGED
@@ -115,8 +115,8 @@ export class AcpClient {
115
115
  const detail = this.stderrTail.trim() || `exit code ${code ?? 'null'}${exitSignal ? ` signal ${exitSignal}` : ''}`;
116
116
  this.failAll(new Error(`agent process exited: ${detail}`));
117
117
  });
118
- const hasFsRead = Boolean(this.options.fsReadHandler || this.options.cwd);
119
- const hasFsWrite = Boolean(this.options.fsWriteHandler || this.options.cwd);
118
+ const hasFsRead = this.options.allowHostTools !== false && Boolean(this.options.fsReadHandler || this.options.cwd);
119
+ const hasFsWrite = this.options.allowHostTools !== false && Boolean(this.options.fsWriteHandler || this.options.cwd);
120
120
  const params = {
121
121
  protocolVersion: ACP_PROTOCOL_VERSION,
122
122
  clientCapabilities: {
@@ -230,6 +230,7 @@ export class AcpClient {
230
230
  }, this.options.promptTimeoutMs ?? 15 * 60 * 1000, signal);
231
231
  return {
232
232
  stopReason: response?.stopReason ?? 'end_turn',
233
+ ...(response?.usage ? { usage: response.usage } : {}),
233
234
  text: collected
234
235
  };
235
236
  }
@@ -339,6 +340,12 @@ export class AcpClient {
339
340
  }
340
341
  }
341
342
  async handleServerRequest(request) {
343
+ if (this.options.allowHostTools === false
344
+ && (request.method === ACP_METHODS.READ_TEXT_FILE || request.method === ACP_METHODS.WRITE_TEXT_FILE)) {
345
+ this.write({ jsonrpc: '2.0', id: request.id,
346
+ error: { code: ACP_ERROR_CODES.INVALID_REQUEST, message: 'Use the advertised Causyne tools for host file access.' } });
347
+ return;
348
+ }
342
349
  if (request.method === ACP_METHODS.REQUEST_PERMISSION) {
343
350
  const handler = this.options.permissionHandler;
344
351
  if (!handler) {
package/src/acp/client.ts CHANGED
@@ -38,6 +38,7 @@ export interface AcpClientOptions {
38
38
  env?: NodeJS.ProcessEnv;
39
39
  clientVersion?: string;
40
40
  promptTimeoutMs?: number;
41
+ allowHostTools?: boolean;
41
42
  permissionHandler?: (request: RequestPermissionRequest) => Promise<RequestPermissionResponse['outcome']>;
42
43
  onUpdate?: (sessionId: string, update: SessionUpdate) => void;
43
44
  fsReadHandler?: (filePath: string, options?: { line?: number; limit?: number }) => Promise<string>;
@@ -47,6 +48,7 @@ export interface AcpClientOptions {
47
48
  export interface AcpPromptResult {
48
49
  stopReason: PromptResponse['stopReason'];
49
50
  text: string;
51
+ usage?: PromptResponse['usage'];
50
52
  }
51
53
 
52
54
  interface PendingRequest {
@@ -182,8 +184,8 @@ export class AcpClient {
182
184
  this.failAll(new Error(`agent process exited: ${detail}`));
183
185
  });
184
186
 
185
- const hasFsRead = Boolean(this.options.fsReadHandler || this.options.cwd);
186
- const hasFsWrite = Boolean(this.options.fsWriteHandler || this.options.cwd);
187
+ const hasFsRead = this.options.allowHostTools !== false && Boolean(this.options.fsReadHandler || this.options.cwd);
188
+ const hasFsWrite = this.options.allowHostTools !== false && Boolean(this.options.fsWriteHandler || this.options.cwd);
187
189
 
188
190
  const params: InitializeRequest = {
189
191
  protocolVersion: ACP_PROTOCOL_VERSION,
@@ -299,6 +301,7 @@ export class AcpClient {
299
301
  }, this.options.promptTimeoutMs ?? 15 * 60 * 1000, signal);
300
302
  return {
301
303
  stopReason: response?.stopReason ?? 'end_turn',
304
+ ...(response?.usage ? { usage: response.usage } : {}),
302
305
  text: collected
303
306
  };
304
307
  } finally {
@@ -400,6 +403,12 @@ export class AcpClient {
400
403
  }
401
404
 
402
405
  private async handleServerRequest(request: JsonRpcRequest): Promise<void> {
406
+ if (this.options.allowHostTools === false
407
+ && (request.method === ACP_METHODS.READ_TEXT_FILE || request.method === ACP_METHODS.WRITE_TEXT_FILE)) {
408
+ this.write({ jsonrpc: '2.0', id: request.id,
409
+ error: { code: ACP_ERROR_CODES.INVALID_REQUEST, message: 'Use the advertised Causyne tools for host file access.' } });
410
+ return;
411
+ }
403
412
  if (request.method === ACP_METHODS.REQUEST_PERMISSION) {
404
413
  const handler = this.options.permissionHandler;
405
414
  if (!handler) {
@@ -264,6 +264,15 @@ export type StopReason = 'end_turn' | 'max_tokens' | 'max_turn_requests' | 'refu
264
264
 
265
265
  export interface PromptResponse {
266
266
  stopReason: StopReason;
267
+ usage?: AcpUsage;
268
+ }
269
+
270
+ export interface AcpUsage {
271
+ inputTokens: number;
272
+ outputTokens: number;
273
+ cachedReadTokens?: number;
274
+ cachedWriteTokens?: number;
275
+ thoughtTokens?: number;
267
276
  }
268
277
 
269
278
  export interface SetSessionModeRequest {