pi-fabric 0.62.6 → 0.62.8

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.
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-7B55UIZL.js";
19
19
  import {
20
20
  NESTED_TOOL_CALL_ID_PREFIX
21
- } from "./chunk-DY2S56WR.js";
21
+ } from "./chunk-IAAKH5GZ.js";
22
22
  import {
23
23
  runAbortable,
24
24
  throwIfAborted
@@ -2447,4 +2447,4 @@ export {
2447
2447
  resolveFabricIdentity,
2448
2448
  MainAgentController
2449
2449
  };
2450
- //# sourceMappingURL=chunk-NDDVM5F7.js.map
2450
+ //# sourceMappingURL=chunk-GWDVAULL.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-LMAVZN7J.js";
8
8
  import {
9
9
  FABRIC_NESTED_TOOL_CALL_ID_PREFIX
10
- } from "./chunk-FPHSJZZE.js";
10
+ } from "./chunk-X32MQBTA.js";
11
11
  import {
12
12
  stableJsonHash
13
13
  } from "./chunk-22RY7UMR.js";
@@ -1097,4 +1097,4 @@ export {
1097
1097
  NESTED_TOOL_CALL_ID_PREFIX,
1098
1098
  ActionRegistry
1099
1099
  };
1100
- //# sourceMappingURL=chunk-DY2S56WR.js.map
1100
+ //# sourceMappingURL=chunk-IAAKH5GZ.js.map
@@ -3,6 +3,15 @@ var FABRIC_PROVIDER_REGISTER_EVENT = "pi-fabric:provider:register:v1";
3
3
  var FABRIC_PROVIDER_DISCOVER_EVENT = "pi-fabric:provider:discover:v1";
4
4
  var FABRIC_COMPONENT_REGISTER_EVENT = "pi-fabric:component:register:v1";
5
5
  var FABRIC_COMPONENT_DISCOVER_EVENT = "pi-fabric:component:discover:v1";
6
+ var FABRIC_PREWALK_REQUEST_EVENT = "pi-fabric:prewalk:request:v1";
7
+ var readFabricPrewalkRequestV1 = (value) => {
8
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
9
+ const record = value;
10
+ if (record.version !== 1 || typeof record.context !== "object" || record.context === null || typeof record.claim !== "function" || typeof record.respond !== "function") {
11
+ return void 0;
12
+ }
13
+ return value;
14
+ };
6
15
  var FABRIC_NESTED_TOOL_CALL_ID_PREFIX = "fabric_";
7
16
  var FABRIC_TOOL_RESULT_PROXY_KIND = "pi-fabric.tool-result-proxy.v1";
8
17
  var readFabricToolResultProxyDetailsV1 = (value) => {
@@ -19,8 +28,10 @@ export {
19
28
  FABRIC_PROVIDER_DISCOVER_EVENT,
20
29
  FABRIC_COMPONENT_REGISTER_EVENT,
21
30
  FABRIC_COMPONENT_DISCOVER_EVENT,
31
+ FABRIC_PREWALK_REQUEST_EVENT,
32
+ readFabricPrewalkRequestV1,
22
33
  FABRIC_NESTED_TOOL_CALL_ID_PREFIX,
23
34
  FABRIC_TOOL_RESULT_PROXY_KIND,
24
35
  readFabricToolResultProxyDetailsV1
25
36
  };
26
- //# sourceMappingURL=chunk-FPHSJZZE.js.map
37
+ //# sourceMappingURL=chunk-X32MQBTA.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/protocol.ts"],
4
+ "sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\n\nexport const FABRIC_PROVIDER_REGISTER_EVENT = \"pi-fabric:provider:register:v1\";\nexport const FABRIC_PROVIDER_DISCOVER_EVENT = \"pi-fabric:provider:discover:v1\";\nexport const FABRIC_COMPONENT_REGISTER_EVENT = \"pi-fabric:component:register:v1\";\nexport const FABRIC_COMPONENT_DISCOVER_EVENT = \"pi-fabric:component:discover:v1\";\nexport const FABRIC_PREWALK_REQUEST_EVENT = \"pi-fabric:prewalk:request:v1\";\n\nexport type FabricPrewalkRequestResultV1 =\n | { ok: true }\n | { ok: false; error: string };\n\n/** Host-local request used by queue extensions that need an acknowledged prewalk arm. */\nexport interface FabricPrewalkRequestV1 {\n version: 1;\n context: ExtensionContext;\n claim: () => boolean;\n respond: (result: FabricPrewalkRequestResultV1) => void;\n}\n\nexport const readFabricPrewalkRequestV1 = (\n value: unknown,\n): FabricPrewalkRequestV1 | undefined => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined;\n const record = value as Record<string, unknown>;\n if (\n record.version !== 1 ||\n typeof record.context !== \"object\" ||\n record.context === null ||\n typeof record.claim !== \"function\" ||\n typeof record.respond !== \"function\"\n ) {\n return undefined;\n }\n return value as FabricPrewalkRequestV1;\n};\n\n/** Identifies host-side tool lifecycle events replayed for a nested Fabric call. */\nexport const FABRIC_NESTED_TOOL_CALL_ID_PREFIX = \"fabric_\";\n\n/** Discriminant for the transient details envelope on a proxied provider result. */\nexport const FABRIC_TOOL_RESULT_PROXY_KIND = \"pi-fabric.tool-result-proxy.v1\";\n\n/**\n * Host-only middleware details for non-Pi Fabric providers. `result` is the\n * exact value before maxNestedResultChars is enforced and is not persisted as\n * a separate Pi tool-result message.\n */\nexport interface FabricToolResultProxyDetailsV1 {\n kind: typeof FABRIC_TOOL_RESULT_PROXY_KIND;\n ref: string;\n result: unknown;\n}\n\nexport const readFabricToolResultProxyDetailsV1 = (\n value: unknown,\n): FabricToolResultProxyDetailsV1 | undefined => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return undefined;\n const record = value as Record<string, unknown>;\n if (\n record.kind !== FABRIC_TOOL_RESULT_PROXY_KIND ||\n typeof record.ref !== \"string\" ||\n !Object.prototype.hasOwnProperty.call(record, \"result\")\n ) {\n return undefined;\n }\n return record as unknown as FabricToolResultProxyDetailsV1;\n};\n\nexport type FabricRisk = \"read\" | \"write\" | \"execute\" | \"network\" | \"agent\";\nexport type FabricEffectKind = \"none\" | \"scoped\" | \"transactional\" | \"emission\";\nexport type FabricEffectOrdering = \"commutative\" | \"ordered\" | \"unknown\";\n\nexport interface FabricActionEffect {\n kind: FabricEffectKind;\n resources?: string[];\n ordering?: FabricEffectOrdering;\n}\nexport type FabricActivityEntityKind =\n | \"agent\"\n | \"actor\"\n | \"tool\"\n | \"extension\"\n | \"mcp\"\n | \"mesh\"\n | \"task\"\n | \"custom\";\n\nexport type FabricInvocationActivityUpdate =\n | { type: \"progress\"; message: string }\n | { type: \"entity\"; id: string; kind: FabricActivityEntityKind; name?: string }\n | { type: \"metrics\"; tokens?: number; toolCalls?: number; cost?: number };\n\nexport interface FabricMediaBlock {\n type: \"image\";\n data: string;\n mimeType: string;\n}\n\nexport interface FabricActionDescriptor {\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n outputSchema?: Record<string, unknown>;\n risk: FabricRisk;\n namespace?: string;\n effect?: FabricActionEffect;\n}\n\nexport interface FabricCapabilityActionHead {\n key: string;\n parentKey: string;\n ref: string;\n name: string;\n description: string;\n descriptorHash: string;\n risk: FabricRisk;\n namespace?: string;\n effect?: FabricActionEffect;\n}\n\nexport interface FabricCapabilityProviderHead {\n key: string;\n parentKey: string;\n name: string;\n description: string;\n descriptorHash: string;\n actions: FabricCapabilityActionHead[];\n}\n\nexport interface FabricCapabilityBindingView {\n ref: string;\n provider: string;\n providerBindingId: string;\n generation: number;\n descriptorHash: string;\n}\n\nexport interface FabricCommittedCapabilityView {\n id: string;\n /** Runtime-local digest including provider binding generations. */\n digest: string;\n /** Portable digest of exact refs and descriptor semantics across runtimes. */\n semanticDigest: string;\n bindings: Record<string, FabricCapabilityBindingView>;\n}\n\nexport interface FabricCapabilityResolution {\n satisfied: boolean;\n missing: string[];\n optionalMissing: string[];\n view?: FabricCommittedCapabilityView;\n}\n\nexport interface FabricCapabilityCatalog {\n kind: \"pi-fabric.capability-catalog\";\n version: 1;\n root: {\n key: \"capability:fabric\";\n name: \"Fabric capabilities\";\n description: string;\n descriptorHash: string;\n };\n providers: FabricCapabilityProviderHead[];\n totalActions: number;\n indexedActions: number;\n complete: boolean;\n reasons: string[];\n}\n\nexport interface FabricProviderListRequest {\n namespace?: string;\n query?: string;\n limit?: number;\n}\n\n/** One named action whose arguments should be typed in guest declarations. */\nexport interface FabricNamedActionTypeSource {\n name: string;\n inputSchema: Record<string, unknown>;\n}\n\n/** One MCP server plus the tools to type for `mcp.<server>.*` guest calls. */\nexport interface FabricMcpServerTypeSource {\n server: string;\n tools: FabricNamedActionTypeSource[];\n}\n\n/**\n * Live descriptor snapshot the registry hands to the guest declaration\n * builder so dynamic surfaces (mcp, extensions) get argument checking before\n * the sandbox runs. Empty/absent sections keep the loose static declarations.\n */\nexport interface FabricGuestTypeSources {\n mcpServers?: FabricMcpServerTypeSource[];\n extensionTools?: FabricNamedActionTypeSource[];\n}\n\n/**\n * Pre-rendered `declare const` blocks replacing the loose mcp/extensions\n * declaration lines. Values are full replacement text (helpers + declare).\n */\nexport interface FabricDynamicGuestDeclarations {\n mcp?: string;\n extensions?: string;\n}\n\nexport interface FabricInvocationContext {\n cwd: string;\n signal: AbortSignal | undefined;\n parentToolCallId: string;\n nestedToolCallId: string;\n extensionContext: ExtensionContext;\n update(message: string): void;\n activity?(update: FabricInvocationActivityUpdate): void;\n /** Host-supplied inside fabric_exec so agents.handoff schedules the outer-call boundary. */\n deferHandoff?(args: Record<string, unknown>): Record<string, unknown>;\n // Out-of-band image content blocks a provider (currently only pi.read of an\n // image file) wants attached to the call audit, so the single-call render can\n // re-attach them to the fabric_exec result content for pi core's kitty image\n // preview. Bypasses the result char bound that would truncate the base64.\n // `note` is the read tool's own text output (e.g. \"Read image file [image/png]\"),\n // captured after any tool_result patch so a handoff that strips pi's\n // non-vision note has run; used as the single-call body + content text so the\n // preview shows the clean note instead of the swapped description.\n attachMedia?(blocks: FabricMediaBlock[], note?: string): void;\n // Providers call this after mutable tool_call middleware has run so live and\n // durable audit surfaces reflect the arguments actually passed to the tool.\n updateArguments?(args: Record<string, unknown>): void;\n // Ephemeral renderer-only metadata. It is exposed to live Fabric previews but\n // never projected into the durable execution trace.\n attachPreview?(preview: unknown): void;\n capabilityView?: FabricCommittedCapabilityView;\n /** Advisory for ordinary calls; strict components reject concurrent conflicting effects. */\n effectPolicy?: \"advisory\" | \"strict\";\n}\n\nexport interface FabricScopedProviderResult {\n value: unknown;\n dispose(): void | Promise<void>;\n}\n\nexport interface FabricProvider {\n name: string;\n description: string;\n list(\n request: FabricProviderListRequest,\n context: FabricInvocationContext,\n ): Promise<FabricActionDescriptor[]>;\n describe(\n actionName: string,\n context: FabricInvocationContext,\n ): Promise<FabricActionDescriptor | undefined>;\n prepareArguments?(\n actionName: string,\n args: Record<string, unknown>,\n context: FabricInvocationContext,\n ): Record<string, unknown> | Promise<Record<string, unknown>>;\n invoke(\n actionName: string,\n args: Record<string, unknown>,\n context: FabricInvocationContext,\n ): Promise<unknown>;\n acquire?(\n actionName: string,\n args: Record<string, unknown>,\n context: FabricInvocationContext,\n ): Promise<FabricScopedProviderResult>;\n invocationEnded?(parentToolCallId: string): Promise<void>;\n subscribeCatalog?(listener: () => void): () => void;\n close?(): Promise<void>;\n}\n\nexport interface FabricProviderRegistration {\n version: 1;\n provider: FabricProvider;\n overwrite?: boolean;\n}\n\nexport interface FabricProviderDiscovery {\n version: 1;\n register(provider: FabricProvider, options?: { overwrite?: boolean }): void;\n}\n\nexport type {\n FabricCapabilityRequirement,\n FabricComponentChildOptions,\n FabricComponentContext,\n FabricComponentDefinition,\n FabricComponentDiscovery,\n FabricComponentDisposer,\n FabricComponentEffect,\n FabricComponentEffectConflict,\n FabricComponentEffectInfo,\n FabricComponentEffectOptions,\n FabricComponentEffectRegistration,\n FabricComponentEntry,\n FabricComponentGraph,\n FabricComponentGuarantee,\n FabricComponentHandle,\n FabricComponentInfo,\n FabricComponentProviderLease,\n FabricModelGuidance,\n FabricModelGuidanceInfo,\n FabricModelGuidancePlacement,\n FabricModelGuidanceTarget,\n FabricComponentProvision,\n FabricComponentRegistration,\n FabricComponentState,\n FabricComponentStopOptions,\n} from \"./components/types.js\";\n\nexport {\n FABRIC_EXECUTION_GUIDANCE_SLOT,\n MAX_FABRIC_MODEL_GUIDANCE_CONTENT_CHARS,\n MAX_FABRIC_MODEL_GUIDANCE_PER_COMPONENT,\n MAX_FABRIC_MODEL_GUIDANCE_REGISTRATIONS,\n MAX_FABRIC_MODEL_GUIDANCE_SNAPSHOT_CHARS,\n MAX_FABRIC_MODEL_GUIDANCE_TOTAL_CHARS,\n} from \"./components/model-guidance.js\";\n"],
5
+ "mappings": ";AAEO,IAAM,iCAAiC;AACvC,IAAM,iCAAiC;AACvC,IAAM,kCAAkC;AACxC,IAAM,kCAAkC;AACxC,IAAM,+BAA+B;AAcrC,IAAM,6BAA6B,CACxC,UACuC;AACvC,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,EAAG,QAAO;AAChF,QAAM,SAAS;AACf,MACE,OAAO,YAAY,KACnB,OAAO,OAAO,YAAY,YAC1B,OAAO,YAAY,QACnB,OAAO,OAAO,UAAU,cACxB,OAAO,OAAO,YAAY,YAC1B;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAGO,IAAM,oCAAoC;AAG1C,IAAM,gCAAgC;AAatC,IAAM,qCAAqC,CAChD,UAC+C;AAC/C,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,EAAG,QAAO;AAChF,QAAM,SAAS;AACf,MACE,OAAO,SAAS,iCAChB,OAAO,OAAO,QAAQ,YACtB,CAAC,OAAO,UAAU,eAAe,KAAK,QAAQ,QAAQ,GACtD;AACA,WAAO;AAAA,EACT;AACA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -27,7 +27,7 @@ import {
27
27
  runFabricHandoffAtBoundary,
28
28
  sameConfigLayers,
29
29
  statConfigLayers
30
- } from "./chunk-NDDVM5F7.js";
30
+ } from "./chunk-GWDVAULL.js";
31
31
  import {
32
32
  sanitizeMcpRefPart
33
33
  } from "./chunk-IGVDD2HT.js";
@@ -102,7 +102,7 @@ import {
102
102
  import "./chunk-4VEGQHZO.js";
103
103
  import {
104
104
  ActionRegistry
105
- } from "./chunk-DY2S56WR.js";
105
+ } from "./chunk-IAAKH5GZ.js";
106
106
  import {
107
107
  runAbortable,
108
108
  throwIfAborted
@@ -115,7 +115,7 @@ import {
115
115
  FABRIC_PROVIDER_DISCOVER_EVENT,
116
116
  FABRIC_TOOL_RESULT_PROXY_KIND,
117
117
  readFabricToolResultProxyDetailsV1
118
- } from "./chunk-FPHSJZZE.js";
118
+ } from "./chunk-X32MQBTA.js";
119
119
  import {
120
120
  MAX_FABRIC_MODEL_GUIDANCE_PER_COMPONENT,
121
121
  MAX_FABRIC_MODEL_GUIDANCE_REGISTRATIONS,
@@ -11061,4 +11061,4 @@ var deepAssign = (target, source) => {
11061
11061
  export {
11062
11062
  FabricRuntimeState
11063
11063
  };
11064
- //# sourceMappingURL=fabric-runtime-state-XXAABN22.js.map
11064
+ //# sourceMappingURL=fabric-runtime-state-CY3V6Y7M.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fabric.d.ts","sourceRoot":"","sources":["../../src/commands/fabric.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAE3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAI9D,UAAU,iBAAiB;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,aAAa,EAAE,mBAAmB,CAAC;IACnC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,0BAA0B,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAmFD,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAwkBrF"}
1
+ {"version":3,"file":"fabric.d.ts","sourceRoot":"","sources":["../../src/commands/fabric.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAE3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAS9D,UAAU,iBAAiB;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,aAAa,EAAE,mBAAmB,CAAC;IACnC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,0BAA0B,CAAC,EAAE,MAAM,IAAI,CAAC;IACxC,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAwHD,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI,CA6jBrF"}
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ActionRegistry,
3
3
  NESTED_TOOL_CALL_ID_PREFIX
4
- } from "../chunks/chunk-DY2S56WR.js";
4
+ } from "../chunks/chunk-IAAKH5GZ.js";
5
5
  import "../chunks/chunk-7TB7NXSL.js";
6
6
  import "../chunks/chunk-LMAVZN7J.js";
7
- import "../chunks/chunk-FPHSJZZE.js";
7
+ import "../chunks/chunk-X32MQBTA.js";
8
8
  import "../chunks/chunk-22RY7UMR.js";
9
9
  import "../chunks/chunk-HFYEEIXR.js";
10
10
  export {
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  settleInPlacePrewalk,
23
23
  toMcpAdvisoryDescriptor,
24
24
  withTrajectoryRearmDirective
25
- } from "./chunks/chunk-NDDVM5F7.js";
25
+ } from "./chunks/chunk-GWDVAULL.js";
26
26
  import {
27
27
  sanitizeMcpRefPart
28
28
  } from "./chunks/chunk-IGVDD2HT.js";
@@ -103,18 +103,20 @@ import {
103
103
  } from "./chunks/chunk-4VEGQHZO.js";
104
104
  import {
105
105
  NESTED_TOOL_CALL_ID_PREFIX
106
- } from "./chunks/chunk-DY2S56WR.js";
106
+ } from "./chunks/chunk-IAAKH5GZ.js";
107
107
  import "./chunks/chunk-7TB7NXSL.js";
108
108
  import "./chunks/chunk-LMAVZN7J.js";
109
109
  import {
110
110
  FABRIC_COMPONENT_DISCOVER_EVENT,
111
111
  FABRIC_COMPONENT_REGISTER_EVENT,
112
112
  FABRIC_NESTED_TOOL_CALL_ID_PREFIX,
113
+ FABRIC_PREWALK_REQUEST_EVENT,
113
114
  FABRIC_PROVIDER_DISCOVER_EVENT,
114
115
  FABRIC_PROVIDER_REGISTER_EVENT,
115
116
  FABRIC_TOOL_RESULT_PROXY_KIND,
117
+ readFabricPrewalkRequestV1,
116
118
  readFabricToolResultProxyDetailsV1
117
- } from "./chunks/chunk-FPHSJZZE.js";
119
+ } from "./chunks/chunk-X32MQBTA.js";
118
120
  import {
119
121
  FABRIC_EXECUTION_GUIDANCE_SLOT,
120
122
  MAX_FABRIC_MODEL_GUIDANCE_CONTENT_CHARS,
@@ -686,8 +688,51 @@ var resolvePrewalkModel = async (state, context) => {
686
688
  }
687
689
  return context.ui.select("Prewalk executor model", keys);
688
690
  };
691
+ var armPrewalk = async (state, context, pi, task = "") => {
692
+ if (!state.config.fullCodeMode || state.config.schema.mode === "enforce") {
693
+ const error = "Fabric prewalk requires full code mode and Schema enforce mode disabled.";
694
+ context.ui.notify(error, "error");
695
+ return { ok: false, error };
696
+ }
697
+ if (state.config.prewalk.mode === "trajectory" && !state.config.agents.enabled) {
698
+ const error = "Trajectory prewalk requires enabled agents. Choose in-place mode or enable agents.";
699
+ context.ui.notify(error, "error");
700
+ return { ok: false, error };
701
+ }
702
+ const model = await resolvePrewalkModel(state, context);
703
+ if (!model) return { ok: false, error: "Fabric prewalk was not armed." };
704
+ await armFabricPrewalkSession(state, context, pi, {
705
+ model,
706
+ ...task ? { task } : {}
707
+ });
708
+ const modeLabel = state.config.prewalk.mode === "in-place" ? "Main will continue in place" : "the trajectory will move to a visible child executor";
709
+ context.ui.notify(
710
+ task ? `Fabric prewalk armed for the next matching Fabric boundary; ${modeLabel} with ${model}${state.config.prewalk.alwaysRearm ? "; always re-arm enabled" : ""}` : `Fabric prewalk armed for the next task; ${modeLabel} with ${model}${state.config.prewalk.alwaysRearm ? "; always re-arm enabled" : ""}`,
711
+ "info"
712
+ );
713
+ if (task) pi.sendUserMessage(task);
714
+ return { ok: true };
715
+ };
689
716
  function registerFabricCommand(pi, deps) {
690
717
  const { state, fabricUi, capturedTools, applyFabricMode, suspendToolCapture } = deps;
718
+ const unsubscribePrewalkRequests = pi.events?.on?.(FABRIC_PREWALK_REQUEST_EVENT, (value) => {
719
+ const request = readFabricPrewalkRequestV1(value);
720
+ if (!request || !request.claim()) return;
721
+ void (async () => {
722
+ try {
723
+ await state.ensure(request.context);
724
+ request.respond(await armPrewalk(state, request.context, pi));
725
+ } catch (error) {
726
+ request.respond({
727
+ ok: false,
728
+ error: error instanceof Error ? error.message : String(error)
729
+ });
730
+ }
731
+ })();
732
+ });
733
+ if (unsubscribePrewalkRequests) {
734
+ pi.on("session_shutdown", () => unsubscribePrewalkRequests());
735
+ }
691
736
  pi.registerCommand("fabric", {
692
737
  description: "Open Fabric, arm prewalk, reload, or manage agents and actors",
693
738
  getArgumentCompletions: (argumentPrefix) => {
@@ -838,33 +883,8 @@ Task: ${status.task}` : ""}`,
838
883
  );
839
884
  return;
840
885
  }
841
- if (!state.config.fullCodeMode || state.config.schema.mode === "enforce") {
842
- context.ui.notify(
843
- "Fabric prewalk requires full code mode and Schema enforce mode disabled.",
844
- "error"
845
- );
846
- return;
847
- }
848
- if (state.config.prewalk.mode === "trajectory" && !state.config.agents.enabled) {
849
- context.ui.notify(
850
- "Trajectory prewalk requires enabled agents. Choose in-place mode or enable agents.",
851
- "error"
852
- );
853
- return;
854
- }
855
- const model = await resolvePrewalkModel(state, context);
856
- if (!model) return;
857
886
  const task = argumentsText.trim().slice(command.length).trim();
858
- await armFabricPrewalkSession(state, context, pi, {
859
- model,
860
- ...task ? { task } : {}
861
- });
862
- const modeLabel = state.config.prewalk.mode === "in-place" ? "Main will continue in place" : "the trajectory will move to a visible child executor";
863
- context.ui.notify(
864
- task ? `Fabric prewalk armed for the next matching Fabric boundary; ${modeLabel} with ${model}${state.config.prewalk.alwaysRearm ? "; always re-arm enabled" : ""}` : `Fabric prewalk armed for the next task; ${modeLabel} with ${model}${state.config.prewalk.alwaysRearm ? "; always re-arm enabled" : ""}`,
865
- "info"
866
- );
867
- if (task) pi.sendUserMessage(task);
887
+ await armPrewalk(state, context, pi, task);
868
888
  return;
869
889
  }
870
890
  if (command === "dashboard" || command === "ui") {
@@ -3425,7 +3445,7 @@ var FabricState = class {
3425
3445
  return activation;
3426
3446
  }
3427
3447
  async #createRuntime() {
3428
- const module = await (this.#options.runtimeLoader?.() ?? import("./chunks/fabric-runtime-state-XXAABN22.js"));
3448
+ const module = await (this.#options.runtimeLoader?.() ?? import("./chunks/fabric-runtime-state-CY3V6Y7M.js"));
3429
3449
  return new module.FabricRuntimeState(
3430
3450
  this.pi,
3431
3451
  this.capturedTools,
@@ -4849,6 +4869,7 @@ export {
4849
4869
  FABRIC_EXECUTION_TRACE_MAX_BYTES,
4850
4870
  FABRIC_EXECUTION_TRACE_VERSION,
4851
4871
  FABRIC_NESTED_TOOL_CALL_ID_PREFIX,
4872
+ FABRIC_PREWALK_REQUEST_EVENT,
4852
4873
  FABRIC_PROVIDER_DISCOVER_EVENT,
4853
4874
  FABRIC_PROVIDER_REGISTER_EVENT,
4854
4875
  FABRIC_TOOL_RESULT_PROXY_KIND,
@@ -4868,6 +4889,7 @@ export {
4868
4889
  projectFabricAuditResult,
4869
4890
  readFabricExecutionRenderDetails,
4870
4891
  readFabricExecutionTraceV1,
4892
+ readFabricPrewalkRequestV1,
4871
4893
  readFabricToolResultProxyDetailsV1
4872
4894
  };
4873
4895
  //# sourceMappingURL=index.js.map