@gajae-code/coding-agent 0.11.7 → 0.11.8

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 (180) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/types/cli/args.d.ts +0 -2
  3. package/dist/types/config/keybindings.d.ts +33 -3
  4. package/dist/types/config/model-profile-activation.d.ts +4 -3
  5. package/dist/types/config/model-profile-contract.d.ts +38 -0
  6. package/dist/types/config/settings-schema.d.ts +15 -2
  7. package/dist/types/edit/modes/patch.d.ts +13 -0
  8. package/dist/types/edit/path-mutation-lock.d.ts +15 -0
  9. package/dist/types/eval/py/executor.d.ts +1 -1
  10. package/dist/types/eval/py/tool-bridge.d.ts +1 -2
  11. package/dist/types/gjc-runtime/repository-binding.d.ts +63 -0
  12. package/dist/types/gjc-runtime/ultragoal-guard.d.ts +1 -0
  13. package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +24 -0
  14. package/dist/types/main.d.ts +8 -0
  15. package/dist/types/modes/components/runtime-mcp-add-wizard.d.ts +2 -1
  16. package/dist/types/modes/components/tool-status-header.d.ts +3 -2
  17. package/dist/types/modes/components/welcome.d.ts +2 -0
  18. package/dist/types/modes/controllers/command-controller.d.ts +2 -0
  19. package/dist/types/modes/controllers/selector-controller.d.ts +2 -1
  20. package/dist/types/modes/interactive-mode.d.ts +5 -2
  21. package/dist/types/modes/prompt-action-autocomplete.d.ts +6 -1
  22. package/dist/types/modes/prompt-suggestion-controller.d.ts +35 -0
  23. package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +2 -2
  24. package/dist/types/modes/types.d.ts +3 -0
  25. package/dist/types/modes/utils/hotkeys-markdown.d.ts +2 -1
  26. package/dist/types/runtime-mcp/manager.d.ts +1 -1
  27. package/dist/types/runtime-mcp/oauth-flow.d.ts +0 -5
  28. package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +14 -0
  29. package/dist/types/sdk/broker/broker.d.ts +2 -0
  30. package/dist/types/sdk/broker/lifecycle.d.ts +6 -0
  31. package/dist/types/sdk/bus/chat-daemon-control.d.ts +5 -1
  32. package/dist/types/sdk/bus/config-commands.d.ts +2 -2
  33. package/dist/types/sdk/bus/config.d.ts +2 -0
  34. package/dist/types/sdk/bus/conversation-store.d.ts +1 -0
  35. package/dist/types/sdk/bus/index.d.ts +25 -0
  36. package/dist/types/sdk/bus/notification-orchestration.d.ts +1 -0
  37. package/dist/types/sdk/bus/prompt-reconciliation.d.ts +105 -0
  38. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +13 -3
  39. package/dist/types/sdk/bus/telegram-daemon-control.d.ts +5 -1
  40. package/dist/types/sdk/bus/telegram-daemon.d.ts +128 -1
  41. package/dist/types/sdk/bus/telegram-reference.d.ts +2 -0
  42. package/dist/types/sdk/host/control/operations.d.ts +1 -1
  43. package/dist/types/sdk/host/host.d.ts +1 -1
  44. package/dist/types/sdk/host/query/handlers.d.ts +9 -0
  45. package/dist/types/sdk/index.d.ts +2 -0
  46. package/dist/types/sdk/prompt-status.d.ts +88 -0
  47. package/dist/types/sdk/session-directory.d.ts +1 -1
  48. package/dist/types/sdk/startup-capability.d.ts +3 -0
  49. package/dist/types/session/agent-session.d.ts +2 -0
  50. package/dist/types/session/internal/managed-session-scope.d.ts +11 -2
  51. package/dist/types/session/internal/managed-session-storage.d.ts +17 -2
  52. package/dist/types/session/internal/native-publish-outcome.d.ts +48 -0
  53. package/dist/types/session/session-storage.d.ts +18 -0
  54. package/dist/types/task/index.d.ts +3 -1
  55. package/dist/types/task/receipt.d.ts +2 -0
  56. package/dist/types/task/types.d.ts +94 -0
  57. package/dist/types/tools/ask.d.ts +454 -174
  58. package/dist/types/tools/image-gen.d.ts +47 -1
  59. package/dist/types/tools/index.d.ts +4 -0
  60. package/dist/types/utils/prompt-suggestion.d.ts +33 -0
  61. package/package.json +8 -8
  62. package/scripts/capture-platform-shortcut-labels-showcase.ts +342 -0
  63. package/scripts/dogfood-repository-binding.ts +209 -0
  64. package/scripts/generate-sdk-operation-inventory.ts +2 -0
  65. package/scripts/run-test-manifest.ts +4 -4
  66. package/src/cli/args.ts +2 -92
  67. package/src/cli/notify-cli.ts +5 -38
  68. package/src/cli.ts +18 -0
  69. package/src/commands/sdk.ts +2 -2
  70. package/src/config/keybindings.ts +157 -24
  71. package/src/config/model-profile-activation.ts +7 -18
  72. package/src/config/model-profile-contract.ts +161 -0
  73. package/src/config/model-registry.ts +11 -1
  74. package/src/config/settings-schema.ts +17 -2
  75. package/src/coordinator-mcp/model-preset.ts +21 -74
  76. package/src/defaults/gjc/skills/deep-interview/SKILL.md +2 -2
  77. package/src/defaults/gjc/skills/ralplan/SKILL.md +3 -1
  78. package/src/edit/index.ts +3 -6
  79. package/src/edit/modes/patch.ts +38 -1
  80. package/src/edit/modes/replace.ts +42 -0
  81. package/src/edit/path-mutation-lock.ts +112 -0
  82. package/src/eval/py/executor.ts +30 -11
  83. package/src/eval/py/prelude.py +2 -2
  84. package/src/eval/py/tool-bridge.ts +34 -18
  85. package/src/extensibility/gjc-plugins/runtime-adapters.ts +2 -1
  86. package/src/gjc-runtime/launch-tmux.ts +1 -1
  87. package/src/gjc-runtime/managed-owner-supervisor.ts +83 -4
  88. package/src/gjc-runtime/ralplan-runtime.ts +75 -3
  89. package/src/gjc-runtime/repository-binding.ts +267 -0
  90. package/src/gjc-runtime/session-state-sidecar.ts +25 -9
  91. package/src/gjc-runtime/tmux-owner-isolation.ts +2 -1
  92. package/src/gjc-runtime/tmux-sessions.ts +45 -6
  93. package/src/gjc-runtime/ultragoal-guard.ts +5 -5
  94. package/src/gjc-runtime/ultragoal-runtime.ts +181 -19
  95. package/src/internal-urls/docs-index.generated.ts +6 -5
  96. package/src/internal-urls/local-protocol.ts +33 -16
  97. package/src/internal-urls/mcp-protocol.ts +73 -11
  98. package/src/main.ts +25 -10
  99. package/src/modes/DESIGN.md +5 -0
  100. package/src/modes/acp/acp-agent.ts +50 -16
  101. package/src/modes/components/model-selector.ts +42 -8
  102. package/src/modes/components/plan-preview-overlay.ts +1 -1
  103. package/src/modes/components/runtime-mcp-add-wizard.ts +5 -0
  104. package/src/modes/components/tool-status-header.ts +20 -4
  105. package/src/modes/components/welcome.ts +22 -18
  106. package/src/modes/controllers/command-controller.ts +97 -54
  107. package/src/modes/controllers/event-controller.ts +10 -0
  108. package/src/modes/controllers/input-controller.ts +7 -2
  109. package/src/modes/controllers/runtime-mcp-command-controller.ts +29 -6
  110. package/src/modes/controllers/selector-controller.ts +46 -54
  111. package/src/modes/interactive-mode.ts +41 -27
  112. package/src/modes/prompt-action-autocomplete.ts +32 -13
  113. package/src/modes/prompt-suggestion-controller.ts +96 -0
  114. package/src/modes/shared/agent-wire/workflow-gate-broker.ts +2 -2
  115. package/src/modes/types.ts +3 -0
  116. package/src/modes/utils/hotkeys-markdown.ts +64 -36
  117. package/src/modes/utils/ui-helpers.ts +5 -3
  118. package/src/prompts/agents/architect.md +0 -1
  119. package/src/prompts/agents/critic.md +0 -1
  120. package/src/prompts/system/prompt-suggestion-system.md +32 -0
  121. package/src/prompts/system/system-prompt.md +6 -4
  122. package/src/prompts/tools/cron.md +3 -1
  123. package/src/runtime-mcp/manager.ts +51 -53
  124. package/src/runtime-mcp/oauth-flow.ts +0 -72
  125. package/src/runtime-mcp/plugin-network-boundary.ts +101 -0
  126. package/src/runtime-mcp/transports/http.ts +13 -6
  127. package/src/sdk/broker/broker.ts +34 -20
  128. package/src/sdk/broker/lifecycle.ts +185 -36
  129. package/src/sdk/bus/chat-daemon-control.ts +18 -5
  130. package/src/sdk/bus/config-commands.ts +2 -2
  131. package/src/sdk/bus/config.ts +9 -1
  132. package/src/sdk/bus/conversation-store.ts +40 -6
  133. package/src/sdk/bus/index.ts +240 -65
  134. package/src/sdk/bus/lifecycle-commands.ts +47 -3
  135. package/src/sdk/bus/lifecycle-control-runtime.ts +11 -2
  136. package/src/sdk/bus/lifecycle-orchestrator.ts +32 -1
  137. package/src/sdk/bus/notification-orchestration.ts +12 -0
  138. package/src/sdk/bus/notification-service.ts +27 -2
  139. package/src/sdk/bus/prompt-reconciliation.ts +239 -0
  140. package/src/sdk/bus/recent-activity.ts +90 -26
  141. package/src/sdk/bus/telegram-daemon-contract.ts +13 -3
  142. package/src/sdk/bus/telegram-daemon-control.ts +145 -33
  143. package/src/sdk/bus/telegram-daemon.ts +835 -110
  144. package/src/sdk/bus/telegram-reference.ts +20 -2
  145. package/src/sdk/cli/session-cli.ts +15 -2
  146. package/src/sdk/host/control/dispatch.ts +1 -1
  147. package/src/sdk/host/control/operations.ts +1 -1
  148. package/src/sdk/host/host.ts +2 -6
  149. package/src/sdk/host/query/handlers.ts +70 -5
  150. package/src/sdk/index.ts +12 -0
  151. package/src/sdk/prompt-status.ts +97 -0
  152. package/src/sdk/protocol/operation-inventory.generated.json +47 -0
  153. package/src/sdk/protocol/operation-registry.ts +18 -4
  154. package/src/sdk/session-directory.ts +5 -1
  155. package/src/sdk/session.ts +2 -0
  156. package/src/sdk/startup-capability.ts +9 -1
  157. package/src/session/agent-session.ts +52 -5
  158. package/src/session/blob-store.ts +7 -2
  159. package/src/session/internal/managed-session-scope.ts +854 -84
  160. package/src/session/internal/managed-session-storage.ts +251 -199
  161. package/src/session/internal/native-publish-outcome.ts +266 -0
  162. package/src/session/session-manager.ts +310 -327
  163. package/src/session/session-storage.ts +128 -11
  164. package/src/task/gjc-command.ts +2 -2
  165. package/src/task/index.ts +121 -15
  166. package/src/task/receipt.ts +3 -0
  167. package/src/task/types.ts +34 -3
  168. package/src/tools/ask.ts +198 -88
  169. package/src/tools/ast-edit.ts +2 -2
  170. package/src/tools/bash-pty-selection.ts +2 -2
  171. package/src/tools/browser/screenshot-format.ts +6 -1
  172. package/src/tools/cron.ts +1 -1
  173. package/src/tools/image-gen.ts +178 -6
  174. package/src/tools/index.ts +4 -0
  175. package/src/tools/render-utils.ts +7 -1
  176. package/src/utils/edit-mode.ts +2 -2
  177. package/src/utils/prompt-suggestion.ts +265 -0
  178. package/src/utils/sixel.ts +3 -3
  179. package/src/web/insane/url-guard.ts +3 -1
  180. package/src/web/scrapers/docs-rs.ts +30 -5
@@ -0,0 +1,266 @@
1
+ export type NativePublishMutationState = "not_committed" | "committed" | "unknown";
2
+ export type NativePublishDurabilityState = "not_attempted" | "proven" | "not_provable";
3
+ export type NativePublishReason =
4
+ | "none"
5
+ | "destination_exists"
6
+ | "atomic_unavailable"
7
+ | "cross_device"
8
+ | "permission_denied"
9
+ | "io_failure"
10
+ | "interrupted"
11
+ | "invalid_request"
12
+ | "identity_violation"
13
+ | "durability_not_provable"
14
+ | "unknown";
15
+ export type NativePublishOperation = "direct_rename" | "retained_file" | "retained_tree";
16
+
17
+ export type NativePublishPrimitive =
18
+ | "renameat2_noreplace"
19
+ | "renameatx_np_excl"
20
+ | "windows_rename_noreplace"
21
+ | "unsupported"
22
+ | "unknown";
23
+ export type NativePublishPhase =
24
+ | "preflight"
25
+ | "file_sync"
26
+ | "rename"
27
+ | "source_parent_sync"
28
+ | "destination_parent_sync"
29
+ | "terminal_identity"
30
+ | "complete"
31
+ | "unknown";
32
+
33
+ type SyncFailure = {
34
+ phase: Exclude<NativePublishPhase, "preflight" | "file_sync" | "rename" | "complete" | "unknown">;
35
+ parentRole: "source" | "destination" | "shared" | "staged_file";
36
+ osCode?: number;
37
+ kind: "unsupported" | "io" | "permission" | "other";
38
+ };
39
+
40
+ type PublishDiagnostic = {
41
+ schemaVersion: 1;
42
+ collectionState: "complete" | "partial" | "unavailable";
43
+ osCode?: number;
44
+ syncFailures?: readonly SyncFailure[];
45
+ };
46
+
47
+ export type NativePublishIdentity = {
48
+ readonly dev: string;
49
+ readonly ino: string;
50
+ readonly size: string;
51
+ readonly mtimeNs: string;
52
+ readonly ctimeNs: string;
53
+ readonly sha256?: string;
54
+ };
55
+
56
+ export type NativePublishOutcome = {
57
+ readonly ok: boolean;
58
+ readonly code?: string;
59
+ readonly identity?: NativePublishIdentity;
60
+ readonly mutationState: NativePublishMutationState;
61
+ readonly durabilityState: NativePublishDurabilityState;
62
+ readonly reason: NativePublishReason;
63
+ readonly primitive: NativePublishPrimitive;
64
+ readonly phase: NativePublishPhase;
65
+ readonly diagnostic: PublishDiagnostic;
66
+ };
67
+
68
+ const mutationStates = new Set<NativePublishMutationState>(["not_committed", "committed", "unknown"]);
69
+ const durabilityStates = new Set<NativePublishDurabilityState>(["not_attempted", "proven", "not_provable"]);
70
+ const reasons = new Set<NativePublishReason>([
71
+ "none",
72
+ "destination_exists",
73
+ "atomic_unavailable",
74
+ "cross_device",
75
+ "permission_denied",
76
+ "io_failure",
77
+ "interrupted",
78
+ "invalid_request",
79
+ "identity_violation",
80
+ "durability_not_provable",
81
+ "unknown",
82
+ ]);
83
+ const primitives = new Set<NativePublishPrimitive>([
84
+ "renameat2_noreplace",
85
+ "renameatx_np_excl",
86
+ "windows_rename_noreplace",
87
+ "unsupported",
88
+ "unknown",
89
+ ]);
90
+ const phases = new Set<NativePublishPhase>([
91
+ "preflight",
92
+ "file_sync",
93
+ "rename",
94
+ "source_parent_sync",
95
+ "destination_parent_sync",
96
+ "terminal_identity",
97
+ "complete",
98
+ "unknown",
99
+ ]);
100
+ const preMutationReasons = new Set<NativePublishReason>([
101
+ "destination_exists",
102
+ "atomic_unavailable",
103
+ "cross_device",
104
+ "permission_denied",
105
+ "io_failure",
106
+ "interrupted",
107
+ "invalid_request",
108
+ "identity_violation",
109
+ ]);
110
+ const int32 = (value: unknown): value is number =>
111
+ typeof value === "number" && Number.isInteger(value) && value >= -2147483648 && value <= 2147483647;
112
+ const ownPlainRecord = (value: unknown): value is Record<string, unknown> =>
113
+ Boolean(value) && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype;
114
+ const exactKeys = (value: Record<string, unknown>, keys: readonly string[]) =>
115
+ Object.keys(value).every(key => keys.includes(key));
116
+
117
+ const malformed: NativePublishOutcome = Object.freeze({
118
+ ok: false,
119
+ mutationState: "unknown",
120
+ durabilityState: "not_provable",
121
+ reason: "unknown",
122
+ primitive: "unknown",
123
+ phase: "unknown",
124
+ diagnostic: Object.freeze({ schemaVersion: 1, collectionState: "unavailable" }),
125
+ });
126
+
127
+ function validIdentity(value: unknown): boolean {
128
+ if (value === undefined) return true;
129
+ if (!ownPlainRecord(value) || !exactKeys(value, ["dev", "ino", "size", "mtimeNs", "ctimeNs", "sha256"]))
130
+ return false;
131
+ const decimal = (field: unknown) => typeof field === "string" && /^-?[0-9]{1,32}$/.test(field);
132
+ return (
133
+ decimal(value.dev) &&
134
+ decimal(value.ino) &&
135
+ decimal(value.size) &&
136
+ decimal(value.mtimeNs) &&
137
+ decimal(value.ctimeNs) &&
138
+ (value.sha256 === undefined || (typeof value.sha256 === "string" && /^[a-f0-9]{64}$/.test(value.sha256)))
139
+ );
140
+ }
141
+
142
+ function validDiagnostic(value: unknown): value is PublishDiagnostic {
143
+ if (!ownPlainRecord(value) || !exactKeys(value, ["schemaVersion", "collectionState", "osCode", "syncFailures"]))
144
+ return false;
145
+ if (value.schemaVersion !== 1 || !["complete", "partial", "unavailable"].includes(value.collectionState as string))
146
+ return false;
147
+ if (value.osCode !== undefined && !int32(value.osCode)) return false;
148
+ if (value.syncFailures === undefined) return true;
149
+ if (!Array.isArray(value.syncFailures) || value.syncFailures.length > 4) return false;
150
+ return value.syncFailures.every(failure => {
151
+ if (!ownPlainRecord(failure) || !exactKeys(failure, ["phase", "parentRole", "osCode", "kind"])) return false;
152
+ const phase = failure.phase;
153
+ const role = failure.parentRole;
154
+ const compatibleRole =
155
+ (phase === "source_parent_sync" && ["source", "shared"].includes(role as string)) ||
156
+ (phase === "destination_parent_sync" && role === "destination") ||
157
+ (phase === "terminal_identity" && ["source", "destination", "shared", "staged_file"].includes(role as string));
158
+ return (
159
+ ["source_parent_sync", "destination_parent_sync", "terminal_identity"].includes(phase as string) &&
160
+ compatibleRole &&
161
+ (failure.osCode === undefined || int32(failure.osCode)) &&
162
+ ["unsupported", "io", "permission", "other"].includes(failure.kind as string)
163
+ );
164
+ });
165
+ }
166
+
167
+ function legalOutcome(outcome: NativePublishOutcome): boolean {
168
+ if (outcome.mutationState === "not_committed")
169
+ return (
170
+ !outcome.ok &&
171
+ outcome.durabilityState === "not_attempted" &&
172
+ preMutationReasons.has(outcome.reason) &&
173
+ ((outcome.phase === "rename" &&
174
+ ["destination_exists", "atomic_unavailable", "cross_device", "permission_denied", "io_failure"].includes(
175
+ outcome.reason,
176
+ )) ||
177
+ (outcome.phase === "preflight" &&
178
+ !["atomic_unavailable", "cross_device", "interrupted"].includes(outcome.reason)) ||
179
+ (outcome.phase === "file_sync" && outcome.reason === "io_failure"))
180
+ );
181
+ if (outcome.mutationState === "unknown")
182
+ return (
183
+ !outcome.ok &&
184
+ outcome.durabilityState === "not_provable" &&
185
+ outcome.reason === "unknown" &&
186
+ ["rename", "terminal_identity"].includes(outcome.phase)
187
+ );
188
+ if (outcome.ok)
189
+ return (
190
+ outcome.reason === "none" &&
191
+ outcome.phase === "complete" &&
192
+ ["proven", "not_attempted"].includes(outcome.durabilityState)
193
+ );
194
+ return (
195
+ !outcome.ok &&
196
+ outcome.durabilityState === "not_provable" &&
197
+ ((outcome.reason === "durability_not_provable" &&
198
+ ["file_sync", "source_parent_sync", "destination_parent_sync"].includes(outcome.phase)) ||
199
+ (outcome.reason === "identity_violation" && outcome.phase === "terminal_identity") ||
200
+ (outcome.reason === "io_failure" && outcome.phase === "terminal_identity"))
201
+ );
202
+ }
203
+
204
+ /**
205
+ * Treat incompatible native results as an unknown mutation; never infer safety from legacy fields.
206
+ * Retained descriptor operations have a stricter contract than direct rename: a reported success
207
+ * includes the terminal identity and all required durability evidence.
208
+ */
209
+ export function classifyNativePublishOutcome(
210
+ value: unknown,
211
+ operation: NativePublishOperation = "direct_rename",
212
+ ): NativePublishOutcome {
213
+ if (
214
+ !ownPlainRecord(value) ||
215
+ !exactKeys(value, [
216
+ "ok",
217
+ "code",
218
+ "identity",
219
+ "mutationState",
220
+ "durabilityState",
221
+ "reason",
222
+ "primitive",
223
+ "phase",
224
+ "diagnostic",
225
+ ])
226
+ )
227
+ return malformed;
228
+ if (
229
+ typeof value.ok !== "boolean" ||
230
+ (value.code !== undefined && (typeof value.code !== "string" || !/^[a-z0-9_]{1,64}$/.test(value.code))) ||
231
+ !mutationStates.has(value.mutationState as NativePublishMutationState) ||
232
+ !durabilityStates.has(value.durabilityState as NativePublishDurabilityState) ||
233
+ !reasons.has(value.reason as NativePublishReason) ||
234
+ !primitives.has(value.primitive as NativePublishPrimitive) ||
235
+ !phases.has(value.phase as NativePublishPhase) ||
236
+ !validIdentity(value.identity) ||
237
+ !validDiagnostic(value.diagnostic)
238
+ )
239
+ return malformed;
240
+ const outcome = value as unknown as NativePublishOutcome;
241
+ if (!legalOutcome(outcome)) return malformed;
242
+ if (operation === "direct_rename") return outcome;
243
+ if (
244
+ outcome.primitive !== "renameat2_noreplace" ||
245
+ (outcome.ok && (!outcome.identity || outcome.durabilityState !== "proven" || outcome.phase !== "complete"))
246
+ )
247
+ return malformed;
248
+ return outcome;
249
+ }
250
+
251
+ /** Only a fully validated pre-mutation result permits exact cleanup of current staging. */
252
+ export function mayCleanCurrentStaging(outcome: NativePublishOutcome): boolean {
253
+ return outcome.mutationState === "not_committed" && outcome.durabilityState === "not_attempted";
254
+ }
255
+
256
+ /** Stable, bounded text for startup errors. Native paths and messages are intentionally excluded. */
257
+ export function formatNativePublishDiagnostic(outcome: NativePublishOutcome): string {
258
+ const osCode = outcome.diagnostic.osCode === undefined ? "" : ` os=${outcome.diagnostic.osCode}`;
259
+ const failures = outcome.diagnostic.syncFailures
260
+ ?.map(
261
+ failure =>
262
+ `${failure.parentRole}:${failure.phase}:${failure.kind}${failure.osCode === undefined ? "" : `:${failure.osCode}`}`,
263
+ )
264
+ .join(",");
265
+ return `${outcome.reason} primitive=${outcome.primitive} phase=${outcome.phase}${osCode}${failures ? ` sync=${failures}` : ""}`;
266
+ }