@gajae-code/coding-agent 0.11.6 → 0.11.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 +92 -0
- package/dist/types/capability/index.d.ts +10 -20
- package/dist/types/capability/types.d.ts +3 -0
- package/dist/types/cli/args.d.ts +0 -2
- package/dist/types/commands/daemon.d.ts +2 -2
- package/dist/types/commands/sdk.d.ts +20 -2
- package/dist/types/config/keybindings.d.ts +34 -4
- package/dist/types/config/model-profile-activation.d.ts +4 -3
- package/dist/types/config/model-profile-contract.d.ts +38 -0
- package/dist/types/config/settings-schema.d.ts +70 -7
- package/dist/types/edit/modes/patch.d.ts +13 -0
- package/dist/types/edit/path-mutation-lock.d.ts +15 -0
- package/dist/types/eval/py/executor.d.ts +1 -1
- package/dist/types/eval/py/runner-artifact.d.ts +8 -0
- package/dist/types/eval/py/tool-bridge.d.ts +1 -2
- package/dist/types/gjc-runtime/repository-binding.d.ts +63 -0
- package/dist/types/gjc-runtime/ultragoal-guard.d.ts +6 -5
- package/dist/types/gjc-runtime/ultragoal-receipt-freshness.d.ts +20 -0
- package/dist/types/gjc-runtime/ultragoal-runtime.d.ts +43 -5
- package/dist/types/main.d.ts +32 -1
- package/dist/types/modes/components/btw-panel.d.ts +1 -0
- package/dist/types/modes/components/model-selector.d.ts +2 -0
- package/dist/types/modes/components/runtime-mcp-add-wizard.d.ts +2 -1
- package/dist/types/modes/components/tool-status-header.d.ts +4 -2
- package/dist/types/modes/components/welcome.d.ts +2 -0
- package/dist/types/modes/controllers/btw-controller.d.ts +5 -0
- package/dist/types/modes/controllers/command-controller.d.ts +2 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +2 -1
- package/dist/types/modes/interactive-mode.d.ts +7 -2
- package/dist/types/modes/prompt-action-autocomplete.d.ts +6 -1
- package/dist/types/modes/prompt-suggestion-controller.d.ts +35 -0
- package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +2 -2
- package/dist/types/modes/types.d.ts +4 -0
- package/dist/types/modes/utils/hotkeys-markdown.d.ts +2 -1
- package/dist/types/runtime-mcp/content-limits.d.ts +7 -0
- package/dist/types/runtime-mcp/manager.d.ts +1 -1
- package/dist/types/runtime-mcp/oauth-flow.d.ts +0 -5
- package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +14 -0
- package/dist/types/sdk/broker/broker.d.ts +2 -0
- package/dist/types/sdk/broker/lifecycle.d.ts +6 -0
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +6 -1
- package/dist/types/sdk/bus/config-commands.d.ts +2 -2
- package/dist/types/sdk/bus/config.d.ts +2 -0
- package/dist/types/sdk/bus/conversation-store.d.ts +1 -0
- package/dist/types/sdk/bus/index.d.ts +26 -1
- package/dist/types/sdk/bus/lifecycle-commands.d.ts +5 -4
- package/dist/types/sdk/bus/notification-orchestration.d.ts +1 -0
- package/dist/types/sdk/bus/notification-service.d.ts +34 -0
- package/dist/types/sdk/bus/prompt-reconciliation.d.ts +105 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +18 -3
- package/dist/types/sdk/bus/telegram-daemon-control.d.ts +5 -1
- package/dist/types/sdk/bus/telegram-daemon.d.ts +189 -4
- package/dist/types/sdk/bus/telegram-reference.d.ts +2 -0
- package/dist/types/sdk/bus/topic-registry.d.ts +88 -2
- package/dist/types/sdk/client/discovery.d.ts +2 -0
- package/dist/types/sdk/client/liveness.d.ts +7 -0
- package/dist/types/sdk/host/control/operations.d.ts +1 -1
- package/dist/types/sdk/host/host.d.ts +1 -1
- package/dist/types/sdk/host/query/handlers.d.ts +9 -0
- package/dist/types/sdk/index.d.ts +2 -0
- package/dist/types/sdk/prompt-status.d.ts +88 -0
- package/dist/types/sdk/session-directory.d.ts +1 -1
- package/dist/types/sdk/startup-capability.d.ts +3 -0
- package/dist/types/sdk/transport/auth-preface.d.ts +9 -0
- package/dist/types/sdk/transport/index.d.ts +12 -0
- package/dist/types/sdk/transport/relay.d.ts +43 -0
- package/dist/types/sdk/transport/serve-cli.d.ts +4 -0
- package/dist/types/sdk/transport/socket.d.ts +7 -0
- package/dist/types/sdk/transport/stdio.d.ts +3 -0
- package/dist/types/session/agent-session.d.ts +30 -5
- package/dist/types/session/btw-contract.d.ts +16 -0
- package/dist/types/session/internal/managed-session-scope.d.ts +32 -9
- package/dist/types/session/internal/managed-session-storage.d.ts +27 -10
- package/dist/types/session/internal/native-publish-outcome.d.ts +48 -0
- package/dist/types/session/session-manager.d.ts +25 -4
- package/dist/types/session/session-storage.d.ts +18 -0
- package/dist/types/setup/credential-import.d.ts +5 -1
- package/dist/types/setup/provider-onboarding.d.ts +2 -0
- package/dist/types/ssh/utils.d.ts +1 -0
- package/dist/types/task/discovery.d.ts +3 -1
- package/dist/types/task/index.d.ts +3 -1
- package/dist/types/task/receipt.d.ts +2 -0
- package/dist/types/task/types.d.ts +94 -0
- package/dist/types/tools/ask.d.ts +454 -174
- package/dist/types/tools/fetch.d.ts +5 -8
- package/dist/types/tools/image-gen.d.ts +63 -1
- package/dist/types/tools/index.d.ts +4 -0
- package/dist/types/tools/skill-discovery.d.ts +7 -0
- package/dist/types/tools/sqlite-reader.d.ts +7 -0
- package/dist/types/utils/prompt-suggestion.d.ts +33 -0
- package/dist/types/utils/shell-snapshot.d.ts +12 -0
- package/dist/types/web/insane/bridge.d.ts +1 -0
- package/dist/types/web/insane/url-guard.d.ts +17 -0
- package/package.json +8 -8
- package/scripts/capture-platform-shortcut-labels-showcase.ts +342 -0
- package/scripts/dogfood-repository-binding.ts +209 -0
- package/scripts/generate-sdk-operation-inventory.ts +4 -0
- package/scripts/run-test-manifest.ts +4 -4
- package/src/capability/index.ts +50 -42
- package/src/capability/types.ts +3 -0
- package/src/cli/args.ts +2 -92
- package/src/cli/notify-cli.ts +5 -38
- package/src/cli/setup-cli.ts +10 -4
- package/src/cli.ts +52 -9
- package/src/commands/daemon.ts +22 -5
- package/src/commands/sdk.ts +44 -11
- package/src/config/keybindings.ts +158 -25
- package/src/config/model-profile-activation.ts +7 -18
- package/src/config/model-profile-contract.ts +161 -0
- package/src/config/model-profiles.ts +18 -0
- package/src/config/model-registry.ts +11 -1
- package/src/config/settings-schema.ts +73 -7
- package/src/coordinator-mcp/model-preset.ts +21 -74
- package/src/defaults/gjc/skills/deep-interview/SKILL.md +2 -2
- package/src/defaults/gjc/skills/ralplan/SKILL.md +3 -1
- package/src/defaults/gjc/skills/ultragoal/SKILL.md +42 -1
- package/src/discovery/ssh.ts +12 -1
- package/src/edit/index.ts +3 -6
- package/src/edit/modes/patch.ts +38 -1
- package/src/edit/modes/replace.ts +42 -0
- package/src/edit/path-mutation-lock.ts +112 -0
- package/src/eval/py/executor.ts +30 -11
- package/src/eval/py/kernel.ts +1 -21
- package/src/eval/py/prelude.py +2 -2
- package/src/eval/py/runner-artifact.ts +84 -0
- package/src/eval/py/tool-bridge.ts +34 -18
- package/src/extensibility/gjc-plugins/runtime-adapters.ts +2 -1
- package/src/extensibility/plugins/marketplace/fetcher.ts +191 -7
- package/src/gjc-runtime/launch-tmux.ts +1 -1
- package/src/gjc-runtime/managed-owner-supervisor.ts +83 -4
- package/src/gjc-runtime/ralplan-runtime.ts +75 -3
- package/src/gjc-runtime/repository-binding.ts +267 -0
- package/src/gjc-runtime/session-state-sidecar.ts +25 -9
- package/src/gjc-runtime/tmux-owner-isolation.ts +2 -1
- package/src/gjc-runtime/tmux-sessions.ts +45 -6
- package/src/gjc-runtime/ultragoal-guard.ts +93 -15
- package/src/gjc-runtime/ultragoal-receipt-freshness.ts +103 -0
- package/src/gjc-runtime/ultragoal-runtime.ts +456 -31
- package/src/gjc-runtime/workflow-manifest.generated.json +58 -0
- package/src/gjc-runtime/workflow-manifest.ts +23 -0
- package/src/internal-urls/docs-index.generated.ts +12 -10
- package/src/internal-urls/local-protocol.ts +64 -21
- package/src/internal-urls/mcp-protocol.ts +73 -11
- package/src/main.ts +111 -37
- package/src/modes/DESIGN.md +5 -0
- package/src/modes/acp/acp-agent.ts +50 -16
- package/src/modes/action-registry.ts +1 -1
- package/src/modes/components/btw-panel.ts +82 -16
- package/src/modes/components/model-selector.ts +73 -11
- package/src/modes/components/plan-preview-overlay.ts +1 -1
- package/src/modes/components/runtime-mcp-add-wizard.ts +5 -0
- package/src/modes/components/tool-status-header.ts +25 -4
- package/src/modes/components/welcome.ts +22 -18
- package/src/modes/controllers/btw-controller.ts +119 -36
- package/src/modes/controllers/command-controller.ts +97 -54
- package/src/modes/controllers/event-controller.ts +10 -0
- package/src/modes/controllers/input-controller.ts +38 -2
- package/src/modes/controllers/runtime-mcp-command-controller.ts +29 -6
- package/src/modes/controllers/selector-controller.ts +149 -63
- package/src/modes/interactive-mode.ts +57 -34
- package/src/modes/prompt-action-autocomplete.ts +32 -13
- package/src/modes/prompt-suggestion-controller.ts +96 -0
- package/src/modes/shared/agent-wire/workflow-gate-broker.ts +2 -2
- package/src/modes/types.ts +4 -0
- package/src/modes/utils/hotkeys-markdown.ts +64 -36
- package/src/modes/utils/ui-helpers.ts +5 -3
- package/src/prompts/agents/architect.md +0 -1
- package/src/prompts/agents/critic.md +0 -1
- package/src/prompts/system/btw-user.md +3 -8
- package/src/prompts/system/prompt-suggestion-system.md +32 -0
- package/src/prompts/system/system-prompt.md +6 -4
- package/src/prompts/tools/cron.md +3 -1
- package/src/prompts/tools/skill-discovery.md +1 -0
- package/src/runtime-mcp/client.ts +41 -55
- package/src/runtime-mcp/content-limits.ts +71 -0
- package/src/runtime-mcp/json-rpc.ts +23 -9
- package/src/runtime-mcp/manager.ts +51 -53
- package/src/runtime-mcp/oauth-flow.ts +0 -72
- package/src/runtime-mcp/plugin-network-boundary.ts +101 -0
- package/src/runtime-mcp/transports/http.ts +63 -22
- package/src/sdk/broker/broker.ts +34 -20
- package/src/sdk/broker/lifecycle.ts +185 -36
- package/src/sdk/bus/chat-daemon-control.ts +19 -5
- package/src/sdk/bus/config-commands.ts +2 -2
- package/src/sdk/bus/config.ts +9 -1
- package/src/sdk/bus/conversation-store.ts +40 -6
- package/src/sdk/bus/index.ts +244 -70
- package/src/sdk/bus/lifecycle-commands.ts +63 -10
- package/src/sdk/bus/lifecycle-control-runtime.ts +11 -2
- package/src/sdk/bus/lifecycle-orchestrator.ts +32 -1
- package/src/sdk/bus/notification-orchestration.ts +12 -0
- package/src/sdk/bus/notification-service.ts +68 -20
- package/src/sdk/bus/prompt-reconciliation.ts +239 -0
- package/src/sdk/bus/recent-activity.ts +90 -26
- package/src/sdk/bus/telegram-daemon-contract.ts +18 -3
- package/src/sdk/bus/telegram-daemon-control.ts +147 -35
- package/src/sdk/bus/telegram-daemon.ts +2463 -450
- package/src/sdk/bus/telegram-reference.ts +20 -2
- package/src/sdk/bus/topic-registry.ts +451 -12
- package/src/sdk/cli/session-cli.ts +15 -2
- package/src/sdk/client/discovery.ts +19 -3
- package/src/sdk/client/liveness.ts +49 -0
- package/src/sdk/host/control/dispatch.ts +1 -1
- package/src/sdk/host/control/operations.ts +1 -1
- package/src/sdk/host/host.ts +2 -6
- package/src/sdk/host/query/handlers.ts +70 -5
- package/src/sdk/index.ts +12 -0
- package/src/sdk/prompt-status.ts +97 -0
- package/src/sdk/protocol/operation-inventory.generated.json +58 -0
- package/src/sdk/protocol/operation-registry.ts +18 -4
- package/src/sdk/session-directory.ts +5 -1
- package/src/sdk/session.ts +31 -5
- package/src/sdk/startup-capability.ts +9 -1
- package/src/sdk/transport/auth-preface.ts +82 -0
- package/src/sdk/transport/index.ts +18 -0
- package/src/sdk/transport/relay.ts +252 -0
- package/src/sdk/transport/serve-cli.ts +105 -0
- package/src/sdk/transport/socket.ts +197 -0
- package/src/sdk/transport/stdio.ts +17 -0
- package/src/session/agent-session.ts +292 -154
- package/src/session/blob-store.ts +25 -7
- package/src/session/btw-contract.ts +59 -0
- package/src/session/internal/managed-session-scope.ts +1163 -137
- package/src/session/internal/managed-session-storage.ts +397 -234
- package/src/session/internal/native-publish-outcome.ts +266 -0
- package/src/session/session-manager.ts +620 -403
- package/src/session/session-storage.ts +128 -11
- package/src/setup/credential-import.ts +28 -3
- package/src/setup/provider-onboarding.ts +30 -1
- package/src/setup/provider-presets.json +2 -1
- package/src/slash-commands/builtin-registry.ts +1 -1
- package/src/ssh/utils.ts +14 -0
- package/src/task/discovery.ts +8 -2
- package/src/task/gjc-command.ts +2 -2
- package/src/task/index.ts +121 -15
- package/src/task/receipt.ts +3 -0
- package/src/task/types.ts +34 -3
- package/src/tools/ask.ts +199 -89
- package/src/tools/ast-edit.ts +2 -2
- package/src/tools/bash-pty-selection.ts +2 -2
- package/src/tools/browser/screenshot-format.ts +6 -1
- package/src/tools/cron.ts +1 -1
- package/src/tools/fetch.ts +13 -131
- package/src/tools/image-gen.ts +476 -23
- package/src/tools/index.ts +4 -0
- package/src/tools/read.ts +2 -0
- package/src/tools/render-utils.ts +7 -1
- package/src/tools/skill-discovery.ts +39 -3
- package/src/tools/sqlite-reader.ts +63 -5
- package/src/utils/edit-mode.ts +2 -2
- package/src/utils/pasted-image-path.ts +15 -6
- package/src/utils/prompt-suggestion.ts +265 -0
- package/src/utils/shell-snapshot.ts +173 -63
- package/src/utils/sixel.ts +3 -3
- package/src/web/insane/bridge.ts +5 -1
- package/src/web/insane/url-guard.ts +140 -27
- package/src/web/scrapers/docs-rs.ts +30 -5
- package/src/web/scrapers/types.ts +19 -49
- package/src/web/scrapers/utils.ts +12 -26
|
@@ -7,6 +7,13 @@ import type { NativeExactUnlinkResult } from "@gajae-code/natives";
|
|
|
7
7
|
import * as native from "@gajae-code/natives";
|
|
8
8
|
import { resolveEquivalentPath } from "@gajae-code/utils";
|
|
9
9
|
|
|
10
|
+
import {
|
|
11
|
+
isModelProfileError,
|
|
12
|
+
type ModelProfileErrorDetails,
|
|
13
|
+
validateModelProfileName,
|
|
14
|
+
} from "../../config/model-profile-contract";
|
|
15
|
+
import { mergeModelProfiles } from "../../config/model-profiles";
|
|
16
|
+
import { ModelsConfigFile } from "../../config/model-registry";
|
|
10
17
|
import {
|
|
11
18
|
ensureLaunchWorktree,
|
|
12
19
|
ensureReusableNodeModules,
|
|
@@ -326,14 +333,36 @@ function serializeCleanupIdentity(identity: CleanupIdentity): BrokerCleanupIdent
|
|
|
326
333
|
};
|
|
327
334
|
}
|
|
328
335
|
|
|
329
|
-
const fail = (
|
|
336
|
+
const fail = (
|
|
337
|
+
code: string,
|
|
338
|
+
message: string,
|
|
339
|
+
cleanup?: CleanupEvidence,
|
|
340
|
+
details?: ModelProfileErrorDetails,
|
|
341
|
+
): BrokerResponse => ({
|
|
330
342
|
ok: false,
|
|
331
|
-
error: { code: code as never, message, ...(cleanup ? { cleanup } : {}) },
|
|
343
|
+
error: { code: code as never, message, ...(details ? { details } : {}), ...(cleanup ? { cleanup } : {}) },
|
|
332
344
|
});
|
|
333
345
|
function text(value: unknown): string | undefined {
|
|
334
346
|
return typeof value === "string" && value ? value : undefined;
|
|
335
347
|
}
|
|
336
348
|
|
|
349
|
+
function validateBrokerModelPreset(agentDir: string, requestedProfile: string): string | BrokerResponse {
|
|
350
|
+
const modelsConfigFile = ModelsConfigFile.relocate(path.join(agentDir, "models.yml"));
|
|
351
|
+
modelsConfigFile.invalidate();
|
|
352
|
+
const loaded = modelsConfigFile.tryLoad();
|
|
353
|
+
const profiles = mergeModelProfiles(loaded.status === "ok" ? loaded.value.profiles : undefined);
|
|
354
|
+
try {
|
|
355
|
+
return validateModelProfileName(requestedProfile, profiles, loaded.status === "error" ? loaded.error : undefined);
|
|
356
|
+
} catch (error) {
|
|
357
|
+
if (isModelProfileError(error)) return fail(error.code, error.message, undefined, error.details);
|
|
358
|
+
throw error;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export function validateBrokerModelPresetForTest(agentDir: string, requestedProfile: string): string | BrokerResponse {
|
|
363
|
+
return validateBrokerModelPreset(agentDir, requestedProfile);
|
|
364
|
+
}
|
|
365
|
+
|
|
337
366
|
function readinessTimeout(input: Input): number | BrokerResponse {
|
|
338
367
|
const value = input.readinessTimeoutMs;
|
|
339
368
|
if (value === undefined) return READY_TIMEOUT_MS;
|
|
@@ -624,7 +653,7 @@ type ReadyAuthority = {
|
|
|
624
653
|
};
|
|
625
654
|
type ReadinessResult =
|
|
626
655
|
| { kind: "ready"; authority: ReadyAuthority }
|
|
627
|
-
| { kind: "startup_failed";
|
|
656
|
+
| { kind: "startup_failed"; failure: SdkStartupFailure }
|
|
628
657
|
| { kind: "child_exited" }
|
|
629
658
|
| { kind: "timeout" };
|
|
630
659
|
const processIncarnationReadersForTest = new WeakMap<Broker, (pid: number) => string | undefined>();
|
|
@@ -797,19 +826,25 @@ function isLifecycleTranscriptEvidence(value: unknown): value is LifecycleTransc
|
|
|
797
826
|
function isSdkStartupFailure(value: unknown): value is SdkStartupFailure {
|
|
798
827
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
799
828
|
const failure = value as Record<string, unknown>;
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
(
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
failure.reason
|
|
808
|
-
failure.reason
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
829
|
+
const keys = Object.keys(failure);
|
|
830
|
+
if (
|
|
831
|
+
!keys.every(
|
|
832
|
+
key => key === "phase" || key === "reason" || key === "message" || key === "code" || key === "details",
|
|
833
|
+
) ||
|
|
834
|
+
(failure.phase !== "registration" && failure.phase !== "startup") ||
|
|
835
|
+
(failure.reason !== "disabled" &&
|
|
836
|
+
failure.reason !== "ineligible" &&
|
|
837
|
+
failure.reason !== "factory_absent" &&
|
|
838
|
+
failure.reason !== "runner_absent" &&
|
|
839
|
+
failure.reason !== "pending" &&
|
|
840
|
+
failure.reason !== "failed") ||
|
|
841
|
+
typeof failure.message !== "string" ||
|
|
842
|
+
Buffer.byteLength(failure.message) === 0 ||
|
|
843
|
+
Buffer.byteLength(failure.message) > 512
|
|
844
|
+
)
|
|
845
|
+
return false;
|
|
846
|
+
if (failure.code === undefined && failure.details === undefined) return keys.length === 3;
|
|
847
|
+
return keys.length === 5 && isModelProfileError(failure);
|
|
813
848
|
}
|
|
814
849
|
|
|
815
850
|
function isLifecycleFailureArtifact(value: unknown): value is LifecycleFailureArtifact {
|
|
@@ -818,8 +853,14 @@ function isLifecycleFailureArtifact(value: unknown): value is LifecycleFailureAr
|
|
|
818
853
|
if (!isEffectMarker(record)) return false;
|
|
819
854
|
const artifact = value as LifecycleFailureArtifact;
|
|
820
855
|
return (
|
|
821
|
-
Object.keys(record).length ===
|
|
822
|
-
|
|
856
|
+
Object.keys(record).length ===
|
|
857
|
+
7 + (artifact.code === undefined ? 0 : 2) + (artifact.transcript === undefined ? 0 : 1) &&
|
|
858
|
+
isSdkStartupFailure({
|
|
859
|
+
phase: artifact.phase,
|
|
860
|
+
reason: artifact.reason,
|
|
861
|
+
message: artifact.message,
|
|
862
|
+
...(artifact.code === undefined ? {} : { code: artifact.code, details: artifact.details }),
|
|
863
|
+
}) &&
|
|
823
864
|
isRollbackResult(artifact.rollback) &&
|
|
824
865
|
(artifact.transcript === undefined || isLifecycleTranscriptEvidence(artifact.transcript))
|
|
825
866
|
);
|
|
@@ -865,6 +906,8 @@ export async function writeSessionLifecycleFailure(
|
|
|
865
906
|
...(transcript ? { transcript } : {}),
|
|
866
907
|
};
|
|
867
908
|
const bytes = Buffer.from(canonicalJson(artifact), "utf8");
|
|
909
|
+
if (bytes.length > MAX_LIFECYCLE_METADATA_BYTES)
|
|
910
|
+
throw new Error("Lifecycle startup failure exceeds the metadata size ceiling.");
|
|
868
911
|
const target = lifecycleFailurePath(root, id, effectMarker);
|
|
869
912
|
const temporary = path.join(directory, `.${id}.lifecycle.failure.${effectMarker}.${randomUUID()}.tmp`);
|
|
870
913
|
let published = false;
|
|
@@ -1241,6 +1284,10 @@ function validateLifecycleMetadataReplay(cleanup: CleanupEvidence): BrokerRespon
|
|
|
1241
1284
|
if (!current) continue;
|
|
1242
1285
|
if (!sameLifecycleCleanupIdentity(current.identity, file.identity))
|
|
1243
1286
|
return fail("terminal_uncertain", "Lifecycle metadata candidate lacks exact replay authority.");
|
|
1287
|
+
// A completed file's recorded retained quarantine is receipt-bound durable
|
|
1288
|
+
// evidence; anything else that remains is an active survivor.
|
|
1289
|
+
if (file.completed && file.detachedPath && path.resolve(candidate) === path.resolve(file.detachedPath))
|
|
1290
|
+
continue;
|
|
1244
1291
|
activeCandidates++;
|
|
1245
1292
|
}
|
|
1246
1293
|
if (file.completed && activeCandidates > 0)
|
|
@@ -1289,7 +1336,21 @@ function lifecycleMetadataReplayAbsent(cleanup: CleanupEvidence): boolean {
|
|
|
1289
1336
|
const id = cleanup.sessionId!;
|
|
1290
1337
|
const required = new Set<string>([lifecycleMarkerPath(root, id), lifecycleReadyPath(root, id)]);
|
|
1291
1338
|
for (const file of files) for (const candidate of lifecycleCleanupCandidates(file)) required.add(candidate);
|
|
1292
|
-
|
|
1339
|
+
for (const candidate of required) {
|
|
1340
|
+
if (absentLifecyclePath(candidate)) continue;
|
|
1341
|
+
// A completed file's recorded retained quarantine is durable evidence, not a
|
|
1342
|
+
// survivor — accept it only at its receipt-bound path and identity.
|
|
1343
|
+
const owner = files.find(
|
|
1344
|
+
file =>
|
|
1345
|
+
file.completed === true &&
|
|
1346
|
+
file.detachedPath !== undefined &&
|
|
1347
|
+
path.resolve(file.detachedPath) === path.resolve(candidate),
|
|
1348
|
+
);
|
|
1349
|
+
if (!owner) return false;
|
|
1350
|
+
const current = captureLifecycleFile(candidate, true, true);
|
|
1351
|
+
if (!current || !sameLifecycleCleanupIdentity(current.identity, owner.identity)) return false;
|
|
1352
|
+
}
|
|
1353
|
+
return true;
|
|
1293
1354
|
}
|
|
1294
1355
|
|
|
1295
1356
|
/**
|
|
@@ -1552,16 +1613,28 @@ async function reconcileLifecycleCleanup(
|
|
|
1552
1613
|
const candidates = lifecycleCleanupCandidates(file);
|
|
1553
1614
|
if (file.completed) {
|
|
1554
1615
|
for (const candidate of candidates) {
|
|
1616
|
+
let stat: ReturnType<typeof fsSync.lstatSync>;
|
|
1555
1617
|
try {
|
|
1556
|
-
fsSync.lstatSync(candidate);
|
|
1557
|
-
return fail(
|
|
1558
|
-
"terminal_uncertain",
|
|
1559
|
-
"Lifecycle cleanup receipt marks a target complete while an authorized candidate remains.",
|
|
1560
|
-
);
|
|
1618
|
+
stat = fsSync.lstatSync(candidate);
|
|
1561
1619
|
} catch (error) {
|
|
1562
|
-
if ((error as NodeJS.ErrnoException).code
|
|
1563
|
-
|
|
1620
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") continue;
|
|
1621
|
+
return fail("terminal_uncertain", "Lifecycle cleanup completion could not be safely inspected.");
|
|
1622
|
+
}
|
|
1623
|
+
// A completed file's recorded retained quarantine is durable evidence,
|
|
1624
|
+
// not a survivor — accept it only at its receipt-bound path and identity.
|
|
1625
|
+
if (
|
|
1626
|
+
file.detachedPath &&
|
|
1627
|
+
path.resolve(candidate) === path.resolve(file.detachedPath) &&
|
|
1628
|
+
stat.isFile() &&
|
|
1629
|
+
!stat.isSymbolicLink()
|
|
1630
|
+
) {
|
|
1631
|
+
const current = captureLifecycleFile(candidate, true, true);
|
|
1632
|
+
if (current && sameLifecycleCleanupIdentity(current.identity, file.identity)) continue;
|
|
1564
1633
|
}
|
|
1634
|
+
return fail(
|
|
1635
|
+
"terminal_uncertain",
|
|
1636
|
+
"Lifecycle cleanup receipt marks a target complete while an authorized candidate remains.",
|
|
1637
|
+
);
|
|
1565
1638
|
}
|
|
1566
1639
|
continue;
|
|
1567
1640
|
}
|
|
@@ -1631,6 +1704,22 @@ async function reconcileLifecycleCleanup(
|
|
|
1631
1704
|
quarantineName: path.basename(currentFile.plannedPath),
|
|
1632
1705
|
});
|
|
1633
1706
|
if (!result.ok) {
|
|
1707
|
+
if (result.code === "cleanup_pending" && result.detachedPath === currentFile.plannedPath) {
|
|
1708
|
+
// Typed retained authority: the native verified the exact identity-bound
|
|
1709
|
+
// detach and retained the quarantine as durable evidence. Record the
|
|
1710
|
+
// evidence and advance — never claim a terminal byte deletion.
|
|
1711
|
+
const lifecycleFiles = activeCleanup.lifecycleFiles!.map((candidate, candidateIndex) =>
|
|
1712
|
+
candidateIndex === index
|
|
1713
|
+
? { ...candidate, detachedPath: result.detachedPath, completed: true as const }
|
|
1714
|
+
: candidate,
|
|
1715
|
+
);
|
|
1716
|
+
activeCleanup = { ...activeCleanup, lifecycleFiles };
|
|
1717
|
+
await broker.ledger.transition(identity, "effect_started", {
|
|
1718
|
+
response: fail("cleanup_pending", "Lifecycle cleanup completion was durably reconciled.", activeCleanup),
|
|
1719
|
+
});
|
|
1720
|
+
lifecycleCleanupHooksForTest.get(broker)?.();
|
|
1721
|
+
continue;
|
|
1722
|
+
}
|
|
1634
1723
|
const lifecycleFiles = activeCleanup.lifecycleFiles!.map((candidate, candidateIndex) =>
|
|
1635
1724
|
candidateIndex === index && result.detachedPath
|
|
1636
1725
|
? { ...candidate, detachedPath: result.detachedPath }
|
|
@@ -1665,6 +1754,22 @@ async function readSessionLifecycleFailure(
|
|
|
1665
1754
|
?.artifact;
|
|
1666
1755
|
}
|
|
1667
1756
|
|
|
1757
|
+
export async function readSessionLifecycleFailureForTest(
|
|
1758
|
+
root: string,
|
|
1759
|
+
id: string,
|
|
1760
|
+
expected: { pid: number; effectMarker: string; incarnation: string },
|
|
1761
|
+
): Promise<SdkStartupFailure | undefined> {
|
|
1762
|
+
const artifact = await readSessionLifecycleFailure(root, id, expected);
|
|
1763
|
+
return artifact
|
|
1764
|
+
? {
|
|
1765
|
+
phase: artifact.phase,
|
|
1766
|
+
reason: artifact.reason,
|
|
1767
|
+
message: artifact.message,
|
|
1768
|
+
...(artifact.code === undefined ? {} : { code: artifact.code, details: artifact.details }),
|
|
1769
|
+
}
|
|
1770
|
+
: undefined;
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1668
1773
|
async function hasDurableProcessIdentity(
|
|
1669
1774
|
root: string,
|
|
1670
1775
|
id: string,
|
|
@@ -2056,14 +2161,14 @@ async function waitForReady(
|
|
|
2056
2161
|
): Promise<ReadinessResult> {
|
|
2057
2162
|
while (timing.now() < deadline) {
|
|
2058
2163
|
const startupFailure = await readSessionLifecycleFailure(root, id, expected);
|
|
2059
|
-
if (startupFailure) return { kind: "startup_failed",
|
|
2164
|
+
if (startupFailure) return { kind: "startup_failed", failure: startupFailure };
|
|
2060
2165
|
if (
|
|
2061
2166
|
observeProcess(expected.pid, expected.incarnation, value => processIncarnationForBroker(broker, value)) ===
|
|
2062
2167
|
"exited"
|
|
2063
2168
|
) {
|
|
2064
2169
|
const finalStartupFailure = await readSessionLifecycleFailure(root, id, expected);
|
|
2065
2170
|
return finalStartupFailure
|
|
2066
|
-
? { kind: "startup_failed",
|
|
2171
|
+
? { kind: "startup_failed", failure: finalStartupFailure }
|
|
2067
2172
|
: { kind: "child_exited" };
|
|
2068
2173
|
}
|
|
2069
2174
|
try {
|
|
@@ -2191,6 +2296,8 @@ async function launchInput(
|
|
|
2191
2296
|
const requested = sessionId(input);
|
|
2192
2297
|
if (requested !== undefined && !isCanonicalSessionId(requested))
|
|
2193
2298
|
return fail("invalid_input", "sessionId must be a canonical safe identifier.");
|
|
2299
|
+
if (input.modelPreset !== undefined && (typeof input.modelPreset !== "string" || input.modelPreset.length === 0))
|
|
2300
|
+
return fail("invalid_input", "modelPreset must be a non-empty exact profile ID.");
|
|
2194
2301
|
const modelPreset = text(input.modelPreset);
|
|
2195
2302
|
|
|
2196
2303
|
if (operation === "session.create")
|
|
@@ -2615,6 +2722,11 @@ async function executeLifecycleResponse(
|
|
|
2615
2722
|
|
|
2616
2723
|
const launch = await launchInput(broker, operation, input);
|
|
2617
2724
|
if ("ok" in launch) return launch;
|
|
2725
|
+
if (launch.modelPreset) {
|
|
2726
|
+
const validatedModelPreset = validateBrokerModelPreset(broker.settings.agentDir, launch.modelPreset);
|
|
2727
|
+
if (typeof validatedModelPreset !== "string") return validatedModelPreset;
|
|
2728
|
+
launch.modelPreset = validatedModelPreset;
|
|
2729
|
+
}
|
|
2618
2730
|
if (!hasProcessIncarnationAuthority())
|
|
2619
2731
|
return fail(
|
|
2620
2732
|
"incarnation_unavailable",
|
|
@@ -2768,7 +2880,12 @@ async function executeLifecycleResponse(
|
|
|
2768
2880
|
`Session ${launch.id} did not become ready and its spawned process could not be verified dead.`,
|
|
2769
2881
|
);
|
|
2770
2882
|
return readiness.kind === "startup_failed"
|
|
2771
|
-
? fail(
|
|
2883
|
+
? fail(
|
|
2884
|
+
readiness.failure.code ?? "spawn_failed",
|
|
2885
|
+
readiness.failure.message,
|
|
2886
|
+
undefined,
|
|
2887
|
+
readiness.failure.details,
|
|
2888
|
+
)
|
|
2772
2889
|
: readiness.kind === "child_exited"
|
|
2773
2890
|
? fail("spawn_failed", `Session ${launch.id} exited before registering readiness.`)
|
|
2774
2891
|
: fail(
|
|
@@ -3043,11 +3160,26 @@ async function executeLifecycleResponse(
|
|
|
3043
3160
|
`Unable to delete saved session artifacts: ${error instanceof Error ? error.message : String(error)}`,
|
|
3044
3161
|
);
|
|
3045
3162
|
}
|
|
3046
|
-
|
|
3163
|
+
const retainedArtifactsCleanup =
|
|
3164
|
+
deleted.kind === "cleanup_pending" &&
|
|
3165
|
+
deleted.phase === "artifacts" &&
|
|
3166
|
+
deleted.detachedArtifactsPath !== undefined &&
|
|
3167
|
+
cleanupTarget.plannedArtifactsPath !== undefined &&
|
|
3168
|
+
(deleted.detachedArtifactsPath === cleanupTarget.plannedArtifactsPath ||
|
|
3169
|
+
deleted.detachedArtifactsPath === `${cleanupTarget.plannedArtifactsPath}.removing`);
|
|
3170
|
+
if (deleted.kind === "artifacts_removed" || retainedArtifactsCleanup) {
|
|
3047
3171
|
const transcriptPhaseCleanup = {
|
|
3048
3172
|
...preauthorizedCleanup,
|
|
3049
3173
|
phase: "transcript" as const,
|
|
3050
3174
|
artifactsRemoved: true,
|
|
3175
|
+
...(deleted.kind === "cleanup_pending" && deleted.phase === "artifacts"
|
|
3176
|
+
? {
|
|
3177
|
+
detachedArtifactsPath: deleted.detachedArtifactsPath,
|
|
3178
|
+
...(deleted.artifactsIdentity
|
|
3179
|
+
? { artifactsIdentity: serializeCleanupIdentity(deleted.artifactsIdentity) }
|
|
3180
|
+
: {}),
|
|
3181
|
+
}
|
|
3182
|
+
: {}),
|
|
3051
3183
|
...(preauthorizedCleanup.artifactTree
|
|
3052
3184
|
? { artifactTree: { ...preauthorizedCleanup.artifactTree, completed: true as const } }
|
|
3053
3185
|
: {}),
|
|
@@ -3068,7 +3200,14 @@ async function executeLifecycleResponse(
|
|
|
3068
3200
|
artifactsRemoved: true,
|
|
3069
3201
|
});
|
|
3070
3202
|
}
|
|
3071
|
-
if (
|
|
3203
|
+
if (
|
|
3204
|
+
deleted.kind === "cleanup_pending" &&
|
|
3205
|
+
!(
|
|
3206
|
+
deleted.phase === "transcript" &&
|
|
3207
|
+
deleted.detachedTranscriptPath !== undefined &&
|
|
3208
|
+
deleted.detachedTranscriptPath === cleanupTarget.plannedTranscriptPath
|
|
3209
|
+
)
|
|
3210
|
+
)
|
|
3072
3211
|
return fail(
|
|
3073
3212
|
"cleanup_pending",
|
|
3074
3213
|
`Saved session cleanup is pending in ${deleted.phase}: ${deleted.error.message}`,
|
|
@@ -3323,6 +3462,9 @@ export async function executeLifecycle(
|
|
|
3323
3462
|
phase: evidence.artifact.phase,
|
|
3324
3463
|
reason: evidence.artifact.reason,
|
|
3325
3464
|
message: evidence.artifact.message,
|
|
3465
|
+
...(evidence.artifact.code === undefined
|
|
3466
|
+
? {}
|
|
3467
|
+
: { code: evidence.artifact.code, details: evidence.artifact.details }),
|
|
3326
3468
|
rollback: {
|
|
3327
3469
|
endpointGeneration: evidence.artifact.rollback.endpointGeneration,
|
|
3328
3470
|
fenced: evidence.artifact.rollback.fenced,
|
|
@@ -3387,11 +3529,18 @@ export async function executeLifecycle(
|
|
|
3387
3529
|
: startupFailure && cleanupProof
|
|
3388
3530
|
? {
|
|
3389
3531
|
ok: false,
|
|
3390
|
-
error:
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3532
|
+
error: startupFailure.code
|
|
3533
|
+
? {
|
|
3534
|
+
code: startupFailure.code,
|
|
3535
|
+
message: startupFailure.message,
|
|
3536
|
+
details: startupFailure.details!,
|
|
3537
|
+
endpoint: "unavailable" as const,
|
|
3538
|
+
}
|
|
3539
|
+
: {
|
|
3540
|
+
code: "spawn_failed",
|
|
3541
|
+
message: "No ready SDK endpoint remains available.",
|
|
3542
|
+
endpoint: "unavailable" as const,
|
|
3543
|
+
},
|
|
3395
3544
|
...(durableEffects ? { durableEffects } : {}),
|
|
3396
3545
|
startupFailure,
|
|
3397
3546
|
}
|
|
@@ -27,11 +27,16 @@ export type ChatDaemonAction = "stop" | "reload";
|
|
|
27
27
|
* Generation 6 carries the retained managed filesystem authority boundary.
|
|
28
28
|
* Generation 7 restores macOS daemon signaling (kill(2) with a start-time
|
|
29
29
|
* incarnation recheck) so a live/hung owner can be replaced without an external
|
|
30
|
-
* `kill -9`.
|
|
30
|
+
* `kill -9`. Generation 8 adopts Windows expected-identity ACL verification and
|
|
31
|
+
* repair for shared native authority. Generation 9 refreshes the shared native
|
|
32
|
+
* authority declaration contract with bounded frame-delivery acknowledgement.
|
|
33
|
+
* Generation 11 accepts typed retained exact-unlink cleanup authority — a
|
|
34
|
+
* concrete detached quarantine plus a proven-absent canonical lock pathname —
|
|
35
|
+
* when deleting an observed owner-lock lease.
|
|
31
36
|
*/
|
|
32
37
|
export const CHAT_DAEMON_GENERATIONS: Readonly<Record<ChatDaemonKind, number>> = {
|
|
33
|
-
discord:
|
|
34
|
-
slack:
|
|
38
|
+
discord: 11,
|
|
39
|
+
slack: 11,
|
|
35
40
|
};
|
|
36
41
|
|
|
37
42
|
export function chatDaemonGeneration(kind: ChatDaemonKind): number {
|
|
@@ -937,10 +942,19 @@ async function ownsChatDaemonOwnerLock(lock: string, lease: ChatDaemonOwnerLockL
|
|
|
937
942
|
/** Deletes only the exact lease observed by this contender; a successor is retained. */
|
|
938
943
|
function unlinkExactChatDaemonOwnerLock(lock: string, lease: ChatDaemonOwnerLockLease): boolean {
|
|
939
944
|
try {
|
|
940
|
-
|
|
945
|
+
const removed = native.exactUnlink(lock, {
|
|
941
946
|
...lease,
|
|
942
947
|
quarantineName: `.gjc-delete-chat-daemon-lock-${crypto.randomUUID()}`,
|
|
943
|
-
})
|
|
948
|
+
});
|
|
949
|
+
if (removed.ok) return true;
|
|
950
|
+
// Accept only typed retained authority: a concrete detached quarantine plus
|
|
951
|
+
// a proven-absent canonical lock pathname. Anything else stays fail-closed.
|
|
952
|
+
return (
|
|
953
|
+
removed.code === "cleanup_pending" &&
|
|
954
|
+
typeof removed.detachedPath === "string" &&
|
|
955
|
+
removed.detachedPath.length > 0 &&
|
|
956
|
+
!fs.existsSync(lock)
|
|
957
|
+
);
|
|
944
958
|
} catch {
|
|
945
959
|
return false;
|
|
946
960
|
}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* removed), but the user can still adjust per-surface behaviour from inside a
|
|
6
6
|
* session thread with small slash commands:
|
|
7
7
|
*
|
|
8
|
-
* - `/verbose` switch the mirror to
|
|
9
|
-
* - `/lean`
|
|
8
|
+
* - `/verbose` switch the mirror to per-turn assistant text + tool summaries + reasoning summaries
|
|
9
|
+
* - `/lean` settled assistant answer at idle + immediate ask lead-ins (no intermediate tool-turn flood)
|
|
10
10
|
* - `/verbosity lean|verbose`
|
|
11
11
|
* - `/redact on|off` toggle redaction of streamed content
|
|
12
12
|
*
|
package/src/sdk/bus/config.ts
CHANGED
|
@@ -540,6 +540,8 @@ export interface RedactableAction {
|
|
|
540
540
|
question?: string;
|
|
541
541
|
options?: string[];
|
|
542
542
|
summary?: string;
|
|
543
|
+
/** Optional zero-based recommendation into the authoritative raw options. */
|
|
544
|
+
recommendedIndex?: number;
|
|
543
545
|
}
|
|
544
546
|
|
|
545
547
|
/**
|
|
@@ -563,6 +565,12 @@ export function buildRedactedAction(
|
|
|
563
565
|
// Asks stay fully readable/answerable even under redaction.
|
|
564
566
|
if (action.kind === "ask") return action;
|
|
565
567
|
|
|
566
|
-
const {
|
|
568
|
+
const {
|
|
569
|
+
summary: _summary,
|
|
570
|
+
question: _question,
|
|
571
|
+
options: _options,
|
|
572
|
+
recommendedIndex: _recommendedIndex,
|
|
573
|
+
...base
|
|
574
|
+
} = action;
|
|
567
575
|
return base;
|
|
568
576
|
}
|
|
@@ -92,6 +92,7 @@ export class ConversationStore<T extends ConversationRecord> {
|
|
|
92
92
|
readonly #pidAlive: (pid: number) => boolean;
|
|
93
93
|
readonly #sleep: (ms: number) => Promise<void>;
|
|
94
94
|
readonly #lockTimeoutMs: number;
|
|
95
|
+
readonly #platform: NodeJS.Platform;
|
|
95
96
|
|
|
96
97
|
constructor(input: {
|
|
97
98
|
agentDir: string;
|
|
@@ -104,6 +105,7 @@ export class ConversationStore<T extends ConversationRecord> {
|
|
|
104
105
|
pidAlive?: (pid: number) => boolean;
|
|
105
106
|
sleep?: (ms: number) => Promise<void>;
|
|
106
107
|
lockTimeoutMs?: number;
|
|
108
|
+
platform?: NodeJS.Platform;
|
|
107
109
|
}) {
|
|
108
110
|
this.#file = conversationStorePath(input.agentDir, input.kind, input.fileName);
|
|
109
111
|
this.#directory = path.dirname(this.#file);
|
|
@@ -114,6 +116,7 @@ export class ConversationStore<T extends ConversationRecord> {
|
|
|
114
116
|
this.#pidAlive = input.pidAlive ?? defaultPidAlive;
|
|
115
117
|
this.#sleep = input.sleep ?? (async ms => await Bun.sleep(ms));
|
|
116
118
|
this.#lockTimeoutMs = input.lockTimeoutMs ?? 1_000;
|
|
119
|
+
this.#platform = input.platform ?? process.platform;
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
get filePath(): string {
|
|
@@ -325,12 +328,7 @@ export class ConversationStore<T extends ConversationRecord> {
|
|
|
325
328
|
await handle.close();
|
|
326
329
|
}
|
|
327
330
|
await this.#fs.rename(temporary, this.#file);
|
|
328
|
-
|
|
329
|
-
try {
|
|
330
|
-
await directory.sync();
|
|
331
|
-
} finally {
|
|
332
|
-
await directory.close();
|
|
333
|
-
}
|
|
331
|
+
await syncParentDirectory(this.#fs, this.#directory, this.#platform);
|
|
334
332
|
} catch (error) {
|
|
335
333
|
await this.#fs.unlink(temporary).catch(() => undefined);
|
|
336
334
|
throw error;
|
|
@@ -342,6 +340,42 @@ function isMissing(error: unknown): error is NodeJS.ErrnoException {
|
|
|
342
340
|
return isRecord(error) && error.code === "ENOENT";
|
|
343
341
|
}
|
|
344
342
|
|
|
343
|
+
async function syncParentDirectory(
|
|
344
|
+
fs: ConversationStoreFs,
|
|
345
|
+
directory: string,
|
|
346
|
+
platform: NodeJS.Platform,
|
|
347
|
+
): Promise<void> {
|
|
348
|
+
let handle: ConversationStoreFileHandle;
|
|
349
|
+
try {
|
|
350
|
+
handle = await fs.open(directory, "r");
|
|
351
|
+
} catch (error) {
|
|
352
|
+
if (platform === "win32" && isUnsupportedDirectoryBarrierError(error)) return;
|
|
353
|
+
throw error;
|
|
354
|
+
}
|
|
355
|
+
let syncError: unknown;
|
|
356
|
+
try {
|
|
357
|
+
await handle.sync();
|
|
358
|
+
} catch (error) {
|
|
359
|
+
if (!(platform === "win32" && isUnsupportedDirectoryBarrierError(error))) syncError = error;
|
|
360
|
+
}
|
|
361
|
+
let closeError: unknown;
|
|
362
|
+
try {
|
|
363
|
+
await handle.close();
|
|
364
|
+
} catch (error) {
|
|
365
|
+
closeError = error;
|
|
366
|
+
}
|
|
367
|
+
if (syncError && closeError)
|
|
368
|
+
throw new AggregateError([syncError, closeError], "Parent directory sync and close failed");
|
|
369
|
+
if (syncError) throw syncError;
|
|
370
|
+
if (closeError) throw closeError;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function isUnsupportedDirectoryBarrierError(error: unknown): boolean {
|
|
374
|
+
return (
|
|
375
|
+
isRecord(error) &&
|
|
376
|
+
(error.code === "EINVAL" || error.code === "ENOTSUP" || error.code === "EOPNOTSUPP" || error.code === "EPERM")
|
|
377
|
+
);
|
|
378
|
+
}
|
|
345
379
|
function isAlreadyExists(error: unknown): error is NodeJS.ErrnoException {
|
|
346
380
|
return isRecord(error) && error.code === "EEXIST";
|
|
347
381
|
}
|