@spotpatch/dev-server 0.10.1 → 0.11.1

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
@@ -322,12 +322,20 @@ interface CreateConfiguredKeyAskExecutorsOptions {
322
322
  /** Builds one isolated read-only Ask executor per configured Provider/model pair. */
323
323
  declare function createConfiguredKeyAskExecutors(options: CreateConfiguredKeyAskExecutorsOptions): readonly ContextualAskExecutor[];
324
324
 
325
+ /** Executors that drive a locally installed Agent CLI instead of an API key. */
326
+ interface ManagedAskExecutors {
327
+ readonly codex: ContextualAskExecutor;
328
+ readonly claudeCode: ContextualAskExecutor;
329
+ }
325
330
  interface ComposeContextualAskExecutorsOptions {
326
331
  readonly configuredKey: readonly ContextualAskExecutor[];
327
- readonly managedCodex: ContextualAskExecutor;
332
+ readonly managed: ManagedAskExecutors;
328
333
  readonly defaultExecutor?: ContextualAskExecutorPreference;
329
334
  }
330
- /** Orders independent executor implementations without coupling dev-server to Codex. */
335
+ /**
336
+ * Orders independent executor implementations without coupling dev-server to
337
+ * any Agent. The preferred kind comes first; otherwise configured keys lead.
338
+ */
331
339
  declare function composeContextualAskExecutors(options: ComposeContextualAskExecutorsOptions): readonly ContextualAskExecutor[];
332
340
 
333
341
  interface SpotPatchSession {
@@ -438,7 +446,7 @@ interface DevelopmentSessionInput extends Omit<CreateMiddlewareOptions, "agentMa
438
446
  readonly resolveSourceImports?: CreateContextualAskManagerOptions["resolveSourceImports"];
439
447
  readonly environment: Readonly<Record<string, string | undefined>>;
440
448
  readonly executionRoot?: string;
441
- readonly createManagedAskExecutor: () => ContextualAskExecutor;
449
+ readonly createManagedAskExecutors: () => ManagedAskExecutors;
442
450
  readonly createExternalAgentControl: (validation: ResolvedManagedExecutionValidation) => Promise<ExternalAgentControlPort>;
443
451
  readonly resolveValidation?: () => Promise<ResolvedManagedExecutionValidation>;
444
452
  }
@@ -449,4 +457,4 @@ interface DevelopmentSession {
449
457
  /** Owns feature services, not HTTP listeners or framework-specific transports. */
450
458
  declare function createDevelopmentSession(input: DevelopmentSessionInput): Promise<DevelopmentSession>;
451
459
 
452
- 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 DevelopmentSession, type DevelopmentSessionInput, 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, createDevelopmentSession, 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 };
460
+ 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 DevelopmentSession, type DevelopmentSessionInput, type DiscoverProjectValidationCheckOptions, type EnvironmentAiConfiguration, type ExternalAgentControlPort, type ExternalHandoffService, type FilterEntry, type IntegrationFileChange, type IntegrationPlan, type ManagedAskExecutors, 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, createDevelopmentSession, 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
@@ -322,12 +322,20 @@ interface CreateConfiguredKeyAskExecutorsOptions {
322
322
  /** Builds one isolated read-only Ask executor per configured Provider/model pair. */
323
323
  declare function createConfiguredKeyAskExecutors(options: CreateConfiguredKeyAskExecutorsOptions): readonly ContextualAskExecutor[];
324
324
 
325
+ /** Executors that drive a locally installed Agent CLI instead of an API key. */
326
+ interface ManagedAskExecutors {
327
+ readonly codex: ContextualAskExecutor;
328
+ readonly claudeCode: ContextualAskExecutor;
329
+ }
325
330
  interface ComposeContextualAskExecutorsOptions {
326
331
  readonly configuredKey: readonly ContextualAskExecutor[];
327
- readonly managedCodex: ContextualAskExecutor;
332
+ readonly managed: ManagedAskExecutors;
328
333
  readonly defaultExecutor?: ContextualAskExecutorPreference;
329
334
  }
330
- /** Orders independent executor implementations without coupling dev-server to Codex. */
335
+ /**
336
+ * Orders independent executor implementations without coupling dev-server to
337
+ * any Agent. The preferred kind comes first; otherwise configured keys lead.
338
+ */
331
339
  declare function composeContextualAskExecutors(options: ComposeContextualAskExecutorsOptions): readonly ContextualAskExecutor[];
332
340
 
333
341
  interface SpotPatchSession {
@@ -438,7 +446,7 @@ interface DevelopmentSessionInput extends Omit<CreateMiddlewareOptions, "agentMa
438
446
  readonly resolveSourceImports?: CreateContextualAskManagerOptions["resolveSourceImports"];
439
447
  readonly environment: Readonly<Record<string, string | undefined>>;
440
448
  readonly executionRoot?: string;
441
- readonly createManagedAskExecutor: () => ContextualAskExecutor;
449
+ readonly createManagedAskExecutors: () => ManagedAskExecutors;
442
450
  readonly createExternalAgentControl: (validation: ResolvedManagedExecutionValidation) => Promise<ExternalAgentControlPort>;
443
451
  readonly resolveValidation?: () => Promise<ResolvedManagedExecutionValidation>;
444
452
  }
@@ -449,4 +457,4 @@ interface DevelopmentSession {
449
457
  /** Owns feature services, not HTTP listeners or framework-specific transports. */
450
458
  declare function createDevelopmentSession(input: DevelopmentSessionInput): Promise<DevelopmentSession>;
451
459
 
452
- 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 DevelopmentSession, type DevelopmentSessionInput, 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, createDevelopmentSession, 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 };
460
+ 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 DevelopmentSession, type DevelopmentSessionInput, type DiscoverProjectValidationCheckOptions, type EnvironmentAiConfiguration, type ExternalAgentControlPort, type ExternalHandoffService, type FilterEntry, type IntegrationFileChange, type IntegrationPlan, type ManagedAskExecutors, 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, createDevelopmentSession, 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.js CHANGED
@@ -2699,7 +2699,9 @@ function confidence(value) {
2699
2699
  async function authorizeSeeds(selection, registry, root, realRoot) {
2700
2700
  const byPath = /* @__PURE__ */ new Map();
2701
2701
  for (const target of selection.targets) {
2702
- let fileId = target.react.source?.fileId ?? target.source.fileId;
2702
+ const location = target.react.source?.fileId === void 0 ? target.source : target.react.source;
2703
+ let fileId = location.fileId;
2704
+ let claimedRelative = location.relativePath;
2703
2705
  let sourceVersion;
2704
2706
  if (target.react.componentSourceId !== void 0) {
2705
2707
  const anchor = registry.resolveDataFlowComponent(target.react.componentSourceId);
@@ -2707,6 +2709,7 @@ async function authorizeSeeds(selection, registry, root, realRoot) {
2707
2709
  deny("ASK_SELECTION_STALE");
2708
2710
  }
2709
2711
  fileId = anchor.fileId;
2712
+ claimedRelative = void 0;
2710
2713
  sourceVersion = anchor.sourceVersion;
2711
2714
  }
2712
2715
  if (fileId === void 0) continue;
@@ -2716,7 +2719,6 @@ async function authorizeSeeds(selection, registry, root, realRoot) {
2716
2719
  if (canonical === void 0) deny("ASK_SELECTION_STALE");
2717
2720
  const absolutePath = path5.normalize(canonical);
2718
2721
  const registeredRelative = toPosixRelative(realRoot, absolutePath);
2719
- const claimedRelative = target.react.source?.relativePath ?? target.source.relativePath;
2720
2722
  if (claimedRelative !== void 0 && claimedRelative.split("\\").join("/") !== registeredRelative) {
2721
2723
  deny("ASK_SELECTION_STALE");
2722
2724
  }
@@ -3637,8 +3639,10 @@ function createConfiguredKeyAskExecutors(options) {
3637
3639
 
3638
3640
  // src/contextual-ask/executors.ts
3639
3641
  function composeContextualAskExecutors(options) {
3642
+ const { codex, claudeCode } = options.managed;
3643
+ const preference = options.defaultExecutor?.kind;
3640
3644
  return Object.freeze(
3641
- options.defaultExecutor?.kind === "managed-codex" ? [options.managedCodex, ...options.configuredKey] : [...options.configuredKey, options.managedCodex]
3645
+ preference === "managed-codex" ? [codex, claudeCode, ...options.configuredKey] : preference === "claude-code" ? [claudeCode, codex, ...options.configuredKey] : [...options.configuredKey, codex, claudeCode]
3642
3646
  );
3643
3647
  }
3644
3648
 
@@ -3907,6 +3911,7 @@ import {
3907
3911
  import { realpath as realpath6 } from "fs/promises";
3908
3912
  import path8 from "path";
3909
3913
  import {
3914
+ ELEMENT_INSTANCE_LIMITS,
3910
3915
  ERROR_CODES as ERROR_CODES9,
3911
3916
  SpotPatchError as SpotPatchError9,
3912
3917
  redactSensitiveText,
@@ -4297,17 +4302,14 @@ function freezeMatchedRule(rule) {
4297
4302
  });
4298
4303
  }
4299
4304
  function targetIdentity(target) {
4300
- const source = target.source;
4301
- if (source.fileId !== void 0 && source.line !== void 0 && source.column !== void 0) {
4302
- return `source:${source.fileId}:${String(source.line)}:${String(source.column)}`;
4303
- }
4304
- return [
4305
- "element",
4306
- source.origin,
4307
- source.relativePath ?? "",
4305
+ if (target.element.instance !== void 0)
4306
+ return `instance:${target.element.instance.id}`;
4307
+ return JSON.stringify([
4308
+ target.page?.url ?? "",
4309
+ target.source,
4308
4310
  target.element.selector,
4309
4311
  target.element.sanitizedHtml
4310
- ].join("\0");
4312
+ ]);
4311
4313
  }
4312
4314
  async function authorizeTarget(target, input) {
4313
4315
  const source = await authorizeSourceRef(target.source, input.registry, input.root);
@@ -4344,6 +4346,19 @@ async function authorizeTarget(target, input) {
4344
4346
  ...reactSource === void 0 ? {} : { source: reactSource }
4345
4347
  }),
4346
4348
  element: Object.freeze({
4349
+ ...target.element.instance === void 0 ? {} : {
4350
+ instance: Object.freeze({
4351
+ ...target.element.instance,
4352
+ label: redactSensitiveText(target.element.instance.label).slice(
4353
+ 0,
4354
+ ELEMENT_INSTANCE_LIMITS.labelCharacters
4355
+ ),
4356
+ context: redactSensitiveText(target.element.instance.context).slice(
4357
+ 0,
4358
+ ELEMENT_INSTANCE_LIMITS.contextCharacters
4359
+ )
4360
+ })
4361
+ },
4347
4362
  tagName: target.element.tagName,
4348
4363
  selector: target.element.selector,
4349
4364
  sanitizedHtml: target.element.sanitizedHtml,
@@ -5905,9 +5920,9 @@ function parseContextualAsk(value) {
5905
5920
  throw new TypeError("The SpotPatch contextual Ask transport is invalid.");
5906
5921
  }
5907
5922
  const preference = value.defaultExecutor;
5908
- if (preference.kind === "managed-codex" && hasExactKeys(preference, ["kind"])) {
5923
+ if ((preference.kind === "managed-codex" || preference.kind === "claude-code") && hasExactKeys(preference, ["kind"])) {
5909
5924
  return Object.freeze({
5910
- defaultExecutor: Object.freeze({ kind: "managed-codex" })
5925
+ defaultExecutor: Object.freeze({ kind: preference.kind })
5911
5926
  });
5912
5927
  }
5913
5928
  if (preference.kind === "configured-key" && hasExactKeys(preference, ["kind", "modelProfileId", "providerProfileId"]) && typeof preference.providerProfileId === "string" && typeof preference.modelProfileId === "string") {
@@ -5999,7 +6014,7 @@ async function createDevelopmentSession(input) {
5999
6014
  environment: input.environment,
6000
6015
  ...preference
6001
6016
  }),
6002
- managedCodex: input.createManagedAskExecutor(),
6017
+ managed: input.createManagedAskExecutors(),
6003
6018
  ...preference
6004
6019
  })
6005
6020
  });