@spotpatch/dev-server 0.8.0 → 0.9.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/dist/index.cjs +1876 -458
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +107 -3
- package/dist/index.d.ts +107 -3
- package/dist/index.js +1535 -101
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { applyPreparedAgentChange, executeAgentChange, inspectAgentWorkspace, probeProviderCapability, resolveProviderCredential, revertPreparedAgentChange } from '@spotpatch/agent';
|
|
2
|
-
import { AgentJobEvent, AgentJobSnapshot, AgentJobCreateRequest, AgentCapabilityRequest, AgentCapabilitySnapshot, AgentJobResultResponse, AgentWorkspaceHealthSnapshot, ResolvedAiOptions, ExternalHandoffFramework, ExternalHandoffCapability, ExternalHandoffPublishRequest, SpotAnnotation, ExternalHandoffPublishResult, ExternalHandoffStatusResult, ExternalAgentControlStatus, ExternalAgentControlConnectRequest, ExternalAgentControlDisconnectRequest, ExternalAgentControlCancelRequest, ExternalAgentManagedResult, SpotPatchEditorPreference, ContextBudget, SpotPatchLocalePreference, DataFlowLimits, AiProviderProtocol, AiProviderAuthentication, AiExecutionOptions, AiOptions, RuntimeAiConfig, RuntimeDataFlowConfig, ResolvedAgentCheckDefinition, AgentLimits, SpotPatchRuntimeConfig } from '@spotpatch/shared';
|
|
1
|
+
import { applyPreparedAgentChange, executeAgentChange, inspectAgentWorkspace, probeProviderCapability, resolveProviderCredential, revertPreparedAgentChange, AskSourceGrant, ContextualAskReadSnapshot, AskSourceGrantEntry, ContextualAskExecutor } from '@spotpatch/agent';
|
|
2
|
+
import { AgentJobEvent, AgentJobSnapshot, AgentJobCreateRequest, AgentCapabilityRequest, AgentCapabilitySnapshot, AgentJobResultResponse, AgentWorkspaceHealthSnapshot, ResolvedAiOptions, ExternalHandoffFramework, ExternalHandoffCapability, ExternalHandoffPublishRequest, SpotAnnotation, ExternalHandoffPublishResult, ExternalHandoffStatusResult, ExternalAgentControlStatus, ExternalAgentControlConnectRequest, ExternalAgentControlDisconnectRequest, ExternalAgentControlCancelRequest, ExternalAgentManagedResult, SpotPatchEditorPreference, ContextBudget, SpotPatchLocalePreference, DataFlowLimits, ContextualAskExecutorPreference, AiProviderProtocol, AiProviderAuthentication, AiExecutionOptions, AiOptions, ContextualAskOptions, RuntimeAiConfig, RuntimeDataFlowConfig, ResolvedAgentCheckDefinition, AgentLimits, SpotSelectionContext, AskJobEvent, AskJobSnapshot, ContextualAskCapability, AskJobCreateRequest, AskJobResultResponse, ContextualAskErrorCode, SpotPatchRuntimeConfig } from '@spotpatch/shared';
|
|
3
3
|
import { SourceFilterEntry } from '@spotpatch/compiler';
|
|
4
4
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
5
5
|
|
|
6
|
+
type WorkspaceActivityKind = "ask" | "change";
|
|
7
|
+
interface WorkspaceActivityLease {
|
|
8
|
+
release(): void;
|
|
9
|
+
}
|
|
10
|
+
interface WorkspaceActivityCoordinator {
|
|
11
|
+
acquire(kind: WorkspaceActivityKind): WorkspaceActivityLease | undefined;
|
|
12
|
+
current(): WorkspaceActivityKind | undefined;
|
|
13
|
+
}
|
|
14
|
+
declare function createWorkspaceActivityCoordinator(): WorkspaceActivityCoordinator;
|
|
15
|
+
|
|
6
16
|
type AgentJobEventListener = (event: AgentJobEvent) => void;
|
|
7
17
|
interface AgentJobManager {
|
|
8
18
|
apply(jobId: string): Promise<AgentJobSnapshot>;
|
|
@@ -32,6 +42,7 @@ interface CreateAgentJobManagerOptions {
|
|
|
32
42
|
readonly environment?: Readonly<Record<string, string | undefined>>;
|
|
33
43
|
readonly fetch?: typeof globalThis.fetch;
|
|
34
44
|
readonly root: string;
|
|
45
|
+
readonly coordinator?: WorkspaceActivityCoordinator;
|
|
35
46
|
}
|
|
36
47
|
declare function createAgentJobManager(options: CreateAgentJobManagerOptions): AgentJobManager;
|
|
37
48
|
|
|
@@ -93,6 +104,11 @@ interface SpotPatchOptions {
|
|
|
93
104
|
readonly ai?: SpotPatchAiOptions;
|
|
94
105
|
readonly dataFlow?: false | SpotPatchDataFlowOptions;
|
|
95
106
|
readonly externalAgent?: boolean;
|
|
107
|
+
readonly contextualAsk?: ContextualAskOptions;
|
|
108
|
+
}
|
|
109
|
+
interface ResolvedContextualAskOptions {
|
|
110
|
+
readonly enabled: boolean;
|
|
111
|
+
readonly defaultExecutor?: ContextualAskExecutorPreference;
|
|
96
112
|
}
|
|
97
113
|
interface ResolvedSpotPatchOptions {
|
|
98
114
|
readonly enabled: boolean;
|
|
@@ -111,6 +127,7 @@ interface ResolvedSpotPatchOptions {
|
|
|
111
127
|
readonly externalAgent: Readonly<{
|
|
112
128
|
enabled: boolean;
|
|
113
129
|
}>;
|
|
130
|
+
readonly contextualAsk: ResolvedContextualAskOptions;
|
|
114
131
|
}
|
|
115
132
|
interface ResolvedSpotPatchDataFlowOptions {
|
|
116
133
|
readonly enabled: boolean;
|
|
@@ -161,6 +178,9 @@ declare const DEFAULT_OPTIONS: Readonly<{
|
|
|
161
178
|
externalAgent: Readonly<{
|
|
162
179
|
enabled: false;
|
|
163
180
|
}>;
|
|
181
|
+
contextualAsk: Readonly<{
|
|
182
|
+
enabled: false;
|
|
183
|
+
}>;
|
|
164
184
|
}>;
|
|
165
185
|
declare function createRuntimeAiConfig(options: false | ResolvedAiOptions): RuntimeAiConfig;
|
|
166
186
|
declare function createRuntimeDataFlowConfig(options: ResolvedSpotPatchDataFlowOptions): RuntimeDataFlowConfig;
|
|
@@ -219,6 +239,7 @@ interface SourceRegistry {
|
|
|
219
239
|
register(absolutePath: string): string;
|
|
220
240
|
registerDataFlowComponents(absolutePath: string, sourceVersion: string, components: readonly DataFlowComponentAnchorInput[]): string;
|
|
221
241
|
resolve(fileId: string): string | undefined;
|
|
242
|
+
findRegisteredId(absolutePath: string): string | undefined;
|
|
222
243
|
resolveDataFlowComponent(componentSourceId: string): DataFlowComponentAnchor | undefined;
|
|
223
244
|
clear(): void;
|
|
224
245
|
}
|
|
@@ -236,6 +257,75 @@ interface SourceRegistryOptions {
|
|
|
236
257
|
}
|
|
237
258
|
declare function createSourceRegistry(options?: SourceRegistryOptions): SourceRegistry;
|
|
238
259
|
|
|
260
|
+
interface CapturedAskReadSnapshot {
|
|
261
|
+
readonly grant: AskSourceGrant;
|
|
262
|
+
readonly snapshot: ContextualAskReadSnapshot;
|
|
263
|
+
dispose(): void;
|
|
264
|
+
isStale(): Promise<boolean>;
|
|
265
|
+
projectCitation(handleId: string, startLine: number, endLine: number): AskSourceGrantEntry & Readonly<{
|
|
266
|
+
startLine: number;
|
|
267
|
+
endLine: number;
|
|
268
|
+
}>;
|
|
269
|
+
}
|
|
270
|
+
interface CaptureAskReadSnapshotOptions {
|
|
271
|
+
readonly root: string;
|
|
272
|
+
readonly registry: SourceRegistry;
|
|
273
|
+
readonly selection: SpotSelectionContext;
|
|
274
|
+
readonly signal?: AbortSignal;
|
|
275
|
+
readonly createHandleId?: () => string;
|
|
276
|
+
}
|
|
277
|
+
declare function captureAskReadSnapshot(options: CaptureAskReadSnapshotOptions): Promise<CapturedAskReadSnapshot>;
|
|
278
|
+
|
|
279
|
+
type ContextualAskJobEventListener = (event: AskJobEvent) => void;
|
|
280
|
+
interface ContextualAskManager {
|
|
281
|
+
cancel(jobId: string): AskJobSnapshot;
|
|
282
|
+
capability(signal: AbortSignal): Promise<ContextualAskCapability>;
|
|
283
|
+
close(): Promise<void>;
|
|
284
|
+
create(request: AskJobCreateRequest): Promise<AskJobSnapshot>;
|
|
285
|
+
events(jobId: string, afterSequence?: number): readonly AskJobEvent[];
|
|
286
|
+
result(jobId: string): Promise<AskJobResultResponse>;
|
|
287
|
+
snapshot(jobId: string): AskJobSnapshot;
|
|
288
|
+
subscribe(jobId: string, listener: ContextualAskJobEventListener): () => void;
|
|
289
|
+
}
|
|
290
|
+
interface ContextualAskManagerDependencies {
|
|
291
|
+
readonly captureSnapshot: typeof captureAskReadSnapshot;
|
|
292
|
+
readonly createId: () => string;
|
|
293
|
+
readonly now: () => Date;
|
|
294
|
+
}
|
|
295
|
+
interface CreateContextualAskManagerOptions {
|
|
296
|
+
readonly coordinator: WorkspaceActivityCoordinator;
|
|
297
|
+
readonly enabled: boolean;
|
|
298
|
+
readonly executors?: readonly ContextualAskExecutor[];
|
|
299
|
+
readonly registry: SourceRegistry;
|
|
300
|
+
readonly root: string;
|
|
301
|
+
readonly dependencies?: Partial<ContextualAskManagerDependencies>;
|
|
302
|
+
}
|
|
303
|
+
declare function createContextualAskManager(options: CreateContextualAskManagerOptions): ContextualAskManager;
|
|
304
|
+
|
|
305
|
+
declare class ContextualAskError extends Error {
|
|
306
|
+
readonly code: ContextualAskErrorCode;
|
|
307
|
+
constructor(code: ContextualAskErrorCode, options?: Readonly<{
|
|
308
|
+
cause?: unknown;
|
|
309
|
+
}>);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
interface CreateConfiguredKeyAskExecutorsOptions {
|
|
313
|
+
readonly ai: ResolvedAiOptions;
|
|
314
|
+
readonly environment: Readonly<Record<string, string | undefined>>;
|
|
315
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
316
|
+
readonly defaultExecutor?: ContextualAskExecutorPreference;
|
|
317
|
+
}
|
|
318
|
+
/** Builds one isolated read-only Ask executor per configured Provider/model pair. */
|
|
319
|
+
declare function createConfiguredKeyAskExecutors(options: CreateConfiguredKeyAskExecutorsOptions): readonly ContextualAskExecutor[];
|
|
320
|
+
|
|
321
|
+
interface ComposeContextualAskExecutorsOptions {
|
|
322
|
+
readonly configuredKey: readonly ContextualAskExecutor[];
|
|
323
|
+
readonly managedCodex: ContextualAskExecutor;
|
|
324
|
+
readonly defaultExecutor?: ContextualAskExecutorPreference;
|
|
325
|
+
}
|
|
326
|
+
/** Orders independent executor implementations without coupling dev-server to Codex. */
|
|
327
|
+
declare function composeContextualAskExecutors(options: ComposeContextualAskExecutorsOptions): readonly ContextualAskExecutor[];
|
|
328
|
+
|
|
239
329
|
interface SpotPatchSession {
|
|
240
330
|
readonly id: string;
|
|
241
331
|
readonly token: string;
|
|
@@ -265,6 +355,7 @@ interface SpotPatchServerLogger {
|
|
|
265
355
|
}
|
|
266
356
|
interface CreateMiddlewareOptions {
|
|
267
357
|
readonly agentManager?: AgentJobManager;
|
|
358
|
+
readonly contextualAskManager?: ContextualAskManager;
|
|
268
359
|
readonly bootstrap?: RuntimeBootstrapOptions;
|
|
269
360
|
readonly editorLauncher?: EditorLauncher;
|
|
270
361
|
readonly externalAgentControl?: ExternalAgentControlPort;
|
|
@@ -281,6 +372,18 @@ declare function readJsonRequestBody(request: IncomingMessage, maximumBytes?: nu
|
|
|
281
372
|
|
|
282
373
|
declare function isLoopbackHostname(hostname: string): boolean;
|
|
283
374
|
|
|
375
|
+
type ContextualAskRoute = Readonly<{
|
|
376
|
+
kind: "capability";
|
|
377
|
+
}> | Readonly<{
|
|
378
|
+
kind: "create";
|
|
379
|
+
}> | Readonly<{
|
|
380
|
+
kind: "job";
|
|
381
|
+
action: "events" | "result" | "cancel";
|
|
382
|
+
jobId: string;
|
|
383
|
+
}>;
|
|
384
|
+
declare function matchContextualAskPath(pathname: string): ContextualAskRoute | undefined;
|
|
385
|
+
declare function handleContextualAskRequest(request: IncomingMessage, response: ServerResponse, route: ContextualAskRoute, manager: ContextualAskManager | undefined, logger?: SpotPatchServerLogger): Promise<void>;
|
|
386
|
+
|
|
284
387
|
interface SourceRegistrationServiceOptions {
|
|
285
388
|
readonly internalSecret: string;
|
|
286
389
|
readonly options: ResolvedSpotPatchOptions;
|
|
@@ -311,6 +414,7 @@ interface SerializedSpotPatchOptions {
|
|
|
311
414
|
readonly budget: Readonly<ContextBudget>;
|
|
312
415
|
readonly debug: boolean;
|
|
313
416
|
readonly dataFlow: false | SpotPatchDataFlowOptions;
|
|
417
|
+
readonly contextualAsk: ContextualAskOptions;
|
|
314
418
|
readonly editor: SpotPatchEditorPreference;
|
|
315
419
|
readonly enabled: boolean;
|
|
316
420
|
readonly externalAgent: boolean;
|
|
@@ -324,4 +428,4 @@ interface SerializedSpotPatchOptions {
|
|
|
324
428
|
declare function serializeResolvedSpotPatchOptions(options: ResolvedSpotPatchOptions): SerializedSpotPatchOptions;
|
|
325
429
|
declare function parseSerializedSpotPatchOptions(value: unknown): ResolvedSpotPatchOptions;
|
|
326
430
|
|
|
327
|
-
export { type AgentJobEventListener, type AgentJobManager, type CreateAgentJobManagerOptions, type CreateExternalHandoffServiceOptions, type CreateMiddlewareOptions, DEFAULT_EXCLUDE, DEFAULT_OPTIONS, type DiscoverProjectValidationCheckOptions, type EnvironmentAiConfiguration, type ExternalAgentControlPort, type ExternalHandoffService, type FilterEntry, type IntegrationFileChange, type IntegrationPlan, type ResolveManagedExecutionValidationOptions, type ResolveProjectOptionsInput, type ResolveProjectValidationChecksOptions, type ResolvedManagedExecutionValidation, type ResolvedRuntimeBootstrapOptions, type ResolvedSpotPatchDataFlowOptions, type ResolvedSpotPatchOptions, type RuntimeBootstrapOptions, type SerializedFilterEntry, type SerializedSpotPatchOptions, type SimpleAiOptions, type SourceRegistrationHandler, type SourceRegistrationService, type SourceRegistrationServiceOptions, type SourceRegistry, type SpotPatchAiOptions, type SpotPatchDataFlowOptions, type SpotPatchMiddleware, type SpotPatchNext, type SpotPatchOptions, type SpotPatchServerLogger, type SpotPatchSession, applyIntegrationPlan, createAgentJobManager, createExternalHandoffService, createIntegrationFileChange, createRuntimeAiConfig, createRuntimeDataFlowConfig, createSession, createSourceRegistrationService, createSourceRegistry, createSpotPatchMiddleware, discoverProjectValidationCheck, integrationPathExists, isLoopbackHostname, parseSerializedSpotPatchOptions, readIntegrationFile, readJsonRequestBody, readRuntimeBootstrap, resolveCredentialEnvironment, resolveEnvironmentAiConfiguration, resolveManagedExecutionValidation, resolveOptions, resolveProjectOptions, resolveProjectValidationChecks, resolveRuntimeBootstrapOptions, serializeResolvedSpotPatchOptions };
|
|
431
|
+
export { type AgentJobEventListener, type AgentJobManager, type CaptureAskReadSnapshotOptions, type CapturedAskReadSnapshot, type ComposeContextualAskExecutorsOptions, ContextualAskError, type ContextualAskJobEventListener, type ContextualAskManager, type ContextualAskRoute, type CreateAgentJobManagerOptions, type CreateConfiguredKeyAskExecutorsOptions, type CreateContextualAskManagerOptions, type CreateExternalHandoffServiceOptions, type CreateMiddlewareOptions, DEFAULT_EXCLUDE, DEFAULT_OPTIONS, type DiscoverProjectValidationCheckOptions, type EnvironmentAiConfiguration, type ExternalAgentControlPort, type ExternalHandoffService, type FilterEntry, type IntegrationFileChange, type IntegrationPlan, type ResolveManagedExecutionValidationOptions, type ResolveProjectOptionsInput, type ResolveProjectValidationChecksOptions, type ResolvedContextualAskOptions, type ResolvedManagedExecutionValidation, type ResolvedRuntimeBootstrapOptions, type ResolvedSpotPatchDataFlowOptions, type ResolvedSpotPatchOptions, type RuntimeBootstrapOptions, type SerializedFilterEntry, type SerializedSpotPatchOptions, type SimpleAiOptions, type SourceRegistrationHandler, type SourceRegistrationService, type SourceRegistrationServiceOptions, type SourceRegistry, type SpotPatchAiOptions, type SpotPatchDataFlowOptions, type SpotPatchMiddleware, type SpotPatchNext, type SpotPatchOptions, type SpotPatchServerLogger, type SpotPatchSession, type WorkspaceActivityCoordinator, type WorkspaceActivityKind, type WorkspaceActivityLease, applyIntegrationPlan, captureAskReadSnapshot, composeContextualAskExecutors, createAgentJobManager, createConfiguredKeyAskExecutors, createContextualAskManager, createExternalHandoffService, createIntegrationFileChange, createRuntimeAiConfig, createRuntimeDataFlowConfig, createSession, createSourceRegistrationService, createSourceRegistry, createSpotPatchMiddleware, createWorkspaceActivityCoordinator, discoverProjectValidationCheck, handleContextualAskRequest, integrationPathExists, isLoopbackHostname, matchContextualAskPath, parseSerializedSpotPatchOptions, readIntegrationFile, readJsonRequestBody, readRuntimeBootstrap, resolveCredentialEnvironment, resolveEnvironmentAiConfiguration, resolveManagedExecutionValidation, resolveOptions, resolveProjectOptions, resolveProjectValidationChecks, resolveRuntimeBootstrapOptions, serializeResolvedSpotPatchOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { applyPreparedAgentChange, executeAgentChange, inspectAgentWorkspace, probeProviderCapability, resolveProviderCredential, revertPreparedAgentChange } from '@spotpatch/agent';
|
|
2
|
-
import { AgentJobEvent, AgentJobSnapshot, AgentJobCreateRequest, AgentCapabilityRequest, AgentCapabilitySnapshot, AgentJobResultResponse, AgentWorkspaceHealthSnapshot, ResolvedAiOptions, ExternalHandoffFramework, ExternalHandoffCapability, ExternalHandoffPublishRequest, SpotAnnotation, ExternalHandoffPublishResult, ExternalHandoffStatusResult, ExternalAgentControlStatus, ExternalAgentControlConnectRequest, ExternalAgentControlDisconnectRequest, ExternalAgentControlCancelRequest, ExternalAgentManagedResult, SpotPatchEditorPreference, ContextBudget, SpotPatchLocalePreference, DataFlowLimits, AiProviderProtocol, AiProviderAuthentication, AiExecutionOptions, AiOptions, RuntimeAiConfig, RuntimeDataFlowConfig, ResolvedAgentCheckDefinition, AgentLimits, SpotPatchRuntimeConfig } from '@spotpatch/shared';
|
|
1
|
+
import { applyPreparedAgentChange, executeAgentChange, inspectAgentWorkspace, probeProviderCapability, resolveProviderCredential, revertPreparedAgentChange, AskSourceGrant, ContextualAskReadSnapshot, AskSourceGrantEntry, ContextualAskExecutor } from '@spotpatch/agent';
|
|
2
|
+
import { AgentJobEvent, AgentJobSnapshot, AgentJobCreateRequest, AgentCapabilityRequest, AgentCapabilitySnapshot, AgentJobResultResponse, AgentWorkspaceHealthSnapshot, ResolvedAiOptions, ExternalHandoffFramework, ExternalHandoffCapability, ExternalHandoffPublishRequest, SpotAnnotation, ExternalHandoffPublishResult, ExternalHandoffStatusResult, ExternalAgentControlStatus, ExternalAgentControlConnectRequest, ExternalAgentControlDisconnectRequest, ExternalAgentControlCancelRequest, ExternalAgentManagedResult, SpotPatchEditorPreference, ContextBudget, SpotPatchLocalePreference, DataFlowLimits, ContextualAskExecutorPreference, AiProviderProtocol, AiProviderAuthentication, AiExecutionOptions, AiOptions, ContextualAskOptions, RuntimeAiConfig, RuntimeDataFlowConfig, ResolvedAgentCheckDefinition, AgentLimits, SpotSelectionContext, AskJobEvent, AskJobSnapshot, ContextualAskCapability, AskJobCreateRequest, AskJobResultResponse, ContextualAskErrorCode, SpotPatchRuntimeConfig } from '@spotpatch/shared';
|
|
3
3
|
import { SourceFilterEntry } from '@spotpatch/compiler';
|
|
4
4
|
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
5
5
|
|
|
6
|
+
type WorkspaceActivityKind = "ask" | "change";
|
|
7
|
+
interface WorkspaceActivityLease {
|
|
8
|
+
release(): void;
|
|
9
|
+
}
|
|
10
|
+
interface WorkspaceActivityCoordinator {
|
|
11
|
+
acquire(kind: WorkspaceActivityKind): WorkspaceActivityLease | undefined;
|
|
12
|
+
current(): WorkspaceActivityKind | undefined;
|
|
13
|
+
}
|
|
14
|
+
declare function createWorkspaceActivityCoordinator(): WorkspaceActivityCoordinator;
|
|
15
|
+
|
|
6
16
|
type AgentJobEventListener = (event: AgentJobEvent) => void;
|
|
7
17
|
interface AgentJobManager {
|
|
8
18
|
apply(jobId: string): Promise<AgentJobSnapshot>;
|
|
@@ -32,6 +42,7 @@ interface CreateAgentJobManagerOptions {
|
|
|
32
42
|
readonly environment?: Readonly<Record<string, string | undefined>>;
|
|
33
43
|
readonly fetch?: typeof globalThis.fetch;
|
|
34
44
|
readonly root: string;
|
|
45
|
+
readonly coordinator?: WorkspaceActivityCoordinator;
|
|
35
46
|
}
|
|
36
47
|
declare function createAgentJobManager(options: CreateAgentJobManagerOptions): AgentJobManager;
|
|
37
48
|
|
|
@@ -93,6 +104,11 @@ interface SpotPatchOptions {
|
|
|
93
104
|
readonly ai?: SpotPatchAiOptions;
|
|
94
105
|
readonly dataFlow?: false | SpotPatchDataFlowOptions;
|
|
95
106
|
readonly externalAgent?: boolean;
|
|
107
|
+
readonly contextualAsk?: ContextualAskOptions;
|
|
108
|
+
}
|
|
109
|
+
interface ResolvedContextualAskOptions {
|
|
110
|
+
readonly enabled: boolean;
|
|
111
|
+
readonly defaultExecutor?: ContextualAskExecutorPreference;
|
|
96
112
|
}
|
|
97
113
|
interface ResolvedSpotPatchOptions {
|
|
98
114
|
readonly enabled: boolean;
|
|
@@ -111,6 +127,7 @@ interface ResolvedSpotPatchOptions {
|
|
|
111
127
|
readonly externalAgent: Readonly<{
|
|
112
128
|
enabled: boolean;
|
|
113
129
|
}>;
|
|
130
|
+
readonly contextualAsk: ResolvedContextualAskOptions;
|
|
114
131
|
}
|
|
115
132
|
interface ResolvedSpotPatchDataFlowOptions {
|
|
116
133
|
readonly enabled: boolean;
|
|
@@ -161,6 +178,9 @@ declare const DEFAULT_OPTIONS: Readonly<{
|
|
|
161
178
|
externalAgent: Readonly<{
|
|
162
179
|
enabled: false;
|
|
163
180
|
}>;
|
|
181
|
+
contextualAsk: Readonly<{
|
|
182
|
+
enabled: false;
|
|
183
|
+
}>;
|
|
164
184
|
}>;
|
|
165
185
|
declare function createRuntimeAiConfig(options: false | ResolvedAiOptions): RuntimeAiConfig;
|
|
166
186
|
declare function createRuntimeDataFlowConfig(options: ResolvedSpotPatchDataFlowOptions): RuntimeDataFlowConfig;
|
|
@@ -219,6 +239,7 @@ interface SourceRegistry {
|
|
|
219
239
|
register(absolutePath: string): string;
|
|
220
240
|
registerDataFlowComponents(absolutePath: string, sourceVersion: string, components: readonly DataFlowComponentAnchorInput[]): string;
|
|
221
241
|
resolve(fileId: string): string | undefined;
|
|
242
|
+
findRegisteredId(absolutePath: string): string | undefined;
|
|
222
243
|
resolveDataFlowComponent(componentSourceId: string): DataFlowComponentAnchor | undefined;
|
|
223
244
|
clear(): void;
|
|
224
245
|
}
|
|
@@ -236,6 +257,75 @@ interface SourceRegistryOptions {
|
|
|
236
257
|
}
|
|
237
258
|
declare function createSourceRegistry(options?: SourceRegistryOptions): SourceRegistry;
|
|
238
259
|
|
|
260
|
+
interface CapturedAskReadSnapshot {
|
|
261
|
+
readonly grant: AskSourceGrant;
|
|
262
|
+
readonly snapshot: ContextualAskReadSnapshot;
|
|
263
|
+
dispose(): void;
|
|
264
|
+
isStale(): Promise<boolean>;
|
|
265
|
+
projectCitation(handleId: string, startLine: number, endLine: number): AskSourceGrantEntry & Readonly<{
|
|
266
|
+
startLine: number;
|
|
267
|
+
endLine: number;
|
|
268
|
+
}>;
|
|
269
|
+
}
|
|
270
|
+
interface CaptureAskReadSnapshotOptions {
|
|
271
|
+
readonly root: string;
|
|
272
|
+
readonly registry: SourceRegistry;
|
|
273
|
+
readonly selection: SpotSelectionContext;
|
|
274
|
+
readonly signal?: AbortSignal;
|
|
275
|
+
readonly createHandleId?: () => string;
|
|
276
|
+
}
|
|
277
|
+
declare function captureAskReadSnapshot(options: CaptureAskReadSnapshotOptions): Promise<CapturedAskReadSnapshot>;
|
|
278
|
+
|
|
279
|
+
type ContextualAskJobEventListener = (event: AskJobEvent) => void;
|
|
280
|
+
interface ContextualAskManager {
|
|
281
|
+
cancel(jobId: string): AskJobSnapshot;
|
|
282
|
+
capability(signal: AbortSignal): Promise<ContextualAskCapability>;
|
|
283
|
+
close(): Promise<void>;
|
|
284
|
+
create(request: AskJobCreateRequest): Promise<AskJobSnapshot>;
|
|
285
|
+
events(jobId: string, afterSequence?: number): readonly AskJobEvent[];
|
|
286
|
+
result(jobId: string): Promise<AskJobResultResponse>;
|
|
287
|
+
snapshot(jobId: string): AskJobSnapshot;
|
|
288
|
+
subscribe(jobId: string, listener: ContextualAskJobEventListener): () => void;
|
|
289
|
+
}
|
|
290
|
+
interface ContextualAskManagerDependencies {
|
|
291
|
+
readonly captureSnapshot: typeof captureAskReadSnapshot;
|
|
292
|
+
readonly createId: () => string;
|
|
293
|
+
readonly now: () => Date;
|
|
294
|
+
}
|
|
295
|
+
interface CreateContextualAskManagerOptions {
|
|
296
|
+
readonly coordinator: WorkspaceActivityCoordinator;
|
|
297
|
+
readonly enabled: boolean;
|
|
298
|
+
readonly executors?: readonly ContextualAskExecutor[];
|
|
299
|
+
readonly registry: SourceRegistry;
|
|
300
|
+
readonly root: string;
|
|
301
|
+
readonly dependencies?: Partial<ContextualAskManagerDependencies>;
|
|
302
|
+
}
|
|
303
|
+
declare function createContextualAskManager(options: CreateContextualAskManagerOptions): ContextualAskManager;
|
|
304
|
+
|
|
305
|
+
declare class ContextualAskError extends Error {
|
|
306
|
+
readonly code: ContextualAskErrorCode;
|
|
307
|
+
constructor(code: ContextualAskErrorCode, options?: Readonly<{
|
|
308
|
+
cause?: unknown;
|
|
309
|
+
}>);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
interface CreateConfiguredKeyAskExecutorsOptions {
|
|
313
|
+
readonly ai: ResolvedAiOptions;
|
|
314
|
+
readonly environment: Readonly<Record<string, string | undefined>>;
|
|
315
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
316
|
+
readonly defaultExecutor?: ContextualAskExecutorPreference;
|
|
317
|
+
}
|
|
318
|
+
/** Builds one isolated read-only Ask executor per configured Provider/model pair. */
|
|
319
|
+
declare function createConfiguredKeyAskExecutors(options: CreateConfiguredKeyAskExecutorsOptions): readonly ContextualAskExecutor[];
|
|
320
|
+
|
|
321
|
+
interface ComposeContextualAskExecutorsOptions {
|
|
322
|
+
readonly configuredKey: readonly ContextualAskExecutor[];
|
|
323
|
+
readonly managedCodex: ContextualAskExecutor;
|
|
324
|
+
readonly defaultExecutor?: ContextualAskExecutorPreference;
|
|
325
|
+
}
|
|
326
|
+
/** Orders independent executor implementations without coupling dev-server to Codex. */
|
|
327
|
+
declare function composeContextualAskExecutors(options: ComposeContextualAskExecutorsOptions): readonly ContextualAskExecutor[];
|
|
328
|
+
|
|
239
329
|
interface SpotPatchSession {
|
|
240
330
|
readonly id: string;
|
|
241
331
|
readonly token: string;
|
|
@@ -265,6 +355,7 @@ interface SpotPatchServerLogger {
|
|
|
265
355
|
}
|
|
266
356
|
interface CreateMiddlewareOptions {
|
|
267
357
|
readonly agentManager?: AgentJobManager;
|
|
358
|
+
readonly contextualAskManager?: ContextualAskManager;
|
|
268
359
|
readonly bootstrap?: RuntimeBootstrapOptions;
|
|
269
360
|
readonly editorLauncher?: EditorLauncher;
|
|
270
361
|
readonly externalAgentControl?: ExternalAgentControlPort;
|
|
@@ -281,6 +372,18 @@ declare function readJsonRequestBody(request: IncomingMessage, maximumBytes?: nu
|
|
|
281
372
|
|
|
282
373
|
declare function isLoopbackHostname(hostname: string): boolean;
|
|
283
374
|
|
|
375
|
+
type ContextualAskRoute = Readonly<{
|
|
376
|
+
kind: "capability";
|
|
377
|
+
}> | Readonly<{
|
|
378
|
+
kind: "create";
|
|
379
|
+
}> | Readonly<{
|
|
380
|
+
kind: "job";
|
|
381
|
+
action: "events" | "result" | "cancel";
|
|
382
|
+
jobId: string;
|
|
383
|
+
}>;
|
|
384
|
+
declare function matchContextualAskPath(pathname: string): ContextualAskRoute | undefined;
|
|
385
|
+
declare function handleContextualAskRequest(request: IncomingMessage, response: ServerResponse, route: ContextualAskRoute, manager: ContextualAskManager | undefined, logger?: SpotPatchServerLogger): Promise<void>;
|
|
386
|
+
|
|
284
387
|
interface SourceRegistrationServiceOptions {
|
|
285
388
|
readonly internalSecret: string;
|
|
286
389
|
readonly options: ResolvedSpotPatchOptions;
|
|
@@ -311,6 +414,7 @@ interface SerializedSpotPatchOptions {
|
|
|
311
414
|
readonly budget: Readonly<ContextBudget>;
|
|
312
415
|
readonly debug: boolean;
|
|
313
416
|
readonly dataFlow: false | SpotPatchDataFlowOptions;
|
|
417
|
+
readonly contextualAsk: ContextualAskOptions;
|
|
314
418
|
readonly editor: SpotPatchEditorPreference;
|
|
315
419
|
readonly enabled: boolean;
|
|
316
420
|
readonly externalAgent: boolean;
|
|
@@ -324,4 +428,4 @@ interface SerializedSpotPatchOptions {
|
|
|
324
428
|
declare function serializeResolvedSpotPatchOptions(options: ResolvedSpotPatchOptions): SerializedSpotPatchOptions;
|
|
325
429
|
declare function parseSerializedSpotPatchOptions(value: unknown): ResolvedSpotPatchOptions;
|
|
326
430
|
|
|
327
|
-
export { type AgentJobEventListener, type AgentJobManager, type CreateAgentJobManagerOptions, type CreateExternalHandoffServiceOptions, type CreateMiddlewareOptions, DEFAULT_EXCLUDE, DEFAULT_OPTIONS, type DiscoverProjectValidationCheckOptions, type EnvironmentAiConfiguration, type ExternalAgentControlPort, type ExternalHandoffService, type FilterEntry, type IntegrationFileChange, type IntegrationPlan, type ResolveManagedExecutionValidationOptions, type ResolveProjectOptionsInput, type ResolveProjectValidationChecksOptions, type ResolvedManagedExecutionValidation, type ResolvedRuntimeBootstrapOptions, type ResolvedSpotPatchDataFlowOptions, type ResolvedSpotPatchOptions, type RuntimeBootstrapOptions, type SerializedFilterEntry, type SerializedSpotPatchOptions, type SimpleAiOptions, type SourceRegistrationHandler, type SourceRegistrationService, type SourceRegistrationServiceOptions, type SourceRegistry, type SpotPatchAiOptions, type SpotPatchDataFlowOptions, type SpotPatchMiddleware, type SpotPatchNext, type SpotPatchOptions, type SpotPatchServerLogger, type SpotPatchSession, applyIntegrationPlan, createAgentJobManager, createExternalHandoffService, createIntegrationFileChange, createRuntimeAiConfig, createRuntimeDataFlowConfig, createSession, createSourceRegistrationService, createSourceRegistry, createSpotPatchMiddleware, discoverProjectValidationCheck, integrationPathExists, isLoopbackHostname, parseSerializedSpotPatchOptions, readIntegrationFile, readJsonRequestBody, readRuntimeBootstrap, resolveCredentialEnvironment, resolveEnvironmentAiConfiguration, resolveManagedExecutionValidation, resolveOptions, resolveProjectOptions, resolveProjectValidationChecks, resolveRuntimeBootstrapOptions, serializeResolvedSpotPatchOptions };
|
|
431
|
+
export { type AgentJobEventListener, type AgentJobManager, type CaptureAskReadSnapshotOptions, type CapturedAskReadSnapshot, type ComposeContextualAskExecutorsOptions, ContextualAskError, type ContextualAskJobEventListener, type ContextualAskManager, type ContextualAskRoute, type CreateAgentJobManagerOptions, type CreateConfiguredKeyAskExecutorsOptions, type CreateContextualAskManagerOptions, type CreateExternalHandoffServiceOptions, type CreateMiddlewareOptions, DEFAULT_EXCLUDE, DEFAULT_OPTIONS, type DiscoverProjectValidationCheckOptions, type EnvironmentAiConfiguration, type ExternalAgentControlPort, type ExternalHandoffService, type FilterEntry, type IntegrationFileChange, type IntegrationPlan, type ResolveManagedExecutionValidationOptions, type ResolveProjectOptionsInput, type ResolveProjectValidationChecksOptions, type ResolvedContextualAskOptions, type ResolvedManagedExecutionValidation, type ResolvedRuntimeBootstrapOptions, type ResolvedSpotPatchDataFlowOptions, type ResolvedSpotPatchOptions, type RuntimeBootstrapOptions, type SerializedFilterEntry, type SerializedSpotPatchOptions, type SimpleAiOptions, type SourceRegistrationHandler, type SourceRegistrationService, type SourceRegistrationServiceOptions, type SourceRegistry, type SpotPatchAiOptions, type SpotPatchDataFlowOptions, type SpotPatchMiddleware, type SpotPatchNext, type SpotPatchOptions, type SpotPatchServerLogger, type SpotPatchSession, type WorkspaceActivityCoordinator, type WorkspaceActivityKind, type WorkspaceActivityLease, applyIntegrationPlan, captureAskReadSnapshot, composeContextualAskExecutors, createAgentJobManager, createConfiguredKeyAskExecutors, createContextualAskManager, createExternalHandoffService, createIntegrationFileChange, createRuntimeAiConfig, createRuntimeDataFlowConfig, createSession, createSourceRegistrationService, createSourceRegistry, createSpotPatchMiddleware, createWorkspaceActivityCoordinator, discoverProjectValidationCheck, handleContextualAskRequest, integrationPathExists, isLoopbackHostname, matchContextualAskPath, parseSerializedSpotPatchOptions, readIntegrationFile, readJsonRequestBody, readRuntimeBootstrap, resolveCredentialEnvironment, resolveEnvironmentAiConfiguration, resolveManagedExecutionValidation, resolveOptions, resolveProjectOptions, resolveProjectValidationChecks, resolveRuntimeBootstrapOptions, serializeResolvedSpotPatchOptions };
|