@spotpatch/dev-server 0.6.0 → 0.8.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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
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, SpotPatchEditorPreference, ContextBudget, SpotPatchLocalePreference, DataFlowLimits, AiProviderProtocol, AiProviderAuthentication, AiExecutionOptions, AiOptions, RuntimeAiConfig, RuntimeDataFlowConfig, ResolvedAgentCheckDefinition, SpotPatchRuntimeConfig } from '@spotpatch/shared';
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';
3
3
  import { SourceFilterEntry } from '@spotpatch/compiler';
4
4
  import { IncomingMessage, ServerResponse } from 'node:http';
5
5
 
@@ -51,6 +51,16 @@ interface CreateExternalHandoffServiceOptions {
51
51
  }
52
52
  declare function createExternalHandoffService(options: CreateExternalHandoffServiceOptions): ExternalHandoffService;
53
53
 
54
+ interface ExternalAgentControlPort {
55
+ getStatus(): ExternalAgentControlStatus;
56
+ connect(request: ExternalAgentControlConnectRequest, signal: AbortSignal): Promise<ExternalAgentControlStatus>;
57
+ disconnect(request: ExternalAgentControlDisconnectRequest): Promise<ExternalAgentControlStatus>;
58
+ cancel(request: ExternalAgentControlCancelRequest): Promise<ExternalAgentControlStatus>;
59
+ getResult(revision: number): ExternalAgentManagedResult | undefined;
60
+ subscribe(listener: (status: ExternalAgentControlStatus) => void): () => void;
61
+ dispose(): Promise<void>;
62
+ }
63
+
54
64
  type FilterEntry = SourceFilterEntry;
55
65
  interface SimpleAiOptions {
56
66
  readonly baseURL: string;
@@ -145,6 +155,7 @@ declare const DEFAULT_OPTIONS: Readonly<{
145
155
  readonly graphMaxCallsites: 100;
146
156
  readonly analysisTimeoutMs: 2000;
147
157
  readonly reportMaxFields: 100;
158
+ readonly sourceMaxComponents: 256;
148
159
  }>;
149
160
  }>;
150
161
  externalAgent: Readonly<{
@@ -187,13 +198,26 @@ interface DiscoverProjectValidationCheckOptions {
187
198
  readonly appRoot: string;
188
199
  readonly timeoutMs: number;
189
200
  }
201
+ interface ResolveProjectValidationChecksOptions extends DiscoverProjectValidationCheckOptions {
202
+ readonly checks: Readonly<Record<string, ResolvedAgentCheckDefinition>>;
203
+ }
204
+ interface ResolveManagedExecutionValidationOptions {
205
+ readonly ai: false | ResolvedAiOptions;
206
+ readonly appRoot: string;
207
+ }
208
+ interface ResolvedManagedExecutionValidation {
209
+ readonly checks: Readonly<Record<string, ResolvedAgentCheckDefinition>>;
210
+ readonly limits: Readonly<AgentLimits>;
211
+ }
190
212
  declare function discoverProjectValidationCheck(options: DiscoverProjectValidationCheckOptions): Promise<ResolvedAgentCheckDefinition | undefined>;
213
+ declare function resolveProjectValidationChecks(options: ResolveProjectValidationChecksOptions): Promise<Readonly<Record<string, ResolvedAgentCheckDefinition>>>;
214
+ declare function resolveManagedExecutionValidation(options: ResolveManagedExecutionValidationOptions): Promise<ResolvedManagedExecutionValidation>;
191
215
 
192
216
  type SourceIdFactory = () => string;
193
217
 
194
218
  interface SourceRegistry {
195
219
  register(absolutePath: string): string;
196
- registerDataFlowComponents(absolutePath: string, sourceVersion: string, components: readonly DataFlowComponentAnchorInput[]): void;
220
+ registerDataFlowComponents(absolutePath: string, sourceVersion: string, components: readonly DataFlowComponentAnchorInput[]): string;
197
221
  resolve(fileId: string): string | undefined;
198
222
  resolveDataFlowComponent(componentSourceId: string): DataFlowComponentAnchor | undefined;
199
223
  clear(): void;
@@ -232,7 +256,10 @@ declare function resolveRuntimeBootstrapOptions(options: RuntimeBootstrapOptions
232
256
  declare function readRuntimeBootstrap(request: IncomingMessage, options: ResolvedRuntimeBootstrapOptions): Promise<SpotPatchRuntimeConfig>;
233
257
 
234
258
  type SpotPatchNext = (error?: unknown) => void;
235
- type SpotPatchMiddleware = (request: IncomingMessage, response: ServerResponse, next: SpotPatchNext) => void;
259
+ interface SpotPatchMiddleware {
260
+ (request: IncomingMessage, response: ServerResponse, next: SpotPatchNext): void;
261
+ dispose(): void;
262
+ }
236
263
  interface SpotPatchServerLogger {
237
264
  warn(message: string): void;
238
265
  }
@@ -240,6 +267,7 @@ interface CreateMiddlewareOptions {
240
267
  readonly agentManager?: AgentJobManager;
241
268
  readonly bootstrap?: RuntimeBootstrapOptions;
242
269
  readonly editorLauncher?: EditorLauncher;
270
+ readonly externalAgentControl?: ExternalAgentControlPort;
243
271
  readonly externalHandoffService?: ExternalHandoffService;
244
272
  readonly logger?: SpotPatchServerLogger;
245
273
  readonly options: ResolvedSpotPatchOptions;
@@ -296,4 +324,4 @@ interface SerializedSpotPatchOptions {
296
324
  declare function serializeResolvedSpotPatchOptions(options: ResolvedSpotPatchOptions): SerializedSpotPatchOptions;
297
325
  declare function parseSerializedSpotPatchOptions(value: unknown): ResolvedSpotPatchOptions;
298
326
 
299
- export { type AgentJobEventListener, type AgentJobManager, type CreateAgentJobManagerOptions, type CreateExternalHandoffServiceOptions, type CreateMiddlewareOptions, DEFAULT_EXCLUDE, DEFAULT_OPTIONS, type DiscoverProjectValidationCheckOptions, type EnvironmentAiConfiguration, type ExternalHandoffService, type FilterEntry, type IntegrationFileChange, type IntegrationPlan, type ResolveProjectOptionsInput, 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, resolveOptions, resolveProjectOptions, resolveRuntimeBootstrapOptions, serializeResolvedSpotPatchOptions };
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 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
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, SpotPatchEditorPreference, ContextBudget, SpotPatchLocalePreference, DataFlowLimits, AiProviderProtocol, AiProviderAuthentication, AiExecutionOptions, AiOptions, RuntimeAiConfig, RuntimeDataFlowConfig, ResolvedAgentCheckDefinition, SpotPatchRuntimeConfig } from '@spotpatch/shared';
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';
3
3
  import { SourceFilterEntry } from '@spotpatch/compiler';
4
4
  import { IncomingMessage, ServerResponse } from 'node:http';
5
5
 
@@ -51,6 +51,16 @@ interface CreateExternalHandoffServiceOptions {
51
51
  }
52
52
  declare function createExternalHandoffService(options: CreateExternalHandoffServiceOptions): ExternalHandoffService;
53
53
 
54
+ interface ExternalAgentControlPort {
55
+ getStatus(): ExternalAgentControlStatus;
56
+ connect(request: ExternalAgentControlConnectRequest, signal: AbortSignal): Promise<ExternalAgentControlStatus>;
57
+ disconnect(request: ExternalAgentControlDisconnectRequest): Promise<ExternalAgentControlStatus>;
58
+ cancel(request: ExternalAgentControlCancelRequest): Promise<ExternalAgentControlStatus>;
59
+ getResult(revision: number): ExternalAgentManagedResult | undefined;
60
+ subscribe(listener: (status: ExternalAgentControlStatus) => void): () => void;
61
+ dispose(): Promise<void>;
62
+ }
63
+
54
64
  type FilterEntry = SourceFilterEntry;
55
65
  interface SimpleAiOptions {
56
66
  readonly baseURL: string;
@@ -145,6 +155,7 @@ declare const DEFAULT_OPTIONS: Readonly<{
145
155
  readonly graphMaxCallsites: 100;
146
156
  readonly analysisTimeoutMs: 2000;
147
157
  readonly reportMaxFields: 100;
158
+ readonly sourceMaxComponents: 256;
148
159
  }>;
149
160
  }>;
150
161
  externalAgent: Readonly<{
@@ -187,13 +198,26 @@ interface DiscoverProjectValidationCheckOptions {
187
198
  readonly appRoot: string;
188
199
  readonly timeoutMs: number;
189
200
  }
201
+ interface ResolveProjectValidationChecksOptions extends DiscoverProjectValidationCheckOptions {
202
+ readonly checks: Readonly<Record<string, ResolvedAgentCheckDefinition>>;
203
+ }
204
+ interface ResolveManagedExecutionValidationOptions {
205
+ readonly ai: false | ResolvedAiOptions;
206
+ readonly appRoot: string;
207
+ }
208
+ interface ResolvedManagedExecutionValidation {
209
+ readonly checks: Readonly<Record<string, ResolvedAgentCheckDefinition>>;
210
+ readonly limits: Readonly<AgentLimits>;
211
+ }
190
212
  declare function discoverProjectValidationCheck(options: DiscoverProjectValidationCheckOptions): Promise<ResolvedAgentCheckDefinition | undefined>;
213
+ declare function resolveProjectValidationChecks(options: ResolveProjectValidationChecksOptions): Promise<Readonly<Record<string, ResolvedAgentCheckDefinition>>>;
214
+ declare function resolveManagedExecutionValidation(options: ResolveManagedExecutionValidationOptions): Promise<ResolvedManagedExecutionValidation>;
191
215
 
192
216
  type SourceIdFactory = () => string;
193
217
 
194
218
  interface SourceRegistry {
195
219
  register(absolutePath: string): string;
196
- registerDataFlowComponents(absolutePath: string, sourceVersion: string, components: readonly DataFlowComponentAnchorInput[]): void;
220
+ registerDataFlowComponents(absolutePath: string, sourceVersion: string, components: readonly DataFlowComponentAnchorInput[]): string;
197
221
  resolve(fileId: string): string | undefined;
198
222
  resolveDataFlowComponent(componentSourceId: string): DataFlowComponentAnchor | undefined;
199
223
  clear(): void;
@@ -232,7 +256,10 @@ declare function resolveRuntimeBootstrapOptions(options: RuntimeBootstrapOptions
232
256
  declare function readRuntimeBootstrap(request: IncomingMessage, options: ResolvedRuntimeBootstrapOptions): Promise<SpotPatchRuntimeConfig>;
233
257
 
234
258
  type SpotPatchNext = (error?: unknown) => void;
235
- type SpotPatchMiddleware = (request: IncomingMessage, response: ServerResponse, next: SpotPatchNext) => void;
259
+ interface SpotPatchMiddleware {
260
+ (request: IncomingMessage, response: ServerResponse, next: SpotPatchNext): void;
261
+ dispose(): void;
262
+ }
236
263
  interface SpotPatchServerLogger {
237
264
  warn(message: string): void;
238
265
  }
@@ -240,6 +267,7 @@ interface CreateMiddlewareOptions {
240
267
  readonly agentManager?: AgentJobManager;
241
268
  readonly bootstrap?: RuntimeBootstrapOptions;
242
269
  readonly editorLauncher?: EditorLauncher;
270
+ readonly externalAgentControl?: ExternalAgentControlPort;
243
271
  readonly externalHandoffService?: ExternalHandoffService;
244
272
  readonly logger?: SpotPatchServerLogger;
245
273
  readonly options: ResolvedSpotPatchOptions;
@@ -296,4 +324,4 @@ interface SerializedSpotPatchOptions {
296
324
  declare function serializeResolvedSpotPatchOptions(options: ResolvedSpotPatchOptions): SerializedSpotPatchOptions;
297
325
  declare function parseSerializedSpotPatchOptions(value: unknown): ResolvedSpotPatchOptions;
298
326
 
299
- export { type AgentJobEventListener, type AgentJobManager, type CreateAgentJobManagerOptions, type CreateExternalHandoffServiceOptions, type CreateMiddlewareOptions, DEFAULT_EXCLUDE, DEFAULT_OPTIONS, type DiscoverProjectValidationCheckOptions, type EnvironmentAiConfiguration, type ExternalHandoffService, type FilterEntry, type IntegrationFileChange, type IntegrationPlan, type ResolveProjectOptionsInput, 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, resolveOptions, resolveProjectOptions, resolveRuntimeBootstrapOptions, serializeResolvedSpotPatchOptions };
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 };