@gajae-code/coding-agent 0.18.1 → 0.18.5

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 (55) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/types/cli/stats-cli.d.ts +0 -5
  3. package/dist/types/config/autorouting-tier-map.d.ts +29 -2
  4. package/dist/types/config/model-registry.d.ts +16 -1
  5. package/dist/types/exa/mcp-client.d.ts +1 -5
  6. package/dist/types/exec/bash-shell-guardian.d.ts +26 -0
  7. package/dist/types/hashline/parser.d.ts +28 -5
  8. package/dist/types/modes/acp/acp-agent.d.ts +6 -1
  9. package/dist/types/sdk/broker/lifecycle.d.ts +6 -1
  10. package/dist/types/sdk/broker/recovery-backoff.d.ts +62 -0
  11. package/dist/types/sdk/broker/runtime.d.ts +20 -0
  12. package/dist/types/sdk/broker/startup-budget.d.ts +5 -1
  13. package/dist/types/sdk/bus/index.d.ts +1 -0
  14. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +1 -1
  15. package/dist/types/sdk/host/session-runtime.d.ts +7 -0
  16. package/dist/types/sdk/prompt-watchdog.d.ts +1 -1
  17. package/dist/types/tools/bash.d.ts +1 -0
  18. package/package.json +7 -7
  19. package/src/cli/stats-cli.ts +4 -36
  20. package/src/cli-main.ts +4 -8
  21. package/src/cli.ts +4 -8
  22. package/src/commands/commit.ts +2 -2
  23. package/src/commands/sdk.ts +1 -2
  24. package/src/config/autorouting-tier-map.ts +20 -2
  25. package/src/config/model-preset-registry.ts +17 -2
  26. package/src/config/model-profile-activation.ts +3 -1
  27. package/src/config/model-profiles.ts +11 -3
  28. package/src/config/model-registry.ts +45 -17
  29. package/src/exa/mcp-client.ts +41 -8
  30. package/src/exec/bash-shell-guardian.ts +184 -34
  31. package/src/hashline/execute.ts +51 -3
  32. package/src/hashline/parser.ts +63 -16
  33. package/src/internal-urls/docs-index.generated.ts +22 -22
  34. package/src/modes/acp/acp-agent.ts +39 -4
  35. package/src/modes/controllers/ssh-command-controller.ts +3 -1
  36. package/src/sdk/broker/lifecycle.ts +408 -218
  37. package/src/sdk/broker/recovery-backoff.ts +135 -0
  38. package/src/sdk/broker/runtime.ts +83 -0
  39. package/src/sdk/broker/startup-budget.ts +6 -1
  40. package/src/sdk/bus/chat-daemon-control.ts +2 -2
  41. package/src/sdk/bus/index.ts +305 -19
  42. package/src/sdk/bus/telegram-daemon-contract.ts +1 -1
  43. package/src/sdk/host/session-runtime.ts +99 -3
  44. package/src/sdk/prompt-watchdog.ts +17 -4
  45. package/src/session/agent-session.ts +14 -2
  46. package/src/session/internal/managed-session-storage.ts +23 -0
  47. package/src/tools/bash.ts +39 -0
  48. package/dist/types/cli/grep-cli.d.ts +0 -17
  49. package/dist/types/cli/shell-cli.d.ts +0 -8
  50. package/dist/types/commands/grep.d.ts +0 -42
  51. package/dist/types/commands/shell.d.ts +0 -21
  52. package/src/cli/grep-cli.ts +0 -160
  53. package/src/cli/shell-cli.ts +0 -176
  54. package/src/commands/grep.ts +0 -48
  55. package/src/commands/shell.ts +0 -29
@@ -667,7 +667,9 @@ function logDroppedPromptTerminal(
667
667
  });
668
668
  }
669
669
 
670
- type SdkPromptFailedOutcome = Extract<SdkPromptTerminalOutcome, { kind: "failed" }>;
670
+ type SdkPromptFailedOutcome = Extract<SdkPromptTerminalOutcome, { kind: "failed" }> & {
671
+ deliveryFailure?: { cause: string; frameBytes: number };
672
+ };
671
673
 
672
674
  /**
673
675
  * A prompt rejection that still carries the terminal's structured failure classification.
@@ -803,6 +805,13 @@ function promptFailureWireData(failure: SdkPromptFailedOutcome): Record<string,
803
805
  category: failure.category,
804
806
  retryability: promptFailureRetryability(failure.category),
805
807
  ...(isSafePromptFailureCode(failure.providerCode) ? { providerCode: failure.providerCode } : {}),
808
+ ...(failure.deliveryFailure
809
+ ? {
810
+ reason: "delivery_failed",
811
+ cause: failure.deliveryFailure.cause,
812
+ frameBytes: String(failure.deliveryFailure.frameBytes),
813
+ }
814
+ : {}),
806
815
  ...(operatorMessage === undefined ? {} : { operatorMessage }),
807
816
  };
808
817
  }
@@ -921,13 +930,28 @@ function terminalOutcome(event: JsonObject): SdkPromptTerminalOutcome | undefine
921
930
  typeof outcome.message === "string" &&
922
931
  (outcome.provenance === "agent_failed" || outcome.provenance === "deadline")
923
932
  ) {
924
- return failedPromptOutcome({
933
+ const failure = failedPromptOutcome({
925
934
  code: outcome.code,
926
935
  provenance: outcome.provenance,
927
936
  ...(typeof outcome.providerCode === "string" ? { providerCode: outcome.providerCode } : {}),
928
937
  ...(isSdkPromptFailurePhase(outcome.phase) ? { phase: outcome.phase } : {}),
929
938
  evidence: {},
930
939
  });
940
+ const delivery = object(event.error);
941
+ if (
942
+ delivery?.code === "delivery_failed" &&
943
+ isSafePromptFailureCode(delivery.cause) &&
944
+ typeof delivery.frameBytes === "number" &&
945
+ Number.isSafeInteger(delivery.frameBytes) &&
946
+ delivery.frameBytes >= 0
947
+ ) {
948
+ const classified: SdkPromptFailedOutcome = {
949
+ ...failure,
950
+ deliveryFailure: { cause: delivery.cause, frameBytes: delivery.frameBytes },
951
+ };
952
+ return classified;
953
+ }
954
+ return failure;
931
955
  }
932
956
  return undefined;
933
957
  }
@@ -1115,6 +1139,15 @@ function frameMessageRole(event: JsonObject | undefined): string | undefined {
1115
1139
  return typeof role === "string" ? role : undefined;
1116
1140
  }
1117
1141
 
1142
+ function frameMessageHasToolCall(event: JsonObject | undefined): boolean {
1143
+ const content = object(event?.message)?.content;
1144
+ if (!Array.isArray(content)) return false;
1145
+ return content.some(block => {
1146
+ const value = object(block);
1147
+ return value?.type === "toolCall" || value?.type === "tool_use";
1148
+ });
1149
+ }
1150
+
1118
1151
  const ACP_CONFIG_OPTIONS = [
1119
1152
  { id: MODEL_CONFIG_ID, name: "Model", category: "model", options: [] },
1120
1153
  { id: THINKING_CONFIG_ID, name: "Thinking", category: "thought_level", options: [] },
@@ -4205,6 +4238,7 @@ export class AcpAgent implements Agent {
4205
4238
  typeof event?.type === "string" ? event.type : undefined,
4206
4239
  typeof event?.toolCallId === "string" ? event.toolCallId : undefined,
4207
4240
  frameMessageRole(event),
4241
+ frameMessageHasToolCall(event),
4208
4242
  );
4209
4243
  }
4210
4244
 
@@ -4966,10 +5000,11 @@ export class AcpAgent implements Agent {
4966
5000
  // connection watched start. Upgrade it from the frames this prompt actually owned, never
4967
5001
  // downgrade a terminal that already reported `post_start`, and carry the whole
4968
5002
  // classification on the rejection so the first-turn retry gate can read it (review P1).
4969
- const failure =
5003
+ const failure = (
4970
5004
  outcome.phase === "post_start"
4971
5005
  ? outcome
4972
- : (rephaseFailedOutcome(outcome, { hasActivity: waiter.observedTurnActivity }) as SdkPromptFailedOutcome);
5006
+ : rephaseFailedOutcome(outcome, { hasActivity: waiter.observedTurnActivity })
5007
+ ) as SdkPromptFailedOutcome;
4973
5008
  waiter.reject(new AcpPromptFailureError(failure));
4974
5009
  }
4975
5010
 
@@ -134,7 +134,9 @@ export class SSHCommandController {
134
134
  this.ctx.showError("Missing value for --port.");
135
135
  return;
136
136
  }
137
- const parsed = Number.parseInt(value, 10);
137
+ // Same rule as the ACP `/ssh add` parser: `Number.parseInt` accepts
138
+ // trailing garbage ("22oops" -> 22), which would save a typo as a port.
139
+ const parsed = /^\d+$/.test(value) ? Number.parseInt(value, 10) : Number.NaN;
138
140
  if (Number.isNaN(parsed) || parsed < 1 || parsed > 65535) {
139
141
  this.ctx.showError("Invalid --port value. Must be an integer between 1 and 65535.");
140
142
  return;