@gajae-code/coding-agent 0.11.10 → 0.11.11
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 +38 -0
- package/dist/types/cli.d.ts +8 -1
- package/dist/types/config/model-profile-activation.d.ts +1 -0
- package/dist/types/config/model-profile-contract.d.ts +2 -0
- package/dist/types/config/settings-schema.d.ts +57 -2
- package/dist/types/config/settings.d.ts +1 -0
- package/dist/types/extensibility/extensions/types.d.ts +21 -0
- package/dist/types/gjc-runtime/linux-proc.d.ts +22 -14
- package/dist/types/gjc-runtime/ralplan-runtime.d.ts +60 -0
- package/dist/types/gjc-runtime/state-runtime.d.ts +3 -1
- package/dist/types/modes/acp/acp-agent.d.ts +14 -9
- package/dist/types/modes/components/queue-pane.d.ts +8 -0
- package/dist/types/modes/components/queued-message-selector.d.ts +6 -0
- package/dist/types/modes/components/welcome.d.ts +1 -0
- package/dist/types/modes/interactive-mode.d.ts +5 -1
- package/dist/types/runtime/memory-domain.d.ts +9 -0
- package/dist/types/runtime/memory-guard-contract.d.ts +71 -0
- package/dist/types/runtime/memory-guard.d.ts +39 -0
- package/dist/types/runtime/memory-limit.d.ts +11 -0
- package/dist/types/runtime-mcp/manager.d.ts +8 -0
- package/dist/types/sdk/acp/final-text.d.ts +19 -0
- package/dist/types/sdk/acp/mcp.d.ts +23 -0
- package/dist/types/sdk/broker/lifecycle.d.ts +2 -0
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +2 -1
- package/dist/types/sdk/bus/index.d.ts +3 -1
- package/dist/types/sdk/bus/rate-limit-pool.d.ts +2 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +6 -4
- package/dist/types/sdk/bus/telegram-daemon.d.ts +23 -3
- package/dist/types/sdk/host/control/operations.d.ts +1 -0
- package/dist/types/sdk/lifecycle-session.d.ts +10 -1
- package/dist/types/sdk/startup-capability.d.ts +6 -0
- package/dist/types/session/agent-session.d.ts +9 -11
- package/dist/types/session/fallback-chain-controller.d.ts +18 -2
- package/dist/types/session/internal/managed-session-scope.d.ts +27 -0
- package/dist/types/session/session-manager.d.ts +34 -0
- package/dist/types/task/executor.d.ts +6 -0
- package/dist/types/task/types.d.ts +36 -0
- package/dist/types/task/ultragoal-redteam-activation.d.ts +33 -0
- package/dist/types/tools/resource-gc.d.ts +19 -0
- package/package.json +8 -8
- package/scripts/generate-sdk-operation-inventory.ts +2 -0
- package/scripts/run-test-manifest.ts +6 -4
- package/src/cli/args.ts +14 -8
- package/src/cli/fast-help.ts +1 -1
- package/src/cli.ts +48 -2
- package/src/commands/sdk.ts +91 -7
- package/src/config/model-profile-activation.ts +1 -0
- package/src/config/model-profile-contract.ts +13 -0
- package/src/config/model-profiles.ts +24 -0
- package/src/config/settings-schema.ts +61 -2
- package/src/config/settings.ts +8 -0
- package/src/defaults/gjc/skills/ralplan/SKILL.md +21 -2
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +1 -1
- package/src/extensibility/extensions/runner.ts +4 -0
- package/src/extensibility/extensions/types.ts +14 -0
- package/src/gjc-runtime/deep-interview-ambiguity.ts +16 -2
- package/src/gjc-runtime/deep-interview-state.ts +25 -3
- package/src/gjc-runtime/linux-proc.ts +70 -36
- package/src/gjc-runtime/ralplan-runtime.ts +252 -1
- package/src/gjc-runtime/state-runtime.ts +48 -11
- package/src/internal-urls/docs-index.generated.ts +4 -4
- package/src/internal-urls/local-protocol.ts +23 -4
- package/src/modes/acp/acp-agent.ts +554 -60
- package/src/modes/acp/acp-event-mapper.ts +93 -6
- package/src/modes/components/model-selector.ts +15 -1
- package/src/modes/components/notifications-settings-editor.ts +1 -1
- package/src/modes/components/queue-pane.ts +55 -9
- package/src/modes/components/queued-message-selector.ts +53 -10
- package/src/modes/components/tool-status-header.ts +1 -4
- package/src/modes/components/welcome.ts +18 -3
- package/src/modes/controllers/command-controller.ts +4 -0
- package/src/modes/controllers/extension-ui-controller.ts +4 -10
- package/src/modes/controllers/input-controller.ts +44 -3
- package/src/modes/interactive-mode.ts +65 -26
- package/src/modes/runtime-init.ts +1 -0
- package/src/prompts/agents/executor.md +1 -1
- package/src/runtime/memory-domain.ts +66 -0
- package/src/runtime/memory-guard-contract.ts +73 -0
- package/src/runtime/memory-guard.ts +292 -0
- package/src/runtime/memory-limit.ts +50 -0
- package/src/runtime-mcp/manager.ts +26 -6
- package/src/sdk/acp/adapter.ts +8 -1
- package/src/sdk/acp/final-text.ts +40 -0
- package/src/sdk/acp/mcp.ts +26 -0
- package/src/sdk/broker/lifecycle.ts +82 -1
- package/src/sdk/bus/chat-daemon-cli.ts +2 -2
- package/src/sdk/bus/chat-daemon-control.ts +4 -3
- package/src/sdk/bus/config.ts +1 -1
- package/src/sdk/bus/index.ts +162 -22
- package/src/sdk/bus/rate-limit-pool.ts +8 -0
- package/src/sdk/bus/telegram-daemon-contract.ts +6 -4
- package/src/sdk/bus/telegram-daemon.ts +531 -53
- package/src/sdk/host/control/dispatch.ts +2 -0
- package/src/sdk/host/control/operations.ts +1 -0
- package/src/sdk/host/host.ts +2 -2
- package/src/sdk/lifecycle-session.ts +19 -3
- package/src/sdk/protocol/operation-inventory.generated.json +47 -0
- package/src/sdk/protocol/operation-registry.ts +1 -0
- package/src/sdk/session.ts +12 -1
- package/src/sdk/startup-capability.ts +6 -0
- package/src/session/agent-session.ts +256 -142
- package/src/session/fallback-chain-controller.ts +47 -8
- package/src/session/internal/managed-session-scope.ts +40 -10
- package/src/session/internal/native-publish-outcome.ts +8 -3
- package/src/session/session-manager.ts +608 -25
- package/src/task/executor.ts +11 -3
- package/src/task/index.ts +2 -0
- package/src/task/types.ts +22 -11
- package/src/task/ultragoal-redteam-activation.ts +75 -0
- package/src/tools/resource-gc.ts +496 -120
- package/src/workflow/workflow-intent-diff.ts +4 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
+
// Subpath import keeps this module native-free for the gjc-state-gates shards:
|
|
5
|
+
// the package barrel pulls procmgr/ptree → @gajae-code/natives.
|
|
6
|
+
import * as logger from "@gajae-code/utils/logger";
|
|
4
7
|
import type { WorkflowHudSummary } from "../skill-state/active-state";
|
|
5
8
|
import {
|
|
6
9
|
applyHandoffToActiveState,
|
|
@@ -265,7 +268,21 @@ async function describeStaleClearState(
|
|
|
265
268
|
return undefined;
|
|
266
269
|
}
|
|
267
270
|
|
|
268
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Route a workflow-state warning through the TUI-safe centralized file logger
|
|
273
|
+
* (console transport off by default) so interactive sessions never paint raw
|
|
274
|
+
* bytes into the alternate-screen stream (#3002). CLI command handlers may also
|
|
275
|
+
* collect the warning via an `onWarning` sink to surface it on the structured
|
|
276
|
+
* {@link StateCommandResult.stderr} channel, so `gjc state` automation still
|
|
277
|
+
* distinguishes corrupt state from absent state.
|
|
278
|
+
*/
|
|
279
|
+
function emitStateWarning(warning: string, context?: Record<string, unknown>): void {
|
|
280
|
+
logger.warn(warning, context);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
type StateWarningSink = (warning: string) => void;
|
|
284
|
+
|
|
285
|
+
async function readJsonFile(filePath: string, onWarning?: StateWarningSink): Promise<Record<string, unknown> | null> {
|
|
269
286
|
try {
|
|
270
287
|
const raw = await fs.readFile(filePath, "utf-8");
|
|
271
288
|
const parsed = JSON.parse(raw);
|
|
@@ -276,18 +293,22 @@ async function readJsonFile(filePath: string): Promise<Record<string, unknown> |
|
|
|
276
293
|
} catch (error) {
|
|
277
294
|
const err = error as NodeJS.ErrnoException;
|
|
278
295
|
if (err.code === "ENOENT") return null;
|
|
279
|
-
|
|
296
|
+
const warning = `WARNING: failed to read ${filePath}; ignoring corrupt state: ${err.message}`;
|
|
297
|
+
emitStateWarning(warning, { filePath, error: err.message });
|
|
298
|
+
onWarning?.(warning);
|
|
280
299
|
return null;
|
|
281
300
|
}
|
|
282
301
|
}
|
|
283
302
|
|
|
284
|
-
async function readJsonValue(filePath: string): Promise<unknown | null> {
|
|
303
|
+
async function readJsonValue(filePath: string, onWarning?: StateWarningSink): Promise<unknown | null> {
|
|
285
304
|
try {
|
|
286
305
|
return JSON.parse(await fs.readFile(filePath, "utf-8"));
|
|
287
306
|
} catch (error) {
|
|
288
307
|
const err = error as NodeJS.ErrnoException;
|
|
289
308
|
if (err.code === "ENOENT") return null;
|
|
290
|
-
|
|
309
|
+
const warning = `WARNING: failed to read ${filePath}; ignoring corrupt state: ${err.message}`;
|
|
310
|
+
emitStateWarning(warning, { filePath, error: err.message });
|
|
311
|
+
onWarning?.(warning);
|
|
291
312
|
return null;
|
|
292
313
|
}
|
|
293
314
|
}
|
|
@@ -1101,21 +1122,30 @@ export async function readWorkflowStateJson(
|
|
|
1101
1122
|
cwd: string,
|
|
1102
1123
|
skill: CanonicalGjcWorkflowSkill,
|
|
1103
1124
|
sessionId?: string,
|
|
1125
|
+
onWarning?: StateWarningSink,
|
|
1104
1126
|
): Promise<Record<string, unknown>> {
|
|
1105
1127
|
const session = await resolveGjcSessionForRead(cwd, {
|
|
1106
1128
|
payloadSessionId: sessionId,
|
|
1107
1129
|
envSessionId: process.env.GJC_SESSION_ID,
|
|
1108
1130
|
});
|
|
1109
|
-
return (await readJsonFile(modeStateFile(cwd, skill, session.gjcSessionId))) ?? {};
|
|
1131
|
+
return (await readJsonFile(modeStateFile(cwd, skill, session.gjcSessionId), onWarning)) ?? {};
|
|
1110
1132
|
}
|
|
1111
1133
|
|
|
1112
1134
|
async function handleRead(args: readonly string[], cwd: string): Promise<StateCommandResult> {
|
|
1113
1135
|
const selectors = await resolveSelectors(args, cwd, "read");
|
|
1114
1136
|
const mode = selectors.mode ?? (await inferModeFromActiveState(cwd, selectors.gjcSessionId));
|
|
1115
1137
|
const fields = parseFieldsFlag(args);
|
|
1138
|
+
// Corrupt-state warnings are TUI-safe file-logged inside the readers; the CLI
|
|
1139
|
+
// path also surfaces them on the command result so `gjc state read`
|
|
1140
|
+
// automation can tell corrupt state from absent state (#3002).
|
|
1141
|
+
const warnings: string[] = [];
|
|
1142
|
+
const warningStderr = (): Pick<StateCommandResult, "stderr"> =>
|
|
1143
|
+
warnings.length ? { stderr: warnings.map(warning => `${warning}\n`).join("") } : {};
|
|
1116
1144
|
if (mode) {
|
|
1117
1145
|
const filePath = modeStateFile(cwd, mode, selectors.gjcSessionId);
|
|
1118
|
-
const existing = await readWorkflowStateJson(cwd, mode, selectors.gjcSessionId
|
|
1146
|
+
const existing = await readWorkflowStateJson(cwd, mode, selectors.gjcSessionId, warning =>
|
|
1147
|
+
warnings.push(warning),
|
|
1148
|
+
);
|
|
1119
1149
|
const envelope = { skill: mode, state: existing, storage_path: filePath };
|
|
1120
1150
|
const manifest = getSkillManifest(mode);
|
|
1121
1151
|
if (fields) {
|
|
@@ -1125,6 +1155,7 @@ async function handleRead(args: readonly string[], cwd: string): Promise<StateCo
|
|
|
1125
1155
|
stdout: hasFlag(args, "--json")
|
|
1126
1156
|
? `${JSON.stringify(projected, null, 2)}\n`
|
|
1127
1157
|
: renderStateMarkdown(mode, projected, manifest),
|
|
1158
|
+
...warningStderr(),
|
|
1128
1159
|
};
|
|
1129
1160
|
}
|
|
1130
1161
|
if (hasFlag(args, "--compact")) {
|
|
@@ -1134,6 +1165,7 @@ async function handleRead(args: readonly string[], cwd: string): Promise<StateCo
|
|
|
1134
1165
|
stdout: hasFlag(args, "--json")
|
|
1135
1166
|
? `${JSON.stringify(compact, null, 2)}\n`
|
|
1136
1167
|
: renderStateMarkdown(mode, envelope, manifest),
|
|
1168
|
+
...warningStderr(),
|
|
1137
1169
|
};
|
|
1138
1170
|
}
|
|
1139
1171
|
return {
|
|
@@ -1141,12 +1173,13 @@ async function handleRead(args: readonly string[], cwd: string): Promise<StateCo
|
|
|
1141
1173
|
stdout: hasFlag(args, "--json")
|
|
1142
1174
|
? `${JSON.stringify(envelope, null, 2)}\n`
|
|
1143
1175
|
: renderStateMarkdown(mode, envelope, manifest),
|
|
1176
|
+
...warningStderr(),
|
|
1144
1177
|
};
|
|
1145
1178
|
}
|
|
1146
1179
|
const filePath = activeStateFile(cwd, selectors.gjcSessionId);
|
|
1147
|
-
const existingRaw = await readJsonValue(filePath);
|
|
1180
|
+
const existingRaw = await readJsonValue(filePath, warning => warnings.push(warning));
|
|
1148
1181
|
const existing = isPlainObject(existingRaw) ? existingRaw : null;
|
|
1149
|
-
return { status: 0, stdout: `${JSON.stringify(existing ?? {}, null, 2)}\n
|
|
1182
|
+
return { status: 0, stdout: `${JSON.stringify(existing ?? {}, null, 2)}\n`, ...warningStderr() };
|
|
1150
1183
|
}
|
|
1151
1184
|
|
|
1152
1185
|
async function handleStatus(args: readonly string[], cwd: string): Promise<StateCommandResult> {
|
|
@@ -1159,7 +1192,8 @@ async function handleStatus(args: readonly string[], cwd: string): Promise<State
|
|
|
1159
1192
|
);
|
|
1160
1193
|
}
|
|
1161
1194
|
const filePath = modeStateFile(cwd, mode, selectors.gjcSessionId);
|
|
1162
|
-
const
|
|
1195
|
+
const warnings: string[] = [];
|
|
1196
|
+
const existing = await readWorkflowStateJson(cwd, mode, selectors.gjcSessionId, warning => warnings.push(warning));
|
|
1163
1197
|
const summary = buildStateStatusSummary(
|
|
1164
1198
|
mode,
|
|
1165
1199
|
{ skill: mode, state: existing, storage_path: filePath },
|
|
@@ -1169,6 +1203,7 @@ async function handleStatus(args: readonly string[], cwd: string): Promise<State
|
|
|
1169
1203
|
return {
|
|
1170
1204
|
status: 0,
|
|
1171
1205
|
stdout: hasFlag(args, "--json") ? `${JSON.stringify(summary, null, 2)}\n` : renderStateStatusLine(summary),
|
|
1206
|
+
...(warnings.length ? { stderr: warnings.map(warning => `${warning}\n`).join("") } : {}),
|
|
1172
1207
|
};
|
|
1173
1208
|
}
|
|
1174
1209
|
|
|
@@ -1603,7 +1638,7 @@ async function handleHandoffUnlocked(args: readonly string[], cwd: string): Prom
|
|
|
1603
1638
|
toPhase: "handoff",
|
|
1604
1639
|
});
|
|
1605
1640
|
await updateWorkflowTransactionJournal(cwd, sessionId, mutationId, { steps: ["caller-mode-state"] });
|
|
1606
|
-
if (callerWrite.warning)
|
|
1641
|
+
if (callerWrite.warning) emitStateWarning(callerWrite.warning);
|
|
1607
1642
|
const stampedCallerReceipt = isPlainObject(callerWrite.stamped.receipt) ? callerWrite.stamped.receipt : {};
|
|
1608
1643
|
await syncSkillActiveState({
|
|
1609
1644
|
cwd,
|
|
@@ -1646,6 +1681,7 @@ async function handleHandoffUnlocked(args: readonly string[], cwd: string): Prom
|
|
|
1646
1681
|
active_state: activeStateFile(cwd, sessionId),
|
|
1647
1682
|
},
|
|
1648
1683
|
}),
|
|
1684
|
+
...(callerWrite.warning ? { stderr: `${callerWrite.warning}\n` } : {}),
|
|
1649
1685
|
};
|
|
1650
1686
|
}
|
|
1651
1687
|
|
|
@@ -1746,7 +1782,7 @@ async function handleHandoffUnlocked(args: readonly string[], cwd: string): Prom
|
|
|
1746
1782
|
);
|
|
1747
1783
|
const stampedCallerReceipt = isPlainObject(callerWrite.stamped.receipt) ? callerWrite.stamped.receipt : {};
|
|
1748
1784
|
const stampedCalleeReceipt = isPlainObject(calleeWrite.stamped.receipt) ? calleeWrite.stamped.receipt : {};
|
|
1749
|
-
for (const warning of warnings)
|
|
1785
|
+
for (const warning of warnings) emitStateWarning(warning);
|
|
1750
1786
|
if (process.env.GJC_STATE_HANDOFF_FAIL_AFTER_CALLER === mutationId) {
|
|
1751
1787
|
throw new StateCommandError(1, `injected handoff failure after caller write for ${mutationId}`);
|
|
1752
1788
|
}
|
|
@@ -1818,6 +1854,7 @@ async function handleHandoffUnlocked(args: readonly string[], cwd: string): Prom
|
|
|
1818
1854
|
active_state: activeStateFile(cwd, sessionId),
|
|
1819
1855
|
},
|
|
1820
1856
|
}),
|
|
1857
|
+
...(warnings.length ? { stderr: warnings.map(warning => `${warning}\n`).join("") } : {}),
|
|
1821
1858
|
};
|
|
1822
1859
|
}
|
|
1823
1860
|
|