@gajae-code/coding-agent 0.18.6 → 0.18.8
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 +318 -1
- package/dist/types/async/job-manager.d.ts +1 -1
- package/dist/types/capability/mcp.d.ts +2 -0
- package/dist/types/capability/skill.d.ts +2 -0
- package/dist/types/capability/types.d.ts +6 -0
- package/dist/types/cli/public-command-errors.d.ts +3 -1
- package/dist/types/cli/setup-cli.d.ts +1 -1
- package/dist/types/commands/deep-interview.d.ts +3 -0
- package/dist/types/config/autorouting-tier-map.d.ts +348 -9
- package/dist/types/config/file-lock.d.ts +1 -0
- package/dist/types/config/model-bindings-applier.d.ts +2 -0
- package/dist/types/config/model-profile-activation.d.ts +11 -3
- package/dist/types/config/model-registry.d.ts +4 -9
- package/dist/types/config/settings.d.ts +4 -0
- package/dist/types/config/skill-settings-defaults.d.ts +2 -0
- package/dist/types/cursor-delete-path.d.ts +1 -0
- package/dist/types/cursor-mcp-name.d.ts +8 -0
- package/dist/types/customization/inventory.d.ts +2 -0
- package/dist/types/debug/report-bundle-parent.d.ts +2 -0
- package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/provider/stream.d.ts +1 -0
- package/dist/types/defaults/gjc/extensions/grok-cli-vendor/src/provider/version-manager.d.ts +31 -0
- package/dist/types/defaults/gjc-skills.generated.d.ts +5 -6
- package/dist/types/discovery/helpers.d.ts +8 -3
- package/dist/types/export/html/css-color.d.ts +2 -0
- package/dist/types/export/html/template.generated.d.ts +1 -1
- package/dist/types/extensibility/extensions/types.d.ts +7 -0
- package/dist/types/extensibility/gjc-plugins/runtime-adapters.d.ts +14 -1
- package/dist/types/extensibility/plugins/marketplace/cache.d.ts +2 -0
- package/dist/types/extensibility/plugins/plugin-link-path.d.ts +2 -0
- package/dist/types/extensibility/runtime-skill-discovery.d.ts +3 -1
- package/dist/types/extensibility/skill-management.d.ts +3 -1
- package/dist/types/extensibility/skills.d.ts +2 -0
- package/dist/types/gjc-runtime/deep-interview-crystallize.d.ts +74 -0
- package/dist/types/gjc-runtime/deep-interview-runtime.d.ts +11 -0
- package/dist/types/gjc-runtime/gc-runtime.d.ts +5 -0
- package/dist/types/gjc-runtime/ralplan-runtime.d.ts +0 -5
- package/dist/types/gjc-runtime/state-argv.d.ts +1 -1
- package/dist/types/gjc-runtime/state-migrations.d.ts +8 -0
- package/dist/types/gjc-runtime/state-runtime.d.ts +95 -0
- package/dist/types/gjc-runtime/state-writer.d.ts +11 -1
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +8 -0
- package/dist/types/internal-urls/skill-path.d.ts +1 -0
- package/dist/types/lsp/workspace-path.d.ts +1 -0
- package/dist/types/modes/acp/acp-agent.d.ts +7 -0
- package/dist/types/modes/components/custom-editor.d.ts +6 -0
- package/dist/types/modes/components/customization/customization-dashboard.d.ts +1 -0
- package/dist/types/modes/components/extensions/state-manager.d.ts +4 -3
- package/dist/types/modes/controllers/input-controller.d.ts +9 -0
- package/dist/types/modes/interactive-mode.d.ts +1 -0
- package/dist/types/modes/utils/interrupt-ownership.d.ts +3 -0
- package/dist/types/modes/utils/keybinding-matchers.d.ts +1 -0
- package/dist/types/modes/utils/macos-option-forwarding.d.ts +17 -0
- package/dist/types/progress/collect-project-progress.d.ts +38 -0
- package/dist/types/progress/progress-contract.d.ts +154 -0
- package/dist/types/progress/progress-snapshot.d.ts +11 -0
- package/dist/types/progress/project-progress.d.ts +141 -0
- package/dist/types/progress/render-progress.d.ts +28 -0
- package/dist/types/runtime-mcp/elicitation.d.ts +12 -0
- package/dist/types/runtime-mcp/oauth-public-url.d.ts +1 -0
- package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +1 -0
- package/dist/types/runtime-mcp/smithery-registry.d.ts +24 -0
- package/dist/types/runtime-mcp/types.d.ts +6 -0
- package/dist/types/sdk/acp/adapter.d.ts +1 -1
- package/dist/types/sdk/broker/broker-exit.d.ts +6 -2
- package/dist/types/sdk/broker/broker.d.ts +18 -1
- package/dist/types/sdk/broker/lifecycle.d.ts +9 -0
- package/dist/types/sdk/broker/session-index.d.ts +12 -6
- package/dist/types/sdk/broker/task-artifact-owner-validation.d.ts +55 -0
- package/dist/types/sdk/bus/index.d.ts +12 -1
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +6 -1
- package/dist/types/sdk/bus/telegram-daemon.d.ts +3 -2
- package/dist/types/sdk/client/client.d.ts +2 -0
- package/dist/types/sdk/host/host.d.ts +6 -0
- package/dist/types/sdk/host/query/handlers.d.ts +3 -0
- package/dist/types/sdk/index.d.ts +1 -0
- package/dist/types/sdk/router/session-router.d.ts +9 -0
- package/dist/types/sdk/session-list.d.ts +1 -1
- package/dist/types/sdk/session.d.ts +8 -0
- package/dist/types/session/agent-session.d.ts +38 -9
- package/dist/types/session/artifacts.d.ts +2 -2
- package/dist/types/session/internal/managed-gc-retirement-codec.d.ts +32 -0
- package/dist/types/session/internal/managed-session-scope.d.ts +79 -2
- package/dist/types/session/internal/managed-session-storage.d.ts +36 -1
- package/dist/types/session/internal/managed-task-owner-cleanup.d.ts +62 -0
- package/dist/types/session/internal/task-artifact-owner-access.d.ts +19 -0
- package/dist/types/session/internal/task-artifact-owner-transcript.d.ts +11 -0
- package/dist/types/session/session-manager.d.ts +31 -5
- package/dist/types/session/session-retirement.d.ts +71 -0
- package/dist/types/session/session-storage.d.ts +62 -48
- package/dist/types/session/session-transcript-header.d.ts +2 -0
- package/dist/types/session/task-artifact-owner-codec.d.ts +109 -0
- package/dist/types/session/task-artifact-owner-retirement.d.ts +7 -0
- package/dist/types/session/task-artifact-owner.d.ts +10 -0
- package/dist/types/setup/credential-auto-import.d.ts +1 -1
- package/dist/types/setup/credential-import.d.ts +6 -4
- package/dist/types/skill-state/active-state.d.ts +38 -0
- package/dist/types/slash-commands/helpers/progress-report.d.ts +8 -0
- package/dist/types/task/executor.d.ts +3 -0
- package/dist/types/tools/bash-skill-urls.d.ts +1 -1
- package/dist/types/tools/index.d.ts +3 -0
- package/dist/types/tools/python.d.ts +9 -1
- package/dist/types/tools/recipe/recipe-guard.d.ts +7 -0
- package/dist/types/tools/restricted-cwd.d.ts +1 -0
- package/dist/types/tools/todo-write.d.ts +6 -0
- package/dist/types/utils/tools-checksum.d.ts +7 -0
- package/package.json +7 -7
- package/scripts/generate-sdk-operation-inventory.ts +21 -0
- package/scripts/resident-memory-bench.ts +174 -20
- package/scripts/verify-managed-empty-stop.ts +28 -0
- package/src/async/job-manager.ts +228 -122
- package/src/capability/index.ts +18 -0
- package/src/capability/mcp.ts +2 -0
- package/src/capability/skill.ts +2 -0
- package/src/capability/types.ts +6 -0
- package/src/cli/auth-broker-cli.ts +1 -1
- package/src/cli/config-cli.ts +8 -18
- package/src/cli/customize-doctor.ts +15 -2
- package/src/cli/public-command-errors.ts +21 -1
- package/src/cli/setup-cli.ts +4 -4
- package/src/cli/skills-cli.ts +5 -0
- package/src/cli-main.ts +7 -8
- package/src/commands/deep-interview.ts +47 -8
- package/src/commands/sdk.ts +140 -29
- package/src/config/autorouting-tier-map.ts +117 -7
- package/src/config/file-lock.ts +307 -68
- package/src/config/mcp-schema.json +4 -0
- package/src/config/model-bindings-applier.ts +20 -0
- package/src/config/model-profile-activation.ts +240 -46
- package/src/config/model-registry.ts +47 -153
- package/src/config/settings.ts +44 -4
- package/src/config/skill-settings-defaults.ts +7 -0
- package/src/coordinator-mcp/policy.ts +3 -2
- package/src/cursor-delete-path.ts +10 -0
- package/src/cursor-mcp-name.ts +15 -0
- package/src/cursor.ts +13 -2
- package/src/customization/inventory.ts +3 -0
- package/src/debug/report-bundle-parent.ts +22 -0
- package/src/debug/report-bundle.ts +3 -0
- package/src/debug/system-info.ts +13 -1
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/stream.ts +67 -4
- package/src/defaults/gjc/extensions/grok-cli-vendor/src/provider/version-manager.ts +80 -0
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +105 -10
- package/src/defaults/gjc/skills/ralplan/SKILL.md +6 -4
- package/src/defaults/gjc-defaults.test.ts +18 -1
- package/src/defaults/gjc-defaults.ts +3 -0
- package/src/defaults/gjc-skills.generated.ts +58 -36
- package/src/discovery/agents.ts +6 -1
- package/src/discovery/builtin.ts +10 -0
- package/src/discovery/helpers.ts +168 -23
- package/src/discovery/mcp-json.ts +6 -0
- package/src/discovery/ssh.ts +9 -4
- package/src/discovery/substitute-plugin-root.ts +3 -1
- package/src/edit/file-read-cache.ts +1 -1
- package/src/eval/py/executor.ts +380 -120
- package/src/export/html/css-color.ts +9 -0
- package/src/export/html/index.ts +5 -4
- package/src/export/html/template.generated.ts +1 -1
- package/src/extensibility/extensions/runner.ts +4 -0
- package/src/extensibility/extensions/types.ts +7 -0
- package/src/extensibility/gjc-plugins/runtime-adapters.ts +73 -8
- package/src/extensibility/plugins/manager.ts +3 -2
- package/src/extensibility/plugins/marketplace/cache.ts +15 -0
- package/src/extensibility/plugins/marketplace/manager.ts +11 -3
- package/src/extensibility/plugins/plugin-link-path.ts +12 -0
- package/src/extensibility/runtime-skill-discovery.ts +20 -2
- package/src/extensibility/skill-management.ts +6 -2
- package/src/extensibility/skills.ts +6 -1
- package/src/gjc-runtime/deep-interview-crystallize.ts +1814 -0
- package/src/gjc-runtime/deep-interview-recorder.ts +20 -2
- package/src/gjc-runtime/deep-interview-runtime.ts +1415 -13
- package/src/gjc-runtime/deep-interview-stage.ts +98 -21
- package/src/gjc-runtime/gc-runtime.ts +206 -8
- package/src/gjc-runtime/launch-worktree.ts +14 -4
- package/src/gjc-runtime/ralplan-runtime.ts +447 -52
- package/src/gjc-runtime/state-argv.ts +2 -0
- package/src/gjc-runtime/state-migrations.ts +91 -29
- package/src/gjc-runtime/state-runtime.ts +3716 -135
- package/src/gjc-runtime/state-writer.ts +83 -8
- package/src/gjc-runtime/ultragoal-runtime.ts +16 -4
- package/src/gjc-runtime/workflow-manifest.generated.json +70 -42
- package/src/gjc-runtime/workflow-manifest.ts +54 -21
- package/src/harness-control-plane/operate.ts +12 -4
- package/src/harness-control-plane/owner.ts +5 -1
- package/src/hashline/parser.ts +48 -9
- package/src/hashline/recovery.ts +13 -4
- package/src/hindsight/config.ts +9 -3
- package/src/internal-urls/docs-index.generated.ts +19 -18
- package/src/internal-urls/skill-path.ts +19 -0
- package/src/internal-urls/skill-protocol.ts +2 -0
- package/src/lsp/edits.ts +6 -0
- package/src/lsp/workspace-path.ts +51 -0
- package/src/main.ts +195 -31
- package/src/modes/acp/acp-agent.ts +163 -7
- package/src/modes/components/custom-editor.ts +14 -0
- package/src/modes/components/customization/customization-dashboard.ts +12 -0
- package/src/modes/components/extensions/extension-dashboard.ts +2 -2
- package/src/modes/components/extensions/state-manager.ts +15 -5
- package/src/modes/components/model-selector.ts +1 -4
- package/src/modes/components/provider-onboarding-selector.ts +1 -1
- package/src/modes/components/status-line/segments.ts +4 -0
- package/src/modes/controllers/event-controller.ts +11 -4
- package/src/modes/controllers/input-controller.ts +74 -29
- package/src/modes/controllers/runtime-mcp-command-controller.ts +8 -3
- package/src/modes/controllers/selector-controller.ts +28 -15
- package/src/modes/interactive-mode.ts +4 -0
- package/src/modes/runtime-init.ts +4 -0
- package/src/modes/utils/abort-message.ts +3 -1
- package/src/modes/utils/interrupt-ownership.ts +12 -0
- package/src/modes/utils/keybinding-matchers.ts +4 -0
- package/src/modes/utils/macos-option-forwarding.ts +80 -0
- package/src/progress/collect-project-progress.ts +153 -0
- package/src/progress/progress-contract.ts +172 -0
- package/src/progress/progress-snapshot.ts +140 -0
- package/src/progress/project-progress.ts +446 -0
- package/src/progress/render-progress.ts +209 -0
- package/src/prompts/system/master-mode.md +1 -0
- package/src/prompts/tools/skill-discovery.md +1 -1
- package/src/runtime-mcp/client.ts +13 -4
- package/src/runtime-mcp/config-writer.ts +10 -6
- package/src/runtime-mcp/config.ts +1 -0
- package/src/runtime-mcp/elicitation.ts +142 -0
- package/src/runtime-mcp/oauth-flow.ts +5 -0
- package/src/runtime-mcp/oauth-public-url.ts +8 -0
- package/src/runtime-mcp/plugin-network-boundary.ts +4 -0
- package/src/runtime-mcp/smithery-registry.ts +22 -3
- package/src/runtime-mcp/transports/http.ts +2 -2
- package/src/runtime-mcp/types.ts +6 -0
- package/src/sdk/acp/adapter.ts +93 -8
- package/src/sdk/broker/broker-exit.ts +52 -23
- package/src/sdk/broker/broker.ts +83 -7
- package/src/sdk/broker/ensure.ts +2 -0
- package/src/sdk/broker/lifecycle.ts +820 -73
- package/src/sdk/broker/session-index.ts +191 -81
- package/src/sdk/broker/task-artifact-owner-validation.ts +259 -0
- package/src/sdk/bus/chat-daemon-cli.ts +38 -1
- package/src/sdk/bus/chat-daemon-control.ts +2 -2
- package/src/sdk/bus/chat-daemon-runtime.ts +3 -0
- package/src/sdk/bus/index.ts +241 -46
- package/src/sdk/bus/telegram-daemon-contract.ts +6 -1
- package/src/sdk/bus/telegram-daemon.ts +4 -2
- package/src/sdk/cli/session-cli.ts +17 -3
- package/src/sdk/client/client.ts +28 -8
- package/src/sdk/host/host.ts +6 -0
- package/src/sdk/host/query/handlers.ts +9 -1
- package/src/sdk/host/session-runtime.test.ts +2805 -411
- package/src/sdk/host/session-runtime.ts +428 -111
- package/src/sdk/host/surface-policy.ts +1 -0
- package/src/sdk/index.ts +8 -0
- package/src/sdk/lifecycle-session.ts +3 -1
- package/src/sdk/mcp/server.ts +15 -3
- package/src/sdk/prompt-deadline-manager.ts +15 -0
- package/src/sdk/protocol/operation-inventory.generated.json +146 -0
- package/src/sdk/protocol/operation-registry.ts +9 -2
- package/src/sdk/router/session-router.ts +94 -14
- package/src/sdk/session-list.ts +1 -0
- package/src/sdk/session.ts +81 -38
- package/src/session/agent-session.ts +674 -224
- package/src/session/artifacts.ts +174 -70
- package/src/session/internal/managed-gc-retirement-codec.ts +319 -0
- package/src/session/internal/managed-session-scope.ts +3457 -462
- package/src/session/internal/managed-session-storage.ts +482 -61
- package/src/session/internal/managed-task-owner-cleanup.ts +473 -0
- package/src/session/internal/task-artifact-owner-access.ts +245 -0
- package/src/session/internal/task-artifact-owner-transcript.ts +614 -0
- package/src/session/session-manager.ts +939 -133
- package/src/session/session-retirement.ts +714 -0
- package/src/session/session-storage.ts +418 -174
- package/src/session/session-transcript-header.ts +17 -0
- package/src/session/task-artifact-owner-codec.ts +641 -0
- package/src/session/task-artifact-owner-retirement.ts +477 -0
- package/src/session/task-artifact-owner.ts +289 -0
- package/src/setup/credential-auto-import.ts +12 -3
- package/src/setup/credential-import.ts +176 -5
- package/src/setup/paseo/announce.ts +6 -1
- package/src/skill-state/active-state.ts +132 -2
- package/src/slash-commands/builtin-registry.ts +39 -9
- package/src/slash-commands/helpers/progress-report.ts +23 -0
- package/src/stt/setup.ts +3 -5
- package/src/task/commands.ts +3 -1
- package/src/task/executor.ts +4 -0
- package/src/task/index.ts +6 -0
- package/src/tools/ask.ts +205 -6
- package/src/tools/ast-edit.ts +4 -0
- package/src/tools/bash-allowed-prefixes.ts +15 -0
- package/src/tools/bash-skill-urls.ts +56 -3
- package/src/tools/bash.ts +48 -79
- package/src/tools/descriptors.ts +5 -1
- package/src/tools/eval.ts +56 -36
- package/src/tools/image-gen.ts +1 -1
- package/src/tools/index.ts +3 -0
- package/src/tools/python.ts +187 -66
- package/src/tools/recipe/index.ts +9 -0
- package/src/tools/recipe/recipe-guard.ts +19 -0
- package/src/tools/restricted-cwd.ts +10 -0
- package/src/tools/skill-discovery.ts +5 -0
- package/src/tools/skill.ts +28 -1
- package/src/tools/todo-write.ts +10 -1
- package/src/tools/tool-catalog.generated.ts +1 -1
- package/src/tools/write.ts +1 -0
- package/src/utils/tools-checksum.ts +34 -0
- package/src/utils/tools-manager.ts +24 -6
- package/src/web/search/providers/codex.ts +3 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FileSessionStorage } from "../session-storage";
|
|
2
|
+
import { type TaskArtifactOwnerLocator, type TaskArtifactOwnerStorageContext } from "../task-artifact-owner-codec";
|
|
3
|
+
import type { ManagedGcProtocolScopeInspector } from "./managed-session-scope";
|
|
4
|
+
/** Resolve the path-free owner locator using transcript replay's header-patch semantics. */
|
|
5
|
+
export declare function taskArtifactOwnerLocatorFromTranscriptBytes(bytes: Uint8Array, expectedSessionId: string): TaskArtifactOwnerLocator | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Read-only inventory of every authenticated managed cwd directory under one profile's
|
|
8
|
+
* sessions root. Any incomplete, replaced, or unrecognized inventory conservatively
|
|
9
|
+
* blocks owner retirement.
|
|
10
|
+
*/
|
|
11
|
+
export declare function hasSiblingTaskArtifactOwnerTranscript(storage: Pick<FileSessionStorage, "readSnapshotSync">, transcriptPath: string, locator: TaskArtifactOwnerLocator, context: TaskArtifactOwnerStorageContext, inspectProtocol?: ManagedGcProtocolScopeInspector): Promise<boolean>;
|
|
@@ -638,6 +638,21 @@ export interface ResumeSessionIdentity {
|
|
|
638
638
|
ctimeNs?: bigint;
|
|
639
639
|
sha256: string;
|
|
640
640
|
}
|
|
641
|
+
/** Descriptor-bound bounded fingerprint for private explicit-session rollback authority.
|
|
642
|
+
* JSON-safe: all bigint fields are stored as strings to survive JSON serialization,
|
|
643
|
+
* spread, structuredClone, and JSON round-trip. */
|
|
644
|
+
export type ExplicitPersistIdentity = {
|
|
645
|
+
dev: string;
|
|
646
|
+
ino: string;
|
|
647
|
+
nlink?: string;
|
|
648
|
+
size: number;
|
|
649
|
+
mtimeMs: number;
|
|
650
|
+
mtimeNs: string;
|
|
651
|
+
ctimeNs?: string;
|
|
652
|
+
canonicalPath: string;
|
|
653
|
+
sessionId: string;
|
|
654
|
+
fingerprintSha256: string;
|
|
655
|
+
};
|
|
641
656
|
export interface ResumeTailResumable {
|
|
642
657
|
kind: "resumable";
|
|
643
658
|
identity: ResumeSessionIdentity;
|
|
@@ -953,7 +968,8 @@ export interface ReadonlySessionManager {
|
|
|
953
968
|
/** Creates an immutable facade that never exposes SessionManager mutation authority. */
|
|
954
969
|
export declare function createReadonlySessionManager(manager: SessionManager): ReadonlySessionManager;
|
|
955
970
|
/** Internal artifact-writing capability. Read-only facades expose it only through a private weak-map lookup. */
|
|
956
|
-
export type
|
|
971
|
+
export type SessionArtifactPublication = (content: string, toolType: string) => Promise<string | undefined>;
|
|
972
|
+
export type SessionArtifactCapability = Readonly<Pick<SessionManager, "allocateArtifactPath" | "saveArtifact" | "putBlob" | "captureArtifactPublication">>;
|
|
957
973
|
/**
|
|
958
974
|
* Returns the artifact capability for a concrete persistence owner or one of its
|
|
959
975
|
* immutable read-only facades. Structural lookalikes remain unauthorized.
|
|
@@ -1038,6 +1054,8 @@ export declare function materializeResidentEntriesThrowingForTests<T>(entries: T
|
|
|
1038
1054
|
sessionFile?: string;
|
|
1039
1055
|
}): T[];
|
|
1040
1056
|
export declare function materializeResidentEntriesForPersistenceForTests<T>(entries: T[], textStore: BlobStore, imageStore?: BlobStore): T[];
|
|
1057
|
+
export declare function isProjectSessionTranscriptPath(projectGjcDir: string, filePath: string): boolean;
|
|
1058
|
+
export declare function readAuthorizedProjectSessionTranscript(projectGjcDir: string, filePath: string, maxBytes: number): Buffer | undefined;
|
|
1041
1059
|
/**
|
|
1042
1060
|
* Discover resumable transcripts intentionally stored inside a project's `.gjc`.
|
|
1043
1061
|
* Runtime token/audit JSONL files are excluded by requiring a known transcript
|
|
@@ -1084,10 +1102,12 @@ interface SessionManagerStateSnapshot {
|
|
|
1084
1102
|
flushed: boolean;
|
|
1085
1103
|
ensuredOnDisk: boolean;
|
|
1086
1104
|
needsFullRewriteOnNextPersist: boolean;
|
|
1087
|
-
fileEntries: FileEntry[];
|
|
1088
|
-
materializedFileEntries: FileEntry[];
|
|
1105
|
+
fileEntries: readonly FileEntry[];
|
|
1106
|
+
materializedFileEntries: readonly FileEntry[];
|
|
1089
1107
|
adoptedArtifactManager: ArtifactManager | null;
|
|
1090
1108
|
coldRestoreFile?: string;
|
|
1109
|
+
/** Explicit persistence identity for snapshot serialization safety. Preserved across cross-manager adoptions. */
|
|
1110
|
+
readonly explicitPersistIdentity?: ExplicitPersistIdentity;
|
|
1091
1111
|
}
|
|
1092
1112
|
/** Benchmark-derived cap for strong materialized session snapshots. */
|
|
1093
1113
|
export declare const MATERIALIZED_CACHE_MAX_BYTES: number;
|
|
@@ -1109,6 +1129,7 @@ export declare const SessionManagerTestHooks: {
|
|
|
1109
1129
|
beforeManagedMissingReturn?: (filePath: string, storage: SessionStorage) => void | Promise<void>;
|
|
1110
1130
|
afterManagedMissingAssertion?: (filePath: string, storage: SessionStorage) => void | Promise<void>;
|
|
1111
1131
|
beforeManagedSwitchIdentity?: (filePath: string, storage: SessionStorage) => void | Promise<void>;
|
|
1132
|
+
beforeColdRollbackCommit?: (filePath: string, storage: SessionStorage) => void | Promise<void>;
|
|
1112
1133
|
/** Internal first-open GC strategy override; omitted means current. */
|
|
1113
1134
|
firstOpenGcStrategy?: SessionMemoryGcStrategy;
|
|
1114
1135
|
/** Internal first-open secondary-artifact mode override; omitted means auto. */
|
|
@@ -1428,8 +1449,11 @@ export declare class SessionManager {
|
|
|
1428
1449
|
* one bound to the current session file unless an external manager was
|
|
1429
1450
|
* adopted via `adoptArtifactManager`. Falls back to the lazily created
|
|
1430
1451
|
* ephemeral filesystem store once a non-persistent session has saved an
|
|
1431
|
-
* artifact, so `artifact://` stays resolvable. Returns null
|
|
1432
|
-
*
|
|
1452
|
+
* artifact, so `artifact://` stays resolvable. Returns null when no store has
|
|
1453
|
+
* been established yet and once the manager has released its artifact
|
|
1454
|
+
* authority while closing — released authority stays observable as absence
|
|
1455
|
+
* (matching `isArtifactManagerAuthorized`), while artifact *operations* are
|
|
1456
|
+
* fenced by `#assertArtifactOpen()` and keep throwing.
|
|
1433
1457
|
*/
|
|
1434
1458
|
getArtifactManager(): ArtifactManager | null;
|
|
1435
1459
|
/** Linearizably establish this session's persistent or ephemeral artifact manager. */
|
|
@@ -1449,6 +1473,8 @@ export declare class SessionManager {
|
|
|
1449
1473
|
* read back from the filesystem instead of being retained in memory.
|
|
1450
1474
|
*/
|
|
1451
1475
|
saveArtifact(content: string, toolType: string): Promise<string | undefined>;
|
|
1476
|
+
/** Capture artifact publication authority for one session lifecycle. */
|
|
1477
|
+
captureArtifactPublication(): SessionArtifactPublication;
|
|
1452
1478
|
/** Inspect an evicted artifact using a bounded range read; never rehydrates by default. */
|
|
1453
1479
|
inspectEvictedToolOutput(handle: unknown, range?: {
|
|
1454
1480
|
start?: number;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { ManagedGcSessionRetirementReceipt } from "./internal/managed-gc-retirement-codec";
|
|
2
|
+
import { type ManagedScope } from "./internal/managed-session-scope";
|
|
3
|
+
import { type FileSessionStorage } from "./session-storage";
|
|
4
|
+
import type { TaskArtifactOwnerDeletionEvidence, TaskArtifactOwnerRetirementContinuation, TaskArtifactOwnerRetirementOutcome } from "./task-artifact-owner-codec";
|
|
5
|
+
export interface SessionRetirementContinuation {
|
|
6
|
+
readonly managedScope: ManagedScope;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Outcome of a disk-retention retirement attempt.
|
|
10
|
+
*
|
|
11
|
+
* `kept` means the transcript survived and nothing of the session was
|
|
12
|
+
* destroyed, with the exact reason so `gjc gc --disk` can report it.
|
|
13
|
+
* `cleanup_pending` means the delete authority already detached or removed the
|
|
14
|
+
* session's artifact tree (or quarantined the transcript) before it stopped:
|
|
15
|
+
* the record survives, the session does not, and a caller must NOT report that
|
|
16
|
+
* as an ordinary keep.
|
|
17
|
+
*/
|
|
18
|
+
export type SessionRetirementOutcome = {
|
|
19
|
+
kind: "retired";
|
|
20
|
+
taskArtifactOwnerRetired?: true;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "kept";
|
|
23
|
+
reason: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: "cleanup_pending";
|
|
26
|
+
reason: string;
|
|
27
|
+
phase?: "artifacts" | "transcript";
|
|
28
|
+
taskArtifactOwnerDeletionEvidence?: TaskArtifactOwnerDeletionEvidence;
|
|
29
|
+
taskArtifactOwnerRetirementOutcome?: TaskArtifactOwnerRetirementOutcome;
|
|
30
|
+
taskArtifactOwnerRetirementContinuation?: TaskArtifactOwnerRetirementContinuation;
|
|
31
|
+
taskArtifactOwnerPayloadRetired?: true;
|
|
32
|
+
taskArtifactOwnerNamespaceRetained?: true;
|
|
33
|
+
taskArtifactOwnerRetired?: true;
|
|
34
|
+
};
|
|
35
|
+
export type SessionRetirementProbeOutcome = Extract<SessionRetirementOutcome, {
|
|
36
|
+
kind: "cleanup_pending";
|
|
37
|
+
}> | {
|
|
38
|
+
kind: "retirable";
|
|
39
|
+
taskArtifactOwnerDeletionEvidence?: TaskArtifactOwnerDeletionEvidence;
|
|
40
|
+
taskArtifactOwnerRetirementOutcome?: TaskArtifactOwnerRetirementOutcome;
|
|
41
|
+
taskArtifactOwnerRetired?: true;
|
|
42
|
+
taskArtifactOwnerRetirementContinuation?: TaskArtifactOwnerRetirementContinuation;
|
|
43
|
+
taskArtifactOwnerPayloadRetired?: true;
|
|
44
|
+
taskArtifactOwnerNamespaceRetained?: true;
|
|
45
|
+
} | {
|
|
46
|
+
kind: "kept";
|
|
47
|
+
reason: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Non-mutating projection of {@link retireSessionTranscript}: would the
|
|
51
|
+
* retention pass's own preconditions let this transcript be retired at all?
|
|
52
|
+
*
|
|
53
|
+
* `gjc gc --disk` runs it so a dry run reports the verdict a prune would reach
|
|
54
|
+
* instead of promising bytes the delete authority will refuse to release. The
|
|
55
|
+
* authority's verdict (containment, identity, artifact tree) is deliberately
|
|
56
|
+
* not predicted here — it is re-derived against live state at delete time.
|
|
57
|
+
*/
|
|
58
|
+
export declare function probeSessionRetirement(storage: FileSessionStorage, sessionsRoot: string, transcriptPath: string, continuation?: SessionRetirementContinuation): Promise<SessionRetirementProbeOutcome>;
|
|
59
|
+
export declare function retireOrphanSessionTranscript(storage: FileSessionStorage, sessionsRoot: string, continuation: SessionRetirementContinuation, receipt: ManagedGcSessionRetirementReceipt): Promise<SessionRetirementOutcome>;
|
|
60
|
+
/**
|
|
61
|
+
* Retire one managed session transcript through the verified hard-delete
|
|
62
|
+
* authority.
|
|
63
|
+
*
|
|
64
|
+
* This is the only supported way for a retention pass to remove a transcript:
|
|
65
|
+
* identity, containment, header id/cwd, artifact tree and parent directory are
|
|
66
|
+
* all re-verified inside {@link FileSessionStorage.deleteSessionVerified}, and
|
|
67
|
+
* anything ambiguous fails closed as `kept` rather than deleting bytes. The
|
|
68
|
+
* caller owns the retention policy; this function owns nothing but the delete
|
|
69
|
+
* authority.
|
|
70
|
+
*/
|
|
71
|
+
export declare function retireSessionTranscript(storage: FileSessionStorage, sessionsRoot: string, transcriptPath: string, continuation?: SessionRetirementContinuation): Promise<SessionRetirementOutcome>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type * as native from "@gajae-code/natives";
|
|
2
|
+
import type { ManagedGcProtocolScopeInspector } from "./internal/managed-session-scope";
|
|
2
3
|
import { type ManagedDirectoryRoot } from "./internal/managed-session-storage";
|
|
4
|
+
import { type TaskArtifactOwnerDeletionEvidence, type TaskArtifactOwnerRetirementContinuation, type TaskArtifactOwnerRetirementOutcome, type TaskArtifactOwnerStorageContext } from "./task-artifact-owner-codec";
|
|
3
5
|
export interface SessionStorageStat {
|
|
4
6
|
dev: bigint;
|
|
5
7
|
ino: bigint;
|
|
@@ -312,8 +314,24 @@ export interface VerifiedSessionDeleteTarget {
|
|
|
312
314
|
retainedTranscriptSuccessorPath?: string;
|
|
313
315
|
/** Native-retained exchange placeholder observed during transcript cleanup. */
|
|
314
316
|
retainedTranscriptPlaceholderPath?: string;
|
|
315
|
-
/** Native-retained
|
|
317
|
+
/** Native-retained entry whose identity could not be verified. */
|
|
316
318
|
retainedTranscriptUnknownPath?: string;
|
|
319
|
+
/** Trusted managed authority for the path-free persisted task-artifact locator. */
|
|
320
|
+
taskArtifactOwnerStorageContext?: TaskArtifactOwnerStorageContext;
|
|
321
|
+
/** Exact owner-tree evidence captured before deletion and retained across retries. */
|
|
322
|
+
taskArtifactOwnerDeletionEvidence?: TaskArtifactOwnerDeletionEvidence;
|
|
323
|
+
/** Owning journal persists the full native disposition across delete effects. */
|
|
324
|
+
taskArtifactOwnerRetirementOutcome?: TaskArtifactOwnerRetirementOutcome;
|
|
325
|
+
/** Native terminal evidence of logical transcript deletion; pathname absence alone is insufficient. */
|
|
326
|
+
taskArtifactOwnerTranscriptDeleted?: true;
|
|
327
|
+
/** Explicitly leave owner retirement to its owning coordinator. */
|
|
328
|
+
deferTaskArtifactOwnerRetirement?: true;
|
|
329
|
+
/** Durable evidence that exact owner retirement completed. */
|
|
330
|
+
taskArtifactOwnerRetired?: true;
|
|
331
|
+
/** Exact native remnant, separate from immutable original authority. */
|
|
332
|
+
taskArtifactOwnerRetirementContinuation?: TaskArtifactOwnerRetirementContinuation;
|
|
333
|
+
taskArtifactOwnerPayloadRetired?: true;
|
|
334
|
+
taskArtifactOwnerNamespaceRetained?: true;
|
|
317
335
|
/** Native-retained publisher successor observed during cleanup. */
|
|
318
336
|
retainedArtifactsSuccessorPath?: string;
|
|
319
337
|
/** Native-retained exchange placeholder observed during cleanup. */
|
|
@@ -337,8 +355,22 @@ export type VerifiedSessionDeleteResult = {
|
|
|
337
355
|
kind: "artifacts_removed";
|
|
338
356
|
phase: "artifacts";
|
|
339
357
|
transcriptIdentity: SessionStorageFileIdentity;
|
|
358
|
+
taskArtifactOwnerDeletionEvidence?: TaskArtifactOwnerDeletionEvidence;
|
|
359
|
+
taskArtifactOwnerRetirementOutcome?: TaskArtifactOwnerRetirementOutcome;
|
|
360
|
+
taskArtifactOwnerTranscriptDeleted?: true;
|
|
361
|
+
taskArtifactOwnerRetired?: true;
|
|
362
|
+
taskArtifactOwnerRetirementContinuation?: TaskArtifactOwnerRetirementContinuation;
|
|
363
|
+
taskArtifactOwnerPayloadRetired?: true;
|
|
364
|
+
taskArtifactOwnerNamespaceRetained?: true;
|
|
340
365
|
} | {
|
|
341
366
|
kind: "deleted";
|
|
367
|
+
taskArtifactOwnerDeletionEvidence?: TaskArtifactOwnerDeletionEvidence;
|
|
368
|
+
taskArtifactOwnerRetirementOutcome?: TaskArtifactOwnerRetirementOutcome;
|
|
369
|
+
taskArtifactOwnerTranscriptDeleted?: true;
|
|
370
|
+
taskArtifactOwnerRetired?: true;
|
|
371
|
+
taskArtifactOwnerRetirementContinuation?: TaskArtifactOwnerRetirementContinuation;
|
|
372
|
+
taskArtifactOwnerPayloadRetired?: true;
|
|
373
|
+
taskArtifactOwnerNamespaceRetained?: true;
|
|
342
374
|
} | {
|
|
343
375
|
kind: "cleanup_pending";
|
|
344
376
|
phase: "artifacts";
|
|
@@ -355,6 +387,27 @@ export type VerifiedSessionDeleteResult = {
|
|
|
355
387
|
retainedSuccessorPath?: string;
|
|
356
388
|
retainedPlaceholderPath?: string;
|
|
357
389
|
retainedUnknownPath?: string;
|
|
390
|
+
taskArtifactOwnerDeletionEvidence?: TaskArtifactOwnerDeletionEvidence;
|
|
391
|
+
taskArtifactOwnerRetirementOutcome?: TaskArtifactOwnerRetirementOutcome;
|
|
392
|
+
taskArtifactOwnerTranscriptDeleted?: true;
|
|
393
|
+
taskArtifactOwnerRetired?: true;
|
|
394
|
+
taskArtifactOwnerRetirementContinuation?: TaskArtifactOwnerRetirementContinuation;
|
|
395
|
+
taskArtifactOwnerPayloadRetired?: true;
|
|
396
|
+
taskArtifactOwnerNamespaceRetained?: true;
|
|
397
|
+
} | {
|
|
398
|
+
kind: "cleanup_pending";
|
|
399
|
+
phase: "task_artifact_owner";
|
|
400
|
+
/** True only after verified artifact completion, never inferred from the failure phase. */
|
|
401
|
+
artifactsRemoved: boolean;
|
|
402
|
+
error: Error;
|
|
403
|
+
transcriptIdentity: SessionStorageFileIdentity;
|
|
404
|
+
taskArtifactOwnerDeletionEvidence: TaskArtifactOwnerDeletionEvidence;
|
|
405
|
+
taskArtifactOwnerRetirementOutcome?: TaskArtifactOwnerRetirementOutcome;
|
|
406
|
+
taskArtifactOwnerTranscriptDeleted?: true;
|
|
407
|
+
taskArtifactOwnerRetired?: true;
|
|
408
|
+
taskArtifactOwnerRetirementContinuation?: TaskArtifactOwnerRetirementContinuation;
|
|
409
|
+
taskArtifactOwnerPayloadRetired?: true;
|
|
410
|
+
taskArtifactOwnerNamespaceRetained?: true;
|
|
358
411
|
} | {
|
|
359
412
|
kind: "cleanup_pending";
|
|
360
413
|
phase: "transcript";
|
|
@@ -367,6 +420,13 @@ export type VerifiedSessionDeleteResult = {
|
|
|
367
420
|
retainedSuccessorPath?: string;
|
|
368
421
|
retainedPlaceholderPath?: string;
|
|
369
422
|
retainedUnknownPath?: string;
|
|
423
|
+
taskArtifactOwnerDeletionEvidence?: TaskArtifactOwnerDeletionEvidence;
|
|
424
|
+
taskArtifactOwnerRetirementOutcome?: TaskArtifactOwnerRetirementOutcome;
|
|
425
|
+
taskArtifactOwnerTranscriptDeleted?: true;
|
|
426
|
+
taskArtifactOwnerRetired?: true;
|
|
427
|
+
taskArtifactOwnerRetirementContinuation?: TaskArtifactOwnerRetirementContinuation;
|
|
428
|
+
taskArtifactOwnerPayloadRetired?: true;
|
|
429
|
+
taskArtifactOwnerNamespaceRetained?: true;
|
|
370
430
|
};
|
|
371
431
|
type NativeDirectoryTreeEntry = {
|
|
372
432
|
relativePath: string;
|
|
@@ -469,7 +529,7 @@ export declare class FileSessionStorage implements SessionStorage {
|
|
|
469
529
|
* revalidate, transcript last. Partial deletion returns typed cleanup_pending
|
|
470
530
|
* evidence; identity/symlink/containment/header/cwd mismatch throws.
|
|
471
531
|
*/
|
|
472
|
-
deleteSessionVerified(target: VerifiedSessionDeleteTarget): Promise<VerifiedSessionDeleteResult>;
|
|
532
|
+
deleteSessionVerified(target: VerifiedSessionDeleteTarget, inspectProtocol?: ManagedGcProtocolScopeInspector): Promise<VerifiedSessionDeleteResult>;
|
|
473
533
|
}
|
|
474
534
|
export declare class MemorySessionStorage implements SessionStorage {
|
|
475
535
|
#private;
|
|
@@ -512,50 +572,4 @@ export declare class MemorySessionStorage implements SessionStorage {
|
|
|
512
572
|
openBufferedWriter(path: string, options?: SessionStorageWriterOpenOptions): SessionStorageBufferedWriter;
|
|
513
573
|
openStagedWriter(path: string): StagedStreamingWriter;
|
|
514
574
|
}
|
|
515
|
-
/**
|
|
516
|
-
* Outcome of a disk-retention retirement attempt.
|
|
517
|
-
*
|
|
518
|
-
* `kept` means the transcript survived and nothing of the session was
|
|
519
|
-
* destroyed, with the exact reason so `gjc gc --disk` can report it.
|
|
520
|
-
* `cleanup_pending` means the delete authority already detached or removed the
|
|
521
|
-
* session's artifact tree (or quarantined the transcript) before it stopped:
|
|
522
|
-
* the record survives, the session does not, and a caller must NOT report that
|
|
523
|
-
* as an ordinary keep.
|
|
524
|
-
*/
|
|
525
|
-
export type SessionRetirementOutcome = {
|
|
526
|
-
kind: "retired";
|
|
527
|
-
} | {
|
|
528
|
-
kind: "kept";
|
|
529
|
-
reason: string;
|
|
530
|
-
} | {
|
|
531
|
-
kind: "cleanup_pending";
|
|
532
|
-
reason: string;
|
|
533
|
-
};
|
|
534
|
-
/**
|
|
535
|
-
* Non-mutating projection of {@link retireSessionTranscript}: would the
|
|
536
|
-
* retention pass's own preconditions let this transcript be retired at all?
|
|
537
|
-
*
|
|
538
|
-
* `gjc gc --disk` runs it so a dry run reports the verdict a prune would reach
|
|
539
|
-
* instead of promising bytes the delete authority will refuse to release. The
|
|
540
|
-
* authority's verdict (containment, identity, artifact tree) is deliberately
|
|
541
|
-
* not predicted here — it is re-derived against live state at delete time.
|
|
542
|
-
*/
|
|
543
|
-
export declare function probeSessionRetirement(storage: FileSessionStorage, sessionsRoot: string, transcriptPath: string): {
|
|
544
|
-
kind: "retirable";
|
|
545
|
-
} | {
|
|
546
|
-
kind: "kept";
|
|
547
|
-
reason: string;
|
|
548
|
-
};
|
|
549
|
-
/**
|
|
550
|
-
* Retire one managed session transcript through the verified hard-delete
|
|
551
|
-
* authority.
|
|
552
|
-
*
|
|
553
|
-
* This is the only supported way for a retention pass to remove a transcript:
|
|
554
|
-
* identity, containment, header id/cwd, artifact tree and parent directory are
|
|
555
|
-
* all re-verified inside {@link FileSessionStorage.deleteSessionVerified}, and
|
|
556
|
-
* anything ambiguous fails closed as `kept` rather than deleting bytes. The
|
|
557
|
-
* caller owns the retention policy; this function owns nothing but the delete
|
|
558
|
-
* authority.
|
|
559
|
-
*/
|
|
560
|
-
export declare function retireSessionTranscript(storage: FileSessionStorage, sessionsRoot: string, transcriptPath: string): Promise<SessionRetirementOutcome>;
|
|
561
575
|
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { NativeExactUnlinkResult } from "@gajae-code/natives";
|
|
2
|
+
import type { ManagedDirectoryRoot, ManagedSessionSecurityPolicy } from "./internal/managed-session-storage";
|
|
3
|
+
import type { NativeDirectoryTreeSnapshot } from "./session-storage";
|
|
4
|
+
export declare const OWNER_DIRECTORY = ".task-artifact-owners";
|
|
5
|
+
export declare const OWNER_LOCK_DIRECTORY = ".task-artifact-owner-locks";
|
|
6
|
+
export declare const OWNER_MANIFEST = ".gjc-task-artifact-owner-v1.json";
|
|
7
|
+
export declare const OWNER_SCHEMA_VERSION: 1;
|
|
8
|
+
export declare const OWNER_DELETION_SCHEMA_VERSION: 2;
|
|
9
|
+
export declare const OWNER_RETIREMENT_SCHEMA_VERSION: 1;
|
|
10
|
+
export declare const EMPTY_PAYLOAD_SHA256: string;
|
|
11
|
+
export interface TaskArtifactOwnerLocator {
|
|
12
|
+
readonly schemaVersion: typeof OWNER_SCHEMA_VERSION;
|
|
13
|
+
readonly ownerId: string;
|
|
14
|
+
readonly directoryDev: string;
|
|
15
|
+
readonly directoryIno: string;
|
|
16
|
+
}
|
|
17
|
+
export interface TaskArtifactOwnerStorageContext {
|
|
18
|
+
readonly rootAuthority: ManagedDirectoryRoot;
|
|
19
|
+
readonly sessionsRoot: string;
|
|
20
|
+
readonly securityPolicy: ManagedSessionSecurityPolicy;
|
|
21
|
+
readonly profileAgentDir: string;
|
|
22
|
+
}
|
|
23
|
+
/** Exact parent directory identity authorizing direct native owner-tree removal. */
|
|
24
|
+
export interface TaskArtifactOwnerParentIdentity {
|
|
25
|
+
readonly dev: string;
|
|
26
|
+
readonly ino: string;
|
|
27
|
+
}
|
|
28
|
+
/** Immutable exact deletion input retained by managed lifecycle tombstones and retries. */
|
|
29
|
+
export interface TaskArtifactOwnerDeletionEvidence {
|
|
30
|
+
readonly schemaVersion: typeof OWNER_DELETION_SCHEMA_VERSION;
|
|
31
|
+
readonly sessionId: string;
|
|
32
|
+
readonly locator: TaskArtifactOwnerLocator;
|
|
33
|
+
readonly parentIdentity: TaskArtifactOwnerParentIdentity;
|
|
34
|
+
readonly treeSnapshot: NativeDirectoryTreeSnapshot;
|
|
35
|
+
}
|
|
36
|
+
/** Native retained-root and side-path state safe to persist for a later retirement attempt. */
|
|
37
|
+
export interface TaskArtifactOwnerRetirementContinuation {
|
|
38
|
+
readonly schemaVersion: typeof OWNER_RETIREMENT_SCHEMA_VERSION;
|
|
39
|
+
/** Must remain equal to the immutable evidence's managed owner-parent identity. */
|
|
40
|
+
readonly parentIdentity: TaskArtifactOwnerParentIdentity;
|
|
41
|
+
/** Only the original owner root or its native `.removing` sibling is actionable. */
|
|
42
|
+
readonly retainedRootPath: string;
|
|
43
|
+
/** Last identity-checked tree snapshot; it may only shrink from the original evidence. */
|
|
44
|
+
readonly retainedTreeSnapshot: NativeDirectoryTreeSnapshot;
|
|
45
|
+
/** Historical exact native detached-root roles; these paths are diagnostics, not extra authority. */
|
|
46
|
+
readonly detachedPaths?: readonly string[];
|
|
47
|
+
readonly nativeCodes?: readonly string[];
|
|
48
|
+
readonly payloadDurable?: boolean;
|
|
49
|
+
readonly retainedSuccessorPaths?: readonly string[];
|
|
50
|
+
readonly retainedPlaceholderPaths?: readonly string[];
|
|
51
|
+
readonly retainedUnknownPaths?: readonly string[];
|
|
52
|
+
readonly windowsErrorCodes?: readonly string[];
|
|
53
|
+
}
|
|
54
|
+
/** `completed` is decoded persisted data, not proof of physical retirement or writer closure. */
|
|
55
|
+
export type TaskArtifactOwnerRetirementOutcome = {
|
|
56
|
+
readonly kind: "completed";
|
|
57
|
+
readonly evidence: TaskArtifactOwnerDeletionEvidence;
|
|
58
|
+
readonly nativeOutcome?: NativeExactUnlinkResult;
|
|
59
|
+
} | {
|
|
60
|
+
/** Live payload is durably destroyed; native namespace cleanup remains pending. */
|
|
61
|
+
readonly kind: "payload_retired";
|
|
62
|
+
readonly namespace: "retained";
|
|
63
|
+
readonly evidence: TaskArtifactOwnerDeletionEvidence;
|
|
64
|
+
readonly continuation: TaskArtifactOwnerRetirementContinuation;
|
|
65
|
+
readonly nativeOutcome: NativeExactUnlinkResult;
|
|
66
|
+
} | {
|
|
67
|
+
/** Native explicitly retained cleanup state with a validated, non-expanding continuation. */
|
|
68
|
+
readonly kind: "cleanup_pending";
|
|
69
|
+
readonly evidence: TaskArtifactOwnerDeletionEvidence;
|
|
70
|
+
readonly continuation: TaskArtifactOwnerRetirementContinuation;
|
|
71
|
+
readonly nativeOutcome?: NativeExactUnlinkResult;
|
|
72
|
+
} | {
|
|
73
|
+
/** No safe completion proof exists; callers must retain evidence and continuation. */
|
|
74
|
+
readonly kind: "uncertain";
|
|
75
|
+
readonly evidence: TaskArtifactOwnerDeletionEvidence;
|
|
76
|
+
readonly continuation: TaskArtifactOwnerRetirementContinuation;
|
|
77
|
+
readonly reason: string;
|
|
78
|
+
readonly nativeOutcome?: NativeExactUnlinkResult;
|
|
79
|
+
};
|
|
80
|
+
/** True only for canonical unsigned decimal strings within the native u64 range. */
|
|
81
|
+
export declare function isCanonicalDecimal(value: unknown): value is string;
|
|
82
|
+
export declare function isCanonicalNativeId(value: unknown): value is string;
|
|
83
|
+
/** Deterministic owner identity bound to one non-empty logical session ID. */
|
|
84
|
+
export declare function ownerIdForSession(sessionId: string): string;
|
|
85
|
+
export declare function ownerRelativePath(ownerId: string): string;
|
|
86
|
+
export declare function manifestRelativePath(ownerId: string): string;
|
|
87
|
+
export declare function assertSafeRelativePath(relativePath: string): void;
|
|
88
|
+
export declare function assertSessionRoot(context: TaskArtifactOwnerStorageContext): void;
|
|
89
|
+
export declare function freezeTreeSnapshot(snapshot: NativeDirectoryTreeSnapshot): NativeDirectoryTreeSnapshot;
|
|
90
|
+
/** Project only authenticated remaining entries; never restore an omitted entry's authority. */
|
|
91
|
+
export declare function normalizeRetainedTreeSnapshot(expected: NativeDirectoryTreeSnapshot, retained: NativeDirectoryTreeSnapshot): NativeDirectoryTreeSnapshot | undefined;
|
|
92
|
+
export declare function retainedTreeDoesNotExpandAuthority(expected: NativeDirectoryTreeSnapshot, retained: NativeDirectoryTreeSnapshot): boolean;
|
|
93
|
+
export declare function sameTreeContents(left: NativeDirectoryTreeSnapshot, right: NativeDirectoryTreeSnapshot): boolean;
|
|
94
|
+
export declare function sameOwnerParentIdentity(left: TaskArtifactOwnerParentIdentity, right: TaskArtifactOwnerParentIdentity): boolean;
|
|
95
|
+
export declare function immutableDeletionEvidence(sessionId: string, locatorValue: TaskArtifactOwnerLocator, parentIdentityValue: TaskArtifactOwnerParentIdentity, treeSnapshotValue: NativeDirectoryTreeSnapshot): TaskArtifactOwnerDeletionEvidence;
|
|
96
|
+
/** Parse a persisted locator. Missing metadata returns undefined; malformed metadata fails closed. */
|
|
97
|
+
export declare function parseTaskArtifactOwnerLocator(value: unknown): TaskArtifactOwnerLocator | undefined;
|
|
98
|
+
/** Validate JSON-restored tombstone evidence before it is used for exact retirement. */
|
|
99
|
+
export declare function parseTaskArtifactOwnerDeletionEvidence(value: unknown): TaskArtifactOwnerDeletionEvidence;
|
|
100
|
+
export declare function ownerAbsolutePath(context: TaskArtifactOwnerStorageContext, ownerId: string): string;
|
|
101
|
+
export declare function isOwnerRetainedRoot(context: TaskArtifactOwnerStorageContext, ownerId: string, pathname: string): boolean;
|
|
102
|
+
export declare function isKnownNativeSidePath(context: TaskArtifactOwnerStorageContext, ownerId: string, pathname: string): boolean;
|
|
103
|
+
/** Validate JSON-restored native continuation data against immutable owner authorization. */
|
|
104
|
+
export declare function parseTaskArtifactOwnerRetirementContinuation(context: TaskArtifactOwnerStorageContext, evidenceValue: TaskArtifactOwnerDeletionEvidence, value: unknown): TaskArtifactOwnerRetirementContinuation;
|
|
105
|
+
/**
|
|
106
|
+
* Strictly decode persisted managed-journal data. Parsing does not establish current physical retirement,
|
|
107
|
+
* payload destruction, or writer quiescence.
|
|
108
|
+
*/
|
|
109
|
+
export declare function parseTaskArtifactOwnerRetirementOutcome(context: TaskArtifactOwnerStorageContext, evidence: TaskArtifactOwnerDeletionEvidence, value: unknown): TaskArtifactOwnerRetirementOutcome;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type TaskArtifactOwnerDeletionEvidence, type TaskArtifactOwnerRetirementContinuation, type TaskArtifactOwnerRetirementOutcome, type TaskArtifactOwnerStorageContext } from "./task-artifact-owner-codec";
|
|
2
|
+
/** Confirm physical completion from a managed native proof, never from canonical absence alone. */
|
|
3
|
+
export declare function verifyTaskArtifactOwnerPhysicalRetirement(context: TaskArtifactOwnerStorageContext, evidence: TaskArtifactOwnerDeletionEvidence, value: unknown): void;
|
|
4
|
+
/** Revalidate a persisted remnant through managed authority without mutation or new payload proof. */
|
|
5
|
+
export declare function verifyTaskArtifactOwnerRetirementContinuation(context: TaskArtifactOwnerStorageContext, evidenceValue: TaskArtifactOwnerDeletionEvidence, value: unknown): TaskArtifactOwnerRetirementContinuation;
|
|
6
|
+
/** Continue exact native removal without widening the original owner-tree authority. */
|
|
7
|
+
export declare function retireTaskArtifactOwner(context: TaskArtifactOwnerStorageContext, evidenceValue: TaskArtifactOwnerDeletionEvidence, continuationValue?: unknown): TaskArtifactOwnerRetirementOutcome;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ArtifactManager } from "./artifacts";
|
|
2
|
+
import { type TaskArtifactOwnerLocator, type TaskArtifactOwnerStorageContext } from "./task-artifact-owner-codec";
|
|
3
|
+
export interface ManagedTaskArtifactOwner {
|
|
4
|
+
readonly locator: TaskArtifactOwnerLocator;
|
|
5
|
+
readonly manager: ArtifactManager;
|
|
6
|
+
}
|
|
7
|
+
/** Reopen an owner only beneath the captured managed sessions-root authority. */
|
|
8
|
+
export declare function restoreManagedTaskArtifactOwner(context: TaskArtifactOwnerStorageContext, sessionId: string, locatorValue: unknown): ManagedTaskArtifactOwner;
|
|
9
|
+
/** Establish or restore the logical-session owner under the captured managed sessions authority. */
|
|
10
|
+
export declare function ensureManagedTaskArtifactOwner(context: TaskArtifactOwnerStorageContext, sessionId: string, locatorValue: unknown, legacyArtifactRelativePath?: string): Promise<ManagedTaskArtifactOwner>;
|
|
@@ -7,7 +7,7 @@ export declare const CREDENTIAL_AUTO_IMPORT_REFRESH_WARNING = "Imported credenti
|
|
|
7
7
|
export declare const CREDENTIAL_AUTO_IMPORT_DISCOVERY_WARNING = "External credential discovery could not be completed. Use /provider to import credentials manually.";
|
|
8
8
|
export declare const CREDENTIAL_AUTO_IMPORT_RETRY_WARNING = "Some external credentials could not be imported. Use /provider to retry.";
|
|
9
9
|
export declare const CREDENTIAL_AUTO_IMPORT_STATE_UNREADABLE_WARNING = "Credential import preference could not be read. External credential discovery was skipped; use /provider to import credentials manually.";
|
|
10
|
-
export type CredentialAutoImportSourceLabel = "claude-code-file" | "claude-code-keychain" | "codex-file";
|
|
10
|
+
export type CredentialAutoImportSourceLabel = "claude-code-file" | "claude-code-keychain" | "codex-file" | "kiro-cli-social";
|
|
11
11
|
export type CredentialAutoImportTrigger = "startup" | "bare-login" | "setup-cli";
|
|
12
12
|
export type InitialImportResolution = "accepted" | "declined";
|
|
13
13
|
export type CredentialAutoImportStateProblem = "invalid-initial-import-resolution" | "invalid-last-import-version" | "malformed-json" | "malformed-root";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AuthCredential } from "@gajae-code/ai/core";
|
|
2
2
|
/** gjc provider ids that external credentials map onto. */
|
|
3
|
-
export type ExternalProvider = "anthropic" | "openai-codex";
|
|
3
|
+
export type ExternalProvider = "anthropic" | "openai-codex" | "kiro";
|
|
4
4
|
/** Where a discovered credential came from. */
|
|
5
|
-
export type CredentialOrigin = "claude-code-file" | "claude-code-keychain" | "codex-file";
|
|
5
|
+
export type CredentialOrigin = "claude-code-file" | "claude-code-keychain" | "codex-file" | "kiro-cli-social";
|
|
6
6
|
export declare const AUTO_IMPORT_OAUTH_PROVIDER_ORIGINS: Record<ExternalProvider, ReadonlySet<CredentialOrigin>>;
|
|
7
7
|
/** Human labels for providers, used in redacted summaries. */
|
|
8
8
|
export declare const EXTERNAL_PROVIDER_LABELS: Record<ExternalProvider, string>;
|
|
@@ -66,6 +66,8 @@ export interface DiscoveryOptions {
|
|
|
66
66
|
* or `null` when no entry exists.
|
|
67
67
|
*/
|
|
68
68
|
readClaudeKeychain?: () => Promise<string | null>;
|
|
69
|
+
/** Absolute Kiro CLI data.sqlite3 override, primarily for tests and embedders. */
|
|
70
|
+
kiroCliDatabasePath?: string;
|
|
69
71
|
}
|
|
70
72
|
export type CredentialUpserter = (provider: string, credential: AuthCredential) => unknown | Promise<unknown>;
|
|
71
73
|
export interface ImportSummary {
|
|
@@ -76,8 +78,8 @@ export interface ImportSummary {
|
|
|
76
78
|
}>;
|
|
77
79
|
}
|
|
78
80
|
/**
|
|
79
|
-
* Discover Claude Code and
|
|
80
|
-
*
|
|
81
|
+
* Discover Claude Code, Codex CLI, and Kiro CLI credentials across their local
|
|
82
|
+
* stores and environment variables. Never throws for individual unreadable or
|
|
81
83
|
* malformed sources — those land in {@link CredentialDiscoveryResult.skipped}.
|
|
82
84
|
*/
|
|
83
85
|
export declare function discoverExternalCredentials(options?: DiscoveryOptions): Promise<CredentialDiscoveryResult>;
|
|
@@ -135,6 +135,44 @@ interface ActiveStateSignature {
|
|
|
135
135
|
}
|
|
136
136
|
export declare function computeActiveStateSignature(cwd: string, sessionId: string): Promise<ActiveStateSignature>;
|
|
137
137
|
export declare function invalidateVisibleSkillActiveStateCache(cwd?: string, sessionId?: string): void;
|
|
138
|
+
/**
|
|
139
|
+
* Outcome of a failure-observable workflow-state read:
|
|
140
|
+
* - `absent`: neither a session snapshot nor a per-skill entry is recorded.
|
|
141
|
+
* - `read`: every recorded source was read and no snapshot row lacks authority.
|
|
142
|
+
* - `recovered`: the session snapshot was unreadable, but authoritative per-skill
|
|
143
|
+
* entries (which the snapshot is rebuilt from) supplied the visible state.
|
|
144
|
+
* - `discarded`: the snapshot is a derived cache that still lists active workflows
|
|
145
|
+
* whose per-skill entry is gone or inactive (e.g. a deactivation whose snapshot
|
|
146
|
+
* rebuild never ran); those stale rows were dropped and the visible state comes
|
|
147
|
+
* from the per-skill entries alone.
|
|
148
|
+
* - `unresolved`: the snapshot lists active workflows without an active per-skill
|
|
149
|
+
* entry, but it cannot be shown to be a derived cache, so those rows may be legacy
|
|
150
|
+
* authority or stale cache; they are excluded without confirming their absence.
|
|
151
|
+
* - `failed`: the session snapshot was unreadable and no per-skill entry could
|
|
152
|
+
* replace it (e.g. a corrupt legacy root-only record), so the state is unknown.
|
|
153
|
+
*/
|
|
154
|
+
export type VisibleSkillActiveStateReadStatus = "absent" | "read" | "recovered" | "discarded" | "unresolved" | "failed";
|
|
155
|
+
export interface VisibleSkillActiveStateRead {
|
|
156
|
+
status: VisibleSkillActiveStateReadStatus;
|
|
157
|
+
/** Visible active state; `null` when nothing is active or the read failed. */
|
|
158
|
+
state: SkillActiveState | null;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Uncached, failure-observable counterpart of `readVisibleSkillActiveState` for
|
|
162
|
+
* read-only projections that must not present unreadable state as absence. The
|
|
163
|
+
* tolerant reader keeps mapping an unreadable session snapshot to `null` for
|
|
164
|
+
* HUD and guard callers; this variant reports `failed` or `recovered` instead.
|
|
165
|
+
*
|
|
166
|
+
* Unlike the tolerant reader, a snapshot row never survives without authority: an
|
|
167
|
+
* active row with no active per-skill entry is dropped as stale (`discarded`) when
|
|
168
|
+
* the snapshot is provably derived, or excluded as `unresolved` when it is not.
|
|
169
|
+
* Only a legacy root-only record keeps its own row. Per-skill entry read failures
|
|
170
|
+
* propagate, as they do from the tolerant reader, and so does an entry file that
|
|
171
|
+
* exists but holds no usable skill entry (e.g. `{}`): the tolerant reader skips
|
|
172
|
+
* it, which would make it indistinguishable from a deleted entry and let it pass
|
|
173
|
+
* as proof that a snapshot row is stale. The read never repairs state.
|
|
174
|
+
*/
|
|
175
|
+
export declare function readVisibleSkillActiveStateWithStatus(cwd: string, sessionId: string): Promise<VisibleSkillActiveStateRead>;
|
|
138
176
|
export declare function readVisibleSkillActiveState(cwd: string, sessionId?: string, opts?: ReadVisibleSkillActiveStateOptions): Promise<SkillActiveState | null>;
|
|
139
177
|
export declare function syncSkillActiveState(options: SyncSkillActiveStateOptions): Promise<GuardedWriteResult | undefined>;
|
|
140
178
|
export interface ApplyHandoffOptions {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProjectProgressReport } from "../../progress/project-progress";
|
|
2
|
+
import { type ProgressRenderStyle } from "../../progress/render-progress";
|
|
3
|
+
/** Bound untrusted durable text (objectives, titles, HUD values) to one sanitized display line of `max` columns. */
|
|
4
|
+
export declare function clipProgressText(text: string, max: number): string;
|
|
5
|
+
/** TUI view: the `session.progress` snapshot rendered with column-aware clipping and theme colours. */
|
|
6
|
+
export declare function renderProgressReportLines(report: ProjectProgressReport, style?: ProgressRenderStyle): string[];
|
|
7
|
+
/** Plain text view: identical to what production ACP renders from the `session.progress` query. */
|
|
8
|
+
export declare function renderProgressReportText(report: ProjectProgressReport): string;
|
|
@@ -7,6 +7,7 @@ import type { AgentTelemetryConfig, ThinkingLevel } from "@gajae-code/agent-core
|
|
|
7
7
|
import { type Model, type ServiceTier } from "@gajae-code/ai/core";
|
|
8
8
|
import { AsyncJobManager } from "../async";
|
|
9
9
|
import { type AutoroutingReasonCode } from "../config/autorouting-contract";
|
|
10
|
+
import type { ModelProfileOwnershipMarker } from "../config/model-profile-ownership";
|
|
10
11
|
import { ModelRegistry } from "../config/model-registry";
|
|
11
12
|
import type { PromptTemplate } from "../config/prompt-templates";
|
|
12
13
|
import { Settings } from "../config/settings";
|
|
@@ -71,6 +72,8 @@ export interface ExecutorOptions {
|
|
|
71
72
|
* Manual/direct parents (no active profile) keep exact resolution.
|
|
72
73
|
*/
|
|
73
74
|
parentActiveModelProfile?: string;
|
|
75
|
+
/** Parent session's model profile ownership marker for propagating to subagent sessions. */
|
|
76
|
+
parentModelProfileOwnershipMarker?: ModelProfileOwnershipMarker;
|
|
74
77
|
parentSessionId?: string;
|
|
75
78
|
parentCredentialSessionId?: string;
|
|
76
79
|
thinkingLevel?: ThinkingLevel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Skill } from "../extensibility/skills";
|
|
2
|
-
import { type LocalProtocolOptions } from "../internal-urls";
|
|
2
|
+
import { type LocalProtocolOptions } from "../internal-urls/local-protocol";
|
|
3
3
|
import type { InternalResource } from "../internal-urls/types";
|
|
4
4
|
interface InternalUrlResolver {
|
|
5
5
|
canHandle(input: string): boolean;
|
|
@@ -14,6 +14,7 @@ import type { ArtifactManager } from "../session/artifacts";
|
|
|
14
14
|
import type { ClientBridge } from "../session/client-bridge";
|
|
15
15
|
import type { FoldAdapter } from "../session/fold-coordinator";
|
|
16
16
|
import type { CustomMessage } from "../session/messages";
|
|
17
|
+
import type { SessionArtifactPublication } from "../session/session-manager";
|
|
17
18
|
import type { ToolChoiceQueue } from "../session/tool-choice-queue";
|
|
18
19
|
import type { SkillActiveEntry } from "../skill-state/active-state";
|
|
19
20
|
import type { AgentOutputManager } from "../task/output-manager";
|
|
@@ -258,6 +259,8 @@ export interface ToolSession {
|
|
|
258
259
|
id?: string;
|
|
259
260
|
path?: string;
|
|
260
261
|
}>;
|
|
262
|
+
/** Capture owner-bound artifact publication authority for one session lifecycle. */
|
|
263
|
+
captureArtifactPublication?: () => SessionArtifactPublication;
|
|
261
264
|
/** Get session spawns */
|
|
262
265
|
getSessionSpawns: () => string | null;
|
|
263
266
|
/** Get resolved model string if explicitly set for this session */
|
|
@@ -5,11 +5,19 @@ export declare function pythonKernelOwnerId(sessionId: string): string;
|
|
|
5
5
|
export interface SessionPythonToolInput {
|
|
6
6
|
/** Working directory for kernel execution (session cwd). */
|
|
7
7
|
cwd: string;
|
|
8
|
+
/** Resolve the current working directory for each admitted invocation. */
|
|
9
|
+
getCwd?: () => string;
|
|
8
10
|
/** Session settings used for Python runtime policy. */
|
|
9
11
|
settings?: SettingsType;
|
|
12
|
+
/** Resolve the session file associated with each admitted invocation. */
|
|
13
|
+
getSessionFile?: () => string | null;
|
|
10
14
|
/** Resolve the GJC session id used for the kernel owner and transcript paths. */
|
|
11
15
|
getSessionId: () => string | null;
|
|
12
16
|
/** Register cleanup with the current logical session lifecycle. */
|
|
13
|
-
registerSessionCleanup: (cleanup: () => Promise<void> | void) => void;
|
|
17
|
+
registerSessionCleanup: (cleanup: () => Promise<void> | void) => (() => void) | void;
|
|
18
|
+
/** Reject execution after the owning session has begun disposal. */
|
|
19
|
+
assertEvalExecutionAllowed?: () => void;
|
|
20
|
+
/** Track this whole invocation through its transcript append. */
|
|
21
|
+
trackEvalExecution?: <T>(execution: Promise<T>, abortController: AbortController) => Promise<T>;
|
|
14
22
|
}
|
|
15
23
|
export declare function createSessionPythonTool(input: SessionPythonToolInput): AgentTool;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assertCwdInsideWorkspace(workspace: string, commandCwd: string): Promise<void>;
|