@squidcloud/backend 1.0.486 → 1.0.487

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.
@@ -39,8 +39,6 @@ export interface RestrictedSourceRunRequest {
39
39
  prompt: string;
40
40
  /** Points to the disposable prepared source tree. */
41
41
  analyzerRootDirectory: string;
42
- /** Aborts the analyzer when its lease or caller ends. */
43
- signal: AbortSignal;
44
42
  /** Requests a timeout no greater than the deployment ceiling. */
45
43
  timeoutMs: number;
46
44
  /** Publishes observable analyzer activity to the calling AI session. */
@@ -1,5 +1,5 @@
1
1
  /** Lists stable source-analysis error categories exposed to applications. */
2
- export declare const SOURCE_CODE_ERROR_CODES: readonly ["SOURCE_CONFIGURATION_INVALID", "SOURCE_AUTHENTICATION_FAILED", "SOURCE_REPOSITORY_UNAVAILABLE", "SOURCE_WORKSPACE_BUSY", "SOURCE_RESOURCE_LIMIT", "SOURCE_SANDBOX_UNAVAILABLE", "SOURCE_ANALYZER_TIMEOUT", "SOURCE_ANALYZER_FAILED", "SOURCE_LEASE_LOST", "SOURCE_EVIDENCE_UNVERIFIED"];
2
+ export declare const SOURCE_CODE_ERROR_CODES: readonly ["SOURCE_CONFIGURATION_INVALID", "SOURCE_AUTHENTICATION_FAILED", "SOURCE_REPOSITORY_UNAVAILABLE", "SOURCE_WORKSPACE_BUSY", "SOURCE_RESOURCE_LIMIT", "SOURCE_SANDBOX_UNAVAILABLE", "SOURCE_ANALYZER_TIMEOUT", "SOURCE_ANALYZER_FAILED", "SOURCE_EVIDENCE_UNVERIFIED"];
3
3
  /** Identifies a stable source-analysis error category. */
4
4
  export type SourceCodeErrorCode = (typeof SOURCE_CODE_ERROR_CODES)[number];
5
5
  /** Carries a safe source-analysis category without provider or repository details. */
@@ -20,12 +20,6 @@ export interface SourceCodeLimits {
20
20
  analyzerTimeoutMs: number;
21
21
  /** Bounds cached snapshot age during transient provider failures. */
22
22
  maxStaleAgeMs: number;
23
- /** Bounds waiting for exclusive workspace ownership. */
24
- leaseWaitMs: number;
25
- /** Configures the exclusive workspace lease lifetime. */
26
- leaseTtlMs: number;
27
- /** Configures the exclusive workspace lease heartbeat interval. */
28
- leaseHeartbeatMs: number;
29
23
  }
30
24
  /** Supplies the production source-code limits. */
31
25
  export declare const DEFAULT_SOURCE_CODE_LIMITS: Readonly<SourceCodeLimits>;
@@ -1,6 +1,6 @@
1
1
  import type { SourceCodeAnalyzerModel, SourceControlProvider } from '@squidcloud/client';
2
2
  /** Lists bounded source-analysis outcomes. */
3
- export type SourceCodeOutcome = 'success' | 'stale-success' | 'persistence-warning' | 'configuration' | 'authentication' | 'repository-unavailable' | 'workspace-busy' | 'resource-limit' | 'sandbox-unavailable' | 'analyzer-timeout' | 'analyzer-failed' | 'lease-lost' | 'evidence-unverified';
3
+ export type SourceCodeOutcome = 'success' | 'stale-success' | 'persistence-warning' | 'configuration' | 'authentication' | 'repository-unavailable' | 'workspace-busy' | 'resource-limit' | 'sandbox-unavailable' | 'analyzer-timeout' | 'analyzer-failed' | 'evidence-unverified';
4
4
  /** Contains source-analysis metrics without repository or question content. */
5
5
  export interface SourceCodeTelemetryEvent {
6
6
  /** Identifies the source-control provider. */
@@ -15,12 +15,8 @@ export interface SourceCodeTelemetryEvent {
15
15
  cacheState: 'first-clone' | 'reused' | 'mixed';
16
16
  /** Marks whether any analyzed snapshot was stale. */
17
17
  stale: boolean;
18
- /** Marks whether exclusive workspace ownership was lost. */
19
- leaseLost: boolean;
20
18
  /** Measures total analysis wall-clock duration. */
21
19
  analysisDurationMs: number;
22
- /** Measures time spent acquiring the workspace lease. */
23
- leaseWaitMs: number;
24
20
  /** Measures trusted workspace bytes after preparation. */
25
21
  workspaceBytes: number;
26
22
  /** Counts model input tokens when reported by the CLI. */
@@ -1,33 +1,18 @@
1
1
  import type { SourceCodeRef, SourceRepository } from '@squidcloud/client';
2
- import { WorkspaceAcquireLeaseOptions, WorkspaceMetadata } from '../workspace-client';
2
+ import { WorkspaceMetadata } from '../workspace-client';
3
3
  import { SourceCodeLimits } from './source-code-limits';
4
4
  import { SourceGitCommand } from './source-git-command';
5
5
  import { SourceGitCredentialHelper } from './source-git-credential-helper';
6
6
  import type { SourceProviderAdapter, SourceProviderFailureClassification, TrustedGitTlsProvider } from './source-provider-adapter';
7
7
  import type { SourceRepositorySnapshot } from './source-repository-snapshot';
8
- /** Represents the lease lifecycle consumed by source workspace orchestration. */
9
- export interface SourceWorkspaceLease {
10
- /** Aborts analysis immediately when exclusive ownership is lost. */
11
- readonly signal: AbortSignal;
12
- /** Throws when the local lease identity is no longer active. */
13
- assertActive(): void;
14
- /** Confirms exclusive ownership against Core. */
15
- assertActiveRemotely(): Promise<void>;
16
- /** Releases exclusive ownership. */
17
- release(): Promise<void>;
18
- }
19
8
  /** Represents the shared workspace operations consumed by source orchestration. */
20
9
  export interface SourceWorkspaceClient {
21
- /** Acquires exclusive ownership of one integration-wide cache. */
22
- acquireLease(workspaceId: string, options?: WorkspaceAcquireLeaseOptions): Promise<SourceWorkspaceLease>;
23
10
  /** Pulls the latest shared cache to this pod. */
24
11
  create(id: string, options?: {
25
12
  signal?: AbortSignal;
26
13
  }): Promise<WorkspaceMetadata>;
27
- /** Pushes the trusted cache while proving the active fencing identity. */
28
- push(id: string, options?: {
29
- lease?: SourceWorkspaceLease;
30
- }): Promise<WorkspaceMetadata>;
14
+ /** Publishes the refreshed trusted cache for the next run on any replica. */
15
+ push(id: string): Promise<WorkspaceMetadata>;
31
16
  /** Removes a pod-local copy that must not be reused. */
32
17
  discardLocal(id: string): Promise<void>;
33
18
  }
@@ -83,12 +68,8 @@ export interface PreparedSourceWorkspace {
83
68
  submodules: readonly PreparedSourceSubmodule[];
84
69
  /** Lists bounded preparation warnings. */
85
70
  warnings: readonly string[];
86
- /** Aborts the analyzer when exclusive ownership is lost. */
87
- leaseSignal: AbortSignal;
88
71
  /** Describes whether trusted caches were created or reused. */
89
72
  cacheState: 'first-clone' | 'reused' | 'mixed';
90
- /** Measures time spent acquiring exclusive ownership. */
91
- leaseWaitMs: number;
92
73
  /** Measures trusted cache bytes after preparation. */
93
74
  workspaceBytes: number;
94
75
  }
@@ -24,91 +24,24 @@ export interface WorkspaceCreateOptions {
24
24
  /** Cancels local synchronization before the caller loses ownership. */
25
25
  signal?: AbortSignal;
26
26
  }
27
- /** Options controlling bounded acquisition of an exclusive workspace lease. */
28
- export interface WorkspaceAcquireLeaseOptions {
29
- /** Lease lifetime measured from Core's current time. Defaults to 60 seconds. */
30
- leaseTtlSeconds?: number;
31
- /** Maximum time spent retrying a busy workspace. Defaults to five minutes. */
32
- acquisitionTimeoutMs?: number;
33
- }
34
- /** Options for publishing a workspace directory. */
35
- export interface WorkspacePushOptions {
36
- /** Exclusive lease used for a staged, fenced publish. Omit only for legacy callers. */
37
- lease?: WorkspaceLease;
38
- }
39
27
  /** Injectable Core RPC boundary used by direct SDK integration tests and non-global hosts. */
40
28
  export interface WorkspaceRpcTransport {
41
29
  /** Posts a workspace request to Core with an optional cancellation signal. */
42
30
  post<ResponseType>(path: string, request: unknown, abortSignal?: AbortSignal): Promise<ResponseType>;
43
31
  }
44
- /** Construction options for hosts that supply their own RPC boundary or lease identity. */
32
+ /** Construction options for hosts that supply their own RPC boundary or cache root. */
45
33
  export interface WorkspaceClientOptions {
46
34
  /** Overrides the default Squid RPC transport. */
47
35
  rpcTransport?: WorkspaceRpcTransport;
48
- /** Overrides the prefix used for the unique owner identity created by each acquisition. */
49
- leaseOwnerId?: string;
50
- /** Overrides the default 20-second automatic heartbeat interval. */
51
- leaseHeartbeatIntervalMs?: number;
52
36
  /** Overrides this process's pod-local workspace cache root. */
53
37
  localCacheRoot?: string;
54
38
  }
55
- /** Public lease identity returned by Core and maintained by {@link WorkspaceLease}. */
56
- export interface WorkspaceLeaseIdentity {
57
- /** Identifies the leased workspace. */
58
- workspaceId: string;
59
- /** Identifies the unique lease owner. */
60
- ownerId: string;
61
- /** Fences writes from superseded owners. */
62
- fencingToken: number;
63
- /** Stores the newest expiry accepted from Core. */
64
- expiresAt: string;
65
- }
66
39
  /**
67
40
  * Returns whether the shared workspace server is configured on this pod. Callers that want to degrade
68
41
  * gracefully (treat a shared workspace as best-effort/ephemeral rather than fail) should check this
69
42
  * before calling `WorkspaceClient` methods, which throw when it is not configured.
70
43
  */
71
44
  export declare function isWorkspaceServerConfigured(): boolean;
72
- /**
73
- * Holds exclusive workspace ownership and maintains it with periodic heartbeats until released or lost.
74
- */
75
- export declare class WorkspaceLease {
76
- private readonly leaseTtlSeconds;
77
- private readonly heartbeatIntervalMs;
78
- private readonly rpcTransport;
79
- readonly signal: AbortSignal;
80
- readonly workspaceId: string;
81
- readonly ownerId: string;
82
- readonly fencingToken: number;
83
- private readonly abortController;
84
- private expiryTimer?;
85
- private heartbeatPromise?;
86
- private heartbeatTimer?;
87
- private expiresAtValue;
88
- private state;
89
- /** Creates and starts maintaining a lease returned by Core. */
90
- constructor(identity: WorkspaceLeaseIdentity, leaseTtlSeconds: number, heartbeatIntervalMs: number, rpcTransport: WorkspaceRpcTransport);
91
- /** Returns the newest lease expiry accepted from Core. */
92
- get expiresAt(): string;
93
- /** Renews the lease once, coalescing concurrent callers onto one RPC. */
94
- heartbeat(): Promise<void>;
95
- /** Releases this owner/token without affecting any successor lease. */
96
- release(): Promise<void>;
97
- /** Throws synchronously when the local lease identity is unusable. */
98
- assertActive(): void;
99
- /** Confirms the lease against Core and refreshes its local expiry monotonically. */
100
- assertActiveRemotely(): Promise<void>;
101
- private startHeartbeat;
102
- private scheduleExpiry;
103
- private stopExpiryTimer;
104
- private stopHeartbeat;
105
- private performHeartbeat;
106
- private postWhileActive;
107
- private applyIdentity;
108
- private assertMatchingIdentity;
109
- private markInactive;
110
- private leaseLostError;
111
- }
112
45
  /**
113
46
  * Experimental, backend-only API for a scratch directory ("workspace") that survives across `ask()` calls
114
47
  * and pod replicas. The directory lives on this pod's local disk for fast reads/writes; `create` and
@@ -131,13 +64,9 @@ export declare class WorkspaceClient {
131
64
  */
132
65
  private podKeypairReady?;
133
66
  private readonly rpcTransport;
134
- private readonly leaseOwnerIdPrefix;
135
- private readonly leaseHeartbeatIntervalMs;
136
67
  private readonly localCacheRoot;
137
68
  /** Creates a workspace client using Squid's RPC transport by default. */
138
69
  constructor(options?: WorkspaceClientOptions);
139
- /** Acquires exclusive ownership, retrying a busy workspace within the requested bound. */
140
- acquireLease(workspaceId: string, options?: WorkspaceAcquireLeaseOptions): Promise<WorkspaceLease>;
141
70
  /**
142
71
  * Ensures the workspace directory exists on this pod and reflects the latest push, generating a
143
72
  * new workspace id when none is given. Safe to call repeatedly: pulls from the workspace server only
@@ -145,7 +74,7 @@ export declare class WorkspaceClient {
145
74
  */
146
75
  create(id?: string, options?: WorkspaceCreateOptions): Promise<WorkspaceMetadata>;
147
76
  /** Syncs the current state of the workspace directory to the workspace server as the new authoritative state. */
148
- push(id: string, options?: WorkspacePushOptions): Promise<WorkspaceMetadata>;
77
+ push(id: string): Promise<WorkspaceMetadata>;
149
78
  /** Removes only this client's pod-local copy without changing the shared workspace. */
150
79
  discardLocal(id: string): Promise<void>;
151
80
  /**
@@ -156,8 +85,6 @@ export declare class WorkspaceClient {
156
85
  */
157
86
  delete(id: string): Promise<void>;
158
87
  private buildMetadata;
159
- private buildCommitPushRequest;
160
- private assertLeaseForWorkspace;
161
88
  private resolveLocalWorkspaceDir;
162
89
  private resolveLocalWorkspaceMarkerPath;
163
90
  private resolveLocalWorkspaceQuarantineDir;
@@ -196,8 +123,6 @@ export declare class WorkspaceClient {
196
123
  private isMissingRemoteError;
197
124
  private isWorkspaceBusyError;
198
125
  private isTimeoutError;
199
- private createLeaseOwnerId;
200
- private resolveLeaseHeartbeatIntervalMs;
201
126
  private sshHost;
202
127
  private sshPort;
203
128
  private sshUser;