@gajae-code/coding-agent 0.12.0 → 0.12.2
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 +111 -0
- package/dist/types/async/job-manager.d.ts +17 -3
- package/dist/types/config/settings-schema.d.ts +56 -2
- package/dist/types/exa/mcp-client.d.ts +10 -1
- package/dist/types/exec/bash-executor.d.ts +45 -12
- package/dist/types/extensibility/extensions/types.d.ts +16 -2
- package/dist/types/extensibility/gjc-plugins/index.d.ts +12 -2
- package/dist/types/extensibility/gjc-plugins/installer.d.ts +63 -7
- package/dist/types/extensibility/gjc-plugins/lifecycle-reconciliation.d.ts +55 -0
- package/dist/types/extensibility/gjc-plugins/lifecycle.d.ts +64 -0
- package/dist/types/extensibility/gjc-plugins/runtime-quarantine.d.ts +67 -0
- package/dist/types/extensibility/gjc-plugins/session-validation.d.ts +3 -1
- package/dist/types/extensibility/gjc-plugins/types.d.ts +124 -0
- package/dist/types/gjc-runtime/launch-tmux.d.ts +1 -0
- package/dist/types/gjc-runtime/ralplan-review-conflicts.d.ts +114 -0
- package/dist/types/gjc-runtime/ralplan-runtime.d.ts +23 -3
- package/dist/types/gjc-runtime/team-launch.d.ts +1 -1
- package/dist/types/gjc-runtime/team-runtime.d.ts +25 -0
- package/dist/types/gjc-runtime/team-worker-heartbeat.d.ts +43 -0
- package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +10 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +37 -80
- package/dist/types/modes/acp/acp-agent.d.ts +2 -19
- package/dist/types/modes/components/gjc-bundle-settings.d.ts +34 -0
- package/dist/types/modes/components/irc-sidebar.d.ts +16 -0
- package/dist/types/modes/components/notifications-settings-editor.d.ts +1 -0
- package/dist/types/modes/components/session-observer-overlay.d.ts +18 -0
- package/dist/types/modes/components/settings-selector.d.ts +9 -0
- package/dist/types/modes/components/status-line/gh.d.ts +5 -0
- package/dist/types/modes/components/transcript-viewer-overlay.d.ts +18 -1
- package/dist/types/modes/controllers/command-controller.d.ts +1 -1
- package/dist/types/modes/controllers/event-controller.d.ts +1 -1
- package/dist/types/modes/controllers/extension-ui-controller.d.ts +2 -1
- package/dist/types/modes/controllers/selector-controller.d.ts +1 -1
- package/dist/types/modes/interactive-mode.d.ts +9 -0
- package/dist/types/modes/theme/theme.d.ts +3 -1
- package/dist/types/modes/types.d.ts +32 -0
- package/dist/types/reminders/star-reminder.d.ts +3 -13
- package/dist/types/runtime-mcp/manager.d.ts +1 -0
- package/dist/types/sdk/acp/adapter.d.ts +3 -1
- package/dist/types/sdk/broker/transport.d.ts +2 -0
- package/dist/types/sdk/bus/attachment-registry.d.ts +1 -0
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +5 -1
- package/dist/types/sdk/bus/config.d.ts +6 -2
- package/dist/types/sdk/bus/index.d.ts +29 -0
- package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +8 -1
- package/dist/types/sdk/bus/lifecycle-control-runtime.d.ts +4 -0
- package/dist/types/sdk/bus/reconciliation-store.d.ts +7 -3
- package/dist/types/sdk/bus/rich-draft.d.ts +1 -0
- package/dist/types/sdk/bus/rich-render.d.ts +2 -0
- package/dist/types/sdk/bus/telegram-adoption-intent.d.ts +165 -0
- package/dist/types/sdk/bus/telegram-cli.d.ts +12 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +12 -4
- package/dist/types/sdk/bus/telegram-daemon.d.ts +25 -1
- package/dist/types/sdk/bus/telegram-reference.d.ts +11 -1
- package/dist/types/sdk/bus/threaded-render.d.ts +3 -2
- package/dist/types/sdk/bus/topic-registry.d.ts +11 -1
- package/dist/types/sdk/host/query/revision-store.d.ts +2 -0
- package/dist/types/sdk/host/reverse-leases.d.ts +1 -1
- package/dist/types/sdk/prompt-status.d.ts +23 -3
- package/dist/types/sdk/session.d.ts +6 -0
- package/dist/types/session/agent-session.d.ts +40 -2
- package/dist/types/session/artifacts.d.ts +8 -0
- package/dist/types/session/blob-store.d.ts +57 -4
- package/dist/types/session/internal/managed-session-storage.d.ts +30 -4
- package/dist/types/session/session-manager.d.ts +23 -6
- package/dist/types/session/session-storage.d.ts +4 -0
- package/dist/types/session/streaming-output.d.ts +36 -7
- package/dist/types/setup/credential-import.d.ts +12 -0
- package/dist/types/skill-state/active-state.d.ts +12 -0
- package/dist/types/skill-state/workflow-hud.d.ts +6 -0
- package/dist/types/task/executor.d.ts +3 -2
- package/dist/types/task/index.d.ts +7 -1
- package/dist/types/task/output-manager.d.ts +1 -0
- package/dist/types/task/provider-retry-status.d.ts +8 -0
- package/dist/types/task/receipt.d.ts +9 -1
- package/dist/types/task/types.d.ts +23 -0
- package/dist/types/tools/ask-answer-registry.d.ts +2 -2
- package/dist/types/tools/bash-interactive.d.ts +4 -1
- package/dist/types/tools/bash.d.ts +3 -1
- package/dist/types/tools/image-gen.d.ts +4 -0
- package/dist/types/tools/index.d.ts +6 -0
- package/dist/types/tools/output-meta.d.ts +23 -2
- package/dist/types/tools/path-utils.d.ts +1 -0
- package/dist/types/tools/read.d.ts +0 -6
- package/dist/types/tools/review.d.ts +5 -7
- package/dist/types/tools/subagent.d.ts +2 -0
- package/dist/types/utils/gh.d.ts +13 -0
- package/dist/types/utils/image-resize.d.ts +1 -0
- package/dist/types/web/search/providers/kimi.d.ts +2 -0
- package/dist/types/web/search/providers/searxng.d.ts +7 -0
- package/dist/types/web/search/providers/xai.d.ts +2 -0
- package/package.json +10 -8
- package/scripts/acp-conformance-agent.ts +218 -0
- package/scripts/capture-gjc-bundle-settings.ts +306 -0
- package/scripts/dogfood-ralplan-review-conflicts.ts +272 -0
- package/scripts/generate-sdk-operation-inventory.ts +5 -0
- package/scripts/resident-memory-bench.ts +1341 -0
- package/scripts/run-acp-conformance.ts +290 -0
- package/src/async/job-manager.ts +99 -39
- package/src/cli/fast-help.ts +1 -1
- package/src/cli/plugin-cli.ts +176 -18
- package/src/commands/team.ts +19 -1
- package/src/config/file-lock.ts +11 -2
- package/src/config/settings-schema.ts +53 -2
- package/src/coordinator-mcp/question-gate-codec.ts +1 -1
- package/src/coordinator-mcp/server.ts +5 -12
- package/src/debug/index.ts +42 -17
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +1 -0
- package/src/defaults/gjc/skills/ralplan/SKILL.md +25 -20
- package/src/defaults/gjc/skills/team/SKILL.md +2 -0
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +39 -26
- package/src/defaults/gjc/skills/ultragoal/validation-batch-contracts.md +12 -0
- package/src/defaults/gjc-defaults.ts +4 -4
- package/src/exa/mcp-client.ts +12 -3
- package/src/exec/bash-executor.ts +144 -27
- package/src/extensibility/extensions/runner.ts +15 -0
- package/src/extensibility/extensions/types.ts +18 -1
- package/src/extensibility/gjc-plugins/constrained-hooks.ts +8 -2
- package/src/extensibility/gjc-plugins/index.ts +19 -2
- package/src/extensibility/gjc-plugins/installer.ts +189 -50
- package/src/extensibility/gjc-plugins/lifecycle-reconciliation.ts +199 -0
- package/src/extensibility/gjc-plugins/lifecycle.ts +626 -0
- package/src/extensibility/gjc-plugins/observability.ts +3 -3
- package/src/extensibility/gjc-plugins/prompt-appendix.ts +5 -1
- package/src/extensibility/gjc-plugins/runtime-adapters.ts +12 -2
- package/src/extensibility/gjc-plugins/runtime-quarantine.ts +121 -0
- package/src/extensibility/gjc-plugins/schema.ts +84 -12
- package/src/extensibility/gjc-plugins/session-validation.ts +9 -3
- package/src/extensibility/gjc-plugins/types.ts +141 -0
- package/src/extensibility/gjc-plugins/validation.ts +9 -0
- package/src/gjc-runtime/launch-tmux.ts +25 -6
- package/src/gjc-runtime/launch-worktree.ts +103 -1
- package/src/gjc-runtime/ledger-event-renderer.ts +1 -0
- package/src/gjc-runtime/managed-owner-admission.ts +1 -1
- package/src/gjc-runtime/ralplan-review-conflicts.ts +472 -0
- package/src/gjc-runtime/ralplan-runtime.ts +491 -27
- package/src/gjc-runtime/team-launch.ts +8 -0
- package/src/gjc-runtime/team-runtime.ts +140 -32
- package/src/gjc-runtime/team-worker-heartbeat.ts +149 -0
- package/src/gjc-runtime/tmux-owner-isolation.ts +10 -0
- package/src/gjc-runtime/tmux-sessions.ts +58 -13
- package/src/gjc-runtime/ultragoal-evidence.ts +6 -74
- package/src/gjc-runtime/ultragoal-runtime.ts +635 -612
- package/src/gjc-runtime/workflow-manifest.generated.json +37 -99
- package/src/gjc-runtime/workflow-manifest.ts +21 -70
- package/src/internal-urls/docs-index.generated.ts +16 -16
- package/src/modes/DESIGN.md +104 -0
- package/src/modes/acp/acp-agent.ts +298 -186
- package/src/modes/components/gjc-bundle-settings.ts +508 -0
- package/src/modes/components/irc-sidebar.ts +30 -1
- package/src/modes/components/notifications-settings-editor.ts +12 -1
- package/src/modes/components/oauth-selector.ts +68 -30
- package/src/modes/components/session-observer-overlay.ts +305 -86
- package/src/modes/components/settings-selector.ts +56 -5
- package/src/modes/components/status-line/gh.ts +16 -0
- package/src/modes/components/tool-status-header.ts +3 -15
- package/src/modes/components/transcript-viewer-overlay.ts +99 -24
- package/src/modes/controllers/command-controller.ts +42 -34
- package/src/modes/controllers/event-controller.ts +27 -16
- package/src/modes/controllers/extension-ui-controller.ts +193 -34
- package/src/modes/controllers/selector-controller.ts +160 -22
- package/src/modes/interactive-mode.ts +189 -62
- package/src/modes/jobs-observer.ts +1 -1
- package/src/modes/runtime-init.ts +3 -0
- package/src/modes/theme/theme.ts +11 -9
- package/src/modes/types.ts +88 -0
- package/src/prompts/agent-fragments/ralplan-persistence.md +4 -3
- package/src/prompts/system/eager-todo.md +8 -4
- package/src/prompts/system/system-prompt.md +11 -4
- package/src/prompts/tools/bash.md +5 -5
- package/src/prompts/tools/search-tool-bm25.md +5 -0
- package/src/prompts/tools/task.md +1 -1
- package/src/reminders/star-reminder.ts +4 -42
- package/src/runtime-mcp/manager.ts +19 -4
- package/src/sdk/acp/adapter.ts +22 -6
- package/src/sdk/broker/lifecycle.ts +18 -13
- package/src/sdk/broker/transport.ts +35 -3
- package/src/sdk/bus/attachment-registry.ts +5 -1
- package/src/sdk/bus/chat-daemon-cli.ts +4 -39
- package/src/sdk/bus/chat-daemon-control.ts +7 -3
- package/src/sdk/bus/config.ts +18 -2
- package/src/sdk/bus/index.ts +661 -126
- package/src/sdk/bus/kind-aware-reconciliation.ts +148 -73
- package/src/sdk/bus/lifecycle-commands.ts +4 -1
- package/src/sdk/bus/lifecycle-control-runtime.ts +403 -88
- package/src/sdk/bus/reconciliation-store.ts +95 -16
- package/src/sdk/bus/rich-draft.ts +1 -1
- package/src/sdk/bus/rich-render.ts +2 -2
- package/src/sdk/bus/telegram-adoption-intent.ts +574 -0
- package/src/sdk/bus/telegram-cli.ts +33 -8
- package/src/sdk/bus/telegram-daemon-cli.ts +1 -0
- package/src/sdk/bus/telegram-daemon-contract.ts +12 -4
- package/src/sdk/bus/telegram-daemon.ts +916 -23
- package/src/sdk/bus/telegram-reference.ts +40 -3
- package/src/sdk/bus/threaded-render.ts +48 -3
- package/src/sdk/bus/topic-registry.ts +20 -0
- package/src/sdk/host/query/revision-store.ts +36 -2
- package/src/sdk/host/reverse-leases.ts +44 -7
- package/src/sdk/prompt-status.ts +16 -3
- package/src/sdk/protocol/operation-inventory.generated.json +33 -0
- package/src/sdk/session.ts +89 -9
- package/src/session/agent-session.ts +844 -173
- package/src/session/artifacts.ts +22 -0
- package/src/session/auth-broker-config.ts +10 -3
- package/src/session/blob-store.ts +915 -24
- package/src/session/internal/managed-session-scope.ts +200 -111
- package/src/session/internal/managed-session-storage.ts +492 -62
- package/src/session/session-manager.ts +1614 -435
- package/src/session/session-storage.ts +38 -45
- package/src/session/streaming-output.ts +238 -68
- package/src/setup/credential-import.ts +75 -13
- package/src/skill-state/active-state.ts +32 -0
- package/src/skill-state/workflow-hud.ts +17 -0
- package/src/skill-state/workflow-mutation-guard.ts +496 -2
- package/src/task/executor.ts +122 -39
- package/src/task/index.ts +280 -45
- package/src/task/output-manager.ts +24 -14
- package/src/task/provider-retry-status.ts +16 -0
- package/src/task/receipt.ts +34 -8
- package/src/task/render.ts +6 -2
- package/src/task/types.ts +108 -0
- package/src/tools/ask-answer-registry.ts +12 -6
- package/src/tools/ask.ts +86 -55
- package/src/tools/ast-edit.ts +1 -0
- package/src/tools/ast-grep.ts +1 -0
- package/src/tools/bash-interactive.ts +8 -3
- package/src/tools/bash.ts +503 -60
- package/src/tools/find.ts +1 -0
- package/src/tools/image-gen.ts +29 -5
- package/src/tools/index.ts +6 -0
- package/src/tools/output-meta.ts +108 -14
- package/src/tools/path-utils.ts +3 -2
- package/src/tools/read.ts +18 -0
- package/src/tools/review.ts +5 -7
- package/src/tools/search.ts +1 -0
- package/src/tools/subagent-render.ts +6 -2
- package/src/tools/subagent.ts +6 -0
- package/src/tools/telegram-send.ts +6 -3
- package/src/utils/gh.ts +39 -0
- package/src/utils/image-resize.ts +3 -0
- package/src/web/search/providers/anthropic.ts +4 -4
- package/src/web/search/providers/kimi.ts +15 -5
- package/src/web/search/providers/searxng.ts +47 -4
- package/src/web/search/providers/xai.ts +7 -2
- package/dist/types/gjc-runtime/ultragoal-pipeline.d.ts +0 -23
- package/src/defaults/gjc/skills/ultragoal/pipeline-validation-contracts.md +0 -30
- package/src/gjc-runtime/ultragoal-pipeline.ts +0 -306
|
@@ -8,12 +8,125 @@ import { executeShell, type MinimizerOptions, Shell } from "@gajae-code/natives"
|
|
|
8
8
|
import { postmortem } from "@gajae-code/utils";
|
|
9
9
|
import { Settings, type ShellMinimizerSettings } from "../config/settings";
|
|
10
10
|
import { formatCrashDiagnosticNotice, writeCrashReport } from "../debug/crash-diagnostics";
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
DEFAULT_ARTIFACT_MAX_BYTES,
|
|
13
|
+
DEFAULT_MAX_BYTES,
|
|
14
|
+
OutputSink,
|
|
15
|
+
type TerminalArtifactPublisher,
|
|
16
|
+
truncateHeadBytes,
|
|
17
|
+
} from "../session/streaming-output";
|
|
18
|
+
import { formatArtifactReference, resolveOutputMaxColumns, resolveOutputSinkHeadBytes } from "../tools/output-meta";
|
|
13
19
|
import { getOrCreateSnapshot } from "../utils/shell-snapshot";
|
|
14
20
|
import { NON_INTERACTIVE_ENV } from "./non-interactive-env";
|
|
15
21
|
|
|
22
|
+
export interface BashArtifactSaveSummary {
|
|
23
|
+
artifactId: string;
|
|
24
|
+
complete: boolean;
|
|
25
|
+
omittedBytes?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type BashMinimizedSaveReturn = BashArtifactSaveResult | BashArtifactSaveSummary | string | undefined;
|
|
29
|
+
|
|
30
|
+
export type BashArtifactSaveResult =
|
|
31
|
+
| { status: "saved"; artifactId: string; complete: true; omittedBytes?: undefined }
|
|
32
|
+
| { status: "saved"; artifactId: string; complete: false; omittedBytes: number }
|
|
33
|
+
| { status: "unavailable" }
|
|
34
|
+
| { status: "failed"; diagnostic: string };
|
|
35
|
+
|
|
36
|
+
function summarizeLegacyArtifactSave(artifactId: string, originalText: string): BashArtifactSaveResult {
|
|
37
|
+
const inputBytes = Buffer.byteLength(originalText, "utf-8");
|
|
38
|
+
if (inputBytes <= DEFAULT_ARTIFACT_MAX_BYTES) {
|
|
39
|
+
return { status: "saved", artifactId, complete: true };
|
|
40
|
+
}
|
|
41
|
+
const retainedBytes = truncateHeadBytes(originalText, DEFAULT_ARTIFACT_MAX_BYTES).bytes;
|
|
42
|
+
return {
|
|
43
|
+
status: "saved",
|
|
44
|
+
artifactId,
|
|
45
|
+
complete: false,
|
|
46
|
+
omittedBytes: inputBytes - retainedBytes,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function normalizeExplicitSavedArtifact(
|
|
51
|
+
artifactId: string,
|
|
52
|
+
complete: boolean,
|
|
53
|
+
omittedBytes: number | undefined,
|
|
54
|
+
): BashArtifactSaveResult {
|
|
55
|
+
if (complete) {
|
|
56
|
+
return (omittedBytes ?? 0) > 0
|
|
57
|
+
? { status: "failed", diagnostic: "artifact save reported complete output with omitted bytes" }
|
|
58
|
+
: { status: "saved", artifactId, complete: true };
|
|
59
|
+
}
|
|
60
|
+
return typeof omittedBytes === "number" && omittedBytes > 0
|
|
61
|
+
? { status: "saved", artifactId, complete: false, omittedBytes }
|
|
62
|
+
: { status: "failed", diagnostic: "artifact save reported incomplete output without omitted bytes" };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function normalizeMinimizedSaveResult(value: BashMinimizedSaveReturn, originalText: string): BashArtifactSaveResult {
|
|
66
|
+
if (typeof value === "string") return summarizeLegacyArtifactSave(value, originalText);
|
|
67
|
+
if (!value) return { status: "unavailable" };
|
|
68
|
+
if (!("status" in value)) {
|
|
69
|
+
return normalizeExplicitSavedArtifact(value.artifactId, value.complete, value.omittedBytes);
|
|
70
|
+
}
|
|
71
|
+
if (value.status !== "saved") return value;
|
|
72
|
+
return normalizeExplicitSavedArtifact(value.artifactId, value.complete, value.omittedBytes);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function normalizeMinimizedSaveResultForTests(
|
|
76
|
+
value: BashMinimizedSaveReturn,
|
|
77
|
+
originalText: string,
|
|
78
|
+
): BashArtifactSaveResult {
|
|
79
|
+
return normalizeMinimizedSaveResult(value, originalText);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function completeRawArtifactAvailable(summary: {
|
|
83
|
+
artifactId?: string;
|
|
84
|
+
artifactTruncatedBytes?: number;
|
|
85
|
+
artifactFailureDiagnostic?: string;
|
|
86
|
+
}): boolean {
|
|
87
|
+
return (
|
|
88
|
+
summary.artifactId !== undefined &&
|
|
89
|
+
(summary.artifactTruncatedBytes ?? 0) <= 0 &&
|
|
90
|
+
summary.artifactFailureDiagnostic === undefined
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function appendModelNotice(output: string, notice: string): string {
|
|
95
|
+
const separator = output.length > 0 && !output.endsWith("\n") ? "\n" : "";
|
|
96
|
+
return `${output}${separator}${notice}\n`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function minimizedSaveNotice(
|
|
100
|
+
result: BashArtifactSaveResult,
|
|
101
|
+
summary: { artifactId?: string; artifactTruncatedBytes?: number; artifactFailureDiagnostic?: string },
|
|
102
|
+
): string | undefined {
|
|
103
|
+
if (result.status === "failed") return `Bash output artifact save failed: ${result.diagnostic}`;
|
|
104
|
+
if (result.status === "unavailable" && !completeRawArtifactAvailable(summary)) {
|
|
105
|
+
return "Bash output artifact unavailable: full original output could not be stored because artifact storage is unavailable.";
|
|
106
|
+
}
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function minimizedArtifactFooter(result: Extract<BashArtifactSaveResult, { status: "saved" }>): string {
|
|
111
|
+
const reference = result.complete
|
|
112
|
+
? `artifact://${result.artifactId}`
|
|
113
|
+
: formatArtifactReference(result.artifactId, result.omittedBytes);
|
|
114
|
+
return `[raw output: ${reference}]`;
|
|
115
|
+
}
|
|
116
|
+
|
|
16
117
|
export interface BashExecutorOptions {
|
|
118
|
+
/**
|
|
119
|
+
* Invoked when the native minimizer rewrote the command's output, giving
|
|
120
|
+
* the caller a chance to persist the lossless original capture (typically
|
|
121
|
+
* via the session's `ArtifactManager`). Complete saves preserve the
|
|
122
|
+
* historical `[raw output: artifact://<id>]` footer; capped saves carry an
|
|
123
|
+
* honest retained/omitted reference. A legacy string id is still accepted
|
|
124
|
+
* for non-tool callers and is classified from the original UTF-8 byte count.
|
|
125
|
+
*/
|
|
126
|
+
onMinimizedSave?: (
|
|
127
|
+
originalText: string,
|
|
128
|
+
info: { filter: string; inputBytes: number; outputBytes: number },
|
|
129
|
+
) => Promise<BashMinimizedSaveReturn>;
|
|
17
130
|
cwd?: string;
|
|
18
131
|
timeout?: number | null;
|
|
19
132
|
onChunk?: (chunk: string) => void;
|
|
@@ -32,23 +145,18 @@ export interface BashExecutorOptions {
|
|
|
32
145
|
/** Artifact path/id for full output storage */
|
|
33
146
|
artifactPath?: string;
|
|
34
147
|
artifactId?: string;
|
|
148
|
+
/** Optional terminal publisher for managed artifacts without writable paths. */
|
|
149
|
+
artifactPublisher?: TerminalArtifactPublisher;
|
|
150
|
+
/** Optional Bash-specific retained tail budget in bytes. */
|
|
151
|
+
spillThreshold?: number;
|
|
152
|
+
/** Optional Bash-specific retained head budget in bytes. */
|
|
153
|
+
headBytes?: number;
|
|
35
154
|
/** Execute without retaining a native Shell in the persistent session registry. */
|
|
36
155
|
oneShot?: boolean;
|
|
37
156
|
/** Ignore user-configured shell command prefixes. Used by constrained read-only shells. */
|
|
38
157
|
ignoreShellPrefix?: boolean;
|
|
39
158
|
/** Skip sourced shell snapshots. Used by constrained read-only shells. */
|
|
40
159
|
disableShellSnapshot?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Invoked when the native minimizer rewrote the command's output, giving
|
|
43
|
-
* the caller a chance to persist the lossless original capture (typically
|
|
44
|
-
* via the session's `ArtifactManager`). The returned id is spliced into
|
|
45
|
-
* the sink output as `artifact://<id>` so the agent can retrieve the raw
|
|
46
|
-
* bytes. Return `undefined` to skip the footer.
|
|
47
|
-
*/
|
|
48
|
-
onMinimizedSave?: (
|
|
49
|
-
originalText: string,
|
|
50
|
-
info: { filter: string; inputBytes: number; outputBytes: number },
|
|
51
|
-
) => Promise<string | undefined>;
|
|
52
160
|
}
|
|
53
161
|
|
|
54
162
|
export interface BashResult {
|
|
@@ -61,6 +169,8 @@ export interface BashResult {
|
|
|
61
169
|
outputLines: number;
|
|
62
170
|
outputBytes: number;
|
|
63
171
|
artifactId?: string;
|
|
172
|
+
artifactTruncatedBytes?: number;
|
|
173
|
+
artifactFailureDiagnostic?: string;
|
|
64
174
|
}
|
|
65
175
|
|
|
66
176
|
const shellSessions = new Map<string, Shell>();
|
|
@@ -144,7 +254,9 @@ export async function executeBash(command: string, options?: BashExecutorOptions
|
|
|
144
254
|
onRawChunk: options?.onRawChunk,
|
|
145
255
|
artifactPath: options?.artifactPath,
|
|
146
256
|
artifactId: options?.artifactId,
|
|
147
|
-
|
|
257
|
+
artifactPublisher: options?.artifactPublisher,
|
|
258
|
+
spillThreshold: options?.spillThreshold ?? DEFAULT_MAX_BYTES,
|
|
259
|
+
headBytes: options?.headBytes ?? resolveOutputSinkHeadBytes(settings),
|
|
148
260
|
maxColumns: resolveOutputMaxColumns(settings),
|
|
149
261
|
// Throttle the streaming preview callback to avoid saturating the
|
|
150
262
|
// event loop when commands produce massive output (e.g. seq 1 50M).
|
|
@@ -332,21 +444,23 @@ export async function executeBash(command: string, options?: BashExecutorOptions
|
|
|
332
444
|
|
|
333
445
|
// When the native minimizer rewrote the output, swap the sink's accumulated
|
|
334
446
|
// raw stream for the minimized text, persist the original as a session
|
|
335
|
-
// artifact, and splice an
|
|
336
|
-
//
|
|
447
|
+
// artifact, and splice an artifact footer into the visible text so the agent
|
|
448
|
+
// can retrieve retained raw bytes without a false completeness claim.
|
|
337
449
|
const minimized = winner.result.minimized;
|
|
450
|
+
let minimizedSaveResult: BashArtifactSaveResult | undefined;
|
|
338
451
|
if (minimized && minimized.text !== minimized.originalText) {
|
|
339
452
|
sink.replace(minimized.text);
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
453
|
+
const saved = options?.onMinimizedSave
|
|
454
|
+
? await options.onMinimizedSave(minimized.originalText, {
|
|
455
|
+
filter: minimized.filter,
|
|
456
|
+
inputBytes: minimized.inputBytes,
|
|
457
|
+
outputBytes: minimized.outputBytes,
|
|
458
|
+
})
|
|
459
|
+
: undefined;
|
|
460
|
+
minimizedSaveResult = normalizeMinimizedSaveResult(saved, minimized.originalText);
|
|
461
|
+
if (minimizedSaveResult.status === "saved") {
|
|
462
|
+
const sep = minimized.text.endsWith("\n") ? "" : "\n";
|
|
463
|
+
sink.push(`${sep}${minimizedArtifactFooter(minimizedSaveResult)}\n`);
|
|
350
464
|
}
|
|
351
465
|
}
|
|
352
466
|
|
|
@@ -366,10 +480,13 @@ export async function executeBash(command: string, options?: BashExecutorOptions
|
|
|
366
480
|
}
|
|
367
481
|
|
|
368
482
|
// Normal completion
|
|
483
|
+
const summary = await sink.dump();
|
|
484
|
+
const saveNotice = minimizedSaveResult ? minimizedSaveNotice(minimizedSaveResult, summary) : undefined;
|
|
369
485
|
return {
|
|
370
486
|
exitCode: winner.result.exitCode,
|
|
371
487
|
cancelled: false,
|
|
372
|
-
...
|
|
488
|
+
...summary,
|
|
489
|
+
...(saveNotice ? { output: appendModelNotice(summary.output, saveNotice) } : {}),
|
|
373
490
|
};
|
|
374
491
|
} catch (err) {
|
|
375
492
|
resetSession = true;
|
|
@@ -179,8 +179,12 @@ export class ExtensionRunner {
|
|
|
179
179
|
|
|
180
180
|
#getModel: () => Model | undefined = () => undefined;
|
|
181
181
|
#isIdleFn: () => boolean = () => true;
|
|
182
|
+
#getActivePromptHandleFn: () => string | undefined = () => undefined;
|
|
182
183
|
#waitForIdleFn: () => Promise<void> = async () => {};
|
|
183
184
|
#abortFn: () => void = () => {};
|
|
185
|
+
#abortPromptAndWaitFn: NonNullable<ExtensionContextActions["abortPromptAndWait"]> = async () => {
|
|
186
|
+
throw new Error("abortPromptAndWait binding is unavailable");
|
|
187
|
+
};
|
|
184
188
|
#hasPendingMessagesFn: () => boolean = () => false;
|
|
185
189
|
#getPendingMessageCountsFn: () => { steering: number; followUp: number; nextTurn: number } = () => ({
|
|
186
190
|
steering: 0,
|
|
@@ -214,6 +218,7 @@ export class ExtensionRunner {
|
|
|
214
218
|
#getJobsFn: ExtensionContextActions["getJobs"] = undefined;
|
|
215
219
|
#sdkControlFn: ExtensionContextActions["sdkControl"] = undefined;
|
|
216
220
|
#setSdkPermissionProviderFn: ExtensionContextActions["setSdkPermissionProvider"] = undefined;
|
|
221
|
+
#setSdkClientBridgeFn: ExtensionContextActions["setSdkClientBridge"] = undefined;
|
|
217
222
|
|
|
218
223
|
#invokeSkillFn: ExtensionContextActions["invokeSkill"] = undefined;
|
|
219
224
|
#setPlanModeFn: ExtensionContextActions["setPlanMode"] = undefined;
|
|
@@ -297,7 +302,13 @@ export class ExtensionRunner {
|
|
|
297
302
|
// Context actions (required)
|
|
298
303
|
this.#getModel = contextActions.getModel;
|
|
299
304
|
this.#isIdleFn = contextActions.isIdle;
|
|
305
|
+
this.#getActivePromptHandleFn = contextActions.getActivePromptHandle ?? (() => undefined);
|
|
300
306
|
this.#abortFn = contextActions.abort;
|
|
307
|
+
this.#abortPromptAndWaitFn =
|
|
308
|
+
contextActions.abortPromptAndWait ??
|
|
309
|
+
(async () => {
|
|
310
|
+
throw new Error("abortPromptAndWait binding is unavailable");
|
|
311
|
+
});
|
|
301
312
|
this.#hasPendingMessagesFn = contextActions.hasPendingMessages;
|
|
302
313
|
this.#getPendingMessageCountsFn =
|
|
303
314
|
contextActions.getPendingMessageCounts ?? (() => ({ steering: 0, followUp: 0, nextTurn: 0 }));
|
|
@@ -331,6 +342,7 @@ export class ExtensionRunner {
|
|
|
331
342
|
this.#getJobsFn = contextActions.getJobs;
|
|
332
343
|
this.#sdkControlFn = contextActions.sdkControl;
|
|
333
344
|
this.#setSdkPermissionProviderFn = contextActions.setSdkPermissionProvider;
|
|
345
|
+
this.#setSdkClientBridgeFn = contextActions.setSdkClientBridge;
|
|
334
346
|
|
|
335
347
|
// Command context actions (optional, only for interactive mode)
|
|
336
348
|
if (commandContextActions) {
|
|
@@ -551,8 +563,10 @@ export class ExtensionRunner {
|
|
|
551
563
|
get model() {
|
|
552
564
|
return getModel();
|
|
553
565
|
},
|
|
566
|
+
getActivePromptHandle: () => this.#getActivePromptHandleFn(),
|
|
554
567
|
isIdle: () => this.#isIdleFn(),
|
|
555
568
|
abort: () => this.#abortFn(),
|
|
569
|
+
abortPromptAndWait: (handle, options) => this.#abortPromptAndWaitFn(handle, options),
|
|
556
570
|
hasPendingMessages: () => this.#hasPendingMessagesFn(),
|
|
557
571
|
getPendingMessageCounts: () => this.#getPendingMessageCountsFn(),
|
|
558
572
|
getTranscript: () => this.#getTranscriptFn(),
|
|
@@ -582,6 +596,7 @@ export class ExtensionRunner {
|
|
|
582
596
|
getJobs: () => this.#getJobsFn?.(),
|
|
583
597
|
sdkControl: (operation, input) => this.#sdkControlFn?.(operation, input),
|
|
584
598
|
setSdkPermissionProvider: provider => this.#setSdkPermissionProviderFn?.(provider),
|
|
599
|
+
setSdkClientBridge: bridge => this.#setSdkClientBridgeFn?.(bridge),
|
|
585
600
|
sdkBindings: () => [
|
|
586
601
|
...(this.#cycleModelFn ? ["cycleModel"] : []),
|
|
587
602
|
...(this.#setModelProfileFn ? ["setModelProfile"] : []),
|
|
@@ -8,7 +8,13 @@
|
|
|
8
8
|
* - Interact with the user via UI primitives
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {
|
|
11
|
+
import type {
|
|
12
|
+
AgentMessage,
|
|
13
|
+
AgentToolResult,
|
|
14
|
+
AgentToolUpdateCallback,
|
|
15
|
+
RunSettlementProof,
|
|
16
|
+
ThinkingLevel,
|
|
17
|
+
} from "@gajae-code/agent-core";
|
|
12
18
|
import type { CompactionResult } from "@gajae-code/agent-core/compaction";
|
|
13
19
|
import type {
|
|
14
20
|
Api,
|
|
@@ -38,6 +44,7 @@ import type { CustomEditor } from "../../modes/components/custom-editor";
|
|
|
38
44
|
import type { WorkflowGateEmitter } from "../../modes/shared/agent-wire/workflow-gate-broker";
|
|
39
45
|
import type { Theme } from "../../modes/theme/theme";
|
|
40
46
|
import type {
|
|
47
|
+
ClientBridge,
|
|
41
48
|
ClientBridgePermissionOption,
|
|
42
49
|
ClientBridgePermissionOutcome,
|
|
43
50
|
ClientBridgePermissionToolCall,
|
|
@@ -355,8 +362,12 @@ export interface ExtensionContext {
|
|
|
355
362
|
model: Model | undefined;
|
|
356
363
|
/** Whether the agent is idle (not streaming) */
|
|
357
364
|
isIdle(): boolean;
|
|
365
|
+
/** Stable resource ownership identifier for the active prompt run. */
|
|
366
|
+
getActivePromptHandle(): string | undefined;
|
|
358
367
|
/** Abort the current agent operation */
|
|
359
368
|
abort(): void;
|
|
369
|
+
/** Abort and prove whether resources for a specific prompt settled. */
|
|
370
|
+
abortPromptAndWait?(handle: string, options: { graceMs: number }): Promise<RunSettlementProof>;
|
|
360
371
|
/** Whether there are queued messages waiting */
|
|
361
372
|
hasPendingMessages(): boolean;
|
|
362
373
|
/** Typed pending-message counts per queue (steering, follow-up, next-turn). */
|
|
@@ -416,6 +427,8 @@ export interface ExtensionContext {
|
|
|
416
427
|
) => Promise<ClientBridgePermissionOutcome>)
|
|
417
428
|
| undefined,
|
|
418
429
|
): void;
|
|
430
|
+
/** Install a client bridge backed by a live SDK reverse provider lease. */
|
|
431
|
+
setSdkClientBridge?(bridge: ClientBridge | undefined): void;
|
|
419
432
|
/** Names of session SDK seams actually installed by the active runtime. */
|
|
420
433
|
sdkBindings?(): readonly string[];
|
|
421
434
|
|
|
@@ -1436,7 +1449,10 @@ export interface ExtensionActions {
|
|
|
1436
1449
|
export interface ExtensionContextActions {
|
|
1437
1450
|
getModel: () => Model | undefined;
|
|
1438
1451
|
isIdle: () => boolean;
|
|
1452
|
+
/** Stable resource ownership identifier for the active prompt run. */
|
|
1453
|
+
getActivePromptHandle?: () => string | undefined;
|
|
1439
1454
|
abort: () => void;
|
|
1455
|
+
abortPromptAndWait?: (handle: string, options: { graceMs: number }) => Promise<RunSettlementProof>;
|
|
1440
1456
|
hasPendingMessages: () => boolean;
|
|
1441
1457
|
/** Typed pending-message counts per queue; optional for embedders without a counted queue. */
|
|
1442
1458
|
getPendingMessageCounts?: () => { steering: number; followUp: number; nextTurn: number };
|
|
@@ -1484,6 +1500,7 @@ export interface ExtensionContextActions {
|
|
|
1484
1500
|
) => Promise<ClientBridgePermissionOutcome>)
|
|
1485
1501
|
| undefined,
|
|
1486
1502
|
) => void;
|
|
1503
|
+
setSdkClientBridge?: (bridge: ClientBridge | undefined) => void;
|
|
1487
1504
|
sdkControl?: (operation: string, input: Record<string, unknown>) => unknown | Promise<unknown>;
|
|
1488
1505
|
invokeSkill?: (
|
|
1489
1506
|
name: string,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { logger } from "@gajae-code/utils";
|
|
2
|
-
|
|
2
|
+
import { bundleIdentity } from "./lifecycle-reconciliation";
|
|
3
3
|
import { loadEffectiveGjcPluginRegistry } from "./registry";
|
|
4
4
|
import { type SessionQuarantine, validateSessionBundles, verifyEntryHashes } from "./session-validation";
|
|
5
|
-
import { GjcPluginLoadError, type GjcPluginRegistryEntry } from "./types";
|
|
5
|
+
import { GjcPluginLoadError, type GjcPluginRegistryEntry, type GjcPluginScope } from "./types";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Constrained plugin-hook loader.
|
|
@@ -37,6 +37,7 @@ const DENIED_API_METHODS = [
|
|
|
37
37
|
|
|
38
38
|
interface DeclaredHook {
|
|
39
39
|
plugin: string;
|
|
40
|
+
scope: GjcPluginScope;
|
|
40
41
|
event: string;
|
|
41
42
|
target?: string;
|
|
42
43
|
phase?: "before" | "after";
|
|
@@ -52,6 +53,7 @@ function collectDeclaredHooks(entries: readonly GjcPluginRegistryEntry[]): Decla
|
|
|
52
53
|
if (disabled.has(h.extensionId)) continue;
|
|
53
54
|
out.push({
|
|
54
55
|
plugin: entry.name,
|
|
56
|
+
scope: entry.scope,
|
|
55
57
|
event: h.event,
|
|
56
58
|
target: h.target,
|
|
57
59
|
phase: h.phase,
|
|
@@ -88,6 +90,7 @@ async function loadOneHook(
|
|
|
88
90
|
return {
|
|
89
91
|
hook: null,
|
|
90
92
|
quarantine: {
|
|
93
|
+
identity: bundleIdentity(declared.scope, declared.plugin),
|
|
91
94
|
plugin: declared.plugin,
|
|
92
95
|
surfaceId: `hook:${declared.event}:${declared.target ?? ""}`,
|
|
93
96
|
code: "invalid_hook",
|
|
@@ -99,6 +102,7 @@ async function loadOneHook(
|
|
|
99
102
|
return {
|
|
100
103
|
hook: null,
|
|
101
104
|
quarantine: {
|
|
105
|
+
identity: bundleIdentity(declared.scope, declared.plugin),
|
|
102
106
|
plugin: declared.plugin,
|
|
103
107
|
surfaceId: `hook:${declared.event}`,
|
|
104
108
|
code: "invalid_hook",
|
|
@@ -113,6 +117,7 @@ async function loadOneHook(
|
|
|
113
117
|
return {
|
|
114
118
|
hook: null,
|
|
115
119
|
quarantine: {
|
|
120
|
+
identity: bundleIdentity(declared.scope, declared.plugin),
|
|
116
121
|
plugin: declared.plugin,
|
|
117
122
|
surfaceId: `hook:${declared.event}`,
|
|
118
123
|
code,
|
|
@@ -125,6 +130,7 @@ async function loadOneHook(
|
|
|
125
130
|
return {
|
|
126
131
|
hook: null,
|
|
127
132
|
quarantine: {
|
|
133
|
+
identity: bundleIdentity(declared.scope, declared.plugin),
|
|
128
134
|
plugin: declared.plugin,
|
|
129
135
|
surfaceId: `hook:${declared.event}`,
|
|
130
136
|
code: "runtime_mismatch",
|
|
@@ -2,14 +2,31 @@ export * from "./activation";
|
|
|
2
2
|
export * from "./compiler";
|
|
3
3
|
export * from "./constrained-hooks";
|
|
4
4
|
export * from "./injection";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Public barrel. Mutation primitives are deliberately NOT re-exported here:
|
|
7
|
+
* `lifecycle.ts` is the sole policy and persistence writer, so the installer
|
|
8
|
+
* transaction and the registry writers stay reachable only through their own
|
|
9
|
+
* modules. Re-exporting them would let a caller commit a replacement and
|
|
10
|
+
* bypass the create-only rule.
|
|
11
|
+
*/
|
|
12
|
+
export { isGjcPluginBundleSource, isGjcPluginSourceShape } from "./installer";
|
|
13
|
+
export * from "./lifecycle";
|
|
14
|
+
export * from "./lifecycle-reconciliation";
|
|
6
15
|
export * from "./loader";
|
|
7
16
|
export * from "./mcp-policy";
|
|
8
17
|
export * from "./observability";
|
|
9
18
|
export * from "./paths";
|
|
10
19
|
export * from "./prompt-appendix";
|
|
11
|
-
export
|
|
20
|
+
export {
|
|
21
|
+
loadEffectiveGjcPluginRegistry,
|
|
22
|
+
readRegistry,
|
|
23
|
+
registryEntryFingerprint,
|
|
24
|
+
registryPathForScope,
|
|
25
|
+
registryRootForScope,
|
|
26
|
+
sortRegistryEntries,
|
|
27
|
+
} from "./registry";
|
|
12
28
|
export * from "./runtime-adapters";
|
|
29
|
+
export * from "./runtime-quarantine";
|
|
13
30
|
export * from "./schema";
|
|
14
31
|
export * from "./session-validation";
|
|
15
32
|
export * from "./state";
|