@quantiya/codevibe-core 2.0.79 → 2.0.81
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/dist/appsync/appsync-client.d.ts +7 -1
- package/dist/appsync/index.d.ts +2 -0
- package/dist/appsync/sync-mobile-echo.d.ts +9 -0
- package/dist/appsync/sync-source-cursor.d.ts +14 -0
- package/dist/appsync/sync-source-file.d.ts +15 -0
- package/dist/appsync/sync-source-pair.d.ts +2 -1
- package/dist/appsync/sync-source-recovery.d.ts +35 -0
- package/dist/credential-broker/index.d.ts +1 -1
- package/dist/credential-broker/oauth-account-lock.d.ts +24 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +517 -517
- package/dist/orchestration-shell/cli.js +370 -213
- package/dist/tool-activity/replay-cursor.d.ts +11 -1
- package/package.json +1 -1
|
@@ -1041,7 +1041,9 @@ export declare class AppSyncClient {
|
|
|
1041
1041
|
/**
|
|
1042
1042
|
* Update a session
|
|
1043
1043
|
*/
|
|
1044
|
-
updateSession(input: UpdateSessionInput
|
|
1044
|
+
updateSession(input: UpdateSessionInput, options?: {
|
|
1045
|
+
expectedUserId?: string;
|
|
1046
|
+
}): Promise<Session>;
|
|
1045
1047
|
private doUpdateSession;
|
|
1046
1048
|
/**
|
|
1047
1049
|
* Get a session
|
|
@@ -2012,6 +2014,10 @@ export declare class AppSyncClient {
|
|
|
2012
2014
|
private handleApplyUserDecisionWatcherError;
|
|
2013
2015
|
private cleanupApplyUserDecisionWatcherState;
|
|
2014
2016
|
private heartbeatTimers;
|
|
2017
|
+
private heartbeatReadiness;
|
|
2018
|
+
/** Local producer health, not a quota/transport flag. Reconnect must not
|
|
2019
|
+
* advertise readiness while the owning transcript reader is degraded. */
|
|
2020
|
+
setHeartbeatReadiness(sessionId: string, ready: () => boolean): () => void;
|
|
2015
2021
|
/** Identity tokens invalidate in-flight pulses when a session is stopped. */
|
|
2016
2022
|
private heartbeatTokens;
|
|
2017
2023
|
/** Shared initial confirmation makes duplicate start calls idempotent. */
|
package/dist/appsync/index.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ export { MAX_SYNC_SOURCE_ANCHOR_BYTES } from './sync-source-cursor';
|
|
|
25
25
|
export type { DesktopSyncSourceStream, DesktopSyncSourceFrame, DesktopSyncSourceCursor, DesktopSyncSourceJournal, DesktopSyncSourceInventory, DesktopSyncSourceAnchor, DesktopSyncSourcePosition, DesktopSyncSourceGap } from './sync-source-cursor';
|
|
26
26
|
export type { DesktopSyncSourcePair } from './sync-source-pair';
|
|
27
27
|
export { readDesktopSyncFile } from './sync-source-file';
|
|
28
|
+
export { DEFAULT_SYNC_SOURCE_RECOVERY_POLICY, planSyncSourceRecovery, resolveSyncSourceRecoveryPolicy } from './sync-source-recovery';
|
|
29
|
+
export type { SyncSourceRecoveryPolicy, SyncSourceMessageObservation } from './sync-source-recovery';
|
|
28
30
|
export type { DesktopSyncFileIdentity, DesktopSyncFileFrame, DesktopSyncFileAdmission } from './sync-source-file';
|
|
29
31
|
export { DesktopSyncReadClient, SyncReadClientError } from './sync-read-client';
|
|
30
32
|
export type { DesktopSyncRegistrationAttempt, DesktopSyncReadCredential, SyncReadEvent, SyncHistoryPage } from './sync-read-client';
|
|
@@ -274,6 +274,15 @@ export interface DesktopMobileEchoJournal {
|
|
|
274
274
|
}): Promise<void>;
|
|
275
275
|
/** Uses native record time, not replay time; reserves one exact byte occurrence. */
|
|
276
276
|
claim(frame: DesktopMobileEchoFrame, content: string, nativeTimestamp: string): Promise<boolean>;
|
|
277
|
+
/** Read-only, under the existing row lock: freeze exact eligible IDs and
|
|
278
|
+
* one-to-one native proofs. Caller must persist the plan before settlement. */
|
|
279
|
+
planOmitted(records: Iterable<{
|
|
280
|
+
sourceSha256: string;
|
|
281
|
+
content: string;
|
|
282
|
+
timestamp: string;
|
|
283
|
+
}>): Promise<string>;
|
|
284
|
+
/** Idempotent exact removals; never rematch history or consult wall clocks. */
|
|
285
|
+
settleOmitted(plan: string): Promise<number>;
|
|
277
286
|
/** Call only after the real native cursor is durably at/past this position. */
|
|
278
287
|
reconcile(streamSha256: string, committedByteOffset: number): Promise<number>;
|
|
279
288
|
}
|
|
@@ -17,9 +17,19 @@ export interface DesktopSyncSourcePosition {
|
|
|
17
17
|
byteOffset: number;
|
|
18
18
|
anchor: DesktopSyncSourceAnchor | null;
|
|
19
19
|
discardUntilNewline: boolean;
|
|
20
|
+
/** Durable rebase marker, projected by the paired owner; never a new input. */
|
|
21
|
+
recovered?: {
|
|
22
|
+
previousOffset: number;
|
|
23
|
+
boundaryOffset: number;
|
|
24
|
+
skippedHistory: boolean;
|
|
25
|
+
recordedAt: number;
|
|
26
|
+
/** Opaque bounded cleanup intent in the existing encrypted projection. */
|
|
27
|
+
projection?: string | null;
|
|
28
|
+
};
|
|
20
29
|
/** Recovery hint only, never persisted: finish this linked PREPARING frame
|
|
21
30
|
* before the reader may discard a later backlog range. */
|
|
22
31
|
pendingFrameEndOffset?: number;
|
|
32
|
+
pendingFrame?: Pick<DesktopSyncSourceFrame, 'startOffset' | 'endOffset' | 'sourceSha256'>;
|
|
23
33
|
}
|
|
24
34
|
export interface DesktopSyncSourceGap {
|
|
25
35
|
startOffset: number;
|
|
@@ -28,6 +38,8 @@ export interface DesktopSyncSourceGap {
|
|
|
28
38
|
reason: 'BACKLOG_LIMIT' | 'OVERSIZED_RECORD' | 'PARTIAL_RECORD' | 'MALFORMED_RECORD' | 'EMPTY_RECORD';
|
|
29
39
|
discardUntilNewline: boolean;
|
|
30
40
|
}
|
|
41
|
+
/** Shared preflight: reject malformed caller coordinates before inspecting WAL progress. */
|
|
42
|
+
export declare function validSourceRebase(previous: DesktopSyncSourcePosition, target: DesktopSyncSourceAnchor, skipped: boolean): boolean;
|
|
31
43
|
declare const schema: z.ZodObject<{
|
|
32
44
|
schemaVersion: z.ZodLiteral<1>;
|
|
33
45
|
kind: z.ZodLiteral<"SOURCE_CURSOR">;
|
|
@@ -507,6 +519,8 @@ export interface DesktopSyncSourceJournal {
|
|
|
507
519
|
admit(frame: DesktopSyncSourceFrame, prepare: ((operationId: string) => Promise<CreateDesktopSyncEventInput>) | null, projectionAfter?: string | null): Promise<string | null>;
|
|
508
520
|
/** Persist an intentional reader safety gap, never a network/quota fallback. */
|
|
509
521
|
skip(gap: DesktopSyncSourceGap): Promise<void>;
|
|
522
|
+
/** A verified native rewrite, only after all already admitted operations settle. */
|
|
523
|
+
rebase(previous: DesktopSyncSourcePosition, target: DesktopSyncSourceAnchor, skippedHistory: boolean, recordedAt: number, recoveryProjection?: string | null): Promise<void>;
|
|
510
524
|
/** Repairs interrupted preparation/settlement without source bytes or new encryption. */
|
|
511
525
|
recover(): Promise<void>;
|
|
512
526
|
/** Bounded cloud drain, separate from native source admission. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type DesktopSyncSourceAnchor, type DesktopSyncSourcePosition, type DesktopSyncSourceGap } from './sync-source-cursor';
|
|
2
|
+
import { type SyncSourceMessageObservation, type SyncSourceRecoveryPolicy } from './sync-source-recovery';
|
|
2
3
|
export interface DesktopSyncFileIdentity {
|
|
3
4
|
filePath: string;
|
|
4
5
|
fileIdentity: Readonly<{
|
|
@@ -16,6 +17,15 @@ export interface DesktopSyncFileAdmission<T> {
|
|
|
16
17
|
restore(source: Readonly<DesktopSyncFileIdentity>, initial: DesktopSyncSourcePosition): Promise<DesktopSyncSourcePosition | null>;
|
|
17
18
|
admit(event: T, source: Readonly<DesktopSyncFileFrame>): Promise<void>;
|
|
18
19
|
skip(gap: DesktopSyncSourceGap, source: Readonly<DesktopSyncFileIdentity>): Promise<void>;
|
|
20
|
+
rebase?(previous: DesktopSyncSourcePosition, target: DesktopSyncSourceAnchor, skippedHistory: boolean, recoveryProjection?: string | null): Promise<DesktopSyncSourcePosition>;
|
|
21
|
+
recovered?(recovery: NonNullable<DesktopSyncSourcePosition['recovered']>): Promise<void>;
|
|
22
|
+
beforeRead?(position: Readonly<DesktopSyncSourcePosition>, source: Readonly<DesktopSyncFileIdentity>, size: number): Promise<void>;
|
|
23
|
+
/** Freeze an exact-ID cleanup plan BEFORE committing the rebase. Only newly
|
|
24
|
+
* omitted records are supplied; this callback never dispatches history. */
|
|
25
|
+
prepareRecovery?(records: Iterable<{
|
|
26
|
+
event: T;
|
|
27
|
+
frame: DesktopSyncFileFrame;
|
|
28
|
+
}>): Promise<string>;
|
|
19
29
|
}
|
|
20
30
|
/** Bounded descriptor-based reader. Admission/fsync, not cloud delivery, advances it. */
|
|
21
31
|
export declare function readDesktopSyncFile<T>(options: {
|
|
@@ -26,8 +36,13 @@ export declare function readDesktopSyncFile<T>(options: {
|
|
|
26
36
|
isCurrent(): boolean;
|
|
27
37
|
maxBacklogBytes?: number;
|
|
28
38
|
maxRecordBytes?: number;
|
|
39
|
+
recovery?: {
|
|
40
|
+
inspect(line: string): SyncSourceMessageObservation | null;
|
|
41
|
+
policy?: SyncSourceRecoveryPolicy;
|
|
42
|
+
};
|
|
29
43
|
}): Promise<{
|
|
30
44
|
position: DesktopSyncSourcePosition;
|
|
31
45
|
size: number;
|
|
32
46
|
mtimeMs: number;
|
|
47
|
+
recovered?: DesktopSyncSourcePosition['recovered'];
|
|
33
48
|
} | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CreateDesktopSyncEventInput } from './sync-event-client';
|
|
2
|
-
import type { DesktopSyncSourceFrame, DesktopSyncSourceGap, DesktopSyncSourceJournal, DesktopSyncSourcePosition, DesktopSyncSourceStream } from './sync-source-cursor';
|
|
2
|
+
import type { DesktopSyncSourceFrame, DesktopSyncSourceGap, DesktopSyncSourceJournal, DesktopSyncSourcePosition, DesktopSyncSourceStream, DesktopSyncSourceAnchor } from './sync-source-cursor';
|
|
3
3
|
type Prepare = ((operationId: string) => Promise<CreateDesktopSyncEventInput>) | null;
|
|
4
4
|
export interface DesktopSyncSourcePair {
|
|
5
5
|
/** Restore the earliest unfinished lane, never the latest volatile reader offset. */
|
|
@@ -7,6 +7,7 @@ export interface DesktopSyncSourcePair {
|
|
|
7
7
|
/** Both slots are fixed for this source's lifetime; null explicitly ignores a slot. */
|
|
8
8
|
admit(frame: DesktopSyncSourceFrame, prepare: readonly [Prepare, Prepare]): Promise<readonly [string | null, string | null]>;
|
|
9
9
|
skip(gap: DesktopSyncSourceGap): Promise<void>;
|
|
10
|
+
rebase(previous: DesktopSyncSourcePosition, target: DesktopSyncSourceAnchor, skippedHistory: boolean, recoveryProjection?: string | null): Promise<DesktopSyncSourcePosition>;
|
|
10
11
|
recover(): Promise<void>;
|
|
11
12
|
/** The bound is per lane; two lanes cannot starve each other. */
|
|
12
13
|
drain(maximumPerLane?: number, signal?: AbortSignal): Promise<number>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type DesktopSyncSourceAnchor, type DesktopSyncSourcePosition } from './sync-source-cursor';
|
|
2
|
+
/** Owner-approved recovery defaults. These are local catch-up bounds, not quotas. */
|
|
3
|
+
export interface SyncSourceRecoveryPolicy {
|
|
4
|
+
staleAfterMs: number;
|
|
5
|
+
maximumRecentMessages: number;
|
|
6
|
+
anchorSearchBytes: number;
|
|
7
|
+
maximumScanBytes: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const DEFAULT_SYNC_SOURCE_RECOVERY_POLICY: Readonly<SyncSourceRecoveryPolicy>;
|
|
10
|
+
export interface SyncSourceMessageObservation {
|
|
11
|
+
timestampMs: number;
|
|
12
|
+
isMessage: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface SyncSourceRecoveryPlan {
|
|
15
|
+
anchor: DesktopSyncSourceAnchor;
|
|
16
|
+
skippedHistory: boolean;
|
|
17
|
+
/** Current-file end of the uniquely relocated old checkpoint. Never scan
|
|
18
|
+
* already-acknowledged history as new omitted-echo evidence. */
|
|
19
|
+
resumeOffset: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function resolveSyncSourceRecoveryPolicy(): SyncSourceRecoveryPolicy;
|
|
22
|
+
/** Metadata-only traversal, bounded by the caller; never advances a cursor. */
|
|
23
|
+
export declare function scanSyncSourceFrames(fd: number, start: number, end: number): Generator<{
|
|
24
|
+
start: number;
|
|
25
|
+
end: number;
|
|
26
|
+
bytes: Buffer;
|
|
27
|
+
}>;
|
|
28
|
+
/** Same-descriptor, bounded scan. It never dispatches or returns message content. */
|
|
29
|
+
export declare function planSyncSourceRecovery(options: {
|
|
30
|
+
fd: number;
|
|
31
|
+
size: number;
|
|
32
|
+
previous: DesktopSyncSourcePosition;
|
|
33
|
+
inspect(line: string): SyncSourceMessageObservation | null;
|
|
34
|
+
policy?: SyncSourceRecoveryPolicy;
|
|
35
|
+
}): SyncSourceRecoveryPlan;
|
|
@@ -9,7 +9,7 @@ export { KeychainVendorKeyStore } from "./vendor-key-store";
|
|
|
9
9
|
export { BrokerTokenMinter, type RotationHandle } from "./broker-token";
|
|
10
10
|
export { CHATGPT_UPSTREAM_CONFIG, chatGptUpstreamUrl, CHATGPT_TOKEN_ENDPOINT, CHATGPT_OAUTH_CLIENT_ID, CHATGPT_REFRESH_CONTENT_TYPE, } from "./chatgpt-config";
|
|
11
11
|
export { FetchRefreshTransport, refreshOAuthToken, buildRefreshBody, type RefreshTransport, type RefreshOutcome, } from "./oauth-refresh";
|
|
12
|
-
export { OAuthAccountLock, createOAuthAccountLock, defaultOAuthLockDir, type OAuthAccountLockOptions, type LockHandle, type LockOwner, } from "./oauth-account-lock";
|
|
12
|
+
export { OAuthAccountLock, LocalLockBusyError, type LocalLockRole, createOAuthAccountLock, defaultOAuthLockDir, type OAuthAccountLockOptions, type LockHandle, type LockOwner, } from "./oauth-account-lock";
|
|
13
13
|
export { buildCanonicalRequest, selfCredentialGuard, requestSha256, CanonicalRejectError, } from "./canonical";
|
|
14
14
|
export type { CanonicalInput, CanonicalRequest } from "./canonical";
|
|
15
15
|
export { scrubRequestBody } from "./scrubber";
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
/** Liveness of a recorded lock owner (only `dead` is ever reclaimed). */
|
|
2
2
|
export type OwnerLiveness = "alive" | "dead" | "unknown";
|
|
3
|
+
export type LocalLockRole = "oauth-account" | "sync-journal" | "sync-journal-store" | "tool-sync-recovery";
|
|
4
|
+
/** Contention, not proof of corrupt persisted work. Never authorizes reclaim. */
|
|
5
|
+
export declare class LocalLockBusyError extends Error {
|
|
6
|
+
readonly diagnostic: {
|
|
7
|
+
role: LocalLockRole;
|
|
8
|
+
lockId: string;
|
|
9
|
+
holderPid: number | null;
|
|
10
|
+
holderState: OwnerLiveness | "absent" | "unreadable";
|
|
11
|
+
heldMs: number | null;
|
|
12
|
+
waitMs: number;
|
|
13
|
+
};
|
|
14
|
+
readonly code = "LOCAL_LOCK_BUSY";
|
|
15
|
+
constructor(diagnostic: {
|
|
16
|
+
role: LocalLockRole;
|
|
17
|
+
lockId: string;
|
|
18
|
+
holderPid: number | null;
|
|
19
|
+
holderState: OwnerLiveness | "absent" | "unreadable";
|
|
20
|
+
heldMs: number | null;
|
|
21
|
+
waitMs: number;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
3
24
|
/** The `owner.json` record written once per acquisition. */
|
|
4
25
|
export interface LockOwner {
|
|
5
26
|
pid: number;
|
|
@@ -12,6 +33,7 @@ export interface LockOwner {
|
|
|
12
33
|
export interface OAuthAccountLockOptions {
|
|
13
34
|
/** The canonical lockdir path (keyed to the OAuth account). */
|
|
14
35
|
lockDir: string;
|
|
36
|
+
role?: LocalLockRole;
|
|
15
37
|
/** GC callers must retain their recovery index unless unlink/rmdir succeeds.
|
|
16
38
|
* Default callers keep the existing best-effort release behavior. */
|
|
17
39
|
requireRemovalOnRelease?: boolean;
|
|
@@ -66,6 +88,7 @@ export interface LockHandle {
|
|
|
66
88
|
/** The portable cross-process OAuth-account lock (§5 / AMEND-1). */
|
|
67
89
|
export declare class OAuthAccountLock {
|
|
68
90
|
private readonly lockDir;
|
|
91
|
+
private readonly role;
|
|
69
92
|
private readonly requireRemovalOnRelease;
|
|
70
93
|
private readonly ownerFile;
|
|
71
94
|
private readonly reclaimGuardDir;
|
|
@@ -90,6 +113,7 @@ export declare class OAuthAccountLock {
|
|
|
90
113
|
* ZERO side effects on the persisted bundle on any fail-closed path.
|
|
91
114
|
*/
|
|
92
115
|
acquire(): Promise<LockHandle>;
|
|
116
|
+
private contentionError;
|
|
93
117
|
/** Whether the EXISTING lockdir holder is reclaimable (dead), an ownerless strand
|
|
94
118
|
* (F6), or must be waited on. */
|
|
95
119
|
private classifyExistingHolder;
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export type { DurableSyncResult, DurableDesktopSyncWriterOptions, DesktopSyncSes
|
|
|
29
29
|
export { MAX_SYNC_SOURCE_ANCHOR_BYTES } from './appsync';
|
|
30
30
|
export type { DesktopSyncSourcePair } from './appsync';
|
|
31
31
|
export { readDesktopSyncFile } from './appsync';
|
|
32
|
+
export { DEFAULT_SYNC_SOURCE_RECOVERY_POLICY, planSyncSourceRecovery, resolveSyncSourceRecoveryPolicy } from './appsync';
|
|
33
|
+
export type { SyncSourceRecoveryPolicy, SyncSourceMessageObservation } from './appsync';
|
|
32
34
|
export type { DesktopSyncFileIdentity, DesktopSyncFileFrame, DesktopSyncFileAdmission } from './appsync';
|
|
33
35
|
export type { DesktopSyncSourceStream, DesktopSyncSourceFrame, DesktopSyncSourceCursor, DesktopSyncSourceJournal, DesktopSyncSourceInventory, DesktopSyncSourceAnchor, DesktopSyncSourcePosition, DesktopSyncSourceGap } from './appsync';
|
|
34
36
|
export { createToolActivitySyncTransport } from './tool-activity/sync-transport';
|
|
@@ -57,6 +59,7 @@ export * as AuditKeys from './audit-keys';
|
|
|
57
59
|
export * as Substrate from './substrate';
|
|
58
60
|
export { buildSeatbeltProfile, SandboxExecSubstrate } from './substrate';
|
|
59
61
|
export * as CredentialBroker from './credential-broker';
|
|
62
|
+
export { LocalLockBusyError } from './credential-broker/oauth-account-lock';
|
|
60
63
|
export * as SubstrateLaunch from './substrate-launch';
|
|
61
64
|
export * from './types';
|
|
62
65
|
export * as Planner from './planner';
|
|
@@ -75,7 +78,7 @@ export { emitShellEvent, createShellEventEmitter } from './orchestration-shell';
|
|
|
75
78
|
export { processMarkers, withRoleMarker } from './orchestration-shell';
|
|
76
79
|
export { ToolActivityOutbox, type ToolActivityOutboxOptions, type ListPendingResult, } from './tool-activity';
|
|
77
80
|
export { ToolActivityLedger, LedgerEntrySchema, LedgerFileSchema, LegacyOwnedFileSchema, type LedgerEntry, type LedgerFile, type LegacyOwnedFile, type OccurrenceRef, type ToolActivityLedgerOptions, } from './tool-activity';
|
|
78
|
-
export { ToolReplayCursor, captureToolReplayBoundary, ReplayFrameTooLargeError, ReplayCursorStateSchema, DEFAULT_REPLAY_READ_BYTES, DEFAULT_REPLAY_MAX_FRAME_BYTES, type ReplayCursorState, type ReplayFrame, type ReadFramesResult, type ToolReplayCursorOptions, type ToolReplayInitialBoundary, } from './tool-activity';
|
|
81
|
+
export { ToolReplayCursor, captureToolReplayBoundary, ReplayFrameTooLargeError, ReplayCursorStateSchema, DEFAULT_REPLAY_READ_BYTES, DEFAULT_REPLAY_MAX_FRAME_BYTES, type ReplayCursorState, type ReplayFrame, type ReadFramesResult, type ToolReplayCursorOptions, type ToolReplayInitialBoundary, type ToolReplayVerifiedBoundary, } from './tool-activity';
|
|
79
82
|
export { ToolActivitySessionMap, InProcessRolloutLock, SessionMapRecordSchema, type RolloutLock, type RolloutOwnership, type SessionMapRecord, type ToolActivitySessionMapOptions, } from './tool-activity';
|
|
80
83
|
export { ToolActivityConsolidator, isSessionKeyStaleError, isTerminalSessionError, type ObservedOccurrence, type ObserveDisposition, type ToolActivityTransport, type ToolActivityConsolidatorOptions, } from './tool-activity';
|
|
81
84
|
export { SocketRolloutLock, type SocketRolloutLockOptions, FlockRolloutLock, type FlockRolloutLockOptions, type FlockSyncFn, type FlockFlag, createRolloutLock, type CreateRolloutLockOptions, } from './tool-activity';
|