@gajae-code/coding-agent 0.11.8 → 0.11.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 (101) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/dist/types/cli.d.ts +1 -0
  3. package/dist/types/config/model-profiles.d.ts +2 -3
  4. package/dist/types/config/model-registry.d.ts +2 -0
  5. package/dist/types/gjc-runtime/deep-interview-ambiguity.d.ts +12 -5
  6. package/dist/types/gjc-runtime/deep-interview-draft.d.ts +8 -0
  7. package/dist/types/gjc-runtime/deep-interview-payload.d.ts +41 -0
  8. package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +32 -17
  9. package/dist/types/gjc-runtime/deep-interview-repair.d.ts +17 -0
  10. package/dist/types/gjc-runtime/deep-interview-state.d.ts +135 -4
  11. package/dist/types/gjc-runtime/state-writer.d.ts +45 -0
  12. package/dist/types/gjc-runtime/workflow-manifest.d.ts +5 -3
  13. package/dist/types/modes/components/welcome.d.ts +2 -0
  14. package/dist/types/modes/controllers/selector-controller.d.ts +16 -8
  15. package/dist/types/runtime-mcp/redaction.d.ts +2 -0
  16. package/dist/types/sdk/bus/chat-daemon-control.d.ts +3 -1
  17. package/dist/types/sdk/bus/daemon-paths.d.ts +1 -0
  18. package/dist/types/sdk/bus/index.d.ts +8 -1
  19. package/dist/types/sdk/bus/operator-runtime.d.ts +1 -0
  20. package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +14 -7
  21. package/dist/types/sdk/bus/telegram-daemon.d.ts +74 -5
  22. package/dist/types/sdk/session.d.ts +7 -0
  23. package/dist/types/session/agent-session.d.ts +2 -0
  24. package/dist/types/session/internal/managed-session-scope.d.ts +13 -3
  25. package/dist/types/session/internal/managed-session-storage.d.ts +8 -3
  26. package/dist/types/session/session-manager.d.ts +5 -1
  27. package/dist/types/session/session-storage.d.ts +13 -0
  28. package/dist/types/skill-state/active-state.d.ts +4 -0
  29. package/dist/types/task/provider-retry-status.d.ts +13 -0
  30. package/dist/types/task/types.d.ts +3 -0
  31. package/dist/types/tools/index.d.ts +3 -1
  32. package/package.json +8 -8
  33. package/scripts/generate-sdk-operation-inventory.ts +1 -0
  34. package/src/cli/mcp-cli.ts +4 -21
  35. package/src/cli/notify-cli.ts +1 -0
  36. package/src/cli.ts +32 -0
  37. package/src/commands/deep-interview.ts +9 -4
  38. package/src/commit/agentic/index.ts +3 -3
  39. package/src/commit/map-reduce/index.ts +2 -2
  40. package/src/config/model-profiles.ts +9 -10
  41. package/src/config/model-registry.ts +4 -2
  42. package/src/defaults/gjc/skills/deep-interview/SKILL.md +78 -163
  43. package/src/eval/js/tool-bridge.ts +1 -1
  44. package/src/gjc-runtime/deep-interview-ambiguity.ts +68 -47
  45. package/src/gjc-runtime/deep-interview-draft.ts +843 -0
  46. package/src/gjc-runtime/deep-interview-payload.ts +262 -0
  47. package/src/gjc-runtime/deep-interview-recorder.ts +310 -227
  48. package/src/gjc-runtime/deep-interview-repair.ts +1674 -0
  49. package/src/gjc-runtime/deep-interview-runtime.ts +264 -103
  50. package/src/gjc-runtime/deep-interview-state.ts +916 -4
  51. package/src/gjc-runtime/ralplan-runtime.ts +3 -1
  52. package/src/gjc-runtime/state-writer.ts +166 -2
  53. package/src/gjc-runtime/workflow-manifest.generated.json +386 -1
  54. package/src/gjc-runtime/workflow-manifest.ts +191 -5
  55. package/src/hooks/skill-state.ts +23 -1
  56. package/src/internal-urls/docs-index.generated.ts +6 -5
  57. package/src/modes/components/welcome.ts +10 -2
  58. package/src/modes/controllers/selector-controller.ts +38 -8
  59. package/src/modes/interactive-mode.ts +29 -9
  60. package/src/prompts/agent-fragments/restricted-bash.md +1 -1
  61. package/src/prompts/agents/architect.md +8 -1
  62. package/src/prompts/agents/critic.md +8 -1
  63. package/src/prompts/agents/planner.md +8 -1
  64. package/src/prompts/system/system-prompt.md +1 -0
  65. package/src/runtime-mcp/json-rpc.ts +7 -4
  66. package/src/runtime-mcp/redaction.ts +30 -0
  67. package/src/sdk/broker/identity.ts +22 -12
  68. package/src/sdk/broker/session-index.ts +11 -1
  69. package/src/sdk/bus/chat-daemon-control.ts +5 -3
  70. package/src/sdk/bus/daemon-paths.ts +2 -0
  71. package/src/sdk/bus/index.ts +60 -5
  72. package/src/sdk/bus/notification-service.ts +19 -5
  73. package/src/sdk/bus/operator-runtime.ts +31 -5
  74. package/src/sdk/bus/telegram-cli.ts +6 -13
  75. package/src/sdk/bus/telegram-daemon-cli.ts +8 -3
  76. package/src/sdk/bus/telegram-daemon-contract.ts +15 -7
  77. package/src/sdk/bus/telegram-daemon-control.ts +14 -5
  78. package/src/sdk/bus/telegram-daemon.ts +685 -120
  79. package/src/sdk/protocol/operation-inventory.generated.json +11 -0
  80. package/src/sdk/session.ts +12 -0
  81. package/src/session/agent-session.ts +140 -10
  82. package/src/session/internal/managed-session-scope.ts +339 -228
  83. package/src/session/internal/managed-session-storage.ts +17 -4
  84. package/src/session/session-manager.ts +96 -33
  85. package/src/session/session-storage.ts +23 -0
  86. package/src/skill-state/active-state.ts +10 -0
  87. package/src/skill-state/workflow-mutation-guard.ts +41 -7
  88. package/src/task/executor.ts +154 -44
  89. package/src/task/provider-retry-status.ts +88 -0
  90. package/src/task/render.ts +45 -26
  91. package/src/task/types.ts +3 -0
  92. package/src/tools/ask.ts +1 -0
  93. package/src/tools/bash-allowed-prefixes.ts +45 -1
  94. package/src/tools/index.ts +3 -1
  95. package/src/tools/subagent-render.ts +74 -16
  96. package/src/tools/subagent.ts +2 -0
  97. package/vendor/insane-search/MANIFEST.json +4 -1
  98. package/vendor/insane-search/engine/bias_check.py +5 -0
  99. package/vendor/insane-search/engine/fetch_chain.py +67 -1
  100. package/vendor/insane-search/engine/transport.py +13 -2
  101. package/vendor/insane-search/engine/validators.py +4 -1
@@ -0,0 +1,262 @@
1
+ import {
2
+ decodeDeepInterviewAnswerJson,
3
+ decodeDeepInterviewRoundResultJson,
4
+ decodeDeepInterviewSetupJson,
5
+ decodeDeepInterviewTopologyJson,
6
+ } from "./deep-interview-repair";
7
+ import type { DeepInterviewRoundResultV1 } from "./deep-interview-state";
8
+
9
+ export const DEEP_INTERVIEW_DRAFT_KINDS = [
10
+ "initialize-context",
11
+ "confirm-topology",
12
+ "record-answer",
13
+ "apply-round-result",
14
+ ] as const;
15
+
16
+ export type DeepInterviewDraftKind = (typeof DEEP_INTERVIEW_DRAFT_KINDS)[number];
17
+ export type DeepInterviewDraftPayload = Record<string, unknown>;
18
+ export type DraftScalarType = "string" | "id" | "text" | "score" | "number" | "safe-int" | "boolean" | "enum";
19
+ export interface DraftLeafDescriptor {
20
+ kind: "leaf";
21
+ type: DraftScalarType;
22
+ nullable?: boolean;
23
+ maxBytes?: number;
24
+ values?: readonly string[];
25
+ optional?: boolean;
26
+ dynamicMapValue?: boolean;
27
+ }
28
+ export interface DraftObjectDescriptor {
29
+ kind: "object";
30
+ fields: Record<string, DraftDescriptor>;
31
+ optional?: boolean;
32
+ dynamicMapValue?: boolean;
33
+ dynamicValue?: DraftLeafDescriptor;
34
+ }
35
+ export interface DraftArrayDescriptor {
36
+ kind: "array";
37
+ item: DraftLeafDescriptor | DraftObjectDescriptor;
38
+ maxItems: number;
39
+ optional?: boolean;
40
+ }
41
+ export type DraftDescriptor = DraftLeafDescriptor | DraftObjectDescriptor | DraftArrayDescriptor;
42
+
43
+ const string = (maxBytes: number, optional = true): DraftLeafDescriptor => ({
44
+ kind: "leaf",
45
+ type: "string",
46
+ maxBytes,
47
+ optional,
48
+ });
49
+ const text = (maxBytes: number, optional = true): DraftLeafDescriptor => ({
50
+ kind: "leaf",
51
+ type: "text",
52
+ maxBytes,
53
+ optional,
54
+ });
55
+ const id = (optional = true): DraftLeafDescriptor => ({ kind: "leaf", type: "id", maxBytes: 128, optional });
56
+ const score = (optional = true): DraftLeafDescriptor => ({ kind: "leaf", type: "score", optional });
57
+ const safeInt = (optional = true): DraftLeafDescriptor => ({ kind: "leaf", type: "safe-int", optional });
58
+ const boolean = (optional = true): DraftLeafDescriptor => ({ kind: "leaf", type: "boolean", optional });
59
+ const enumeration = (values: readonly string[], optional = true, nullable = false): DraftLeafDescriptor => ({
60
+ kind: "leaf",
61
+ type: "enum",
62
+ values,
63
+ optional,
64
+ nullable,
65
+ });
66
+ const object = (fields: Record<string, DraftDescriptor>, optional = true): DraftObjectDescriptor => ({
67
+ kind: "object",
68
+ fields,
69
+ optional,
70
+ });
71
+ const array = (
72
+ item: DraftLeafDescriptor | DraftObjectDescriptor,
73
+ maxItems: number,
74
+ optional = true,
75
+ ): DraftArrayDescriptor => ({
76
+ kind: "array",
77
+ item,
78
+ maxItems,
79
+ optional,
80
+ });
81
+
82
+ const DIMENSIONS = ["goal", "constraints", "criteria", "context"] as const;
83
+ const dimensionScores = object(Object.fromEntries(DIMENSIONS.map(dimension => [dimension, score(false)])), false);
84
+ const component = object(
85
+ { id: id(false), name: string(1024), status: enumeration(["active", "deferred"]), active: boolean() },
86
+ false,
87
+ );
88
+ const setup = object(
89
+ {
90
+ type: enumeration(["greenfield", "brownfield"], false),
91
+ interview_id: id(),
92
+ initial_idea: text(4096),
93
+ initial_context_summary: text(4096),
94
+ codebase_context: text(4096),
95
+ challenge_modes_used: array(string(256, false), 64),
96
+ threshold: score(false),
97
+ threshold_source: text(4096),
98
+ language: text(4096),
99
+ trace: array(string(2048, false), 64),
100
+ trace_summary: text(4096),
101
+ },
102
+ false,
103
+ );
104
+ const result = object(
105
+ {
106
+ global_scores: dimensionScores,
107
+ component_updates: array(object({ component_id: id(false), scores: dimensionScores }, false), 12),
108
+ targeting: object({
109
+ target_component_id: id(false),
110
+ target_dimension: enumeration(DIMENSIONS, false),
111
+ weakest_component_id: id(false),
112
+ weakest_dimension: enumeration(DIMENSIONS, false),
113
+ last_targeted_component_id: { ...id(false), nullable: true },
114
+ }),
115
+ triggers: array(
116
+ object(
117
+ {
118
+ kind: enumeration(["A", "B", "C", "D"], false),
119
+ name: text(1024, false),
120
+ status: enumeration(["active", "disputed", "unresolved"], false),
121
+ component: id(false),
122
+ dimension: enumeration(DIMENSIONS, false),
123
+ evidence: text(4096),
124
+ contradictedFactId: id(),
125
+ rationale: text(4096),
126
+ },
127
+ false,
128
+ ),
129
+ 16,
130
+ ),
131
+ fact_ops: array(
132
+ object(
133
+ {
134
+ op: enumeration(["add", "dispute", "supersede"], false),
135
+ id: id(false),
136
+ statement: text(4096),
137
+ component: text(128),
138
+ dimension: enumeration(DIMENSIONS),
139
+ evidence: text(4096),
140
+ target_id: id(),
141
+ },
142
+ false,
143
+ ),
144
+ 32,
145
+ ),
146
+ ontology: object({
147
+ entities: array(
148
+ object(
149
+ {
150
+ id: id(false),
151
+ name: text(1024, false),
152
+ type: text(1024, false),
153
+ fields: array(text(1024, false), 16, false),
154
+ },
155
+ false,
156
+ ),
157
+ 32,
158
+ false,
159
+ ),
160
+ relationships: array(
161
+ object(
162
+ { id: id(false), from_entity_id: id(false), to_entity_id: id(false), type: text(1024, false) },
163
+ false,
164
+ ),
165
+ 16,
166
+ false,
167
+ ),
168
+ reasoning: array(object({ statement: text(4096, false), evidence: text(4096) }, false), 32, false),
169
+ }),
170
+ bookkeeping: object({
171
+ resolution: enumeration(
172
+ ["auto_research_accepted", "auto_answer", "direct", "refined", "cited_confirmation"],
173
+ false,
174
+ ),
175
+ round_ids: array(id(false), 32),
176
+ counter_deltas: {
177
+ kind: "object",
178
+ fields: {},
179
+ dynamicValue: { ...safeInt(false), dynamicMapValue: true },
180
+ optional: true,
181
+ },
182
+ }),
183
+ },
184
+ false,
185
+ );
186
+ const DRAFT_SCHEMAS: Record<DeepInterviewDraftKind, DraftObjectDescriptor> = {
187
+ "initialize-context": setup,
188
+ "confirm-topology": object(
189
+ { components: array(component, 64, false), deferred_components: array(id(false), 64, false) },
190
+ false,
191
+ ),
192
+ "record-answer": object(
193
+ {
194
+ question: text(8192, false),
195
+ answer: object(
196
+ {
197
+ selected_options: array(string(2048, false), 64, false),
198
+ custom_input: { ...text(4096, false), nullable: true },
199
+ },
200
+ false,
201
+ ),
202
+ },
203
+ false,
204
+ ),
205
+ "apply-round-result": result,
206
+ };
207
+
208
+ export function deepInterviewDraftSchema(kind: DeepInterviewDraftKind): DraftObjectDescriptor {
209
+ return DRAFT_SCHEMAS[kind];
210
+ }
211
+
212
+ /** Shared strict payload decoders used by compatibility JSON and CLI-owned drafts. */
213
+ export function decodeInitializeContextPayload(payload: unknown): Record<string, unknown> {
214
+ return decodeDeepInterviewSetupJson(payload);
215
+ }
216
+
217
+ export function decodeConfirmTopologyPayload(payload: unknown): Record<string, unknown> {
218
+ return decodeDeepInterviewTopologyJson(payload);
219
+ }
220
+
221
+ export function decodeRecordAnswerPayload(payload: unknown): {
222
+ question: string;
223
+ answer: { selected_options: string[]; custom_input: string | null };
224
+ } {
225
+ const input = asRecord(payload);
226
+ if (Object.keys(input).some(key => key !== "question" && key !== "answer")) throw new Error("DI_INVALID_INPUT_JSON");
227
+ if (typeof input.question !== "string") throw new Error("DI_INVALID_QUESTION_JSON");
228
+ return { question: input.question, answer: decodeDeepInterviewAnswerJson(input.answer) };
229
+ }
230
+
231
+ export function decodeApplyRoundResultPayload(
232
+ payload: unknown,
233
+ state: Record<string, unknown>,
234
+ ): DeepInterviewRoundResultV1 {
235
+ return decodeDeepInterviewRoundResultJson(payload, state);
236
+ }
237
+
238
+ export function validateDraftPayload(
239
+ kind: DeepInterviewDraftKind,
240
+ payload: unknown,
241
+ state: Record<string, unknown> = {},
242
+ ): void {
243
+ switch (kind) {
244
+ case "initialize-context":
245
+ decodeInitializeContextPayload(payload);
246
+ return;
247
+ case "confirm-topology":
248
+ decodeConfirmTopologyPayload(payload);
249
+ return;
250
+ case "record-answer":
251
+ decodeRecordAnswerPayload(payload);
252
+ return;
253
+ case "apply-round-result":
254
+ decodeApplyRoundResultPayload(payload, state);
255
+ }
256
+ }
257
+
258
+ function asRecord(value: unknown): Record<string, unknown> {
259
+ if (!value || typeof value !== "object" || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype)
260
+ throw new Error("DI_INVALID_INPUT_JSON");
261
+ return value as Record<string, unknown>;
262
+ }