@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.cjs CHANGED
@@ -2685,7 +2685,9 @@ function confidence(value) {
2685
2685
  async function authorizeSeeds(selection, registry, root, realRoot) {
2686
2686
  const byPath = /* @__PURE__ */ new Map();
2687
2687
  for (const target of selection.targets) {
2688
- let fileId = target.react.source?.fileId ?? target.source.fileId;
2688
+ const location = target.react.source?.fileId === void 0 ? target.source : target.react.source;
2689
+ let fileId = location.fileId;
2690
+ let claimedRelative = location.relativePath;
2689
2691
  let sourceVersion;
2690
2692
  if (target.react.componentSourceId !== void 0) {
2691
2693
  const anchor = registry.resolveDataFlowComponent(target.react.componentSourceId);
@@ -2693,6 +2695,7 @@ async function authorizeSeeds(selection, registry, root, realRoot) {
2693
2695
  deny("ASK_SELECTION_STALE");
2694
2696
  }
2695
2697
  fileId = anchor.fileId;
2698
+ claimedRelative = void 0;
2696
2699
  sourceVersion = anchor.sourceVersion;
2697
2700
  }
2698
2701
  if (fileId === void 0) continue;
@@ -2702,7 +2705,6 @@ async function authorizeSeeds(selection, registry, root, realRoot) {
2702
2705
  if (canonical === void 0) deny("ASK_SELECTION_STALE");
2703
2706
  const absolutePath = import_node_path5.default.normalize(canonical);
2704
2707
  const registeredRelative = toPosixRelative(realRoot, absolutePath);
2705
- const claimedRelative = target.react.source?.relativePath ?? target.source.relativePath;
2706
2708
  if (claimedRelative !== void 0 && claimedRelative.split("\\").join("/") !== registeredRelative) {
2707
2709
  deny("ASK_SELECTION_STALE");
2708
2710
  }
@@ -3620,8 +3622,10 @@ function createConfiguredKeyAskExecutors(options) {
3620
3622
 
3621
3623
  // src/contextual-ask/executors.ts
3622
3624
  function composeContextualAskExecutors(options) {
3625
+ const { codex, claudeCode } = options.managed;
3626
+ const preference = options.defaultExecutor?.kind;
3623
3627
  return Object.freeze(
3624
- options.defaultExecutor?.kind === "managed-codex" ? [options.managedCodex, ...options.configuredKey] : [...options.configuredKey, options.managedCodex]
3628
+ preference === "managed-codex" ? [codex, claudeCode, ...options.configuredKey] : preference === "claude-code" ? [claudeCode, codex, ...options.configuredKey] : [...options.configuredKey, codex, claudeCode]
3625
3629
  );
3626
3630
  }
3627
3631
 
@@ -4247,17 +4251,14 @@ function freezeMatchedRule(rule) {
4247
4251
  });
4248
4252
  }
4249
4253
  function targetIdentity(target) {
4250
- const source = target.source;
4251
- if (source.fileId !== void 0 && source.line !== void 0 && source.column !== void 0) {
4252
- return `source:${source.fileId}:${String(source.line)}:${String(source.column)}`;
4253
- }
4254
- return [
4255
- "element",
4256
- source.origin,
4257
- source.relativePath ?? "",
4254
+ if (target.element.instance !== void 0)
4255
+ return `instance:${target.element.instance.id}`;
4256
+ return JSON.stringify([
4257
+ target.page?.url ?? "",
4258
+ target.source,
4258
4259
  target.element.selector,
4259
4260
  target.element.sanitizedHtml
4260
- ].join("\0");
4261
+ ]);
4261
4262
  }
4262
4263
  async function authorizeTarget(target, input) {
4263
4264
  const source = await authorizeSourceRef(target.source, input.registry, input.root);
@@ -4294,6 +4295,19 @@ async function authorizeTarget(target, input) {
4294
4295
  ...reactSource === void 0 ? {} : { source: reactSource }
4295
4296
  }),
4296
4297
  element: Object.freeze({
4298
+ ...target.element.instance === void 0 ? {} : {
4299
+ instance: Object.freeze({
4300
+ ...target.element.instance,
4301
+ label: (0, import_shared15.redactSensitiveText)(target.element.instance.label).slice(
4302
+ 0,
4303
+ import_shared15.ELEMENT_INSTANCE_LIMITS.labelCharacters
4304
+ ),
4305
+ context: (0, import_shared15.redactSensitiveText)(target.element.instance.context).slice(
4306
+ 0,
4307
+ import_shared15.ELEMENT_INSTANCE_LIMITS.contextCharacters
4308
+ )
4309
+ })
4310
+ },
4297
4311
  tagName: target.element.tagName,
4298
4312
  selector: target.element.selector,
4299
4313
  sanitizedHtml: target.element.sanitizedHtml,
@@ -5815,9 +5829,9 @@ function parseContextualAsk(value) {
5815
5829
  throw new TypeError("The SpotPatch contextual Ask transport is invalid.");
5816
5830
  }
5817
5831
  const preference = value.defaultExecutor;
5818
- if (preference.kind === "managed-codex" && hasExactKeys(preference, ["kind"])) {
5832
+ if ((preference.kind === "managed-codex" || preference.kind === "claude-code") && hasExactKeys(preference, ["kind"])) {
5819
5833
  return Object.freeze({
5820
- defaultExecutor: Object.freeze({ kind: "managed-codex" })
5834
+ defaultExecutor: Object.freeze({ kind: preference.kind })
5821
5835
  });
5822
5836
  }
5823
5837
  if (preference.kind === "configured-key" && hasExactKeys(preference, ["kind", "modelProfileId", "providerProfileId"]) && typeof preference.providerProfileId === "string" && typeof preference.modelProfileId === "string") {
@@ -5909,7 +5923,7 @@ async function createDevelopmentSession(input) {
5909
5923
  environment: input.environment,
5910
5924
  ...preference
5911
5925
  }),
5912
- managedCodex: input.createManagedAskExecutor(),
5926
+ managed: input.createManagedAskExecutors(),
5913
5927
  ...preference
5914
5928
  })
5915
5929
  });