@gajae-code/coding-agent 0.12.21 → 0.13.0
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 +67 -2
- package/dist/types/cli/args.d.ts +5 -2
- package/dist/types/cli/root-flags.d.ts +246 -0
- package/dist/types/cli.d.ts +11 -19
- package/dist/types/commands/daemon.d.ts +0 -30
- package/dist/types/commands/launch.d.ts +11 -19
- package/dist/types/commands/quick-lane.d.ts +32 -0
- package/dist/types/commands/sdk.d.ts +21 -15
- package/dist/types/config/file-lock-gc.d.ts +2 -0
- package/dist/types/config/model-equivalence.d.ts +20 -0
- package/dist/types/config/model-profile-activation.d.ts +62 -17
- package/dist/types/config/model-profiles.d.ts +10 -0
- package/dist/types/config/model-registry.d.ts +68 -1
- package/dist/types/config/model-resolver.d.ts +15 -4
- package/dist/types/config/models-config-schema.d.ts +7 -2
- package/dist/types/config/provider-selection-policy.d.ts +62 -0
- package/dist/types/config/settings-schema.d.ts +36 -78
- package/dist/types/config/settings.d.ts +2 -0
- package/dist/types/edit/renderer.d.ts +5 -2
- package/dist/types/edit/streaming.d.ts +13 -0
- package/dist/types/extensibility/custom-tools/types.d.ts +2 -0
- package/dist/types/extensibility/extensions/compact-handler.d.ts +2 -1
- package/dist/types/extensibility/extensions/types.d.ts +3 -0
- package/dist/types/gjc-runtime/gc-runtime.d.ts +19 -5
- package/dist/types/internal-urls/local-protocol.d.ts +1 -0
- package/dist/types/modes/components/model-selector.d.ts +0 -2
- package/dist/types/modes/components/provider-order-context.d.ts +45 -0
- package/dist/types/modes/components/provider-order-editor.d.ts +24 -0
- package/dist/types/modes/components/settings-defs.d.ts +5 -1
- package/dist/types/modes/components/settings-selector.d.ts +2 -0
- package/dist/types/quick-lane/classify.d.ts +40 -0
- package/dist/types/runtime/stt-settings-setup.d.ts +18 -0
- package/dist/types/sdk/broker/broker.d.ts +56 -2
- package/dist/types/sdk/broker/operation-receipt-ledger.d.ts +25 -0
- package/dist/types/sdk/broker/session-index.d.ts +83 -2
- package/dist/types/sdk/broker/state-version.d.ts +1 -1
- package/dist/types/sdk/bus/notification-service.d.ts +6 -0
- package/dist/types/sdk/bus/prompt-reconciliation.d.ts +8 -1
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +4 -1
- package/dist/types/sdk/bus/telegram-daemon.d.ts +26 -0
- package/dist/types/sdk/cli/rows.d.ts +98 -0
- package/dist/types/sdk/cli/session-cli.d.ts +35 -3
- package/dist/types/sdk/elevation/allowlist.d.ts +20 -0
- package/dist/types/sdk/elevation/audit.d.ts +93 -0
- package/dist/types/sdk/elevation/capability.d.ts +3 -0
- package/dist/types/sdk/elevation/digest.d.ts +72 -0
- package/dist/types/sdk/elevation/dispatch-receipt.d.ts +85 -0
- package/dist/types/sdk/elevation/grant-ledger.d.ts +163 -0
- package/dist/types/sdk/elevation/owner.d.ts +48 -0
- package/dist/types/sdk/guides/cache.d.ts +98 -0
- package/dist/types/sdk/guides/catalog.d.ts +156 -0
- package/dist/types/sdk/guides/cli.d.ts +39 -0
- package/dist/types/sdk/guides/manifest.d.ts +66 -0
- package/dist/types/sdk/guides/verify.d.ts +66 -0
- package/dist/types/sdk/host/control/dispatch.d.ts +8 -0
- package/dist/types/sdk/host/control/index.d.ts +1 -1
- package/dist/types/sdk/host/control/operations.d.ts +3 -2
- package/dist/types/sdk/host/query/cursor.d.ts +10 -0
- package/dist/types/sdk/host/query/handlers.d.ts +21 -0
- package/dist/types/sdk/host/session-runtime.d.ts +9 -0
- package/dist/types/sdk/mcp/server.d.ts +2 -2
- package/dist/types/sdk/prompt-status.d.ts +11 -0
- package/dist/types/sdk/session.d.ts +4 -0
- package/dist/types/sdk/transport/index.d.ts +1 -0
- package/dist/types/sdk/transport/relay.d.ts +1 -0
- package/dist/types/sdk/transport/serve-cli.d.ts +20 -1
- package/dist/types/session/agent-session.d.ts +32 -18
- package/dist/types/session/blob-store.d.ts +13 -7
- package/dist/types/session/fallback-chain-controller.d.ts +15 -0
- package/dist/types/session/internal/managed-session-storage.d.ts +25 -1
- package/dist/types/session/internal/session-memory-sidecar.d.ts +5 -5
- package/dist/types/session/session-manager.d.ts +139 -10
- package/dist/types/session/session-storage.d.ts +48 -0
- package/dist/types/setup/provider-onboarding.d.ts +7 -1
- package/dist/types/slash-commands/builtin-registry.d.ts +14 -0
- package/dist/types/stt/setup.d.ts +2 -0
- package/dist/types/task/executor.d.ts +10 -2
- package/dist/types/tools/browser/runtime-diagnostics.d.ts +65 -0
- package/dist/types/tools/browser/tab-protocol.d.ts +4 -0
- package/dist/types/tools/browser/tab-supervisor.d.ts +2 -0
- package/dist/types/tools/browser/tab-worker.d.ts +2 -0
- package/dist/types/tools/browser.d.ts +2 -0
- package/dist/types/tools/image-gen.d.ts +14 -18
- package/dist/types/tools/index.d.ts +2 -0
- package/dist/types/tools/resource-gc.d.ts +2 -0
- package/dist/types/utils/pasted-image-path.d.ts +6 -0
- package/package.json +9 -9
- package/scripts/generate-sdk-operation-inventory.ts +8 -0
- package/scripts/run-test-manifest.ts +61 -21
- package/scripts/verify-gjc-sdk-canonicalization.ts +9 -4
- package/src/cli/args.ts +62 -9
- package/src/cli/completion-cli.ts +1 -0
- package/src/cli/fast-help.ts +1 -0
- package/src/cli/root-flags.ts +100 -0
- package/src/cli/setup-cli.ts +6 -2
- package/src/cli.ts +42 -65
- package/src/commands/acp.ts +1 -1
- package/src/commands/daemon.ts +2 -31
- package/src/commands/gc.ts +1 -1
- package/src/commands/launch.ts +8 -129
- package/src/commands/quick-lane.ts +51 -0
- package/src/commands/sdk.ts +200 -26
- package/src/commands/setup.ts +4 -2
- package/src/config/file-lock-gc.ts +4 -1
- package/src/config/model-equivalence.ts +76 -7
- package/src/config/model-profile-activation.ts +1115 -265
- package/src/config/model-profiles.ts +134 -2
- package/src/config/model-registry.ts +352 -50
- package/src/config/model-resolver.ts +289 -38
- package/src/config/models-config-schema.ts +11 -4
- package/src/config/provider-selection-policy.ts +146 -0
- package/src/config/settings-schema.ts +50 -77
- package/src/config/settings.ts +40 -0
- package/src/coordinator-mcp/server.ts +32 -2
- package/src/edit/renderer.ts +175 -223
- package/src/edit/streaming.ts +108 -1
- package/src/export/html/index.ts +57 -7
- package/src/extensibility/custom-tools/types.ts +2 -0
- package/src/extensibility/extensions/compact-handler.ts +3 -2
- package/src/extensibility/extensions/runner.ts +6 -0
- package/src/extensibility/extensions/types.ts +3 -0
- package/src/gjc-runtime/gc-runtime.ts +379 -20
- package/src/gjc-runtime/launch-worktree.ts +5 -1
- package/src/gjc-runtime/team-runtime.ts +59 -2
- package/src/gjc-runtime/tmux-owner-isolation.ts +19 -0
- package/src/gjc-runtime/ultragoal-receipt-freshness.ts +16 -1
- package/src/internal-urls/docs-index.generated.ts +17 -13
- package/src/internal-urls/local-protocol.ts +1 -0
- package/src/main.ts +40 -3
- package/src/memories/index.ts +4 -2
- package/src/modes/acp/acp-agent.ts +235 -91
- package/src/modes/components/model-selector.ts +206 -42
- package/src/modes/components/provider-order-context.ts +197 -0
- package/src/modes/components/provider-order-editor.ts +441 -0
- package/src/modes/components/settings-defs.ts +21 -1
- package/src/modes/components/settings-selector.ts +45 -2
- package/src/modes/components/tool-execution.ts +47 -15
- package/src/modes/controllers/command-controller.ts +6 -3
- package/src/modes/controllers/extension-ui-controller.ts +2 -0
- package/src/modes/controllers/input-controller.ts +73 -2
- package/src/modes/controllers/selector-controller.ts +260 -153
- package/src/modes/prompt-suggestion-controller.ts +1 -1
- package/src/modes/runtime-init.ts +1 -0
- package/src/modes/utils/ui-helpers.ts +18 -0
- package/src/prompts/tools/browser.md +1 -0
- package/src/quick-lane/classify.ts +257 -0
- package/src/rlm/index.ts +1 -1
- package/src/runtime/stt-settings-setup.ts +57 -0
- package/src/sdk/acp/adapter.ts +2 -1
- package/src/sdk/broker/broker.ts +780 -12
- package/src/sdk/broker/lifecycle.ts +70 -29
- package/src/sdk/broker/operation-receipt-ledger.ts +144 -0
- package/src/sdk/broker/session-index.ts +463 -48
- package/src/sdk/broker/state-version.ts +13 -9
- package/src/sdk/broker/transport.ts +14 -1
- package/src/sdk/bus/index.ts +34 -13
- package/src/sdk/bus/kind-aware-reconciliation.ts +21 -2
- package/src/sdk/bus/notification-service.ts +47 -1
- package/src/sdk/bus/prompt-reconciliation.ts +22 -3
- package/src/sdk/bus/telegram-daemon-contract.ts +4 -1
- package/src/sdk/bus/telegram-daemon.ts +54 -3
- package/src/sdk/cli/rows.ts +247 -0
- package/src/sdk/cli/session-cli.ts +930 -79
- package/src/sdk/elevation/allowlist.ts +54 -0
- package/src/sdk/elevation/audit.ts +208 -0
- package/src/sdk/elevation/capability.ts +41 -0
- package/src/sdk/elevation/digest.ts +129 -0
- package/src/sdk/elevation/dispatch-receipt.ts +184 -0
- package/src/sdk/elevation/grant-ledger.ts +1142 -0
- package/src/sdk/elevation/owner.ts +109 -0
- package/src/sdk/guides/cache.ts +363 -0
- package/src/sdk/guides/catalog.ts +554 -0
- package/src/sdk/guides/cli.ts +235 -0
- package/src/sdk/guides/manifest.ts +152 -0
- package/src/sdk/guides/verify.ts +178 -0
- package/src/sdk/host/control/dispatch.ts +49 -1
- package/src/sdk/host/control/index.ts +1 -0
- package/src/sdk/host/control/operations.ts +8 -1
- package/src/sdk/host/query/cursor.ts +47 -3
- package/src/sdk/host/query/handlers.ts +155 -2
- package/src/sdk/host/sdk-surface-parity.test.ts +1 -0
- package/src/sdk/host/session-runtime.test.ts +391 -1
- package/src/sdk/host/session-runtime.ts +308 -73
- package/src/sdk/host/surface-policy.ts +3 -0
- package/src/sdk/host/websocket-transport.ts +7 -1
- package/src/sdk/mcp/server.ts +88 -15
- package/src/sdk/prompt-status.ts +8 -0
- package/src/sdk/protocol/operation-inventory.generated.json +62 -0
- package/src/sdk/protocol/operation-registry.ts +3 -2
- package/src/sdk/session.ts +87 -39
- package/src/sdk/transport/index.ts +1 -0
- package/src/sdk/transport/relay.ts +3 -0
- package/src/sdk/transport/serve-cli.ts +111 -24
- package/src/secrets/obfuscator.ts +92 -12
- package/src/session/agent-session.ts +322 -93
- package/src/session/blob-store.ts +60 -8
- package/src/session/fallback-chain-controller.ts +35 -0
- package/src/session/internal/managed-session-scope.ts +25 -3
- package/src/session/internal/managed-session-storage.ts +574 -73
- package/src/session/internal/session-memory-sidecar.ts +19 -29
- package/src/session/session-manager.ts +2166 -743
- package/src/session/session-storage.ts +715 -48
- package/src/setup/provider-onboarding.ts +19 -3
- package/src/setup/provider-presets.json +3 -1
- package/src/slash-commands/builtin-registry.ts +85 -3
- package/src/stt/downloader.ts +2 -3
- package/src/stt/setup.ts +29 -4
- package/src/task/executor.ts +22 -18
- package/src/task/index.ts +24 -1
- package/src/tools/archive-reader.ts +11 -2
- package/src/tools/browser/runtime-diagnostics.ts +249 -0
- package/src/tools/browser/tab-protocol.ts +4 -0
- package/src/tools/browser/tab-supervisor.ts +5 -0
- package/src/tools/browser/tab-worker.ts +36 -1
- package/src/tools/browser.ts +7 -0
- package/src/tools/image-gen.ts +110 -166
- package/src/tools/index.ts +2 -0
- package/src/tools/read.ts +1 -1
- package/src/tools/resource-gc.ts +6 -1
- package/src/tools/tool-catalog.generated.ts +5 -1
- package/src/utils/pasted-image-path.ts +93 -0
- package/src/web/search/index.ts +3 -3
|
@@ -86,6 +86,54 @@ export interface SessionManagerObservabilityStats {
|
|
|
86
86
|
materializedCacheDemotedCount: number;
|
|
87
87
|
pathOnlyContextBuildCount: number;
|
|
88
88
|
}
|
|
89
|
+
export type SessionMemoryMode = "off" | "shadow" | "enabled" | "auto";
|
|
90
|
+
export type SessionMemoryGcStrategy = "current" | "none" | "async" | "pressure";
|
|
91
|
+
export type SessionMemorySecondaryArtifactMode = "auto" | "enabled" | "disabled";
|
|
92
|
+
export interface SessionMemoryPhaseTelemetry {
|
|
93
|
+
wallMs: number;
|
|
94
|
+
cpuMs: number | null;
|
|
95
|
+
}
|
|
96
|
+
export interface SessionMemoryFirstOpenTelemetry {
|
|
97
|
+
/** True when a bounded first-open attempt was started for this manager. */
|
|
98
|
+
attempted: boolean;
|
|
99
|
+
/** True only after the bounded sidecar set and context were committed. */
|
|
100
|
+
succeeded: boolean;
|
|
101
|
+
strategy: SessionMemoryGcStrategy;
|
|
102
|
+
secondaryArtifactMode: SessionMemorySecondaryArtifactMode;
|
|
103
|
+
wallMs: number;
|
|
104
|
+
cpuMs: number;
|
|
105
|
+
gcRequests: number;
|
|
106
|
+
gcRequestCount: number;
|
|
107
|
+
gcElapsedMs: number;
|
|
108
|
+
bytesRead: number;
|
|
109
|
+
transcriptBytesRead: number;
|
|
110
|
+
bytesWritten: number;
|
|
111
|
+
sidecarBytesWritten: number;
|
|
112
|
+
sidecarFileBytes: number;
|
|
113
|
+
recordsParsed: number;
|
|
114
|
+
semanticRecordsParsed: number;
|
|
115
|
+
suffixRecordsParsed: number;
|
|
116
|
+
lineAssemblyCopyCount: number;
|
|
117
|
+
lineCopyCount: number;
|
|
118
|
+
lineAssemblyCopyBytes: number;
|
|
119
|
+
indexWriteCalls: number;
|
|
120
|
+
indexWriteBytes: number;
|
|
121
|
+
fsyncCount: number;
|
|
122
|
+
fsyncElapsedMs: number;
|
|
123
|
+
/** Phase names are stable internal keys; missing phases remain zero-valued. */
|
|
124
|
+
phaseTelemetry: Record<string, SessionMemoryPhaseTelemetry>;
|
|
125
|
+
/** Alias retained for benchmark/report consumers. */
|
|
126
|
+
phaseEvidence: Readonly<Record<string, SessionMemoryPhaseTelemetry>>;
|
|
127
|
+
/** Alias retained for benchmark/report consumers. */
|
|
128
|
+
phaseTimings: Readonly<Record<string, SessionMemoryPhaseTelemetry>>;
|
|
129
|
+
/** Internal pressure-mode baseline; not persisted. */
|
|
130
|
+
pressureBaselineBytes?: number;
|
|
131
|
+
dictionaryArtifactEnabled: boolean;
|
|
132
|
+
parentArtifactEnabled: boolean;
|
|
133
|
+
dictionaryBuildElapsedMs: number;
|
|
134
|
+
parentBuildElapsedMs: number;
|
|
135
|
+
flatIndexElapsedMs: number;
|
|
136
|
+
}
|
|
89
137
|
export interface SessionMemoryStats {
|
|
90
138
|
sidecarEnabled: boolean;
|
|
91
139
|
coldRetirementActive: boolean;
|
|
@@ -93,6 +141,18 @@ export interface SessionMemoryStats {
|
|
|
93
141
|
hotRegionBytes: number;
|
|
94
142
|
metaDescriptorBytes: number;
|
|
95
143
|
totalAccountedBytes: number;
|
|
144
|
+
/** Fixed cache/reducer reservation charged for enforcement, distinct from live residency. */
|
|
145
|
+
reservedBudgetBytes: number;
|
|
146
|
+
/** Bytes currently allocated in bounded block/entry/tail caches. */
|
|
147
|
+
allocatedCacheBytes: number;
|
|
148
|
+
/** Resident hot suffix object bytes, excluding reserved budgets. */
|
|
149
|
+
hotResidentBytes: number;
|
|
150
|
+
/** Resident reducer/labels/metadata-delta descriptor bytes. */
|
|
151
|
+
metadataResidentBytes: number;
|
|
152
|
+
/** Bytes currently present in disposable sidecar files. */
|
|
153
|
+
sidecarFileBytes: number;
|
|
154
|
+
/** Latest bounded first-open telemetry; zero-valued when no attempt ran. */
|
|
155
|
+
firstOpen: SessionMemoryFirstOpenTelemetry;
|
|
96
156
|
lastReopenTransition: ReopenClassification | undefined;
|
|
97
157
|
currentCommitTransition: ReopenClassification | undefined;
|
|
98
158
|
lazyReopenAttempted: boolean;
|
|
@@ -155,6 +215,8 @@ export interface ModelChangeEntry extends SessionEntryBase {
|
|
|
155
215
|
model: string;
|
|
156
216
|
/** Role: "default" or an agent role. Undefined treated as "default" */
|
|
157
217
|
role?: string;
|
|
218
|
+
/** Clears the role's previously recorded model when replaying session context. */
|
|
219
|
+
cleared?: boolean;
|
|
158
220
|
/** Requested model before a runtime substitution/fallback, in "provider/modelId" format. */
|
|
159
221
|
previousModel?: string;
|
|
160
222
|
/** Machine-readable reason for runtime model substitution/fallback. */
|
|
@@ -330,6 +392,8 @@ export interface SessionMemorySidecarRuntime {
|
|
|
330
392
|
sidecarIneligible: boolean;
|
|
331
393
|
base: BaseAnchor;
|
|
332
394
|
tail: CommittedTail;
|
|
395
|
+
/** Next non-header ordinal, proven while building or validating the flat index. */
|
|
396
|
+
nextOrdinal: number;
|
|
333
397
|
/** Bounded hot index cache; authoritative lookup falls back to the disk index. */
|
|
334
398
|
coldEntries: Map<string, ColdEntryIndex>;
|
|
335
399
|
indexPath: string;
|
|
@@ -346,6 +410,12 @@ export interface SessionMemorySidecarRuntime {
|
|
|
346
410
|
retirementFirstKeptEntryId: string | undefined;
|
|
347
411
|
/** Hot-suffix byte total (accountant-bounded to ≤ 16 MiB). */
|
|
348
412
|
hotSuffixBytes: number;
|
|
413
|
+
/** Resident hot suffix object bytes charged separately from the raw hot-region byte count. */
|
|
414
|
+
hotResidentBytes: number;
|
|
415
|
+
/** Fixed reservation used for accounting split telemetry. */
|
|
416
|
+
reservedBudgetBytes: number;
|
|
417
|
+
/** Disposable sidecar file byte total captured after first-open publication. */
|
|
418
|
+
sidecarFileBytes: number;
|
|
349
419
|
accountant: SessionMemoryAccountant;
|
|
350
420
|
reducer: ReducerState;
|
|
351
421
|
/** Resident inline provider-affecting entries (merged order minus demoted slots). */
|
|
@@ -377,7 +447,7 @@ export interface SessionMemorySidecarRuntime {
|
|
|
377
447
|
dictionary?: DictionaryArtifactRuntimeState;
|
|
378
448
|
/** Persistent metadata-delta section state; absent = no demoted provider values. */
|
|
379
449
|
metadataDelta?: MetadataDeltaArtifactRuntimeState;
|
|
380
|
-
/**
|
|
450
|
+
/** Fixed-size false-positive-only cache used solely for generated-ID collision avoidance. */
|
|
381
451
|
coldIdHashes?: BoundedColdIdHashSet;
|
|
382
452
|
coldIdHashesDescriptor?: SessionStorageStat;
|
|
383
453
|
/** Live observability counters (P7 live-only contract). */
|
|
@@ -452,11 +522,18 @@ interface MetadataDeltaArtifactRuntimeState {
|
|
|
452
522
|
/** Descriptor of the exact delta bytes whose digest was validated. */
|
|
453
523
|
validatedDescriptor?: SessionStorageStat;
|
|
454
524
|
}
|
|
525
|
+
/**
|
|
526
|
+
* Bounded first-open transcript scan limits. The eager authoritative path handles
|
|
527
|
+
* anything outside these bounds; the bounded path only ever fails closed to it.
|
|
528
|
+
*/
|
|
529
|
+
export declare const BOUNDED_FIRST_OPEN_MAX_LINE_BYTES: number;
|
|
530
|
+
/** Fixed-size collision cache for generated IDs. False positives only cause regeneration. */
|
|
455
531
|
declare class BoundedColdIdHashSet {
|
|
456
532
|
#private;
|
|
533
|
+
constructor(maxEntries?: number);
|
|
534
|
+
get atCapacity(): boolean;
|
|
457
535
|
has(value: string): boolean;
|
|
458
536
|
add(value: string): boolean;
|
|
459
|
-
addUnique(value: string): boolean;
|
|
460
537
|
}
|
|
461
538
|
export type DefaultModelSelectionStage = {
|
|
462
539
|
readonly entryRevision: number;
|
|
@@ -562,6 +639,12 @@ export type SessionDirectoryMigrationPolicy = ManagedMigrationPolicy;
|
|
|
562
639
|
export type SessionAppendPersistenceFailurePhase = "current_append" | "prior_failure";
|
|
563
640
|
/** Safety bound for eager resume compatibility and managed per-file artifacts. */
|
|
564
641
|
export declare const RESUME_TRANSCRIPT_MAX_BYTES: number;
|
|
642
|
+
/**
|
|
643
|
+
* Explicit cold-session admission limit. Two-GiB transcripts remain streamable;
|
|
644
|
+
* the extra MiB covers bounded fork header replacement without rejecting a
|
|
645
|
+
* source exactly at the advertised limit.
|
|
646
|
+
*/
|
|
647
|
+
export declare const BOUNDED_RESUME_TRANSCRIPT_MAX_BYTES: number;
|
|
565
648
|
export declare const SESSION_OVERSIZED_RECOVERY_MESSAGE = "The selected session transcript is too large to resume safely. Use `gjc export <session-file>` to export its content into a new session, or remove/archive it after confirming its content is no longer needed.";
|
|
566
649
|
export declare class SessionAppendPersistenceError extends Error {
|
|
567
650
|
readonly phase: SessionAppendPersistenceFailurePhase;
|
|
@@ -586,6 +669,19 @@ export declare class SessionTranscriptOversizedError extends Error {
|
|
|
586
669
|
readonly size: number;
|
|
587
670
|
constructor(size: number);
|
|
588
671
|
}
|
|
672
|
+
/** Default synchronous session-context materialization budget (512 MiB). */
|
|
673
|
+
export declare const SESSION_CONTEXT_MATERIALIZATION_BUDGET_BYTES_DEFAULT: number;
|
|
674
|
+
/** Ceiling for a `GJC_SESSION_CONTEXT_BUDGET_BYTES` override (8 GiB) so the memory guard stays meaningful. */
|
|
675
|
+
export declare const SESSION_CONTEXT_MATERIALIZATION_BUDGET_BYTES_MAX: number;
|
|
676
|
+
/**
|
|
677
|
+
* Resolve the operation-peak session-context materialization budget from the
|
|
678
|
+
* `GJC_SESSION_CONTEXT_BUDGET_BYTES` override. Parsing is fail-closed: only a
|
|
679
|
+
* canonical positive-integer decimal value is honored; anything else (empty,
|
|
680
|
+
* non-numeric, negative, zero, overflowing a safe integer, or above the
|
|
681
|
+
* documented ceiling) falls back to the 512 MiB default and is surfaced as a
|
|
682
|
+
* warning so a dropped override is never silent.
|
|
683
|
+
*/
|
|
684
|
+
export declare function resolveSessionContextBudgetBytes(override: string | undefined): number;
|
|
589
685
|
/** Operation-peak budget for one synchronous session-context materialization. */
|
|
590
686
|
export declare const SESSION_CONTEXT_MATERIALIZATION_BUDGET_BYTES: number;
|
|
591
687
|
/**
|
|
@@ -872,6 +968,7 @@ interface SessionManagerStateSnapshot {
|
|
|
872
968
|
fileEntries: FileEntry[];
|
|
873
969
|
materializedFileEntries: FileEntry[];
|
|
874
970
|
adoptedArtifactManager: ArtifactManager | null;
|
|
971
|
+
coldRestoreFile?: string;
|
|
875
972
|
}
|
|
876
973
|
/** Benchmark-derived cap for strong materialized session snapshots. */
|
|
877
974
|
export declare const MATERIALIZED_CACHE_MAX_BYTES: number;
|
|
@@ -883,6 +980,22 @@ export declare const SessionManagerTestHooks: {
|
|
|
883
980
|
afterForkTranscriptPublished?: () => void | Promise<void>;
|
|
884
981
|
beforeEphemeralArtifactManagerInstall?: (dir: string) => void | Promise<void>;
|
|
885
982
|
beforePersistPatchFence?: (attempt: number) => void;
|
|
983
|
+
/** Internal first-open GC strategy override; omitted means current. */
|
|
984
|
+
firstOpenGcStrategy?: SessionMemoryGcStrategy;
|
|
985
|
+
/** Internal first-open secondary-artifact mode override; omitted means auto. */
|
|
986
|
+
secondaryArtifactMode?: SessionMemorySecondaryArtifactMode;
|
|
987
|
+
/** Test-only transcript threshold override for automatic routing. */
|
|
988
|
+
autoModeMinTranscriptBytesOverride?: number;
|
|
989
|
+
/** Test-only eager hydration ceiling override. */
|
|
990
|
+
eagerHydrationMaxBytesOverride?: number;
|
|
991
|
+
/** Test-only rolling-tail buffer override for tail-overflow coverage. */
|
|
992
|
+
sidecarTailBufferBytesOverride?: number;
|
|
993
|
+
/** Test-only counter proving complete-index allocation was not used. */
|
|
994
|
+
readAllColdEntryIndexesCalls?: number;
|
|
995
|
+
/** Test-only exact-reopen exception diagnostic. */
|
|
996
|
+
lastSidecarInitError?: string;
|
|
997
|
+
/** Test-only generated-ID cache capacity override. */
|
|
998
|
+
coldIdHashMaxEntriesOverride?: number;
|
|
886
999
|
};
|
|
887
1000
|
/**
|
|
888
1001
|
* Freshness snapshot captured with every async whole-session persistence
|
|
@@ -908,7 +1021,6 @@ export declare class SessionManager {
|
|
|
908
1021
|
private cwd;
|
|
909
1022
|
private sessionDir;
|
|
910
1023
|
private readonly persist;
|
|
911
|
-
private readonly storage;
|
|
912
1024
|
private destination;
|
|
913
1025
|
private constructor();
|
|
914
1026
|
/**
|
|
@@ -919,6 +1031,10 @@ export declare class SessionManager {
|
|
|
919
1031
|
revisionSnapshot(): SessionManagerRevisionSnapshot;
|
|
920
1032
|
/** Puts a binary blob into the blob store and returns the blob reference */
|
|
921
1033
|
putBlob(data: Buffer): Promise<BlobPutResult>;
|
|
1034
|
+
/** Capture rollback authority without materializing an active cold transcript. @internal */
|
|
1035
|
+
captureRollbackState(): Promise<SessionManagerStateSnapshot>;
|
|
1036
|
+
/** Restore a rollback snapshot, reopening cold authority instead of hydrating it. @internal */
|
|
1037
|
+
restoreRollbackState(snapshot: SessionManagerStateSnapshot): Promise<void>;
|
|
922
1038
|
captureState(): SessionManagerStateSnapshot;
|
|
923
1039
|
restoreState(snapshot: SessionManagerStateSnapshot): void;
|
|
924
1040
|
/** Switch to a different session file (used for resume and branching). */
|
|
@@ -1015,7 +1131,7 @@ export declare class SessionManager {
|
|
|
1015
1131
|
getSessionId(): string;
|
|
1016
1132
|
getSessionFile(): string | undefined;
|
|
1017
1133
|
getSessionMemoryStats(): SessionMemoryStats;
|
|
1018
|
-
setSessionMemoryMode(mode:
|
|
1134
|
+
setSessionMemoryMode(mode: SessionMemoryMode): void;
|
|
1019
1135
|
acquireMemoryGuardParticipantIngressLease(): MemoryGuardParticipantIngressLease;
|
|
1020
1136
|
createMemoryGuardCheckpoint(input: MemoryGuardCreateCheckpointInput): Promise<MemoryGuardSessionManagerCheckpointV1>;
|
|
1021
1137
|
/**
|
|
@@ -1027,6 +1143,8 @@ export declare class SessionManager {
|
|
|
1027
1143
|
*/
|
|
1028
1144
|
getArtifactsDir(): string | null;
|
|
1029
1145
|
isManagedDestination(): boolean;
|
|
1146
|
+
/** Retain the verified destination contract for bounded forks. @internal */
|
|
1147
|
+
getDestinationForFork(): SessionDestination;
|
|
1030
1148
|
/** Supplies opaque retained authority for mandatory managed legacy local migration. */
|
|
1031
1149
|
getManagedLegacyLocalMigrationSource(): ManagedLegacyLocalMigrationSource | null;
|
|
1032
1150
|
/**
|
|
@@ -1125,6 +1243,8 @@ export declare class SessionManager {
|
|
|
1125
1243
|
reason?: string;
|
|
1126
1244
|
thinkingLevel?: string | null;
|
|
1127
1245
|
}): string;
|
|
1246
|
+
/** Append an explicit role-model clear marker, preserving absence during replay. */
|
|
1247
|
+
clearModelRole(role: string): string;
|
|
1128
1248
|
/** Append session init metadata (for subagent debugging/replay). Returns entry id. */
|
|
1129
1249
|
appendSessionInit(init: {
|
|
1130
1250
|
systemPrompt: string;
|
|
@@ -1212,6 +1332,13 @@ export declare class SessionManager {
|
|
|
1212
1332
|
getLastModelChangeRole(): string | undefined;
|
|
1213
1333
|
evictCompactedContent(firstKeptEntryId: string, compactionEntryId: string): EvictCompactedContentResult;
|
|
1214
1334
|
getObservabilityStatsForTests(): SessionManagerObservabilityStats;
|
|
1335
|
+
/**
|
|
1336
|
+
* Directory backing the resident *text* blob store, or undefined when the
|
|
1337
|
+
* store is in-memory. The resident-cache root also holds the managed sidecar
|
|
1338
|
+
* cache instance, so callers must not infer the text store from directory
|
|
1339
|
+
* counts.
|
|
1340
|
+
*/
|
|
1341
|
+
residentTextCacheDirForTests(): string | undefined;
|
|
1215
1342
|
setSidecarHotSuffixBudgetForTests(bytes: number): void;
|
|
1216
1343
|
parentChildrenCacheKeysForTests(): string[];
|
|
1217
1344
|
parentArtifactEnabledForTests(): boolean;
|
|
@@ -1263,6 +1390,8 @@ export declare class SessionManager {
|
|
|
1263
1390
|
* Get session header.
|
|
1264
1391
|
*/
|
|
1265
1392
|
getHeader(): SessionHeader | null;
|
|
1393
|
+
/** Whether this manager contains persisted history without forcing cold hydration. */
|
|
1394
|
+
hasHistoryEntries(): boolean;
|
|
1266
1395
|
getEntries(): SessionEntry[];
|
|
1267
1396
|
/**
|
|
1268
1397
|
* Get the session as a tree structure. Returns defensive copies of all entries.
|
|
@@ -1321,14 +1450,14 @@ export declare class SessionManager {
|
|
|
1321
1450
|
* Fork a session into the current project directory.
|
|
1322
1451
|
* Copies history from another session file while creating a new session file in the current sessionDir.
|
|
1323
1452
|
*/
|
|
1324
|
-
static forkFrom(sourcePath: string, cwd: string, destinationInput?: SessionDestinationInput, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy, sessionMemoryMode?:
|
|
1453
|
+
static forkFrom(sourcePath: string, cwd: string, destinationInput?: SessionDestinationInput, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy, sessionMemoryMode?: SessionMemoryMode): Promise<SessionManager>;
|
|
1325
1454
|
/**
|
|
1326
1455
|
* Open a specific session file.
|
|
1327
1456
|
* @param path Path to session file
|
|
1328
1457
|
* @param sessionDir Optional session directory for /new or /branch. If omitted, derives from file's parent.
|
|
1329
1458
|
*/
|
|
1330
|
-
static open(filePath: string, destinationInput?: SessionDestinationInput, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy, sessionMemoryMode?:
|
|
1331
|
-
static openNestedManaged(filePath: string, destination: SessionDestination, store: ManagedSessionDescendantStore, storage?: SessionStorage, cwdOverride?: string, sessionMemoryMode?:
|
|
1459
|
+
static open(filePath: string, destinationInput?: SessionDestinationInput, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy, sessionMemoryMode?: SessionMemoryMode): Promise<SessionManager>;
|
|
1460
|
+
static openNestedManaged(filePath: string, destination: SessionDestination, store: ManagedSessionDescendantStore, storage?: SessionStorage, cwdOverride?: string, sessionMemoryMode?: SessionMemoryMode): Promise<SessionManager>;
|
|
1332
1461
|
/**
|
|
1333
1462
|
* List default-managed sessions for the resume picker without recovery or other
|
|
1334
1463
|
* maintenance writes. This is the only picker inventory that includes legacy
|
|
@@ -1350,7 +1479,7 @@ export declare class SessionManager {
|
|
|
1350
1479
|
* revalidate captured authority before destination initialization and transcript
|
|
1351
1480
|
* persistence; destination history always comes from the captured bytes.
|
|
1352
1481
|
*/
|
|
1353
|
-
static forkFromCaptured(snapshot: CapturedSessionTranscriptSnapshot, cwd: string, destinationInput?: SessionDestinationInput, _migrationPolicy?: SessionDirectoryMigrationPolicy, sessionMemoryMode?:
|
|
1482
|
+
static forkFromCaptured(snapshot: CapturedSessionTranscriptSnapshot, cwd: string, destinationInput?: SessionDestinationInput, _migrationPolicy?: SessionDirectoryMigrationPolicy, sessionMemoryMode?: SessionMemoryMode): Promise<StrictSessionForkResult>;
|
|
1354
1483
|
static restoreMemoryGuardCheckpoint(input: MemoryGuardRestoreInput): Promise<MemoryGuardRestoreResult>;
|
|
1355
1484
|
/** Inspect a selected session without acquiring write-capable ownership. */
|
|
1356
1485
|
static inspectSessionTailReadOnly(filePath: string, storage?: SessionStorage): Promise<ResumeTailInspection>;
|
|
@@ -1371,13 +1500,13 @@ export declare class SessionManager {
|
|
|
1371
1500
|
* the returned discriminant; an error result never creates, rewrites, or adopts
|
|
1372
1501
|
* the selected path. Breadcrumb ownership begins only after `kind: "opened"`.
|
|
1373
1502
|
*/
|
|
1374
|
-
static openExistingStrict(identity: ResumeSessionIdentity, destinationInput?: SessionDestinationInput, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy, sessionMemoryMode?:
|
|
1503
|
+
static openExistingStrict(identity: ResumeSessionIdentity, destinationInput?: SessionDestinationInput, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy, sessionMemoryMode?: SessionMemoryMode): Promise<StrictSessionOpenResult>;
|
|
1375
1504
|
/**
|
|
1376
1505
|
* Continue the most recent session, or create new if none.
|
|
1377
1506
|
* @param cwd Working directory
|
|
1378
1507
|
* @param sessionDir Optional session directory. If omitted, uses default (~/.gjc/agent/sessions/<encoded-cwd>/).
|
|
1379
1508
|
*/
|
|
1380
|
-
static continueRecent(cwd: string, destinationInput?: SessionDestinationInput, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy, sessionMemoryMode?:
|
|
1509
|
+
static continueRecent(cwd: string, destinationInput?: SessionDestinationInput, storage?: SessionStorage, migrationPolicy?: SessionDirectoryMigrationPolicy, sessionMemoryMode?: SessionMemoryMode): Promise<SessionManager>;
|
|
1381
1510
|
/** Create an in-memory session (no file persistence) */
|
|
1382
1511
|
static inMemory(cwd?: string, storage?: SessionStorage): SessionManager;
|
|
1383
1512
|
/**
|
|
@@ -62,6 +62,22 @@ export declare class SessionStorageWriterRetryableCloseError extends Error {
|
|
|
62
62
|
export interface SessionStorageWriterCloseAdapter {
|
|
63
63
|
close(fd: number): void;
|
|
64
64
|
}
|
|
65
|
+
/** Bounded buffered-writer capacity limits. */
|
|
66
|
+
export declare const SESSION_STORAGE_BUFFERED_WRITER_MIN_BYTES: number;
|
|
67
|
+
export declare const SESSION_STORAGE_BUFFERED_WRITER_MAX_BYTES: number;
|
|
68
|
+
export declare const SESSION_STORAGE_BUFFERED_WRITER_DEFAULT_BYTES: number;
|
|
69
|
+
/**
|
|
70
|
+
* Counters for a synchronous buffered sidecar writer. `bytesWritten` and
|
|
71
|
+
* `writeCalls` count operations against the backend, not calls accepted into
|
|
72
|
+
* the in-process buffer.
|
|
73
|
+
*/
|
|
74
|
+
export interface SessionStorageBufferedWriterInstrumentation {
|
|
75
|
+
readonly bytesSubmitted: number;
|
|
76
|
+
readonly bytesWritten: number;
|
|
77
|
+
readonly writeCalls: number;
|
|
78
|
+
readonly flushCalls: number;
|
|
79
|
+
readonly bufferedBytes: number;
|
|
80
|
+
}
|
|
65
81
|
/** Options for opening a {@link SessionStorageWriter}. */
|
|
66
82
|
export interface SessionStorageWriterOpenOptions {
|
|
67
83
|
flags?: "a" | "w";
|
|
@@ -70,6 +86,8 @@ export interface SessionStorageWriterOpenOptions {
|
|
|
70
86
|
closeAdapter?: SessionStorageWriterCloseAdapter;
|
|
71
87
|
/** Opaque authority for default-computed managed destinations only. */
|
|
72
88
|
securityContext?: SessionStorageSecurityContext;
|
|
89
|
+
/** Enable bounded synchronous buffering for disposable sidecar writes. */
|
|
90
|
+
bufferSize?: number;
|
|
73
91
|
}
|
|
74
92
|
/**
|
|
75
93
|
* Immutable authority attached only to a computed managed session destination.
|
|
@@ -127,6 +145,19 @@ export interface SessionStorageWriter {
|
|
|
127
145
|
/** Stored error for non-success close states (`close_failed_retryable`/`close_unknown`). */
|
|
128
146
|
getCloseError(): Error | undefined;
|
|
129
147
|
}
|
|
148
|
+
/** Synchronous byte-oriented writer with bounded buffering for disposable sidecars. */
|
|
149
|
+
export interface SessionStorageBufferedWriter extends SessionStorageWriter {
|
|
150
|
+
/** Append already-serialized bytes; the caller's view may be reused on return. */
|
|
151
|
+
writeBytesSync(bytes: Uint8Array): void;
|
|
152
|
+
/** Flush pending bytes to the backend without synchronizing them to stable storage. */
|
|
153
|
+
flushSync(): void;
|
|
154
|
+
/** Flush pending bytes, then synchronize the backend. */
|
|
155
|
+
fsyncSync(): void;
|
|
156
|
+
/** Flush pending bytes, then close the backend descriptor. */
|
|
157
|
+
closeSync(): void;
|
|
158
|
+
/** Snapshot backend-write counters and current pending capacity. */
|
|
159
|
+
getInstrumentation(): SessionStorageBufferedWriterInstrumentation;
|
|
160
|
+
}
|
|
130
161
|
/** Upper bound for one staged line (excluding the trailing newline). */
|
|
131
162
|
export declare const STAGED_WRITER_LINE_MAX_BYTES: number;
|
|
132
163
|
/** Upper bound for aggregated different-length patches buffered for the publish-time overlay pass. */
|
|
@@ -166,6 +197,9 @@ export interface StagedStreamingWriter {
|
|
|
166
197
|
/** Atomically publish the staged file at the destination only while it is absent. */
|
|
167
198
|
publishNoReplace(): void;
|
|
168
199
|
}
|
|
200
|
+
export interface SessionStorageExclusiveLock {
|
|
201
|
+
releaseSync(): void;
|
|
202
|
+
}
|
|
169
203
|
export interface SessionStorage {
|
|
170
204
|
ensureDirSync(dir: string): void;
|
|
171
205
|
existsSync(path: string): boolean;
|
|
@@ -206,12 +240,18 @@ export interface SessionStorage {
|
|
|
206
240
|
*/
|
|
207
241
|
deleteSessionVerified?(target: VerifiedSessionDeleteTarget): Promise<VerifiedSessionDeleteResult>;
|
|
208
242
|
openWriter(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageWriter;
|
|
243
|
+
/** Open a bounded synchronous byte-oriented writer for disposable sidecars. */
|
|
244
|
+
openBufferedWriter?(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageBufferedWriter;
|
|
209
245
|
/** Bounded recorded-length read with descriptor identity validation (additive). */
|
|
210
246
|
readRangeSync?(path: string, start: number, length: number): SessionStorageRangeSnapshot;
|
|
211
247
|
/** Async bounded recorded-length read with descriptor identity validation (additive). */
|
|
212
248
|
readRange?(path: string, start: number, length: number): Promise<SessionStorageRangeSnapshot>;
|
|
213
249
|
/** Open a staged streaming writer for one immutable one-shot destination (additive). */
|
|
214
250
|
openStagedWriter?(path: string, options?: SessionStorageWriterOpenOptions): StagedStreamingWriter;
|
|
251
|
+
/** Acquire an owner-bound exclusive lock; returns undefined while another owner holds it. */
|
|
252
|
+
acquireExclusiveLockSync?(path: string, options?: {
|
|
253
|
+
securityContext?: SessionStorageSecurityContext;
|
|
254
|
+
}): SessionStorageExclusiveLock | undefined;
|
|
215
255
|
}
|
|
216
256
|
/** Exact authorization evidence for a transcript or artifact path. */
|
|
217
257
|
export interface SessionStorageFileIdentity {
|
|
@@ -382,6 +422,9 @@ export declare function replaceSessionCommitMarkerCheckedSync(storage: SessionSt
|
|
|
382
422
|
}): void;
|
|
383
423
|
export declare class FileSessionStorage implements SessionStorage {
|
|
384
424
|
#private;
|
|
425
|
+
acquireExclusiveLockSync(lockPath: string, options?: {
|
|
426
|
+
securityContext?: SessionStorageSecurityContext;
|
|
427
|
+
}): SessionStorageExclusiveLock | undefined;
|
|
385
428
|
ensureDirSync(dir: string): void;
|
|
386
429
|
existsSync(path: string): boolean;
|
|
387
430
|
writeTextSync(fpath: string, content: string): void;
|
|
@@ -414,6 +457,7 @@ export declare class FileSessionStorage implements SessionStorage {
|
|
|
414
457
|
unlink(path: string): Promise<void>;
|
|
415
458
|
unlinkSync(path: string): void;
|
|
416
459
|
openWriter(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageWriter;
|
|
460
|
+
openBufferedWriter(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageBufferedWriter;
|
|
417
461
|
openStagedWriter(path: string, options?: SessionStorageWriterOpenOptions): StagedStreamingWriter;
|
|
418
462
|
/**
|
|
419
463
|
* Delete a session and sibling artifacts in an operator-selected explicit directory.
|
|
@@ -429,6 +473,9 @@ export declare class FileSessionStorage implements SessionStorage {
|
|
|
429
473
|
}
|
|
430
474
|
export declare class MemorySessionStorage implements SessionStorage {
|
|
431
475
|
#private;
|
|
476
|
+
acquireExclusiveLockSync(lockPath: string, _options?: {
|
|
477
|
+
securityContext?: SessionStorageSecurityContext;
|
|
478
|
+
}): SessionStorageExclusiveLock | undefined;
|
|
432
479
|
ensureDirSync(_dir: string): void;
|
|
433
480
|
existsSync(path: string): boolean;
|
|
434
481
|
writeBytesOwnedSync(path: string, content: Buffer): void;
|
|
@@ -462,6 +509,7 @@ export declare class MemorySessionStorage implements SessionStorage {
|
|
|
462
509
|
deleteSessionWithArtifacts(sessionPath: string): Promise<void>;
|
|
463
510
|
deleteSessionVerified(target: VerifiedSessionDeleteTarget): Promise<VerifiedSessionDeleteResult>;
|
|
464
511
|
openWriter(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageWriter;
|
|
512
|
+
openBufferedWriter(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageBufferedWriter;
|
|
465
513
|
openStagedWriter(path: string): StagedStreamingWriter;
|
|
466
514
|
}
|
|
467
515
|
/**
|
|
@@ -34,12 +34,18 @@ interface ProviderPreset {
|
|
|
34
34
|
compatibility: ProviderCompatibility;
|
|
35
35
|
api: ProviderSetupApi;
|
|
36
36
|
providerId: string;
|
|
37
|
-
baseUrl
|
|
37
|
+
baseUrl?: string;
|
|
38
38
|
apiKeyEnv: string;
|
|
39
39
|
models?: readonly string[];
|
|
40
40
|
modelApi?: Readonly<Record<string, ProviderSetupApi>>;
|
|
41
41
|
compat?: ProviderCompatConfig;
|
|
42
42
|
discovery?: ProviderDiscovery;
|
|
43
|
+
/**
|
|
44
|
+
* Parameterized presets (proxy gateways) do not hardcode a base URL or an
|
|
45
|
+
* unoverridable apiKeyEnv: the caller must supply `--base-url` and may
|
|
46
|
+
* override `--api-key-env`. `baseUrl` is absent for these presets.
|
|
47
|
+
*/
|
|
48
|
+
parameterized?: boolean;
|
|
43
49
|
}
|
|
44
50
|
export declare const PROVIDER_PRESETS: readonly ProviderPreset[];
|
|
45
51
|
export declare function getDefaultModelsPath(): string;
|
|
@@ -5,6 +5,20 @@ export type { BuiltinSlashCommand, SubcommandDef } from "./types";
|
|
|
5
5
|
export type BuiltinSlashCommandRuntime = TuiSlashCommandRuntime & {
|
|
6
6
|
composer?: ComposerSubmissionOptions;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Resolve a `/model <selector>` argument against the merged model-profile
|
|
10
|
+
* registry. Returns the canonical profile name when `selector` is either a
|
|
11
|
+
* bare preset name (`codex-medium`) or a namespaced one
|
|
12
|
+
* (`gajae-code/codex-medium`); returns `undefined` otherwise so the caller
|
|
13
|
+
* falls through to ordinary model resolution.
|
|
14
|
+
*
|
|
15
|
+
* Only selectors that do NOT look like `provider/model` references are
|
|
16
|
+
* considered, so `/model anthropic/claude-...` is never hijacked by a preset.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolvePresetSelector(selector: string, modelRegistry: {
|
|
19
|
+
getModelProfile?: (name: string) => unknown;
|
|
20
|
+
getError?: () => unknown;
|
|
21
|
+
}): string | undefined;
|
|
8
22
|
export declare function formatUnknownBuiltinSlashCommandDiagnostic(commandName: string): string | undefined;
|
|
9
23
|
/** Builtin command metadata used for slash-command autocomplete and help text. */
|
|
10
24
|
export declare const BUILTIN_SLASH_COMMAND_DEFS: ReadonlyArray<BuiltinSlashCommand>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare function getRecorderInstallHint(platform?: NodeJS.Platform): string;
|
|
2
|
+
export declare function formatSTTUsage(platform?: NodeJS.Platform, terminalProgram?: string | undefined): string;
|
|
1
3
|
export interface STTDependencyStatus {
|
|
2
4
|
recorder: {
|
|
3
5
|
available: boolean;
|
|
@@ -15,7 +15,7 @@ import { AgentRegistry } from "../registry/agent-registry";
|
|
|
15
15
|
import type { ForkContextSeed } from "../session/agent-session";
|
|
16
16
|
import type { ArtifactManager } from "../session/artifacts";
|
|
17
17
|
import type { AuthStorage } from "../session/auth-storage";
|
|
18
|
-
import { SessionManager } from "../session/session-manager";
|
|
18
|
+
import { SessionManager, type SessionMemoryMode } from "../session/session-manager";
|
|
19
19
|
import "../tools/yield";
|
|
20
20
|
import type { ContextFileEntry } from "../tools";
|
|
21
21
|
import type { EventBus } from "../utils/event-bus";
|
|
@@ -48,7 +48,15 @@ export interface ExecutorOptions {
|
|
|
48
48
|
* if the resolved subagent model has no working credentials. See #985.
|
|
49
49
|
*/
|
|
50
50
|
parentActiveModelPattern?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the live parent session has an active model profile. When set,
|
|
53
|
+
* persisted `task.agentModelOverrides` may resolve through preset-equivalent
|
|
54
|
+
* aliases (bare profile aliases re-resolve to an equivalent provider variant).
|
|
55
|
+
* Manual/direct parents (no active profile) keep exact resolution.
|
|
56
|
+
*/
|
|
57
|
+
parentActiveModelProfile?: string;
|
|
51
58
|
parentSessionId?: string;
|
|
59
|
+
parentCredentialSessionId?: string;
|
|
52
60
|
thinkingLevel?: ThinkingLevel;
|
|
53
61
|
outputSchema?: unknown;
|
|
54
62
|
/** Parent task recursion depth (0 = top-level, 1 = first child, etc.) */
|
|
@@ -113,7 +121,7 @@ export interface ExecutorOptions {
|
|
|
113
121
|
export declare class ManagedTaskPersistence {
|
|
114
122
|
#private;
|
|
115
123
|
constructor(artifacts: ArtifactManager, taskId: string);
|
|
116
|
-
openSession(cwd: string, sessionMemoryMode?:
|
|
124
|
+
openSession(cwd: string, sessionMemoryMode?: SessionMemoryMode): Promise<SessionManager>;
|
|
117
125
|
publishOutput(rawOutput: string, metadata: Uint8Array): Promise<void>;
|
|
118
126
|
}
|
|
119
127
|
export declare function createManagedTaskPersistence(artifacts: ArtifactManager, taskId: string): ManagedTaskPersistence;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { CDPSession, Page } from "puppeteer-core";
|
|
2
|
+
export interface BrowserRuntimeDiagnostic {
|
|
3
|
+
kind: "pageerror" | "console-error";
|
|
4
|
+
at: string;
|
|
5
|
+
url: string;
|
|
6
|
+
line?: number;
|
|
7
|
+
column?: number;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
interface ExceptionThrownEvent {
|
|
11
|
+
exceptionDetails?: {
|
|
12
|
+
url?: string;
|
|
13
|
+
lineNumber?: number;
|
|
14
|
+
columnNumber?: number;
|
|
15
|
+
exception?: {
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
interface ConsoleCalledEvent {
|
|
21
|
+
type?: string;
|
|
22
|
+
stackTrace?: {
|
|
23
|
+
callFrames?: Array<{
|
|
24
|
+
url?: string;
|
|
25
|
+
lineNumber?: number;
|
|
26
|
+
columnNumber?: number;
|
|
27
|
+
}>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Reduce a runtime-event URL to a persisted-safe location.
|
|
32
|
+
*
|
|
33
|
+
* http(s) URLs are emitted origin-only: path segments routinely carry tokens (signed
|
|
34
|
+
* URLs, invite/reset links, per-tenant identifiers), and diagnostics end up in tool
|
|
35
|
+
* results that are persisted and shareable. Non-parseable values are never echoed
|
|
36
|
+
* verbatim — known engine literals pass through, everything else becomes an
|
|
37
|
+
* irreversible bounded hash so entries stay correlatable without leaking.
|
|
38
|
+
*/
|
|
39
|
+
export declare function maskBrowserRuntimeUrl(value: string): string;
|
|
40
|
+
export declare function pageErrorDiagnostic(event: ExceptionThrownEvent, fallbackUrl: string): BrowserRuntimeDiagnostic;
|
|
41
|
+
export declare function consoleErrorDiagnostic(event: ConsoleCalledEvent, fallbackUrl: string): BrowserRuntimeDiagnostic | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Serialize a drained mailbox into the tool-result text block.
|
|
44
|
+
*
|
|
45
|
+
* - Per-field: `url` is capped with a visible `…` marker; every other field is
|
|
46
|
+
* structurally bounded (ISO timestamp, finite integers, allowlisted class).
|
|
47
|
+
* - Total: the serialized block is capped at `MAX_RUNTIME_DIAGNOSTICS_BLOCK_BYTES`.
|
|
48
|
+
* When the budget is tight the oldest entries are shed (newest survive) and the
|
|
49
|
+
* block carries an explicit `runtimeDiagnosticsTruncated: true` — truncation is
|
|
50
|
+
* never silent.
|
|
51
|
+
*/
|
|
52
|
+
export declare function serializeRuntimeDiagnostics(drained: {
|
|
53
|
+
runtimeDiagnostics: BrowserRuntimeDiagnostic[];
|
|
54
|
+
runtimeDiagnosticsDropped: number;
|
|
55
|
+
}): string;
|
|
56
|
+
export declare class BrowserRuntimeDiagnosticsMailbox {
|
|
57
|
+
#private;
|
|
58
|
+
push(entry: BrowserRuntimeDiagnostic): void;
|
|
59
|
+
drain(): {
|
|
60
|
+
runtimeDiagnostics: BrowserRuntimeDiagnostic[];
|
|
61
|
+
runtimeDiagnosticsDropped: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export declare function instrumentBrowserRuntimeDiagnostics(page: Page, mailbox: BrowserRuntimeDiagnosticsMailbox): Promise<CDPSession>;
|
|
65
|
+
export {};
|
|
@@ -55,12 +55,16 @@ export type WorkerInitPayload = {
|
|
|
55
55
|
url?: string;
|
|
56
56
|
waitUntil?: "load" | "domcontentloaded" | "networkidle0" | "networkidle2";
|
|
57
57
|
timeoutMs: number;
|
|
58
|
+
/** Opt-in bounded page runtime diagnostics (extra CDP session + Runtime events). */
|
|
59
|
+
runtimeDiagnostics?: boolean;
|
|
58
60
|
} | {
|
|
59
61
|
mode: "attach";
|
|
60
62
|
browserWSEndpoint: string;
|
|
61
63
|
safeDir: string;
|
|
62
64
|
targetId: string;
|
|
63
65
|
dialogs?: "accept" | "dismiss";
|
|
66
|
+
/** Opt-in bounded page runtime diagnostics (extra CDP session + Runtime events). */
|
|
67
|
+
runtimeDiagnostics?: boolean;
|
|
64
68
|
};
|
|
65
69
|
export type ToolReply = {
|
|
66
70
|
ok: true;
|
|
@@ -49,6 +49,8 @@ export interface AcquireTabOptions {
|
|
|
49
49
|
dialogs?: DialogPolicy;
|
|
50
50
|
/** Owning session id so dispose can release only this session's tabs (F13). */
|
|
51
51
|
ownerId?: string;
|
|
52
|
+
/** Opt-in bounded page runtime diagnostics (extra CDP session + Runtime events per tab). */
|
|
53
|
+
runtimeDiagnostics?: boolean;
|
|
52
54
|
/** Internal recovery-only target id; makes a headless replacement attach, not open a page. */
|
|
53
55
|
recoveryTargetId?: string;
|
|
54
56
|
/** Recovery fence: replacement must not overwrite a tab installed after dead teardown. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HTMLElement } from "linkedom";
|
|
2
2
|
import type { ElementHandle } from "puppeteer-core";
|
|
3
|
+
import { loadPuppeteerInWorker } from "./launch";
|
|
3
4
|
import type { Transport } from "./tab-protocol";
|
|
4
5
|
declare global {
|
|
5
6
|
interface Element extends HTMLElement {
|
|
@@ -11,6 +12,7 @@ declare global {
|
|
|
11
12
|
elementFromPoint(x: number, y: number): Element | null;
|
|
12
13
|
};
|
|
13
14
|
}
|
|
15
|
+
export declare function __setLoadPuppeteerInWorkerForTest(loader: typeof loadPuppeteerInWorker | undefined): void;
|
|
14
16
|
export declare class WorkerCore {
|
|
15
17
|
#private;
|
|
16
18
|
constructor(transport: Transport);
|
|
@@ -44,6 +44,7 @@ declare const browserSchema: z.ZodObject<{
|
|
|
44
44
|
accept: "accept";
|
|
45
45
|
dismiss: "dismiss";
|
|
46
46
|
}>>;
|
|
47
|
+
diagnostics: z.ZodOptional<z.ZodBoolean>;
|
|
47
48
|
code: z.ZodOptional<z.ZodString>;
|
|
48
49
|
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
49
50
|
verb: z.ZodEnum<{
|
|
@@ -158,6 +159,7 @@ export declare class BrowserTool implements AgentTool<typeof browserSchema, Brow
|
|
|
158
159
|
accept: "accept";
|
|
159
160
|
dismiss: "dismiss";
|
|
160
161
|
}>>;
|
|
162
|
+
diagnostics: z.ZodOptional<z.ZodBoolean>;
|
|
161
163
|
code: z.ZodOptional<z.ZodString>;
|
|
162
164
|
actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
163
165
|
verb: z.ZodEnum<{
|