@gajae-code/coding-agent 0.15.5 → 0.15.6
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 +26 -1
- package/dist/types/async/job-manager.d.ts +83 -0
- package/dist/types/cli/auth-gateway-cli.d.ts +17 -0
- package/dist/types/cli/model-presets-cli.d.ts +9 -0
- package/dist/types/cli/update-cli.d.ts +2 -0
- package/dist/types/commands/auth-gateway.d.ts +3 -0
- package/dist/types/commands/gc.d.ts +13 -0
- package/dist/types/commands/model-presets.d.ts +21 -0
- package/dist/types/config/autorouting-tier-map.d.ts +96 -0
- package/dist/types/config/file-lock.d.ts +49 -2
- package/dist/types/config/internal/model-preset-registry-test-state.d.ts +4 -0
- package/dist/types/config/internal/model-preset-registry-test-support.d.ts +3 -0
- package/dist/types/config/keybindings.d.ts +3 -2
- package/dist/types/config/model-preset-registry.d.ts +368 -0
- package/dist/types/config/model-profile-activation.d.ts +39 -0
- package/dist/types/config/model-profiles.d.ts +5 -3
- package/dist/types/config/model-registry.d.ts +11 -5
- package/dist/types/config/settings-schema.d.ts +9 -0
- package/dist/types/coordinator-mcp/model-preset.d.ts +7 -5
- package/dist/types/coordinator-mcp/projection-scan.d.ts +46 -0
- package/dist/types/extensibility/extensions/types.d.ts +2 -5
- package/dist/types/gjc-runtime/empty-delete-gc.d.ts +58 -0
- package/dist/types/gjc-runtime/gc-runtime.d.ts +2 -0
- package/dist/types/gjc-runtime/session-state-lock.d.ts +35 -6
- package/dist/types/gjc-runtime/session-state-sidecar.d.ts +6 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/main.d.ts +3 -1
- package/dist/types/modes/components/jobs-overlay-model.d.ts +4 -2
- package/dist/types/modes/jobs-observer.d.ts +36 -0
- package/dist/types/sdk/broker/broker.d.ts +3 -0
- package/dist/types/sdk/bus/kind-aware-reconciliation.d.ts +3 -0
- package/dist/types/sdk/bus/prompt-reconciliation.d.ts +4 -0
- package/dist/types/sdk/client/discovery.d.ts +1 -0
- package/dist/types/sdk/host/model-pin.d.ts +7 -2
- package/dist/types/sdk/host/sdk-run-capability.d.ts +1 -0
- package/dist/types/sdk/host/session-runtime.d.ts +15 -1
- package/dist/types/sdk/prompt-deadline-manager.d.ts +11 -1
- package/dist/types/sdk/protocol/adapter-validation.d.ts +2 -0
- package/dist/types/sdk/router/session-router.d.ts +9 -0
- package/dist/types/session/account-inventory.d.ts +1 -0
- package/dist/types/session/agent-session.d.ts +19 -7
- package/dist/types/session/fold-coordinator.d.ts +201 -0
- package/dist/types/session/sdk-run-capability-internal.d.ts +7 -0
- package/dist/types/session/sdk-run-capability.d.ts +2 -0
- package/dist/types/telemetry/control.d.ts +11 -0
- package/dist/types/telemetry/events.d.ts +20 -0
- package/dist/types/telemetry/index.d.ts +3 -0
- package/dist/types/telemetry/transport.d.ts +22 -0
- package/dist/types/tools/bash-interactive.d.ts +23 -0
- package/dist/types/tools/index.d.ts +6 -5
- package/dist/types/web/search/providers/base.d.ts +9 -4
- package/dist/types/web/search/providers/xai.d.ts +2 -1
- package/dist/types/web/search/types.d.ts +14 -0
- package/package.json +10 -7
- package/scripts/generate-hotkeys-docs.ts +4 -0
- package/scripts/generate-sdk-operation-inventory.ts +3 -3
- package/src/async/job-manager.ts +671 -39
- package/src/cli/auth-broker-cli.ts +40 -12
- package/src/cli/auth-gateway-cli.ts +273 -97
- package/src/cli/config-cli.ts +2 -2
- package/src/cli/fast-help.ts +3 -0
- package/src/cli/model-presets-cli.ts +100 -0
- package/src/cli/update-cli.ts +40 -5
- package/src/cli.ts +6 -2
- package/src/commands/auth-gateway.ts +12 -8
- package/src/commands/gc.ts +19 -0
- package/src/commands/model-presets.ts +24 -0
- package/src/config/autorouting-tier-map.ts +32 -0
- package/src/config/file-lock-gc.ts +9 -4
- package/src/config/file-lock.ts +775 -59
- package/src/config/internal/model-preset-registry-test-state.ts +28 -0
- package/src/config/internal/model-preset-registry-test-support.ts +11 -0
- package/src/config/keybindings.ts +6 -2
- package/src/config/model-preset-registry.ts +2799 -0
- package/src/config/model-profile-activation.ts +115 -28
- package/src/config/model-profile-contract.ts +4 -1
- package/src/config/model-profiles.ts +51 -9
- package/src/config/model-registry.ts +1021 -122
- package/src/config/settings-schema.ts +11 -0
- package/src/config/settings.ts +6 -1
- package/src/coordinator-mcp/model-preset.ts +32 -17
- package/src/coordinator-mcp/projection-scan.ts +571 -0
- package/src/coordinator-mcp/server.ts +19 -24
- package/src/coordinator-mcp/session-reaper.ts +9 -3
- package/src/extensibility/extensions/loader.ts +0 -1
- package/src/extensibility/extensions/types.ts +2 -3
- package/src/extensibility/gjc-plugins/runtime-adapters.ts +1 -0
- package/src/gjc-runtime/empty-delete-gc.ts +301 -0
- package/src/gjc-runtime/gc-render.ts +29 -0
- package/src/gjc-runtime/gc-runtime.ts +174 -11
- package/src/gjc-runtime/session-state-lock.ts +1242 -141
- package/src/gjc-runtime/session-state-sidecar.ts +76 -3
- package/src/index.ts +1 -0
- package/src/internal-urls/docs-index.generated.ts +9 -8
- package/src/lsp/config.ts +4 -3
- package/src/lsp/path-trust.ts +12 -6
- package/src/main.ts +9 -2
- package/src/modes/acp/acp-agent.ts +11 -5
- package/src/modes/components/jobs-overlay-model.ts +99 -16
- package/src/modes/components/model-selector.ts +158 -18
- package/src/modes/components/status-line/segments.ts +6 -1
- package/src/modes/controllers/extension-ui-controller.ts +1 -1
- package/src/modes/controllers/input-controller.ts +23 -6
- package/src/modes/interactive-mode.ts +14 -1
- package/src/modes/jobs-observer.ts +149 -16
- package/src/modes/runtime-init.ts +1 -1
- package/src/modes/utils/injected-user-submission.ts +15 -1
- package/src/prompts/tools/bash.md +2 -2
- package/src/prompts/tools/fold-receipt.md +3 -0
- package/src/prompts/tools/job.md +1 -1
- package/src/sdk/acp/adapter.ts +17 -2
- package/src/sdk/broker/broker.ts +48 -21
- package/src/sdk/broker/lifecycle.ts +32 -6
- package/src/sdk/bus/chat-daemon-control.ts +2 -2
- package/src/sdk/bus/chat-daemon-runtime.ts +11 -1
- package/src/sdk/bus/kind-aware-reconciliation.ts +36 -6
- package/src/sdk/bus/prompt-reconciliation.ts +28 -4
- package/src/sdk/bus/slack-conversation.ts +5 -1
- package/src/sdk/cli/session-cli.ts +12 -1
- package/src/sdk/client/discovery.ts +3 -1
- package/src/sdk/host/control/dispatch.ts +3 -0
- package/src/sdk/host/model-pin.ts +185 -25
- package/src/sdk/host/sdk-run-capability.ts +1 -0
- package/src/sdk/host/session-runtime.test.ts +371 -37
- package/src/sdk/host/session-runtime.ts +364 -52
- package/src/sdk/prompt-deadline-manager.ts +16 -1
- package/src/sdk/protocol/adapter-validation.ts +27 -0
- package/src/sdk/protocol/operation-inventory.generated.json +2 -2
- package/src/sdk/protocol/operation-registry.ts +4 -1
- package/src/sdk/router/session-router.ts +228 -96
- package/src/sdk/session.ts +83 -12
- package/src/session/account-inventory.ts +27 -11
- package/src/session/agent-session.ts +678 -103
- package/src/session/fold-coordinator.ts +433 -0
- package/src/session/sdk-run-capability-internal.ts +15 -0
- package/src/session/sdk-run-capability.ts +2 -0
- package/src/session/session-manager.ts +5 -4
- package/src/setup/provider-presets.json +1 -1
- package/src/slash-commands/helpers/credential-switch.ts +6 -1
- package/src/task/executor.ts +19 -3
- package/src/telemetry/control.ts +26 -0
- package/src/telemetry/events.ts +142 -0
- package/src/telemetry/index.ts +3 -0
- package/src/telemetry/transport.ts +87 -0
- package/src/tools/bash-interactive.ts +182 -85
- package/src/tools/bash.ts +772 -67
- package/src/tools/index.ts +7 -5
- package/src/tools/tool-catalog.generated.ts +1 -1
- package/src/web/search/provider.ts +120 -11
- package/src/web/search/providers/anthropic.ts +89 -17
- package/src/web/search/providers/base.ts +9 -4
- package/src/web/search/providers/gemini.ts +87 -15
- package/src/web/search/providers/openai-compatible.ts +23 -8
- package/src/web/search/providers/xai.ts +98 -12
- package/src/web/search/types.ts +16 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session-owned fold/wake coordinator.
|
|
3
|
+
*
|
|
4
|
+
* Folding a running foreground wait is a lifecycle handoff across three
|
|
5
|
+
* independently scheduled domains — the tool observer, the job owner, and
|
|
6
|
+
* agent-turn admission — so it needs ONE linearization point. That is this
|
|
7
|
+
* coordinator: a synchronous prologue claims the fold and arms the steering
|
|
8
|
+
* fence with no `await` in between, and only then does an async tail capture and
|
|
9
|
+
* persist the receipt.
|
|
10
|
+
*
|
|
11
|
+
* Two invariants are load-bearing and easy to get wrong:
|
|
12
|
+
*
|
|
13
|
+
* 1. **Identity is the `AsyncJob` instance, acquired once.** Job ids and
|
|
14
|
+
* generations are manager-local, so two managers can mint the same
|
|
15
|
+
* `bg_1`/`job:1` pair. Slots are therefore keyed by the object itself,
|
|
16
|
+
* obtained exactly once through the registration-bound
|
|
17
|
+
* {@link FoldAdapter.getJob} and retained for the rest of the transaction.
|
|
18
|
+
* Nothing in the fold path may consult an ambient, singleton, or
|
|
19
|
+
* endpoint-resolved manager.
|
|
20
|
+
* 2. **A delivery callback can run more than once.** The async job manager
|
|
21
|
+
* re-pushes the SAME delivery object on retry, so the receipt is attached to
|
|
22
|
+
* a carrier keyed by that object BEFORE the slot is released. A retried
|
|
23
|
+
* delivery therefore still carries its receipt and can never silently
|
|
24
|
+
* degrade into an ordinary receipt-less completion.
|
|
25
|
+
*/
|
|
26
|
+
import type { AsyncJob } from "../async/job-manager";
|
|
27
|
+
/**
|
|
28
|
+
* Idle-flush merge window.
|
|
29
|
+
*
|
|
30
|
+
* Completions that land within this window coalesce into ONE wake turn. The
|
|
31
|
+
* previous 1ms debounce meant staggered completions each bought their own full
|
|
32
|
+
* LLM turn. Deliberately a fixed internal constant, not a setting: the contract
|
|
33
|
+
* is one merge window, and a per-user knob would let wake behavior differ
|
|
34
|
+
* between sessions.
|
|
35
|
+
*/
|
|
36
|
+
export declare const FOLD_WAKE_MERGE_WINDOW_MS = 800;
|
|
37
|
+
/** The wait kinds that can be folded. `task`/`subagent` awaits are a non-goal. */
|
|
38
|
+
export type FoldWaitKind = "bash-managed" | "client-terminal" | "bash-pty";
|
|
39
|
+
/** Outcome of settling the foreground caller. Exactly one party may settle it. */
|
|
40
|
+
export type ForegroundSettleOutcome = "resolved" | "already-settled";
|
|
41
|
+
/**
|
|
42
|
+
* How a folded job's output is retrieved later. Deliberately a structured
|
|
43
|
+
* handle over already-implemented paths rather than an invented URI scheme:
|
|
44
|
+
* there is no `job://` resolver, and inventing one would make the reference
|
|
45
|
+
* unresolvable in exactly the degraded case it exists for.
|
|
46
|
+
*/
|
|
47
|
+
export interface JobOutputRetrieval {
|
|
48
|
+
jobId: string;
|
|
49
|
+
generation: string;
|
|
50
|
+
/** Human/model-facing retrieval instruction naming a real mechanism. */
|
|
51
|
+
instruction: string;
|
|
52
|
+
}
|
|
53
|
+
/** Durable record captured at fold time and replayed into the wake turn. */
|
|
54
|
+
export interface FoldReceipt {
|
|
55
|
+
jobId: string;
|
|
56
|
+
jobGeneration: string;
|
|
57
|
+
kind: FoldWaitKind;
|
|
58
|
+
label: string;
|
|
59
|
+
outputRef: JobOutputRetrieval;
|
|
60
|
+
/** What the interrupted turn still intended to do, so the wake can finish it. */
|
|
61
|
+
remainingIntent: string | undefined;
|
|
62
|
+
foldedAt: number;
|
|
63
|
+
/** Only command kinds can change directory; task-style waits never do. */
|
|
64
|
+
cwdSensitive: boolean;
|
|
65
|
+
}
|
|
66
|
+
/** A terminal completion observed for a folded job. */
|
|
67
|
+
export interface ForegroundTerminalPayload {
|
|
68
|
+
jobId: string;
|
|
69
|
+
generation: string;
|
|
70
|
+
text: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Per-wait fold capability. `getJob` is bound at registration over the manager
|
|
74
|
+
* that registered THIS job, which is what makes cross-manager identity safe.
|
|
75
|
+
*/
|
|
76
|
+
export interface FoldAdapter {
|
|
77
|
+
readonly kind: FoldWaitKind;
|
|
78
|
+
readonly jobId: string;
|
|
79
|
+
readonly jobGeneration: string;
|
|
80
|
+
readonly label: string;
|
|
81
|
+
readonly cwdSensitive: boolean;
|
|
82
|
+
/** Signal for the foreground wait; aborting capture must roll back the fold. */
|
|
83
|
+
readonly signal?: AbortSignal;
|
|
84
|
+
/** True only when the adapter was created by a model-owned Agent turn. */
|
|
85
|
+
readonly originatingTurn?: boolean;
|
|
86
|
+
readonly outputRef: JobOutputRetrieval;
|
|
87
|
+
/** Registration-bound resolver: the job for this adapter, or undefined once evicted or reused. */
|
|
88
|
+
readonly getJob: () => AsyncJob | undefined;
|
|
89
|
+
/** Settle the foreground caller with the fold result. Idempotent. */
|
|
90
|
+
readonly detachObserver: (receipt: FoldReceipt) => ForegroundSettleOutcome;
|
|
91
|
+
/** Hand a parked completion back to a still-attached observer. Idempotent. */
|
|
92
|
+
readonly resolveForegroundObserver: (payload: ForegroundTerminalPayload) => ForegroundSettleOutcome;
|
|
93
|
+
}
|
|
94
|
+
export type FoldRequestResult = {
|
|
95
|
+
status: "folded";
|
|
96
|
+
receipt: FoldReceipt;
|
|
97
|
+
} | {
|
|
98
|
+
status: "unavailable";
|
|
99
|
+
reason: string;
|
|
100
|
+
} | {
|
|
101
|
+
status: "already-terminal";
|
|
102
|
+
reason: string;
|
|
103
|
+
} | {
|
|
104
|
+
status: "capture-failed";
|
|
105
|
+
reason: string;
|
|
106
|
+
};
|
|
107
|
+
/** What a delivery should carry, decided by the durable slot state (T2). */
|
|
108
|
+
export type FoldDeliveryDisposition = {
|
|
109
|
+
kind: "ordinary";
|
|
110
|
+
} | {
|
|
111
|
+
kind: "parked";
|
|
112
|
+
} | {
|
|
113
|
+
kind: "receipt";
|
|
114
|
+
receipt: FoldReceipt;
|
|
115
|
+
text: string;
|
|
116
|
+
};
|
|
117
|
+
export interface FoldCoordinatorDeps {
|
|
118
|
+
/**
|
|
119
|
+
* Fence old-turn steering admission and return the release handle. Armed
|
|
120
|
+
* synchronously inside the prologue because the agent loop polls steering
|
|
121
|
+
* upstream of its pause checkpoint; fencing there keeps queued steering
|
|
122
|
+
* intact instead of draining it.
|
|
123
|
+
*/
|
|
124
|
+
armSteeringFence: () => () => void;
|
|
125
|
+
/** Whether this fold belongs to a currently running Agent turn. */
|
|
126
|
+
hasActiveTurn?: () => boolean;
|
|
127
|
+
/** Arm the cooperative stop so the turn ends after the fold result, never via abort. */
|
|
128
|
+
requestStop: () => void;
|
|
129
|
+
/** Capture what the interrupted turn still intended to accomplish. */
|
|
130
|
+
captureRemainingIntent: () => Promise<string | undefined> | string | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Push a parked completion into the wake path. The delivery seam parks a
|
|
133
|
+
* completion that arrives before the receipt exists; when the fold later
|
|
134
|
+
* replays it (A6), THIS is what makes the wake happen rather than relying on
|
|
135
|
+
* an unrelated idle rearm to rescue it.
|
|
136
|
+
*/
|
|
137
|
+
deliverParked: (job: AsyncJob, disposition: {
|
|
138
|
+
kind: "receipt";
|
|
139
|
+
receipt: FoldReceipt;
|
|
140
|
+
text: string;
|
|
141
|
+
}) => void;
|
|
142
|
+
}
|
|
143
|
+
/** Why a slot is being retired, which decides whether retiring is safe. */
|
|
144
|
+
export type FoldRetireReason = "cancel" | "evict";
|
|
145
|
+
/**
|
|
146
|
+
* Render a fold receipt for the wake turn.
|
|
147
|
+
*
|
|
148
|
+
* Carries the job id, a real retrieval handle, and the captured remaining
|
|
149
|
+
* intent, so the wake turn can finish the ORIGINAL task instead of only
|
|
150
|
+
* reporting that a command ended. The cwd caveat is included only for wait
|
|
151
|
+
* kinds that can actually change directory.
|
|
152
|
+
*/
|
|
153
|
+
export declare function describeFoldReceipt(receipt: FoldReceipt): string;
|
|
154
|
+
export declare class FoldCoordinator {
|
|
155
|
+
#private;
|
|
156
|
+
constructor(deps: FoldCoordinatorDeps);
|
|
157
|
+
/** Register a foldable wait. The most recently registered wait is the default target. */
|
|
158
|
+
registerParticipant(adapter: FoldAdapter): () => void;
|
|
159
|
+
/** Whether any wait is currently foldable, for the key-availability gate. */
|
|
160
|
+
hasFoldableParticipant(): boolean;
|
|
161
|
+
/** Deterministic target: newest registration wins, so the chord folds what the user is watching. */
|
|
162
|
+
resolveTarget(): FoldAdapter | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* T1. Synchronous prologue then async durability tail.
|
|
165
|
+
*
|
|
166
|
+
* Nothing awaits before the slot is reserved and the fence is armed, so a
|
|
167
|
+
* completion or a steering submission that races the capture cannot slip
|
|
168
|
+
* past into the old turn.
|
|
169
|
+
*/
|
|
170
|
+
requestFold(explicit?: FoldAdapter): Promise<FoldRequestResult>;
|
|
171
|
+
/**
|
|
172
|
+
* T2. Decide what a delivery carries, branching on the DURABLE slot state
|
|
173
|
+
* rather than on transient hand-off state.
|
|
174
|
+
*
|
|
175
|
+
* `present` attaches the receipt to the retry-stable carrier BEFORE clearing
|
|
176
|
+
* the slot, so a retried invocation still finds it.
|
|
177
|
+
*/
|
|
178
|
+
onDelivery(job: AsyncJob, text: string): FoldDeliveryDisposition;
|
|
179
|
+
/**
|
|
180
|
+
* Retirement. T-R2: never drop a slot that holds an undelivered payload or
|
|
181
|
+
* that a still-possible delivery could consume.
|
|
182
|
+
*
|
|
183
|
+
* - `cancel` retires freely, because a cancelled job enqueues no delivery at
|
|
184
|
+
* all, so no later consumer can arrive.
|
|
185
|
+
* - `evict` only retires when the job can no longer deliver. An evicted
|
|
186
|
+
* record still delivers with its retained job object, so a completed or
|
|
187
|
+
* failed job keeps its slot.
|
|
188
|
+
*/
|
|
189
|
+
retire(job: AsyncJob, reason: FoldRetireReason): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Claim the single completion notice for a job.
|
|
192
|
+
*
|
|
193
|
+
* Returns true exactly once per job. A delivery can be retried with the same
|
|
194
|
+
* object, so an unguarded notice would repeat for one completion.
|
|
195
|
+
*/
|
|
196
|
+
claimCompletionNotice(job: AsyncJob): boolean;
|
|
197
|
+
/** Claim the receipt-bearing queue entry once across manager delivery retries. */
|
|
198
|
+
claimCompletionDelivery(job: AsyncJob): boolean;
|
|
199
|
+
/** Test/diagnostic view of the durable slot state for a job. */
|
|
200
|
+
slotStateFor(job: AsyncJob): "none" | "reserved-empty" | "reserved-parked" | "present" | "carried";
|
|
201
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const sdkRunTokenBrand: unique symbol;
|
|
2
|
+
export interface SdkRunCapability {
|
|
3
|
+
readonly [sdkRunTokenBrand]: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function createSdkRunCapability(token: string): SdkRunCapability;
|
|
6
|
+
export declare function readSdkRunCapability(value: unknown): string | undefined;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Process-wide emergency stop; it cannot be enabled by project dotenv files. */
|
|
2
|
+
export declare const TELEMETRY_KILL_SWITCH_ENV: "GJC_DISABLE_TELEMETRY";
|
|
3
|
+
export interface TelemetryStatus {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
disabledByKillSwitch: boolean;
|
|
6
|
+
reason: "enabled" | "setting_disabled" | "kill_switch";
|
|
7
|
+
}
|
|
8
|
+
export interface TelemetrySettingsReader {
|
|
9
|
+
get(path: "telemetry.enabled"): boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function getTelemetryStatus(settings: TelemetrySettingsReader): TelemetryStatus;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const TELEMETRY_SCHEMA_VERSION: 1;
|
|
2
|
+
export declare const TELEMETRY_INSTALL_ID_FILE: "telemetry-install-id";
|
|
3
|
+
export declare const TELEMETRY_EVENT_NAMES: readonly ["update_check_started", "update_check_completed", "update_install_started", "update_install_completed", "update_install_failed"];
|
|
4
|
+
export type TelemetryEventName = (typeof TELEMETRY_EVENT_NAMES)[number];
|
|
5
|
+
export interface TelemetryEvent {
|
|
6
|
+
schemaVersion: typeof TELEMETRY_SCHEMA_VERSION;
|
|
7
|
+
event: TelemetryEventName;
|
|
8
|
+
installId: string;
|
|
9
|
+
occurredAt: string;
|
|
10
|
+
channel?: "stable" | "nightly";
|
|
11
|
+
result?: "available" | "up_to_date" | "installed" | "failed" | "skipped";
|
|
12
|
+
installMethod?: "bun" | "npm" | "binary" | "migrate";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Serialize only the versioned telemetry allowlist. Unknown fields are never
|
|
16
|
+
* emitted; forbidden fields anywhere in the input fail closed.
|
|
17
|
+
*/
|
|
18
|
+
export declare function serializeTelemetryEvent(input: unknown): string;
|
|
19
|
+
/** Load or create a random UUIDv4 that is not derived from machine data. */
|
|
20
|
+
export declare function getTelemetryInstallId(filePath?: string): Promise<string>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getTelemetryStatus } from "./control";
|
|
2
|
+
import { type TelemetryEvent, type TelemetryEventName } from "./events";
|
|
3
|
+
export declare const TELEMETRY_ENDPOINT: "https://telemetry.gajae.dev/v1/events";
|
|
4
|
+
export declare const TELEMETRY_MAX_IN_FLIGHT: 2;
|
|
5
|
+
export declare const TELEMETRY_TIMEOUT_MS: 1500;
|
|
6
|
+
export declare const TELEMETRY_FLUSH_TIMEOUT_MS: 2000;
|
|
7
|
+
interface TelemetryTransportDependencies {
|
|
8
|
+
fetchImpl?: (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
9
|
+
endpoint?: string;
|
|
10
|
+
}
|
|
11
|
+
export type TelemetryDetails = Pick<TelemetryEvent, "channel" | "result" | "installMethod">;
|
|
12
|
+
/**
|
|
13
|
+
* Best-effort transport. The caller only schedules work; disabled telemetry,
|
|
14
|
+
* queue saturation, network errors, and non-2xx responses are all ignored.
|
|
15
|
+
*/
|
|
16
|
+
export declare function sendTelemetryEvent(settings: Parameters<typeof getTelemetryStatus>[0], event: TelemetryEvent, deps?: TelemetryTransportDependencies): Promise<void>;
|
|
17
|
+
export declare function resetTelemetryTransportForTest(): Promise<void>;
|
|
18
|
+
/** Schedule an event without making telemetry part of the caller's lifecycle. */
|
|
19
|
+
export declare function recordTelemetryEvent(event: TelemetryEventName, details: TelemetryDetails): Promise<void>;
|
|
20
|
+
/** Wait briefly for accepted events so explicit process exits do not drop them. */
|
|
21
|
+
export declare function flushTelemetryEvents(timeoutMs?: 2000): Promise<void>;
|
|
22
|
+
export {};
|
|
@@ -6,6 +6,24 @@ export interface BashInteractiveResult extends OutputSummary {
|
|
|
6
6
|
cancelled: boolean;
|
|
7
7
|
timedOut: boolean;
|
|
8
8
|
}
|
|
9
|
+
/** Live controls handed to the caller once the PTY run owns its session. */
|
|
10
|
+
export interface InteractivePtyControls {
|
|
11
|
+
/**
|
|
12
|
+
* Detach the overlay and settle the foreground call with `foldResult`, leaving
|
|
13
|
+
* the process running and still writing into the sink. Idempotent.
|
|
14
|
+
*/
|
|
15
|
+
detachObserver: (foldResult: BashInteractiveResult) => "resolved" | "already-settled";
|
|
16
|
+
/**
|
|
17
|
+
* Resolves with the run's real summary when the process actually ends,
|
|
18
|
+
* regardless of whether the foreground was folded. A folded run is delivered
|
|
19
|
+
* from this, so its result can never be silently dropped.
|
|
20
|
+
*/
|
|
21
|
+
terminalCompletion: Promise<BashInteractiveResult>;
|
|
22
|
+
/** Kill the owned process during owner teardown; the observer never calls this. */
|
|
23
|
+
kill: () => void;
|
|
24
|
+
/** Stop forwarding the foreground abort signal after ownership transfers on fold. */
|
|
25
|
+
detachForegroundCancellation: () => void;
|
|
26
|
+
}
|
|
9
27
|
export declare function runInteractiveBashPty(ui: NonNullable<AgentToolContext["ui"]>, options: {
|
|
10
28
|
command: string;
|
|
11
29
|
cwd: string;
|
|
@@ -18,4 +36,9 @@ export declare function runInteractiveBashPty(ui: NonNullable<AgentToolContext["
|
|
|
18
36
|
spillThreshold?: number;
|
|
19
37
|
headBytes?: number;
|
|
20
38
|
settings?: Settings;
|
|
39
|
+
/** Receives live controls once the session is running; used to register a fold. */
|
|
40
|
+
onControls?: (controls: InteractivePtyControls) => void;
|
|
41
|
+
onFoldKey?: () => boolean;
|
|
42
|
+
onDismiss?: () => void;
|
|
43
|
+
onOutput?: (chunk: string) => void;
|
|
21
44
|
}): Promise<BashInteractiveResult>;
|
|
@@ -12,6 +12,7 @@ import type { AgentRegistry } from "../registry/agent-registry";
|
|
|
12
12
|
import type { ForkContextSeed, ForkContextSeedOptions, PurgeQueuedCustomMessagesResult } from "../session/agent-session";
|
|
13
13
|
import type { ArtifactManager } from "../session/artifacts";
|
|
14
14
|
import type { ClientBridge } from "../session/client-bridge";
|
|
15
|
+
import type { FoldAdapter } from "../session/fold-coordinator";
|
|
15
16
|
import type { CustomMessage } from "../session/messages";
|
|
16
17
|
import type { ToolChoiceQueue } from "../session/tool-choice-queue";
|
|
17
18
|
import type { SkillActiveEntry } from "../skill-state/active-state";
|
|
@@ -184,12 +185,12 @@ export interface ToolSession {
|
|
|
184
185
|
assertEvalExecutionAllowed?: () => void;
|
|
185
186
|
/** Track tool-owned eval work so session disposal can await/abort it like direct session eval runs. */
|
|
186
187
|
trackEvalExecution?<T>(execution: Promise<T>, abortController: AbortController): Promise<T>;
|
|
187
|
-
/** Register a
|
|
188
|
-
|
|
189
|
-
/** Whether a
|
|
188
|
+
/** Register a foldable foreground wait so the fold chord can move it into a background job. */
|
|
189
|
+
registerForegroundFoldParticipant?: (adapter: FoldAdapter) => () => void;
|
|
190
|
+
/** Whether a foreground wait is currently foldable into a background job. */
|
|
190
191
|
hasForegroundBashBackgroundRequestHandler?: () => boolean;
|
|
191
|
-
/** Request that the active
|
|
192
|
-
requestForegroundBashBackground?: () => boolean
|
|
192
|
+
/** Request that the active foreground wait fold into a background job, if supported. */
|
|
193
|
+
requestForegroundBashBackground?: () => Promise<boolean>;
|
|
193
194
|
/** Get the session-owned or inherited async job manager. */
|
|
194
195
|
getAsyncJobManager?: () => AsyncJobManager | undefined;
|
|
195
196
|
/** Resolves when the session queues user steering (or `signal` aborts) without consuming it; wait-style tools use this to end their observation early. */
|
|
@@ -17,7 +17,10 @@ export declare const SEARXNG_BEARER_CREDENTIAL_PREFIX = "gjc-searxng-bearer:";
|
|
|
17
17
|
/**
|
|
18
18
|
* Shared web search parameters passed to providers.
|
|
19
19
|
*
|
|
20
|
-
* `authStorage` is the
|
|
20
|
+
* `authStorage` is the credential source for canonical providers. Native
|
|
21
|
+
* active-model search may instead use `activeModelContext.resolveCredentials`,
|
|
22
|
+
* which is supplied by ModelRegistry so rotating config credentials and
|
|
23
|
+
* generated headers are refreshed before the request.
|
|
21
24
|
* Opening a sibling SQLite handle or calling provider-direct refresh helpers
|
|
22
25
|
* (e.g. `refreshOpenAIOpenAI code backendToken`, `refreshGoogleCloudToken`) is prohibited:
|
|
23
26
|
* it races the broker's per-credential refresh and POSTs the broker sentinel
|
|
@@ -72,8 +75,8 @@ export interface SearchParams {
|
|
|
72
75
|
codeExecution?: Record<string, unknown>;
|
|
73
76
|
urlContext?: Record<string, unknown>;
|
|
74
77
|
/**
|
|
75
|
-
* The
|
|
76
|
-
* handle
|
|
78
|
+
* The canonical source of truth for credentials. Providers MUST consult this
|
|
79
|
+
* handle (`getApiKey` for bearer-style auth, `getOAuthAccess`
|
|
77
80
|
* when identity metadata is required). Do not open `AgentStorage` or any
|
|
78
81
|
* `AuthCredentialStore` directly — that bypasses the broker pipeline and
|
|
79
82
|
* the per-credential single-flight refresh.
|
|
@@ -102,7 +105,9 @@ export declare abstract class SearchProvider {
|
|
|
102
105
|
*/
|
|
103
106
|
abstract isAvailable(authStorage: AuthStorage, settings?: SearchProviderSettings): Promise<boolean> | boolean;
|
|
104
107
|
/**
|
|
105
|
-
* Execute a search.
|
|
108
|
+
* Execute a search. Canonical credentials MUST be resolved through
|
|
109
|
+
* `params.authStorage`; active-model credentials MUST use the injected
|
|
110
|
+
* resolver when one is present.
|
|
106
111
|
*/
|
|
107
112
|
abstract search(params: SearchParams): Promise<SearchResponse>;
|
|
108
113
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Endpoint: POST https://api.x.ai/v1/responses
|
|
6
6
|
*/
|
|
7
7
|
import type { AuthStorage } from "@gajae-code/ai/core";
|
|
8
|
-
import type { SearchCitation, SearchResponse } from "../../../web/search/types";
|
|
8
|
+
import type { ActiveSearchModelContext, SearchCitation, SearchResponse } from "../../../web/search/types";
|
|
9
9
|
import type { SearchParams } from "./base";
|
|
10
10
|
import { SearchProvider } from "./base";
|
|
11
11
|
declare const XAI_SEARCH_MODES: readonly ["web", "x", "web_and_x"];
|
|
@@ -31,6 +31,7 @@ export interface XaiSearchParams {
|
|
|
31
31
|
signal?: AbortSignal;
|
|
32
32
|
authStorage: AuthStorage;
|
|
33
33
|
sessionId?: string;
|
|
34
|
+
activeModelContext?: ActiveSearchModelContext;
|
|
34
35
|
}
|
|
35
36
|
/** Test seam: the xAI search base URL as resolved from trusted env. */
|
|
36
37
|
export declare function resolveXaiSearchBaseUrlForTest(): string;
|
|
@@ -6,6 +6,16 @@
|
|
|
6
6
|
/** Supported web search providers */
|
|
7
7
|
export type SearchProviderId = "duckduckgo" | "insane" | "exa" | "brave" | "jina" | "kimi" | "zai" | "anthropic" | "perplexity" | "gemini" | "codex" | "xai" | "tavily" | "parallel" | "kagi" | "synthetic" | "searxng" | "openai-compatible";
|
|
8
8
|
export type WebSearchMode = "on" | "off" | "auto";
|
|
9
|
+
/** Credentials and request headers resolved for the active model. */
|
|
10
|
+
export interface ActiveSearchModelCredentials {
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
/** Refresh-aware resolver supplied by the model registry for native search. */
|
|
15
|
+
export type ActiveSearchModelCredentialResolver = (options: {
|
|
16
|
+
sessionId?: string;
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
}) => Promise<ActiveSearchModelCredentials>;
|
|
9
19
|
export interface ActiveSearchModelContext {
|
|
10
20
|
provider: string;
|
|
11
21
|
modelId: string;
|
|
@@ -13,6 +23,10 @@ export interface ActiveSearchModelContext {
|
|
|
13
23
|
api: string;
|
|
14
24
|
baseUrl?: string;
|
|
15
25
|
headers?: Record<string, string>;
|
|
26
|
+
/** Resolve the active model key and current headers before each native search. */
|
|
27
|
+
resolveCredentials?: ActiveSearchModelCredentialResolver;
|
|
28
|
+
/** True when registry-owned auth or transport overrides this active model. */
|
|
29
|
+
ownerAuthOverride?: boolean;
|
|
16
30
|
webSearch?: WebSearchMode;
|
|
17
31
|
}
|
|
18
32
|
export declare const CONFIGURABLE_SEARCH_PROVIDER_IDS: readonly ["duckduckgo", "insane", "exa", "brave", "jina", "kimi", "zai", "anthropic", "perplexity", "gemini", "codex", "xai", "tavily", "parallel", "kagi", "synthetic", "searxng"];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@gajae-code/coding-agent",
|
|
4
|
-
"version": "0.15.
|
|
4
|
+
"version": "0.15.6",
|
|
5
5
|
"description": "Gajae Code CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://gajae-code.com",
|
|
7
7
|
"author": "Yeachan-Heo and Gajae Code Contributors",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
"@agentclientprotocol/sdk": "1.3.0",
|
|
57
57
|
"@babel/parser": "^7.29.3",
|
|
58
58
|
"@mozilla/readability": "^0.6.0",
|
|
59
|
-
"@gajae-code/stats": "0.15.
|
|
60
|
-
"@gajae-code/agent-core": "0.15.
|
|
61
|
-
"@gajae-code/ai": "0.15.
|
|
62
|
-
"@gajae-code/natives": "0.15.
|
|
63
|
-
"@gajae-code/tui": "0.15.
|
|
64
|
-
"@gajae-code/utils": "0.15.
|
|
59
|
+
"@gajae-code/stats": "0.15.6",
|
|
60
|
+
"@gajae-code/agent-core": "0.15.6",
|
|
61
|
+
"@gajae-code/ai": "0.15.6",
|
|
62
|
+
"@gajae-code/natives": "0.15.6",
|
|
63
|
+
"@gajae-code/tui": "0.15.6",
|
|
64
|
+
"@gajae-code/utils": "0.15.6",
|
|
65
65
|
"@puppeteer/browsers": "^2.13.0",
|
|
66
66
|
"@types/turndown": "5.0.6",
|
|
67
67
|
"@xterm/headless": "^6.0.0",
|
|
@@ -128,6 +128,8 @@
|
|
|
128
128
|
"./slash-commands/helpers/mcp": null,
|
|
129
129
|
"./session/session-manager-internal": null,
|
|
130
130
|
"./session/session-manager-internal.js": null,
|
|
131
|
+
"./session/sdk-run-capability": null,
|
|
132
|
+
"./session/sdk-run-capability.js": null,
|
|
131
133
|
"./sdk": {
|
|
132
134
|
"types": "./dist/types/sdk/index.d.ts",
|
|
133
135
|
"import": "./src/sdk/index.ts"
|
|
@@ -275,6 +277,7 @@
|
|
|
275
277
|
"types": "./dist/types/commit/utils/*.d.ts",
|
|
276
278
|
"import": "./src/commit/utils/*.ts"
|
|
277
279
|
},
|
|
280
|
+
"./config/internal/*": null,
|
|
278
281
|
"./config/*": {
|
|
279
282
|
"types": "./dist/types/config/*.d.ts",
|
|
280
283
|
"import": "./src/config/*.ts"
|
|
@@ -2,6 +2,7 @@ import { readFileSync, writeFileSync } from "node:fs";
|
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import {
|
|
4
4
|
defaultClipboardPasteImageKeysForPlatform,
|
|
5
|
+
defaultForegroundFoldKeysForPlatform,
|
|
5
6
|
defaultMessageQueueKeysForPlatform,
|
|
6
7
|
KEYBINDINGS,
|
|
7
8
|
} from "../src/config/keybindings";
|
|
@@ -27,6 +28,9 @@ function defaultKeys(
|
|
|
27
28
|
case "app.clipboard.pasteImage":
|
|
28
29
|
keys = defaultClipboardPasteImageKeysForPlatform(platform);
|
|
29
30
|
break;
|
|
31
|
+
case "app.tool.backgroundFold":
|
|
32
|
+
keys = defaultForegroundFoldKeysForPlatform(platform);
|
|
33
|
+
break;
|
|
30
34
|
default:
|
|
31
35
|
keys = value.defaultKeys;
|
|
32
36
|
}
|
|
@@ -127,11 +127,11 @@ const LOCKED_EXCLUSIONS: Readonly<Record<string, string>> = {
|
|
|
127
127
|
"internal ACP lifecycle quiescence plumbing, not a user-facing control seam",
|
|
128
128
|
"agent_session:getToolByName": "internal accessor/plumbing, not a user-facing control seam",
|
|
129
129
|
"agent_session:getToolForExecution": "internal accessor/plumbing, not a user-facing control seam",
|
|
130
|
-
"agent_session:
|
|
131
|
-
"internal accessor/plumbing, not a user-facing control seam",
|
|
130
|
+
"agent_session:registerForegroundFoldParticipant": "internal accessor/plumbing, not a user-facing control seam",
|
|
132
131
|
"agent_session:hasForegroundBashBackgroundRequestHandler":
|
|
133
132
|
"internal accessor/plumbing, not a user-facing control seam",
|
|
134
|
-
"agent_session:requestForegroundBashBackground": "internal accessor/plumbing, not a user-facing control seam",
|
|
133
|
+
"agent_session:requestForegroundBashBackground": "internal accessor/plumbing, not a user-facing SDK control seam",
|
|
134
|
+
|
|
135
135
|
"agent_session:getSelectedMCPToolNames": "internal accessor/plumbing, not a user-facing control seam",
|
|
136
136
|
"agent_session:isToolDiscoveryEnabled": "internal accessor/plumbing, not a user-facing control seam",
|
|
137
137
|
"agent_session:getDiscoverableToolSearchIndex": "internal accessor/plumbing, not a user-facing control seam",
|