@wrongstack/runtime 0.310.0 → 0.313.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.
@@ -39,6 +39,15 @@ export interface LightSubagentFactoryDeps {
39
39
  * The host owns this hook; it is not exposed through the agent's tools.
40
40
  */
41
41
  installToolBoundary?: ((pipelines: import('@wrongstack/core/agent').AgentPipelines) => void) | undefined;
42
+ /**
43
+ * Optional hook runner applied to the subagent's ToolExecutor so worker
44
+ * edits honor the WrongTrace lock gate like the leader's. The host owns
45
+ * this runner (typically a dedicated WrongTrace-only HookRunner with a
46
+ * per-process session id); `undefined` means pre-gate behavior, never an
47
+ * error. Mirrors the CLI host factory's `host.deps.hookRunner` thread at
48
+ * packages/cli/src/fleet/host-subagent-factory.ts.
49
+ */
50
+ hookRunner?: import('@wrongstack/core/hooks').HookRunner | undefined;
42
51
  }
43
52
  /**
44
53
  * Retrieve and abort a light subagent's AbortController (stored in ctx.meta
package/dist/index.js CHANGED
@@ -473,6 +473,11 @@ import {
473
473
  import { EventBus, TOKENS as TOKENS2 } from "@wrongstack/core/kernel";
474
474
  import { ToolRegistry } from "@wrongstack/core/registry";
475
475
  import { AutoApprovePermissionPolicy, WIDE_SUBAGENT_CAPABILITIES } from "@wrongstack/core/security";
476
+ import {
477
+ getProxyConfig,
478
+ rewriteBaseUrl,
479
+ shouldRewriteFor
480
+ } from "@wrongstack/core/wiring/proxy-rewrite";
476
481
  var SUBAGENT_BASELINE = "You are a subagent executing one delegated task end-to-end. Work autonomously with your tools; do not ask for confirmation on routine in-project actions. Complete only the assigned task: if you notice problems outside it, report them in your result instead of fixing them. Keep output concise.";
477
482
  var _SUBAGENT_ABORT = "wrongstack:subagent-abort-controller";
478
483
  function abortLightSubagent(agent) {
@@ -574,7 +579,11 @@ function makeLightSubagentFactory(deps) {
574
579
  // in ctx.meta and can satisfy the same gate its leader was held to.
575
580
  // Every ToolExecutor host must resolve this identically — see
576
581
  // packages/cli/src/wiring/pipeline.ts.
577
- requireKanbanGovernance: config.tools?.kanbanGovernance ?? false
582
+ requireKanbanGovernance: config.tools?.kanbanGovernance ?? false,
583
+ // WrongTrace lock gate — worker edits honor peer locks exactly like
584
+ // the leader's, when the host supplies a hookRunner (see
585
+ // LightSubagentFactoryDeps). Absent runner = pre-gate behavior.
586
+ ...deps.hookRunner ? { hookRunner: deps.hookRunner } : {}
578
587
  });
579
588
  const agent = new Agent({
580
589
  container: deps.container,
@@ -634,17 +643,22 @@ function filterToolList(registry, allow) {
634
643
  return selected;
635
644
  }
636
645
  function buildProvider(registry, config, providerId, model) {
637
- const providerConfig = config.providers?.[providerId] ?? {
638
- type: providerId,
639
- apiKey: config.apiKey,
640
- baseUrl: config.baseUrl
646
+ const savedProviderCfg = config.providers?.[providerId];
647
+ const factoryType = savedProviderCfg?.type ?? providerId;
648
+ const rawBaseUrl = savedProviderCfg?.baseUrl ?? config.baseUrl;
649
+ const proxiedBaseUrl = rawBaseUrl && shouldRewriteFor(factoryType) ? rewriteBaseUrl(rawBaseUrl, getProxyConfig().url) : rawBaseUrl;
650
+ const providerConfig = {
651
+ ...savedProviderCfg ?? {},
652
+ apiKey: savedProviderCfg?.apiKey ?? config.apiKey,
653
+ baseUrl: proxiedBaseUrl,
654
+ type: providerId
641
655
  };
642
- if (!registry.has(providerId)) {
656
+ if (!registry.has(factoryType)) {
643
657
  throw new Error(
644
- `No provider factory registered for "${providerId}" \u2014 cannot build a subagent provider for the SDD run.`
658
+ `No provider factory registered for "${factoryType}" (provider "${providerId}") \u2014 cannot build a subagent provider for the SDD run.`
645
659
  );
646
660
  }
647
- return registry.create({ ...providerConfig, type: providerId, model });
661
+ return registry.create({ ...providerConfig, type: factoryType, model }, factoryType);
648
662
  }
649
663
  async function resolveReasoningConfig(registry, providerId, modelId) {
650
664
  if (!registry) return void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/runtime",
3
- "version": "0.310.0",
3
+ "version": "0.313.0",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack default runtime implementations and host-level composition helpers built on @wrongstack/core.",
6
6
  "repository": {
@@ -64,16 +64,17 @@
64
64
  "README.md"
65
65
  ],
66
66
  "dependencies": {
67
- "@wrongstack/core": "0.310.0",
68
- "@wrongstack/kanban": "0.310.0",
69
- "@wrongstack/sage": "0.310.0",
70
- "@wrongstack/governance": "0.310.0",
71
- "@wrongstack/vector-memory": "0.310.0",
72
- "@wrongstack/tools": "0.310.0"
67
+ "@wrongstack/kanban": "0.313.0",
68
+ "@wrongstack/sage": "0.313.0",
69
+ "@wrongstack/governance": "0.313.0",
70
+ "@wrongstack/core": "0.313.0",
71
+ "@wrongstack/tools": "0.313.0",
72
+ "@wrongstack/vector-memory": "0.313.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/node": "^26.2.0",
76
- "typescript": "^7.0.2"
76
+ "typescript": "^7.0.2",
77
+ "@wrongstack/wrongtrace": "0.313.0"
77
78
  },
78
79
  "publishConfig": {
79
80
  "access": "public"