@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.
- package/CHANGELOG.md +35 -1
- package/dist/types/cli.d.ts +1 -0
- package/dist/types/config/model-profiles.d.ts +2 -3
- package/dist/types/config/model-registry.d.ts +2 -0
- package/dist/types/gjc-runtime/deep-interview-ambiguity.d.ts +12 -5
- package/dist/types/gjc-runtime/deep-interview-draft.d.ts +8 -0
- package/dist/types/gjc-runtime/deep-interview-payload.d.ts +41 -0
- package/dist/types/gjc-runtime/deep-interview-recorder.d.ts +32 -17
- package/dist/types/gjc-runtime/deep-interview-repair.d.ts +17 -0
- package/dist/types/gjc-runtime/deep-interview-state.d.ts +135 -4
- package/dist/types/gjc-runtime/state-writer.d.ts +45 -0
- package/dist/types/gjc-runtime/workflow-manifest.d.ts +5 -3
- package/dist/types/modes/components/welcome.d.ts +2 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +16 -8
- package/dist/types/runtime-mcp/redaction.d.ts +2 -0
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +3 -1
- package/dist/types/sdk/bus/daemon-paths.d.ts +1 -0
- package/dist/types/sdk/bus/index.d.ts +8 -1
- package/dist/types/sdk/bus/operator-runtime.d.ts +1 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +14 -7
- package/dist/types/sdk/bus/telegram-daemon.d.ts +74 -5
- package/dist/types/sdk/session.d.ts +7 -0
- package/dist/types/session/agent-session.d.ts +2 -0
- package/dist/types/session/internal/managed-session-scope.d.ts +13 -3
- package/dist/types/session/internal/managed-session-storage.d.ts +8 -3
- package/dist/types/session/session-manager.d.ts +5 -1
- package/dist/types/session/session-storage.d.ts +13 -0
- package/dist/types/skill-state/active-state.d.ts +4 -0
- package/dist/types/task/provider-retry-status.d.ts +13 -0
- package/dist/types/task/types.d.ts +3 -0
- package/dist/types/tools/index.d.ts +3 -1
- package/package.json +8 -8
- package/scripts/generate-sdk-operation-inventory.ts +1 -0
- package/src/cli/mcp-cli.ts +4 -21
- package/src/cli/notify-cli.ts +1 -0
- package/src/cli.ts +32 -0
- package/src/commands/deep-interview.ts +9 -4
- package/src/commit/agentic/index.ts +3 -3
- package/src/commit/map-reduce/index.ts +2 -2
- package/src/config/model-profiles.ts +9 -10
- package/src/config/model-registry.ts +4 -2
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +78 -163
- package/src/eval/js/tool-bridge.ts +1 -1
- package/src/gjc-runtime/deep-interview-ambiguity.ts +68 -47
- package/src/gjc-runtime/deep-interview-draft.ts +843 -0
- package/src/gjc-runtime/deep-interview-payload.ts +262 -0
- package/src/gjc-runtime/deep-interview-recorder.ts +310 -227
- package/src/gjc-runtime/deep-interview-repair.ts +1674 -0
- package/src/gjc-runtime/deep-interview-runtime.ts +264 -103
- package/src/gjc-runtime/deep-interview-state.ts +916 -4
- package/src/gjc-runtime/ralplan-runtime.ts +3 -1
- package/src/gjc-runtime/state-writer.ts +166 -2
- package/src/gjc-runtime/workflow-manifest.generated.json +386 -1
- package/src/gjc-runtime/workflow-manifest.ts +191 -5
- package/src/hooks/skill-state.ts +23 -1
- package/src/internal-urls/docs-index.generated.ts +6 -5
- package/src/modes/components/welcome.ts +10 -2
- package/src/modes/controllers/selector-controller.ts +38 -8
- package/src/modes/interactive-mode.ts +29 -9
- package/src/prompts/agent-fragments/restricted-bash.md +1 -1
- package/src/prompts/agents/architect.md +8 -1
- package/src/prompts/agents/critic.md +8 -1
- package/src/prompts/agents/planner.md +8 -1
- package/src/prompts/system/system-prompt.md +1 -0
- package/src/runtime-mcp/json-rpc.ts +7 -4
- package/src/runtime-mcp/redaction.ts +30 -0
- package/src/sdk/broker/identity.ts +22 -12
- package/src/sdk/broker/session-index.ts +11 -1
- package/src/sdk/bus/chat-daemon-control.ts +5 -3
- package/src/sdk/bus/daemon-paths.ts +2 -0
- package/src/sdk/bus/index.ts +60 -5
- package/src/sdk/bus/notification-service.ts +19 -5
- package/src/sdk/bus/operator-runtime.ts +31 -5
- package/src/sdk/bus/telegram-cli.ts +6 -13
- package/src/sdk/bus/telegram-daemon-cli.ts +8 -3
- package/src/sdk/bus/telegram-daemon-contract.ts +15 -7
- package/src/sdk/bus/telegram-daemon-control.ts +14 -5
- package/src/sdk/bus/telegram-daemon.ts +685 -120
- package/src/sdk/protocol/operation-inventory.generated.json +11 -0
- package/src/sdk/session.ts +12 -0
- package/src/session/agent-session.ts +140 -10
- package/src/session/internal/managed-session-scope.ts +339 -228
- package/src/session/internal/managed-session-storage.ts +17 -4
- package/src/session/session-manager.ts +96 -33
- package/src/session/session-storage.ts +23 -0
- package/src/skill-state/active-state.ts +10 -0
- package/src/skill-state/workflow-mutation-guard.ts +41 -7
- package/src/task/executor.ts +154 -44
- package/src/task/provider-retry-status.ts +88 -0
- package/src/task/render.ts +45 -26
- package/src/task/types.ts +3 -0
- package/src/tools/ask.ts +1 -0
- package/src/tools/bash-allowed-prefixes.ts +45 -1
- package/src/tools/index.ts +3 -1
- package/src/tools/subagent-render.ts +74 -16
- package/src/tools/subagent.ts +2 -0
- package/vendor/insane-search/MANIFEST.json +4 -1
- package/vendor/insane-search/engine/bias_check.py +5 -0
- package/vendor/insane-search/engine/fetch_chain.py +67 -1
- package/vendor/insane-search/engine/transport.py +13 -2
- package/vendor/insane-search/engine/validators.py +4 -1
|
@@ -25,14 +25,6 @@ import {
|
|
|
25
25
|
* (no filesystem, no state-writer, no CLI runtime) so every writer can apply it.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
// =============================================================================
|
|
29
|
-
// Weights (mirrors the Ouroboros deterministic_floor coefficients)
|
|
30
|
-
// =============================================================================
|
|
31
|
-
|
|
32
|
-
const DISPUTED_FACT_WEIGHT = 0.1;
|
|
33
|
-
const UNSCORED_COMPONENT_WEIGHT = 0.05;
|
|
34
|
-
const AUTO_ANSWER_DILUTION_WEIGHT = 0.05;
|
|
35
|
-
|
|
36
28
|
const CORE_CLARITY_DIMENSIONS = ["goal", "constraints", "criteria"] as const;
|
|
37
29
|
|
|
38
30
|
export interface AmbiguityFloorBreakdown {
|
|
@@ -59,64 +51,57 @@ function asArray(value: unknown): unknown[] {
|
|
|
59
51
|
return Array.isArray(value) ? value : [];
|
|
60
52
|
}
|
|
61
53
|
|
|
62
|
-
|
|
63
|
-
return Math.round(value * 100) / 100;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** A disputed fact contributes pressure until it is resolved via `superseded_by` or re-confirmation. */
|
|
54
|
+
/** A disputed fact contributes pressure until it is resolved or superseded. */
|
|
67
55
|
function isUnresolvedDisputedFact(value: unknown): boolean {
|
|
68
56
|
if (!isPlainObject(value)) return false;
|
|
69
|
-
const fact = value as Partial<DeepInterviewEstablishedFact
|
|
70
|
-
if (fact.disputed !== true) return false;
|
|
57
|
+
const fact = value as Partial<DeepInterviewEstablishedFact> & { status?: unknown };
|
|
58
|
+
if (fact.disputed !== true && fact.status !== "disputed") return false;
|
|
71
59
|
return typeof fact.superseded_by !== "string" || fact.superseded_by.trim() === "";
|
|
72
60
|
}
|
|
73
61
|
|
|
74
62
|
/**
|
|
75
63
|
* An active component is unscored while any core clarity dimension lacks a finite
|
|
76
|
-
* numeric score. Deferred
|
|
77
|
-
* and the gate only arms once the topology was explicitly confirmed in Round 0.
|
|
64
|
+
* numeric score. Deferred and inactive components are outside ambiguity math.
|
|
78
65
|
*/
|
|
79
66
|
function countUnscoredActiveComponents(topology: unknown): number {
|
|
80
67
|
if (!isPlainObject(topology) || topology.status !== "confirmed") return 0;
|
|
81
68
|
let unscored = 0;
|
|
82
69
|
for (const component of asArray(topology.components)) {
|
|
83
|
-
if (!isPlainObject(component) || component.status === "deferred") continue;
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (
|
|
70
|
+
if (!isPlainObject(component) || component.status === "deferred" || component.active === false) continue;
|
|
71
|
+
const scores = isPlainObject(component.scores)
|
|
72
|
+
? component.scores
|
|
73
|
+
: isPlainObject(component.clarity_scores)
|
|
74
|
+
? component.clarity_scores
|
|
75
|
+
: {};
|
|
76
|
+
if (
|
|
77
|
+
CORE_CLARITY_DIMENSIONS.some(dimension => {
|
|
78
|
+
const score = scores[dimension];
|
|
79
|
+
return typeof score !== "number" || !Number.isFinite(score);
|
|
80
|
+
})
|
|
81
|
+
) {
|
|
82
|
+
unscored += 1;
|
|
83
|
+
}
|
|
90
84
|
}
|
|
91
85
|
return unscored;
|
|
92
86
|
}
|
|
93
87
|
|
|
94
|
-
|
|
95
|
-
const autoAnswered = asArray(inner.auto_answered_rounds).length;
|
|
96
|
-
if (autoAnswered === 0) return 0;
|
|
97
|
-
const scored = asArray(inner.rounds).filter(round => isPlainObject(round) && round.lifecycle === "scored").length;
|
|
98
|
-
return Math.min(1, autoAnswered / Math.max(scored, 1));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// =============================================================================
|
|
102
|
-
// Floor computation + clamping
|
|
103
|
-
// =============================================================================
|
|
104
|
-
|
|
105
|
-
/** Compute the deterministic floor from the inner deep-interview `state` object. */
|
|
88
|
+
/** Compute the deterministic floor from integer units of persisted evidence. */
|
|
106
89
|
export function computeAmbiguityFloor(inner: unknown): AmbiguityFloorBreakdown {
|
|
107
90
|
const state = isPlainObject(inner) ? inner : {};
|
|
108
91
|
const disputedFactCount = asArray(state.established_facts).filter(isUnresolvedDisputedFact).length;
|
|
109
92
|
const unscoredActiveComponentCount = countUnscoredActiveComponents(state.topology);
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
93
|
+
const scored = asArray(state.rounds).filter(round => isPlainObject(round) && round.lifecycle === "scored").length;
|
|
94
|
+
const autoAnswered = new Set(asArray(state.auto_answered_rounds).map(value => JSON.stringify(value))).size;
|
|
95
|
+
const ratioUnits = scored === 0 ? 0 : Math.min(10_000, Math.floor((autoAnswered * 10_000) / scored));
|
|
96
|
+
const floorUnits = Math.min(
|
|
97
|
+
10_000,
|
|
98
|
+
disputedFactCount * 1_000 + unscoredActiveComponentCount * 500 + Math.floor(ratioUnits / 20),
|
|
99
|
+
);
|
|
115
100
|
return {
|
|
116
|
-
floor:
|
|
101
|
+
floor: floorUnits / 10_000,
|
|
117
102
|
disputed_fact_count: disputedFactCount,
|
|
118
103
|
unscored_active_component_count: unscoredActiveComponentCount,
|
|
119
|
-
auto_answer_ratio:
|
|
104
|
+
auto_answer_ratio: ratioUnits / 10_000,
|
|
120
105
|
};
|
|
121
106
|
}
|
|
122
107
|
|
|
@@ -128,10 +113,8 @@ export function clampReportedAmbiguity(reported: number, floor: number): Ambigui
|
|
|
128
113
|
}
|
|
129
114
|
|
|
130
115
|
/**
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* already-scored answer (A -> B pivot), the facts that answer established can no
|
|
134
|
-
* longer be trusted, so they raise the floor until re-confirmed or superseded.
|
|
116
|
+
* Legacy pure utility for migrations and explicit repair flows. The recorder does
|
|
117
|
+
* not dispute facts when an answer is retracted: scored evidence is immutable.
|
|
135
118
|
* Returns new arrays/objects; never mutates the input.
|
|
136
119
|
*/
|
|
137
120
|
export function disputeFactsFromRetractedRound(
|
|
@@ -204,3 +187,41 @@ export function applyAmbiguityFloorToEnvelope(value: unknown): AppliedAmbiguityF
|
|
|
204
187
|
inner.ambiguity_floor = breakdown;
|
|
205
188
|
return { envelope: { ...envelope, state: inner }, breakdown, clamped };
|
|
206
189
|
}
|
|
190
|
+
export type DeepInterviewAmbiguityMilestone = "initial" | "progress" | "refined" | "ready";
|
|
191
|
+
|
|
192
|
+
export function deriveAmbiguityMilestone(
|
|
193
|
+
effectiveUnits: number,
|
|
194
|
+
thresholdUnits: number,
|
|
195
|
+
): DeepInterviewAmbiguityMilestone {
|
|
196
|
+
if (!Number.isSafeInteger(effectiveUnits) || effectiveUnits < 0 || effectiveUnits > 10_000) {
|
|
197
|
+
throw new RangeError("effective ambiguity units must be an integer from 0 to 10000");
|
|
198
|
+
}
|
|
199
|
+
if (!Number.isSafeInteger(thresholdUnits) || thresholdUnits < 1 || thresholdUnits > 10_000) {
|
|
200
|
+
throw new RangeError("threshold units must be an integer from 1 to 10000");
|
|
201
|
+
}
|
|
202
|
+
if (effectiveUnits <= thresholdUnits) return "ready";
|
|
203
|
+
if (effectiveUnits > 6_000) return "initial";
|
|
204
|
+
if (effectiveUnits > 3_000) return "progress";
|
|
205
|
+
return "refined";
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export function scoreToUnits(score: number): number {
|
|
209
|
+
if (!Number.isFinite(score) || score < 0 || score > 1) throw new RangeError("score must be finite in [0, 1]");
|
|
210
|
+
const units = score * 10_000;
|
|
211
|
+
if (!Number.isSafeInteger(units)) throw new RangeError("score must be expressed in integral 1e-4 units");
|
|
212
|
+
return units;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export function weightedAmbiguityUnits(
|
|
216
|
+
scores: { goal: number; constraints: number; criteria: number; context?: number },
|
|
217
|
+
type: "greenfield" | "brownfield",
|
|
218
|
+
): number {
|
|
219
|
+
const goal = scoreToUnits(scores.goal);
|
|
220
|
+
const constraints = scoreToUnits(scores.constraints);
|
|
221
|
+
const criteria = scoreToUnits(scores.criteria);
|
|
222
|
+
const numerator =
|
|
223
|
+
type === "brownfield"
|
|
224
|
+
? 35 * goal + 25 * constraints + 25 * criteria + 15 * scoreToUnits(scores.context ?? Number.NaN)
|
|
225
|
+
: 40 * goal + 30 * constraints + 30 * criteria;
|
|
226
|
+
return 10_000 - Math.floor(numerator / 100 + 0.5);
|
|
227
|
+
}
|