@gajae-code/coding-agent 0.15.6 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +59 -0
- package/dist/types/cli/args.d.ts +2 -0
- package/dist/types/cli/root-flags.d.ts +14 -0
- package/dist/types/cli/update-cli.d.ts +13 -0
- package/dist/types/cli.d.ts +7 -0
- package/dist/types/commands/launch.d.ts +10 -0
- package/dist/types/config/autorouting-tier-map.d.ts +24 -0
- package/dist/types/config/file-lock.d.ts +5 -0
- package/dist/types/config/model-registry.d.ts +6 -0
- package/dist/types/config/settings-schema.d.ts +10 -1
- package/dist/types/config/settings.d.ts +2 -0
- package/dist/types/coordinator-mcp/projection-scan.d.ts +8 -0
- package/dist/types/crash/record-loader.d.ts +15 -0
- package/dist/types/gjc-runtime/launch-worktree-reservation.d.ts +21 -0
- package/dist/types/gjc-runtime/managed-owner-supervisor.d.ts +2 -0
- package/dist/types/gjc-runtime/session-state-sidecar.d.ts +66 -1
- package/dist/types/gjc-runtime/tmux-owner-isolation.d.ts +1 -0
- package/dist/types/gjc-runtime/tmux-sessions.d.ts +27 -0
- package/dist/types/master-mode/context.d.ts +21 -0
- package/dist/types/master-mode/first-request.d.ts +34 -0
- package/dist/types/master-mode/snapshot.d.ts +32 -0
- package/dist/types/modes/components/frictionless-onboarding-selector.d.ts +10 -0
- package/dist/types/modes/components/oauth-selector.d.ts +1 -0
- package/dist/types/modes/components/status-line/model-name.d.ts +18 -0
- package/dist/types/modes/components/status-line/priority-row.d.ts +34 -0
- package/dist/types/modes/components/status-line/segments.d.ts +10 -0
- package/dist/types/modes/print-mode.d.ts +17 -0
- package/dist/types/modes/ui-language.d.ts +7 -1
- package/dist/types/sdk/broker/broker.d.ts +77 -1
- package/dist/types/sdk/broker/endpoint-authority.d.ts +24 -0
- package/dist/types/sdk/broker/index.d.ts +3 -0
- package/dist/types/sdk/broker/lifecycle.d.ts +26 -0
- package/dist/types/sdk/broker/master-capability.d.ts +10 -0
- package/dist/types/sdk/broker/session-index.d.ts +40 -11
- package/dist/types/sdk/broker/session-scope.d.ts +72 -0
- package/dist/types/sdk/broker/spawn-authority.d.ts +201 -0
- package/dist/types/sdk/broker/spawn-substrate.d.ts +30 -0
- package/dist/types/sdk/broker/state-version.d.ts +4 -1
- package/dist/types/sdk/broker/worktree-occupancy.d.ts +28 -0
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +3 -0
- package/dist/types/sdk/bus/index.d.ts +6 -0
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +1 -1
- package/dist/types/sdk/cli/index.d.ts +1 -0
- package/dist/types/sdk/cli/master-cli.d.ts +63 -0
- package/dist/types/sdk/cli/rows.d.ts +4 -3
- package/dist/types/sdk/cli/session-cli.d.ts +18 -2
- package/dist/types/sdk/client/client.d.ts +3 -2
- package/dist/types/sdk/host/control/dispatch.d.ts +10 -0
- package/dist/types/sdk/host/control/index.d.ts +1 -1
- package/dist/types/sdk/host/control/operations.d.ts +2 -0
- package/dist/types/sdk/host/control/runtime-gate.d.ts +21 -7
- package/dist/types/sdk/host/host.d.ts +10 -0
- package/dist/types/sdk/host/session-runtime.d.ts +52 -0
- package/dist/types/sdk/lifecycle/broker-client.d.ts +6 -0
- package/dist/types/sdk/lifecycle/service.d.ts +15 -3
- package/dist/types/sdk/lifecycle-session.d.ts +2 -0
- package/dist/types/sdk/router/session-router.d.ts +2 -0
- package/dist/types/sdk/session.d.ts +16 -0
- package/dist/types/sdk/startup-capability.d.ts +2 -1
- package/dist/types/session/agent-session.d.ts +5 -0
- package/dist/types/session/credential-store-errors.d.ts +1 -0
- package/dist/types/session/session-manager.d.ts +65 -0
- package/dist/types/session/yield-queue.d.ts +5 -4
- package/dist/types/setup/frictionless-onboarding.d.ts +1 -0
- package/dist/types/tools/bash.d.ts +4 -0
- package/dist/types/tools/gh.d.ts +8 -0
- package/dist/types/tools/index.d.ts +4 -0
- package/package.json +7 -7
- package/scripts/generate-sdk-operation-inventory.ts +6 -0
- package/scripts/verify-gjc-sdk-canonicalization.ts +35 -1
- package/src/cli/accounts-cli.ts +9 -5
- package/src/cli/args.ts +17 -0
- package/src/cli/fast-help.ts +1 -0
- package/src/cli/root-flags.ts +5 -0
- package/src/cli/update-cli.ts +77 -11
- package/src/commands/launch.ts +86 -18
- package/src/commands/sdk.ts +113 -21
- package/src/config/autorouting-tier-map.ts +12 -0
- package/src/config/file-lock.ts +158 -83
- package/src/config/model-preset-registry.ts +1 -5
- package/src/config/model-profiles.ts +5 -5
- package/src/config/model-registry.ts +23 -0
- package/src/config/model-resolver.ts +5 -0
- package/src/config/settings-schema.ts +8 -1
- package/src/config/settings.ts +5 -0
- package/src/coordinator-mcp/projection-scan.ts +21 -0
- package/src/coordinator-mcp/question-state.ts +9 -11
- package/src/coordinator-mcp/server.ts +94 -20
- package/src/crash/index-store.ts +2 -0
- package/src/crash/record-loader.ts +10 -0
- package/src/gjc-runtime/launch-worktree-reservation.ts +242 -0
- package/src/gjc-runtime/managed-owner-supervisor.ts +63 -51
- package/src/gjc-runtime/session-state-lock.ts +79 -6
- package/src/gjc-runtime/session-state-sidecar.ts +929 -23
- package/src/gjc-runtime/tmux-owner-isolation-cli.ts +4 -7
- package/src/gjc-runtime/tmux-owner-isolation.ts +2 -2
- package/src/gjc-runtime/tmux-sessions.ts +252 -13
- package/src/hooks/skill-state.ts +6 -0
- package/src/internal-urls/docs-index.generated.ts +7 -7
- package/src/internal-urls/issue-pr-protocol.ts +4 -2
- package/src/main.ts +57 -2
- package/src/master-mode/context.ts +50 -0
- package/src/master-mode/first-request.ts +65 -0
- package/src/master-mode/snapshot.ts +205 -0
- package/src/modes/acp/acp-agent.ts +605 -156
- package/src/modes/components/footer.ts +4 -2
- package/src/modes/components/frictionless-onboarding-selector.ts +48 -2
- package/src/modes/components/oauth-selector.ts +6 -1
- package/src/modes/components/settings-selector.ts +1 -0
- package/src/modes/components/status-line/model-name.ts +53 -0
- package/src/modes/components/status-line/priority-row.ts +107 -0
- package/src/modes/components/status-line/segments.ts +23 -9
- package/src/modes/components/tool-status-header.ts +151 -15
- package/src/modes/controllers/input-controller.ts +28 -0
- package/src/modes/controllers/selector-controller.ts +191 -96
- package/src/modes/print-mode.ts +64 -0
- package/src/modes/ui-language.ts +49 -2
- package/src/prompts/system/master-mode.md +28 -0
- package/src/sdk/broker/broker.ts +1636 -26
- package/src/sdk/broker/endpoint-authority.ts +86 -0
- package/src/sdk/broker/ensure.ts +5 -0
- package/src/sdk/broker/index.ts +3 -0
- package/src/sdk/broker/lifecycle.ts +186 -41
- package/src/sdk/broker/master-capability.ts +232 -0
- package/src/sdk/broker/session-index.ts +121 -17
- package/src/sdk/broker/session-scope.ts +272 -0
- package/src/sdk/broker/spawn-authority.ts +1031 -0
- package/src/sdk/broker/spawn-substrate.ts +548 -0
- package/src/sdk/broker/state-version.ts +26 -14
- package/src/sdk/broker/transport.ts +1 -0
- package/src/sdk/broker/worktree-occupancy.ts +90 -0
- package/src/sdk/bus/chat-daemon-control.ts +5 -2
- package/src/sdk/bus/chat-daemon-runtime.ts +35 -4
- package/src/sdk/bus/index.ts +51 -4
- package/src/sdk/bus/telegram-daemon-contract.ts +1 -1
- package/src/sdk/cli/index.ts +1 -0
- package/src/sdk/cli/master-cli.ts +259 -0
- package/src/sdk/cli/rows.ts +11 -8
- package/src/sdk/cli/session-cli.ts +264 -5
- package/src/sdk/client/client.ts +14 -8
- package/src/sdk/host/control/dispatch.ts +99 -38
- package/src/sdk/host/control/index.ts +2 -0
- package/src/sdk/host/control/operations.ts +2 -0
- package/src/sdk/host/control/runtime-gate.ts +203 -11
- package/src/sdk/host/host.ts +27 -2
- package/src/sdk/host/session-runtime.test.ts +210 -6
- package/src/sdk/host/session-runtime.ts +291 -49
- package/src/sdk/lifecycle/broker-client.ts +28 -0
- package/src/sdk/lifecycle/service.ts +279 -20
- package/src/sdk/lifecycle-session.ts +10 -2
- package/src/sdk/protocol/operation-inventory.generated.json +51 -0
- package/src/sdk/protocol/operation-registry.ts +13 -3
- package/src/sdk/router/session-router.ts +67 -59
- package/src/sdk/session.ts +357 -155
- package/src/sdk/startup-capability.ts +1 -0
- package/src/session/agent-session.ts +640 -103
- package/src/session/blob-store.ts +15 -5
- package/src/session/credential-store-errors.ts +2 -0
- package/src/session/internal/managed-session-storage.ts +153 -78
- package/src/session/session-manager.ts +337 -24
- package/src/session/yield-queue.ts +24 -10
- package/src/setup/frictionless-onboarding.ts +2 -0
- package/src/telemetry/events.ts +1138 -12
- package/src/tools/bash.ts +256 -42
- package/src/tools/gh.ts +104 -48
- package/src/tools/github-cache.ts +2 -2
- package/src/tools/index.ts +4 -0
|
@@ -39,6 +39,7 @@ const LOCK_ACQUIRE_RETRY_MS = 5;
|
|
|
39
39
|
const LOCK_ACQUIRE_MAX_RETRY_MS = 100;
|
|
40
40
|
const LOCK_ACQUIRE_TIMEOUT_MS = 2_000;
|
|
41
41
|
const LOCK_STALE_MS = 30_000;
|
|
42
|
+
const RELEASED_TRANSITION_GRACE_MS = 1_000;
|
|
42
43
|
|
|
43
44
|
interface LockRetryBudget {
|
|
44
45
|
startedAt: number;
|
|
@@ -1308,7 +1309,13 @@ async function acquireOwnerLock(
|
|
|
1308
1309
|
} catch {
|
|
1309
1310
|
throw error;
|
|
1310
1311
|
}
|
|
1311
|
-
if (!validLockOwner(observed)
|
|
1312
|
+
if (!validLockOwner(observed)) throw error;
|
|
1313
|
+
if (observed.released !== true) {
|
|
1314
|
+
if (await lockOwnerIsAlive(observed)) throw error;
|
|
1315
|
+
const removed = exactUnlinkOwnerRecord(file, current, quarantineName);
|
|
1316
|
+
if (removed !== "removed" && removed !== "absent") throw error;
|
|
1317
|
+
return await createOwnerLock(file, owner, quarantineName);
|
|
1318
|
+
}
|
|
1312
1319
|
try {
|
|
1313
1320
|
return await rewriteHeldOwnerRecord(file, current, owner);
|
|
1314
1321
|
} catch (error) {
|
|
@@ -1330,7 +1337,10 @@ async function acquireOwnerLock(
|
|
|
1330
1337
|
*
|
|
1331
1338
|
* Stale-owner reclaim still uses the native identity-bound detach protocol because no live
|
|
1332
1339
|
* owner or transition claim can vouch for that pathname. A mismatch here likewise leaves a
|
|
1333
|
-
* successor strictly alone.
|
|
1340
|
+
* successor strictly alone. A released tombstone is reclaimable on every platform when its
|
|
1341
|
+
* owner host is this installation and the transition directory is proven empty and unchanged:
|
|
1342
|
+
* the tombstone is the release marker, while the directory generation binds that marker to
|
|
1343
|
+
* the exact claim that release failed to remove.
|
|
1334
1344
|
*/
|
|
1335
1345
|
async function releaseOwnerLock(file: string, held: LockOwnerSnapshot): Promise<void> {
|
|
1336
1346
|
let owner: unknown;
|
|
@@ -1549,7 +1559,7 @@ async function releaseTransitionClaim(
|
|
|
1549
1559
|
}
|
|
1550
1560
|
|
|
1551
1561
|
async function reclaimStaleTransitionClaim(transitionDir: string, quarantineName: string): Promise<void> {
|
|
1552
|
-
const stat = await fs.lstat(transitionDir).catch(() => null);
|
|
1562
|
+
const stat = await fs.lstat(transitionDir, { bigint: true }).catch(() => null);
|
|
1553
1563
|
if (!stat) return;
|
|
1554
1564
|
// Regular-file claims belong to the superseded protocol. They retain the old
|
|
1555
1565
|
// exact-identity stale path; released PID-1 tombstones deliberately require
|
|
@@ -1566,9 +1576,72 @@ async function reclaimStaleTransitionClaim(transitionDir: string, quarantineName
|
|
|
1566
1576
|
return;
|
|
1567
1577
|
}
|
|
1568
1578
|
if (!stat.isDirectory()) throw new SessionStateLockUnavailableError();
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1579
|
+
const ownerSnapshot = await captureRegularLockOwner(`${transitionDir}.owner`);
|
|
1580
|
+
if (!ownerSnapshot) return;
|
|
1581
|
+
let owner: unknown;
|
|
1582
|
+
try {
|
|
1583
|
+
owner = JSON.parse(ownerSnapshot.bytes);
|
|
1584
|
+
} catch {
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
if (!validLockOwner(owner)) return;
|
|
1588
|
+
if (owner.released === true) {
|
|
1589
|
+
// A released record is safe only when it is qualified by this installation.
|
|
1590
|
+
// Never let a shared-volume tombstone, an absent identity, or a legacy foreign
|
|
1591
|
+
// identity authorize removal of a claim this process cannot own.
|
|
1592
|
+
if (owner.owner_host_id === undefined) return;
|
|
1593
|
+
const currentHost = await currentOwnerHostId();
|
|
1594
|
+
const legacyHost = await currentLegacyOwnerHostId();
|
|
1595
|
+
if (owner.owner_host_id !== currentHost && owner.owner_host_id !== legacyHost) return;
|
|
1596
|
+
if (Date.now() - Number(ownerSnapshot.mtimeNs / 1_000_000n) < RELEASED_TRANSITION_GRACE_MS) return;
|
|
1597
|
+
} else {
|
|
1598
|
+
if (process.platform !== "win32") return;
|
|
1599
|
+
if (await lockOwnerIsAlive(owner)) return;
|
|
1600
|
+
}
|
|
1601
|
+
const generation = transitionGenerationFromStat(stat);
|
|
1602
|
+
const nativePath = await canonicalOwnedTransitionPath(transitionDir).catch(() => null);
|
|
1603
|
+
if (!nativePath) return;
|
|
1604
|
+
const captured = nativeSessionStateLock().snapshotDirectoryTree(nativePath);
|
|
1605
|
+
if (!captured.ok || !captured.snapshot) return;
|
|
1606
|
+
const root = captured.snapshot.entries.find(entry => entry.relativePath === "");
|
|
1607
|
+
if (
|
|
1608
|
+
!root ||
|
|
1609
|
+
root.kind !== "directory" ||
|
|
1610
|
+
root.dev !== String(generation.dev) ||
|
|
1611
|
+
root.ino !== String(generation.ino) ||
|
|
1612
|
+
root.nlink !== String(generation.nlink) ||
|
|
1613
|
+
root.mtimeNs !== String(generation.mtimeNs) ||
|
|
1614
|
+
root.ctimeNs !== String(generation.ctimeNs)
|
|
1615
|
+
)
|
|
1616
|
+
return;
|
|
1617
|
+
if (captured.snapshot.entries.length !== 1) return;
|
|
1618
|
+
const removed = nativeSessionStateLock().exactRemoveDirectoryTree(nativePath, captured.snapshot);
|
|
1619
|
+
if (removed.ok || removed.code === "not_found") {
|
|
1620
|
+
const ownerRemoval = exactUnlinkOwnerRecord(`${transitionDir}.owner`, ownerSnapshot, quarantineName);
|
|
1621
|
+
if (ownerRemoval !== "removed" && ownerRemoval !== "absent") return;
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
if (
|
|
1625
|
+
removed.code === "cleanup_pending" &&
|
|
1626
|
+
removed.payloadDurable === true &&
|
|
1627
|
+
removed.detachedPath === `${nativePath}.removing` &&
|
|
1628
|
+
removed.retainedSuccessorPath === undefined &&
|
|
1629
|
+
removed.retainedUnknownPath === undefined &&
|
|
1630
|
+
removed.retainedPlaceholderPath === undefined
|
|
1631
|
+
) {
|
|
1632
|
+
// The captured claim is proven empty, so the native detach receipt leaves an
|
|
1633
|
+
// empty directory at detachedPath. Remove that exact directory directly: calling
|
|
1634
|
+
// the detach primitive again would deterministically create a second `.removing`
|
|
1635
|
+
// collision on POSIX. rmdir never follows a directory's contents and refuses if a
|
|
1636
|
+
// successor populated the detached path.
|
|
1637
|
+
await removeTransitionDir(removed.detachedPath);
|
|
1638
|
+
const ownerRemoval = exactUnlinkOwnerRecord(`${transitionDir}.owner`, ownerSnapshot, quarantineName);
|
|
1639
|
+
if (ownerRemoval !== "removed" && ownerRemoval !== "absent") return;
|
|
1640
|
+
return;
|
|
1641
|
+
}
|
|
1642
|
+
throw new SessionStateLockUnavailableError(
|
|
1643
|
+
new Error(`Stale transition claim could not be reclaimed (${removed.code ?? "unknown"}).`),
|
|
1644
|
+
);
|
|
1572
1645
|
}
|
|
1573
1646
|
|
|
1574
1647
|
/** Run one pathname transition under an atomic `mkdir`/`rmdir` claim. */
|