@spotpatch/dev-server 0.4.0 → 0.6.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, SpotPatchEditorPreference, ContextBudget, SpotPatchLocalePreference, AiProviderProtocol, AiProviderAuthentication, AiExecutionOptions, AiOptions, RuntimeAiConfig, ResolvedAgentCheckDefinition, SpotPatchRuntimeConfig } from '@spotpatch/shared';
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';
3
3
  import { SourceFilterEntry } from '@spotpatch/compiler';
4
4
  import { IncomingMessage, ServerResponse } from 'node:http';
5
5
 
@@ -35,6 +35,22 @@ interface CreateAgentJobManagerOptions {
35
35
  }
36
36
  declare function createAgentJobManager(options: CreateAgentJobManagerOptions): AgentJobManager;
37
37
 
38
+ type AuthorizeExternalHandoff = (annotation: ExternalHandoffPublishRequest["annotation"]) => Promise<SpotAnnotation>;
39
+ interface ExternalHandoffService {
40
+ readonly capability: () => ExternalHandoffCapability;
41
+ readonly close: () => Promise<void>;
42
+ readonly publish: (request: ExternalHandoffPublishRequest, authorize: AuthorizeExternalHandoff) => Promise<ExternalHandoffPublishResult>;
43
+ readonly resolveDelivery: (cursor: string) => ExternalHandoffStatusResult;
44
+ readonly start: () => Promise<void>;
45
+ readonly status: (cursor?: string) => ExternalHandoffStatusResult;
46
+ }
47
+ interface CreateExternalHandoffServiceOptions {
48
+ readonly framework: ExternalHandoffFramework;
49
+ readonly root: string;
50
+ readonly sessionId: string;
51
+ }
52
+ declare function createExternalHandoffService(options: CreateExternalHandoffServiceOptions): ExternalHandoffService;
53
+
38
54
  type FilterEntry = SourceFilterEntry;
39
55
  interface SimpleAiOptions {
40
56
  readonly baseURL: string;
@@ -47,6 +63,9 @@ interface SimpleAiOptions {
47
63
  readonly execution?: AiExecutionOptions;
48
64
  }
49
65
  type SpotPatchAiOptions = false | SimpleAiOptions | AiOptions;
66
+ interface SpotPatchDataFlowOptions {
67
+ readonly runtime?: "dispatch";
68
+ }
50
69
  interface SpotPatchOptions {
51
70
  readonly enabled?: boolean;
52
71
  readonly include?: readonly FilterEntry[];
@@ -62,6 +81,8 @@ interface SpotPatchOptions {
62
81
  readonly locale?: SpotPatchLocalePreference;
63
82
  readonly maxTargets?: number;
64
83
  readonly ai?: SpotPatchAiOptions;
84
+ readonly dataFlow?: false | SpotPatchDataFlowOptions;
85
+ readonly externalAgent?: boolean;
65
86
  }
66
87
  interface ResolvedSpotPatchOptions {
67
88
  readonly enabled: boolean;
@@ -76,6 +97,15 @@ interface ResolvedSpotPatchOptions {
76
97
  readonly locale: SpotPatchLocalePreference;
77
98
  readonly maxTargets: number;
78
99
  readonly ai: false | ResolvedAiOptions;
100
+ readonly dataFlow: ResolvedSpotPatchDataFlowOptions;
101
+ readonly externalAgent: Readonly<{
102
+ enabled: boolean;
103
+ }>;
104
+ }
105
+ interface ResolvedSpotPatchDataFlowOptions {
106
+ readonly enabled: boolean;
107
+ readonly runtime: "dispatch";
108
+ readonly limits: DataFlowLimits;
79
109
  }
80
110
  declare const DEFAULT_EXCLUDE: readonly RegExp[];
81
111
  declare const DEFAULT_OPTIONS: Readonly<{
@@ -98,8 +128,31 @@ declare const DEFAULT_OPTIONS: Readonly<{
98
128
  locale: "auto";
99
129
  maxTargets: number;
100
130
  ai: false;
131
+ dataFlow: Readonly<{
132
+ enabled: false;
133
+ runtime: "dispatch";
134
+ limits: Readonly<{
135
+ readonly observationMaxEntries: 100;
136
+ readonly observationMaxBytes: number;
137
+ readonly observationTtlMs: 300000;
138
+ readonly protocolRequestMaxBytes: number;
139
+ readonly reportMaxBytes: number;
140
+ readonly reportMaxEvidence: 200;
141
+ readonly reportMaxDiagnostics: 256;
142
+ readonly capabilityMaxReasons: 64;
143
+ readonly graphMaxDepth: 5;
144
+ readonly graphMaxModules: 50;
145
+ readonly graphMaxCallsites: 100;
146
+ readonly analysisTimeoutMs: 2000;
147
+ readonly reportMaxFields: 100;
148
+ }>;
149
+ }>;
150
+ externalAgent: Readonly<{
151
+ enabled: false;
152
+ }>;
101
153
  }>;
102
154
  declare function createRuntimeAiConfig(options: false | ResolvedAiOptions): RuntimeAiConfig;
155
+ declare function createRuntimeDataFlowConfig(options: ResolvedSpotPatchDataFlowOptions): RuntimeDataFlowConfig;
103
156
  declare function resolveOptions(options?: SpotPatchOptions, environmentAi?: false | SimpleAiOptions): ResolvedSpotPatchOptions;
104
157
 
105
158
  interface EnvironmentAiConfiguration {
@@ -140,9 +193,20 @@ type SourceIdFactory = () => string;
140
193
 
141
194
  interface SourceRegistry {
142
195
  register(absolutePath: string): string;
196
+ registerDataFlowComponents(absolutePath: string, sourceVersion: string, components: readonly DataFlowComponentAnchorInput[]): void;
143
197
  resolve(fileId: string): string | undefined;
198
+ resolveDataFlowComponent(componentSourceId: string): DataFlowComponentAnchor | undefined;
144
199
  clear(): void;
145
200
  }
201
+ interface DataFlowComponentAnchorInput {
202
+ readonly componentSourceId: string;
203
+ readonly line: number;
204
+ readonly column: number;
205
+ }
206
+ interface DataFlowComponentAnchor extends DataFlowComponentAnchorInput {
207
+ readonly fileId: string;
208
+ readonly sourceVersion: string;
209
+ }
146
210
  interface SourceRegistryOptions {
147
211
  readonly createId?: SourceIdFactory;
148
212
  }
@@ -176,6 +240,7 @@ interface CreateMiddlewareOptions {
176
240
  readonly agentManager?: AgentJobManager;
177
241
  readonly bootstrap?: RuntimeBootstrapOptions;
178
242
  readonly editorLauncher?: EditorLauncher;
243
+ readonly externalHandoffService?: ExternalHandoffService;
179
244
  readonly logger?: SpotPatchServerLogger;
180
245
  readonly options: ResolvedSpotPatchOptions;
181
246
  readonly registry: SourceRegistry;
@@ -217,8 +282,10 @@ interface SerializedSpotPatchOptions {
217
282
  readonly allowLan: boolean;
218
283
  readonly budget: Readonly<ContextBudget>;
219
284
  readonly debug: boolean;
285
+ readonly dataFlow: false | SpotPatchDataFlowOptions;
220
286
  readonly editor: SpotPatchEditorPreference;
221
287
  readonly enabled: boolean;
288
+ readonly externalAgent: boolean;
222
289
  readonly exclude: readonly SerializedFilterEntry[];
223
290
  readonly include: readonly SerializedFilterEntry[];
224
291
  readonly locale: SpotPatchLocalePreference;
@@ -229,4 +296,4 @@ interface SerializedSpotPatchOptions {
229
296
  declare function serializeResolvedSpotPatchOptions(options: ResolvedSpotPatchOptions): SerializedSpotPatchOptions;
230
297
  declare function parseSerializedSpotPatchOptions(value: unknown): ResolvedSpotPatchOptions;
231
298
 
232
- export { type AgentJobEventListener, type AgentJobManager, type CreateAgentJobManagerOptions, type CreateMiddlewareOptions, DEFAULT_EXCLUDE, DEFAULT_OPTIONS, type DiscoverProjectValidationCheckOptions, type EnvironmentAiConfiguration, type FilterEntry, type IntegrationFileChange, type IntegrationPlan, type ResolveProjectOptionsInput, type ResolvedRuntimeBootstrapOptions, type ResolvedSpotPatchOptions, type RuntimeBootstrapOptions, type SerializedFilterEntry, type SerializedSpotPatchOptions, type SimpleAiOptions, type SourceRegistrationHandler, type SourceRegistrationService, type SourceRegistrationServiceOptions, type SourceRegistry, type SpotPatchAiOptions, type SpotPatchMiddleware, type SpotPatchNext, type SpotPatchOptions, type SpotPatchServerLogger, type SpotPatchSession, applyIntegrationPlan, createAgentJobManager, createIntegrationFileChange, createRuntimeAiConfig, createSession, createSourceRegistrationService, createSourceRegistry, createSpotPatchMiddleware, discoverProjectValidationCheck, integrationPathExists, isLoopbackHostname, parseSerializedSpotPatchOptions, readIntegrationFile, readJsonRequestBody, readRuntimeBootstrap, resolveCredentialEnvironment, resolveEnvironmentAiConfiguration, resolveOptions, resolveProjectOptions, resolveRuntimeBootstrapOptions, serializeResolvedSpotPatchOptions };
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 };
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, SpotPatchEditorPreference, ContextBudget, SpotPatchLocalePreference, AiProviderProtocol, AiProviderAuthentication, AiExecutionOptions, AiOptions, RuntimeAiConfig, ResolvedAgentCheckDefinition, SpotPatchRuntimeConfig } from '@spotpatch/shared';
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';
3
3
  import { SourceFilterEntry } from '@spotpatch/compiler';
4
4
  import { IncomingMessage, ServerResponse } from 'node:http';
5
5
 
@@ -35,6 +35,22 @@ interface CreateAgentJobManagerOptions {
35
35
  }
36
36
  declare function createAgentJobManager(options: CreateAgentJobManagerOptions): AgentJobManager;
37
37
 
38
+ type AuthorizeExternalHandoff = (annotation: ExternalHandoffPublishRequest["annotation"]) => Promise<SpotAnnotation>;
39
+ interface ExternalHandoffService {
40
+ readonly capability: () => ExternalHandoffCapability;
41
+ readonly close: () => Promise<void>;
42
+ readonly publish: (request: ExternalHandoffPublishRequest, authorize: AuthorizeExternalHandoff) => Promise<ExternalHandoffPublishResult>;
43
+ readonly resolveDelivery: (cursor: string) => ExternalHandoffStatusResult;
44
+ readonly start: () => Promise<void>;
45
+ readonly status: (cursor?: string) => ExternalHandoffStatusResult;
46
+ }
47
+ interface CreateExternalHandoffServiceOptions {
48
+ readonly framework: ExternalHandoffFramework;
49
+ readonly root: string;
50
+ readonly sessionId: string;
51
+ }
52
+ declare function createExternalHandoffService(options: CreateExternalHandoffServiceOptions): ExternalHandoffService;
53
+
38
54
  type FilterEntry = SourceFilterEntry;
39
55
  interface SimpleAiOptions {
40
56
  readonly baseURL: string;
@@ -47,6 +63,9 @@ interface SimpleAiOptions {
47
63
  readonly execution?: AiExecutionOptions;
48
64
  }
49
65
  type SpotPatchAiOptions = false | SimpleAiOptions | AiOptions;
66
+ interface SpotPatchDataFlowOptions {
67
+ readonly runtime?: "dispatch";
68
+ }
50
69
  interface SpotPatchOptions {
51
70
  readonly enabled?: boolean;
52
71
  readonly include?: readonly FilterEntry[];
@@ -62,6 +81,8 @@ interface SpotPatchOptions {
62
81
  readonly locale?: SpotPatchLocalePreference;
63
82
  readonly maxTargets?: number;
64
83
  readonly ai?: SpotPatchAiOptions;
84
+ readonly dataFlow?: false | SpotPatchDataFlowOptions;
85
+ readonly externalAgent?: boolean;
65
86
  }
66
87
  interface ResolvedSpotPatchOptions {
67
88
  readonly enabled: boolean;
@@ -76,6 +97,15 @@ interface ResolvedSpotPatchOptions {
76
97
  readonly locale: SpotPatchLocalePreference;
77
98
  readonly maxTargets: number;
78
99
  readonly ai: false | ResolvedAiOptions;
100
+ readonly dataFlow: ResolvedSpotPatchDataFlowOptions;
101
+ readonly externalAgent: Readonly<{
102
+ enabled: boolean;
103
+ }>;
104
+ }
105
+ interface ResolvedSpotPatchDataFlowOptions {
106
+ readonly enabled: boolean;
107
+ readonly runtime: "dispatch";
108
+ readonly limits: DataFlowLimits;
79
109
  }
80
110
  declare const DEFAULT_EXCLUDE: readonly RegExp[];
81
111
  declare const DEFAULT_OPTIONS: Readonly<{
@@ -98,8 +128,31 @@ declare const DEFAULT_OPTIONS: Readonly<{
98
128
  locale: "auto";
99
129
  maxTargets: number;
100
130
  ai: false;
131
+ dataFlow: Readonly<{
132
+ enabled: false;
133
+ runtime: "dispatch";
134
+ limits: Readonly<{
135
+ readonly observationMaxEntries: 100;
136
+ readonly observationMaxBytes: number;
137
+ readonly observationTtlMs: 300000;
138
+ readonly protocolRequestMaxBytes: number;
139
+ readonly reportMaxBytes: number;
140
+ readonly reportMaxEvidence: 200;
141
+ readonly reportMaxDiagnostics: 256;
142
+ readonly capabilityMaxReasons: 64;
143
+ readonly graphMaxDepth: 5;
144
+ readonly graphMaxModules: 50;
145
+ readonly graphMaxCallsites: 100;
146
+ readonly analysisTimeoutMs: 2000;
147
+ readonly reportMaxFields: 100;
148
+ }>;
149
+ }>;
150
+ externalAgent: Readonly<{
151
+ enabled: false;
152
+ }>;
101
153
  }>;
102
154
  declare function createRuntimeAiConfig(options: false | ResolvedAiOptions): RuntimeAiConfig;
155
+ declare function createRuntimeDataFlowConfig(options: ResolvedSpotPatchDataFlowOptions): RuntimeDataFlowConfig;
103
156
  declare function resolveOptions(options?: SpotPatchOptions, environmentAi?: false | SimpleAiOptions): ResolvedSpotPatchOptions;
104
157
 
105
158
  interface EnvironmentAiConfiguration {
@@ -140,9 +193,20 @@ type SourceIdFactory = () => string;
140
193
 
141
194
  interface SourceRegistry {
142
195
  register(absolutePath: string): string;
196
+ registerDataFlowComponents(absolutePath: string, sourceVersion: string, components: readonly DataFlowComponentAnchorInput[]): void;
143
197
  resolve(fileId: string): string | undefined;
198
+ resolveDataFlowComponent(componentSourceId: string): DataFlowComponentAnchor | undefined;
144
199
  clear(): void;
145
200
  }
201
+ interface DataFlowComponentAnchorInput {
202
+ readonly componentSourceId: string;
203
+ readonly line: number;
204
+ readonly column: number;
205
+ }
206
+ interface DataFlowComponentAnchor extends DataFlowComponentAnchorInput {
207
+ readonly fileId: string;
208
+ readonly sourceVersion: string;
209
+ }
146
210
  interface SourceRegistryOptions {
147
211
  readonly createId?: SourceIdFactory;
148
212
  }
@@ -176,6 +240,7 @@ interface CreateMiddlewareOptions {
176
240
  readonly agentManager?: AgentJobManager;
177
241
  readonly bootstrap?: RuntimeBootstrapOptions;
178
242
  readonly editorLauncher?: EditorLauncher;
243
+ readonly externalHandoffService?: ExternalHandoffService;
179
244
  readonly logger?: SpotPatchServerLogger;
180
245
  readonly options: ResolvedSpotPatchOptions;
181
246
  readonly registry: SourceRegistry;
@@ -217,8 +282,10 @@ interface SerializedSpotPatchOptions {
217
282
  readonly allowLan: boolean;
218
283
  readonly budget: Readonly<ContextBudget>;
219
284
  readonly debug: boolean;
285
+ readonly dataFlow: false | SpotPatchDataFlowOptions;
220
286
  readonly editor: SpotPatchEditorPreference;
221
287
  readonly enabled: boolean;
288
+ readonly externalAgent: boolean;
222
289
  readonly exclude: readonly SerializedFilterEntry[];
223
290
  readonly include: readonly SerializedFilterEntry[];
224
291
  readonly locale: SpotPatchLocalePreference;
@@ -229,4 +296,4 @@ interface SerializedSpotPatchOptions {
229
296
  declare function serializeResolvedSpotPatchOptions(options: ResolvedSpotPatchOptions): SerializedSpotPatchOptions;
230
297
  declare function parseSerializedSpotPatchOptions(value: unknown): ResolvedSpotPatchOptions;
231
298
 
232
- export { type AgentJobEventListener, type AgentJobManager, type CreateAgentJobManagerOptions, type CreateMiddlewareOptions, DEFAULT_EXCLUDE, DEFAULT_OPTIONS, type DiscoverProjectValidationCheckOptions, type EnvironmentAiConfiguration, type FilterEntry, type IntegrationFileChange, type IntegrationPlan, type ResolveProjectOptionsInput, type ResolvedRuntimeBootstrapOptions, type ResolvedSpotPatchOptions, type RuntimeBootstrapOptions, type SerializedFilterEntry, type SerializedSpotPatchOptions, type SimpleAiOptions, type SourceRegistrationHandler, type SourceRegistrationService, type SourceRegistrationServiceOptions, type SourceRegistry, type SpotPatchAiOptions, type SpotPatchMiddleware, type SpotPatchNext, type SpotPatchOptions, type SpotPatchServerLogger, type SpotPatchSession, applyIntegrationPlan, createAgentJobManager, createIntegrationFileChange, createRuntimeAiConfig, createSession, createSourceRegistrationService, createSourceRegistry, createSpotPatchMiddleware, discoverProjectValidationCheck, integrationPathExists, isLoopbackHostname, parseSerializedSpotPatchOptions, readIntegrationFile, readJsonRequestBody, readRuntimeBootstrap, resolveCredentialEnvironment, resolveEnvironmentAiConfiguration, resolveOptions, resolveProjectOptions, resolveRuntimeBootstrapOptions, serializeResolvedSpotPatchOptions };
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 };