@robota-sdk/agent-product 3.0.6 → 3.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,101 @@
1
1
  # @robota-sdk/agent-product
2
2
 
3
+ ## 3.1.1
4
+ ### Patch Changes
5
+
6
+ - @robota-sdk/agent-framework@3.1.1
7
+ - @robota-sdk/agent-capability-pack@3.1.1
8
+ - @robota-sdk/agent-preset@3.1.1
9
+ - @robota-sdk/agent-core@3.1.1
10
+ - @robota-sdk/agent-interface-transport@3.1.1
11
+
12
+ ## 3.1.0
13
+ ### Minor Changes
14
+
15
+ - ee7f7ef: Make the main entries of `@robota-sdk/agent-tools`, `@robota-sdk/agent-framework`, `@robota-sdk/agent-command`, `@robota-sdk/agent-preset` and `@robota-sdk/agent-product` platform-neutral. They run unchanged in a browser, a Web Worker, Node, Deno and Bun, and no longer map `"browser": null` on `.`. Every package is now in exactly one of ARCHITECTURE.md's three platform lists; the "Not yet neutral" list is gone.
16
+
17
+ - `@robota-sdk/agent-tools` no longer re-exports `GrepIsolationError`, `ReadByteLimitError`, `ReadCancelledError`, `createBashTool`, `createEditTool`, `createGlobTool`, `createGrepTool`, `createReadTool`, `createShellTool`, `createWriteTool` and `webFetchTool` from its main entry. They are on `@robota-sdk/agent-tools/node` only, which is where `@robota-sdk/workflows` 0.0.4 imports them.
18
+ - The five packages build once into `dist` (not `dist/node`) and their `exports` map `import` and `require` only. A Node-only subpath keeps `"browser": null`: `./node` on `agent-tools`, `agent-framework`, `agent-command` and `agent-preset`, and `./testing` on `agent-framework`. Specifiers and the code behind them are unchanged; only a deep import of `dist/node/*` breaks.
19
+ - `/user-local` and `executeUserLocalDirectCommand` read and write their storage root through an injected file system, as `/doctor` does through `doctorDeps`: `createUserLocalCommandModule(storageRoot, fsAsync)`, the `userLocalFileSystem` option of `createDefaultCommandModules` and the `fsAsync` option of `executeUserLocalDirectCommand`. They no longer import `NodeFileSystemAsync` themselves, and absent a file system the command is listed and answers that it is unavailable on this host; nothing is read or written.
20
+ - `@robota-sdk/agent-cli` passes `new NodeFileSystemAsync()` from `@robota-sdk/agent-framework/node` for both, so `/user-local` and `agent user-local` behave as before.
21
+ - 7ce5e73: Add the framework host and make `host` and `cwd` required wherever the framework builds a session. The host is passed and accepted but nothing reads it yet, so behaviour is unchanged.
22
+
23
+ - `@robota-sdk/agent-framework`: `IFrameworkHost` lists what a platform lends the framework (home directory, workspace resolver, path canonicalizer, exit flush, environment, files, git, git remotes, hook executors, background task runners, default tools, observer failure report, async scope, project mutation support). Every member is optional and an absent one means the capability is off, so `{}` is a valid host. `IAsyncScope` is the port behind `createAsyncScope`.
24
+ - `@robota-sdk/agent-framework/node` (new, `"browser": null`) exports `createNodeFrameworkHost({ createDefaultTools })`, which fills every member for a Node process. The composition root names `createDefaultTools` from `@robota-sdk/agent-tool-defaults`; pass `() => []` for sessions with no default tier. `@robota-sdk/agent-framework/testing` exports `createTestFrameworkHost(overrides?)`, the same host with the real default tools, where an override replaces a member and an explicit `undefined` removes it.
25
+ - `host` is required on `InteractiveSession` (both construction shapes, so on `buildRuntimeSession` and `startRuntimeHost` too), `createSession`, `createSubagentSession`, `createQuery`, `createAgentRuntime` and `createStatelessRuntime`, and on the options of `createInteractiveRuntime`, `createProgrammaticAgent`, `HeadlessInteractionChannel` and an in-process subagent runner. A missing `host` throws at construction, naming `createNodeFrameworkHost`.
26
+ - `cwd` is required, and absolute as it already had to be, on `createSession`, `createQuery`, `createStatelessRuntime` and an injected-session `InteractiveSession`. The `process.cwd()` fallback is gone: a caller that relied on it passes `process.cwd()` itself.
27
+ - `@robota-sdk/agent-cli`: `startCliCore` takes the host as its second argument and `runPrintMode` as its second after the product runtime; `startCli` and the headless entry build it with `createNodeFrameworkHost`. `IRunEvalDeps.host` is required unless `runFn` is given.
28
+ - `@robota-sdk/agent-subagent-runner`: `ISubagentWorkerComposition.host` is required; the worker builds its child session on it, and the product's composition supplies it.
29
+ - `@robota-sdk/agent-ui-terminal`: `IRenderOptions` and `ITuiInteractionChannelOptions` take `host`.
30
+ - `@robota-sdk/agent-command`, `@robota-sdk/agent-product`: their tests and scenario scripts pass a host; no published surface changes.
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [bc8de21]
35
+ - Updated dependencies [51ad6a4]
36
+ - Updated dependencies [d46727b]
37
+ - Updated dependencies [bc8de21]
38
+ - Updated dependencies [bc8de21]
39
+ - Updated dependencies [bc8de21]
40
+ - Updated dependencies [bc8de21]
41
+ - Updated dependencies [bc8de21]
42
+ - Updated dependencies [eabce48]
43
+ - Updated dependencies [bc8de21]
44
+ - Updated dependencies [eabce48]
45
+ - Updated dependencies [bc8de21]
46
+ - Updated dependencies [eabce48]
47
+ - Updated dependencies [bc8de21]
48
+ - Updated dependencies [82663df]
49
+ - Updated dependencies [bc8de21]
50
+ - Updated dependencies [bc8de21]
51
+ - Updated dependencies [04c3233]
52
+ - Updated dependencies [9bc13f9]
53
+ - Updated dependencies [830d3d2]
54
+ - Updated dependencies [0a677e9]
55
+ - Updated dependencies [a8c9e25]
56
+ - Updated dependencies [5b46d43]
57
+ - Updated dependencies [fab48ad]
58
+ - Updated dependencies [a2d36ea]
59
+ - Updated dependencies [ea0e424]
60
+ - Updated dependencies [ee7f7ef]
61
+ - Updated dependencies [a2d36ea]
62
+ - Updated dependencies [0fec62f]
63
+ - Updated dependencies [7ce5e73]
64
+ - Updated dependencies [a2d36ea]
65
+ - Updated dependencies [a2d36ea]
66
+ - Updated dependencies [0fec62f]
67
+ - Updated dependencies [be32d9b]
68
+ - Updated dependencies [a2d36ea]
69
+ - Updated dependencies [a2d36ea]
70
+ - Updated dependencies [a2d36ea]
71
+ - Updated dependencies [b7b6cd0]
72
+ - Updated dependencies [8069d0e]
73
+ - Updated dependencies [f5e3057]
74
+ - Updated dependencies [d8cb04f]
75
+ - Updated dependencies [42d595e]
76
+ - Updated dependencies [437ca9e]
77
+ - Updated dependencies [0a677e9]
78
+ - Updated dependencies [44e9640]
79
+ - Updated dependencies [b56b5a9]
80
+ - Updated dependencies [1c19435]
81
+ - Updated dependencies [4e4c92a]
82
+ - Updated dependencies [6ba10ef]
83
+ - @robota-sdk/agent-core@3.1.0
84
+ - @robota-sdk/agent-framework@3.1.0
85
+ - @robota-sdk/agent-preset@3.1.0
86
+ - @robota-sdk/agent-interface-transport@3.1.0
87
+ - @robota-sdk/agent-capability-pack@3.1.0
88
+
89
+ ## 3.0.7
90
+ ### Patch Changes
91
+
92
+ - Updated dependencies
93
+ - @robota-sdk/agent-framework@3.0.7
94
+ - @robota-sdk/agent-capability-pack@3.0.7
95
+ - @robota-sdk/agent-preset@3.0.7
96
+ - @robota-sdk/agent-core@3.0.7
97
+ - @robota-sdk/agent-interface-transport@3.0.7
98
+
3
99
  ## 3.0.6
4
100
  ### Patch Changes
5
101
 
package/README.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # @robota-sdk/agent-product
2
2
 
3
+ > **Version:** Platform support and entries described here target SDK 3.1.0. Install that
4
+ > release after publication; published 3.0.7 packages may have different exports and behavior.
5
+
3
6
  The **product-assembly kernel** for the Robota SDK.
4
7
 
5
8
  `assembleProduct(profile)` is a **pure, deterministic, IO-free fold** over an `IProductProfile` — the
6
9
  composition mechanism a third party imports to build their OWN product on Robota's published runtime.
7
10
  Product identity and its runtime settings are supplied by the host; an external repo can define its own profile.
11
+ The package is platform-neutral: it runs in a browser, a Web Worker, Node, Deno and Bun, and has no Node
12
+ adapter, so it has no `./node` subpath.
8
13
 
9
14
  ## Installation
10
15
 
@@ -15,7 +20,9 @@ npm install @robota-sdk/agent-product
15
20
  ## Usage
16
21
 
17
22
  ```ts
23
+ import { createNodeFrameworkHost } from '@robota-sdk/agent-framework/node';
18
24
  import { assembleProduct } from '@robota-sdk/agent-product';
25
+ import { createDefaultTools } from '@robota-sdk/agent-tool-defaults';
19
26
  import type { ICapabilityPack } from '@robota-sdk/agent-capability-pack';
20
27
  import type { IProviderDefinition } from '@robota-sdk/agent-core';
21
28
 
@@ -37,7 +44,9 @@ const product = assembleProduct({
37
44
  // The external repo binds product.buildRuntime(...) to ITS OWN presentation/transport.
38
45
  // A provider passed in the session options would take precedence over the constructed one.
39
46
  if (product.provider === undefined) throw new Error('no provider configured');
40
- const session = product.buildRuntime({ session: { cwd, provider: product.provider } });
47
+ // The platform the session runs on, and the directory it works in: the kernel assumes neither.
48
+ const host = createNodeFrameworkHost({ createDefaultTools });
49
+ const session = product.buildRuntime({ session: { host, cwd, provider: product.provider } });
41
50
  void product.acceptedPacks;
42
51
  void product.rejectedCapabilities;
43
52
  void product.rejectedPacks;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/product-profile.ts","../src/assemble-product.ts"],"mappings":";;;;;;;;;;;;;;;;UAwCiB;;EAGf;;EAEA;;EAEA;;;;;;EAQA,8BAA8B;;;;;;;;;;;EAW9B,mBAAmB;;;;;;EAMnB,WAAW;;EAEX,wBAAwB;;EAExB;;EAEA;;EAEA,+BAA+B;;EAE/B,6BAA6B;;;;;EAM7B,mBAAmB;;;;;;;;;;;;EAYnB,iBAAiB;;EAEjB;;;;;;EAMA,gBAAgB;;EAIhB,iBAAiB;;EAEjB,8BAA8B;;EAI9B,iCAAiC;;EAEjC,wBAAwB;;EAExB,aAAa,gCAAgC;;;;;;;UAQ9B;;;;;;EAMf,SAAS;;;;;;UAOM;;EAEf;EACA;EACA;;;;;;EAOA,WAAW;;EAEX,8BAA8B;;EAG9B,yBAAyB;;EAEzB,gBAAgB;;EAEhB,oBAAoB;;EAEpB,+BAA+B;;EAE/B,wBAAwB;;EAExB,wBAAwB;;;;;EAMxB,SAAS;;EAET,gBACE,YACA,UAAU,WAAW,yCAClB;;;;;;EAML;EACA,gBAAgB;;EAGhB,gCAAgC;EAChC,wBAAwB;EACxB,aAAa;;;;;;;;EASb,sBAAsB,OAAO,uBAAuB;;;;;;EAOpD,eAAe,OAAO,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCtC/B,gBAAgB,SAAS,kBAAkB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/product-profile.ts","../src/assemble-product.ts"],"mappings":";;;;;;;;;;;;;;;;UAwCiB;;EAGf;;EAEA;;EAEA;;;;;;EAQA,8BAA8B;;;;;;;;;;;EAW9B,mBAAmB;;;;;;EAMnB,WAAW;;EAEX,wBAAwB;;EAExB;;EAEA;;EAEA,+BAA+B;;EAE/B,6BAA6B;;;;;EAM7B,mBAAmB;;;;;;;;;;;;EAYnB,iBAAiB;;EAEjB;;;;;;EAMA,gBAAgB;;EAIhB,iBAAiB;;EAEjB,8BAA8B;;EAI9B,iCAAiC;;EAEjC,wBAAwB;;EAExB,aAAa,gCAAgC;;;;;;;UAQ9B;;;;;;EAMf,SAAS;;;;;;UAOM;;EAEf;EACA;EACA;;;;;;EAOA,WAAW;;EAEX,8BAA8B;;EAG9B,yBAAyB;;EAEzB,gBAAgB;;EAEhB,oBAAoB;;EAEpB,+BAA+B;;EAE/B,wBAAwB;;EAExB,wBAAwB;;;;;EAMxB,SAAS;;EAET,gBACE,YACA,UAAU,WAAW,yCAClB;;;;;;EAML;EACA,gBAAgB;;EAGhB,gCAAgC;EAChC,wBAAwB;EACxB,aAAa;;;;;;;;EASb,sBAAsB,OAAO,uBAAuB;;;;;;EAOpD,eAAe,OAAO,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCtC/B,gBAAgB,SAAS,kBAAkB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/assemble-product.ts"],"sourcesContent":["import { mergeCapabilityPacks } from '@robota-sdk/agent-capability-pack';\nimport { createProviderFromConfig } from '@robota-sdk/agent-core';\nimport { buildRuntimeSession } from '@robota-sdk/agent-framework';\nimport { createPresetRegistry } from '@robota-sdk/agent-preset';\n\nimport type { IAssembledProduct, IBuildRuntimeInput, IProductProfile } from './product-profile.js';\nimport type { TCompositionFieldPolicy } from '@robota-sdk/agent-capability-pack';\nimport type {\n FunctionTool,\n IAIProvider,\n IToolWithEventService,\n TPermissionMode,\n} from '@robota-sdk/agent-core';\nimport type {\n IAgentDefinition,\n ICommandHostAdapters,\n ICommandModule,\n TInteractiveSessionOptions,\n} from '@robota-sdk/agent-framework';\nimport type { IPresetRegistry, IResolvedPresetOptions } from '@robota-sdk/agent-preset';\n\nexport const PRODUCT_PROFILE_FIELD_POLICIES = {\n id: 'surfaced',\n agentName: 'surfaced',\n version: 'surfaced',\n providerDefinitions: 'consumed-and-surfaced',\n providerSettings: 'consumed',\n provider: 'consumed-and-surfaced',\n providerErrorGuidance: 'consumed',\n promptFileReferenceTag: 'consumed',\n modelCommandToolPrefix: 'consumed',\n subagentHookEnvironmentNames: 'consumed',\n observerFailureWarningCode: 'consumed',\n presets: 'consumed',\n presetRegistry: 'consumed-and-surfaced',\n defaultPresetId: 'consumed-and-surfaced',\n presetContext: 'consumed',\n packs: 'consumed',\n baseCommandModules: 'consumed',\n backgroundTaskRunners: 'surfaced',\n subagentRunnerFactory: 'surfaced',\n transports: 'consumed-and-surfaced',\n} as const satisfies Record<keyof IProductProfile, TCompositionFieldPolicy>;\n\n/** The product-owned materials the assembler overlays onto the shell-supplied session options. */\ninterface IOverlayMaterials {\n provider: IAIProvider | undefined;\n providerErrorGuidance: IProductProfile['providerErrorGuidance'];\n promptFileReferenceTag: IProductProfile['promptFileReferenceTag'];\n modelCommandToolPrefix: IProductProfile['modelCommandToolPrefix'];\n subagentHookEnvironmentNames: IProductProfile['subagentHookEnvironmentNames'];\n observerFailureWarningCode: IProductProfile['observerFailureWarningCode'];\n commandModules: readonly ICommandModule[];\n tools: readonly FunctionTool[];\n subagents: readonly IAgentDefinition[];\n defaultPermissionMode: TPermissionMode | undefined;\n /** ARCH-009: the instance preset registry, so `/preset` discovers this product's presets. */\n presetRegistry: IPresetRegistry;\n}\n\n/**\n * Overlay the assembled command modules, pack tools, and pack subagents onto the shell's session options.\n * The injected pre-built-session path gets command modules only (its session already owns its tools); the\n * standard construction path also receives the additive pack tools and — via the framework's\n * `agentDefinitions` injection seam (ARCH-005 S2, owner Decision 2) — the merged pack subagents, so a\n * pack's subagents actually reach the runtime instead of being inert material. `agentDefinitions` is left\n * UNSET when no pack contributes one, so the framework's own built-ins + discovery are unchanged.\n *\n * The default preset's `permissionMode` is applied only when the shell left it unset.\n */\nfunction overlaySessionOptions(\n base: TInteractiveSessionOptions,\n materials: IOverlayMaterials,\n): TInteractiveSessionOptions {\n const provider = base.provider ?? materials.provider;\n const providerErrorGuidance = base.providerErrorGuidance ?? materials.providerErrorGuidance;\n const promptFileReferenceTag = base.promptFileReferenceTag ?? materials.promptFileReferenceTag;\n const modelCommandToolPrefix = base.modelCommandToolPrefix ?? materials.modelCommandToolPrefix;\n const subagentHookEnvironmentNames =\n base.subagentHookEnvironmentNames ?? materials.subagentHookEnvironmentNames;\n const observerFailureWarningCode =\n base.observerFailureWarningCode ?? materials.observerFailureWarningCode;\n const permissionModeOverlay =\n base.permissionMode === undefined && materials.defaultPermissionMode !== undefined\n ? { permissionMode: materials.defaultPermissionMode }\n : {};\n // ARCH-007: the shell may hand in a selection it has ALREADY narrowed — the configured shell applies its preset's\n // enabled/disabledCommandModules delta to the merged `base ⊕ packs` superset before calling the seam\n // (the spec's composition order: the merge widens, the preset delta narrows). Overwriting it here would\n // silently undo that narrowing, so the assembled set is overlaid only when the caller left it unset —\n // the same \"only when the shell left it unset\" rule `permissionMode` already follows.\n const commandModules = base.commandModules ?? materials.commandModules;\n // ARCH-009: MERGED into the shell's bag, never substituted for it. The shell wires its own adapters\n // there (remote control, process, settings) and the registry stands beside them; replacing the bag\n // would silently drop capabilities this assembler knows nothing about. Both arms get it — an\n // injected session is exactly the embedded-host case the item is about.\n const commandHostAdapters: ICommandHostAdapters = {\n ...base.commandHostAdapters,\n presetRegistry: materials.presetRegistry,\n };\n\n if ('session' in base) {\n return {\n ...base,\n provider,\n ...(providerErrorGuidance !== undefined ? { providerErrorGuidance } : {}),\n ...(promptFileReferenceTag !== undefined ? { promptFileReferenceTag } : {}),\n ...(modelCommandToolPrefix !== undefined ? { modelCommandToolPrefix } : {}),\n ...(subagentHookEnvironmentNames !== undefined ? { subagentHookEnvironmentNames } : {}),\n ...(observerFailureWarningCode !== undefined ? { observerFailureWarningCode } : {}),\n commandModules,\n commandHostAdapters,\n ...permissionModeOverlay,\n };\n }\n\n if (provider === undefined) {\n throw new Error(\n 'assembleProduct: no provider available — the profile carried neither `providerSettings` nor an injected `provider`, and the session options supplied none.',\n );\n }\n\n return {\n ...base,\n provider,\n ...(providerErrorGuidance !== undefined ? { providerErrorGuidance } : {}),\n ...(promptFileReferenceTag !== undefined ? { promptFileReferenceTag } : {}),\n ...(modelCommandToolPrefix !== undefined ? { modelCommandToolPrefix } : {}),\n ...(subagentHookEnvironmentNames !== undefined ? { subagentHookEnvironmentNames } : {}),\n ...(observerFailureWarningCode !== undefined ? { observerFailureWarningCode } : {}),\n commandModules,\n commandHostAdapters,\n additionalTools: [\n ...(base.additionalTools ?? []),\n ...(materials.tools as readonly IToolWithEventService[]),\n ],\n ...(materials.subagents.length > 0 ? { agentDefinitions: materials.subagents } : {}),\n ...permissionModeOverlay,\n };\n}\n\n/**\n * The single product-composition function — a PURE, deterministic, IO-free fold over `IProductProfile`.\n *\n * `assembleProduct` is a **peer** of the repo's already-blessed pure folds (`resolvePreset`,\n * `mergeSettings`, `mergeCapabilityPacks`): it reads only its argument, calls only pure sub-folds and the\n * framework's runtime-construction seam, and hard-codes **no** product's choices — there is ZERO\n * product-specific branching (no `if (profile.id === '…')` ever). Everything product-specific arrives as\n * `profile` DATA. This property is what makes the `agent-product` carve-out safe under the amended\n * project-structure L129 rule, and it is enforced by the three composition-neutrality guards\n * (dependency-graph neutrality, purity/no-IO, no product-name conditionals).\n *\n * What it does:\n * 1. Builds a PER-CALL instance-scoped preset registry over `profile.presets` (R8) — or adopts the\n * instance the caller already built and handed in as `profile.presetRegistry` (ARCH-008). Either way it\n * never mutates agent-preset's module-level `externalPresets` global, so two products in one process do\n * not share one registry and repeat calls do not accumulate. `defaultPresetId` is resolved over that\n * registry with `profile.presetContext`, so the product's `defaultPreset` is the caller's resolution.\n * 2. Merges the additive capability packs onto `profile.baseCommandModules` via `mergeCapabilityPacks`\n * (base ⊕ packs, with a rejection channel — never a silent override).\n * 3. Constructs the provider from `profile.providerDefinitions` + the shell's already-resolved\n * `profile.providerSettings` (owner Decision 1) via agent-core's pure `createProviderFromConfig`; an\n * injected `profile.provider` overrides it.\n * 4. Produces `buildRuntimeOptions`/`buildRuntime`, which DELEGATE runtime construction to\n * `agent-framework`'s `buildRuntimeSession` seam (R2, RUNTIME-001 SSOT) — never re-implementing runtime\n * assembly — overlaying the assembled modules, pack tools, and pack subagents (`agentDefinitions`).\n *\n * Settings/args/env resolution and concrete transports/presentation stay in the shell; `assembleProduct`\n * receives already-resolved data and returns neutral materials the shell binds its own transport over.\n */\nexport function assembleProduct(profile: IProductProfile): IAssembledProduct {\n // (1) Per-call instance-scoped preset registry — pure w.r.t. process state (R8). A caller that had to\n // resolve a preset BEFORE it could build this profile (a preset can carry the `model`/`agentName` the\n // profile is constructed from) hands its own instance in as `presetRegistry`; the assembler then uses\n // THAT one rather than building a second, equivalent registry, so there is exactly one resolution path\n // (ARCH-008). Either way the registry is instance-scoped — no module-level state is read or mutated.\n const presets = profile.presetRegistry ?? createPresetRegistry(profile.presets ?? []);\n const defaultPreset: IResolvedPresetOptions | undefined =\n profile.defaultPresetId !== undefined\n ? presets.resolvePreset(profile.defaultPresetId, profile.presetContext)\n : undefined;\n\n // (2) Additive capability merge — base ⊕ packs, deterministic, with a rejection channel.\n const { merged, acceptedPacks, rejected, rejectedPacks } = mergeCapabilityPacks(\n profile.baseCommandModules ?? [],\n profile.packs ?? [],\n );\n\n // (3) Provider construction — IN-KERNEL, from the profile's definitions + the shell's ALREADY-RESOLVED\n // settings (owner Decision 1). `createProviderFromConfig` is a pure `config → IAIProvider` factory that\n // lives in `@robota-sdk/agent-core` (relocated there by ARCH-PROVIDER-003), an ALLOWED dependency layer,\n // so this reads no fs/env and the fold stays pure. An injected `profile.provider` wins (advanced/test\n // override, e.g. `--session-log` replay); with neither, no provider is constructed and the consumer\n // supplies one in the `buildRuntime` session options (the Mode A shape).\n const provider =\n profile.provider ??\n (profile.providerSettings !== undefined\n ? createProviderFromConfig(profile.providerSettings, profile.providerDefinitions)\n : undefined);\n\n // (4) The runtime-construction delegate — DELEGATES to the framework seam, never re-implements.\n const buildRuntimeOptions = (input: IBuildRuntimeInput): TInteractiveSessionOptions =>\n overlaySessionOptions(input.session, {\n provider,\n providerErrorGuidance: profile.providerErrorGuidance,\n promptFileReferenceTag: profile.promptFileReferenceTag,\n modelCommandToolPrefix: profile.modelCommandToolPrefix,\n subagentHookEnvironmentNames: profile.subagentHookEnvironmentNames,\n observerFailureWarningCode: profile.observerFailureWarningCode,\n commandModules: merged.commandModules,\n tools: merged.tools,\n subagents: merged.subagents,\n defaultPermissionMode: defaultPreset?.permissionMode,\n // ARCH-009: the instance registry reaches the SESSION through the host-adapter bag, so\n // `/preset` discovers through the same presets this product resolved with. It was already\n // assembled here and surfaced on the product; what was missing was the last hop, which is why\n // `/preset` read a module global and why two products in one process shared one mutable list.\n presetRegistry: presets,\n });\n\n return {\n id: profile.id,\n ...(profile.agentName !== undefined ? { agentName: profile.agentName } : {}),\n ...(profile.version !== undefined ? { version: profile.version } : {}),\n ...(provider !== undefined ? { provider } : {}),\n providerDefinitions: profile.providerDefinitions,\n commandModules: merged.commandModules,\n tools: merged.tools,\n subagents: merged.subagents,\n acceptedPacks,\n rejectedCapabilities: rejected,\n rejectedPacks,\n presets,\n resolvePreset: (id, context) => presets.resolvePreset(id, context),\n ...(profile.defaultPresetId !== undefined ? { defaultPresetId: profile.defaultPresetId } : {}),\n ...(defaultPreset !== undefined ? { defaultPreset } : {}),\n backgroundTaskRunners: profile.backgroundTaskRunners ?? [],\n ...(profile.subagentRunnerFactory !== undefined\n ? { subagentRunnerFactory: profile.subagentRunnerFactory }\n : {}),\n ...(profile.transports !== undefined\n ? {\n transports:\n typeof profile.transports === 'function' ? profile.transports() : profile.transports,\n }\n : {}),\n buildRuntimeOptions,\n buildRuntime: (input) => buildRuntimeSession(buildRuntimeOptions(input)),\n };\n}\n"],"mappings":"6QAsEA,SAAS,EACP,EACA,EAC4B,CAC5B,IAAM,EAAW,EAAK,UAAY,EAAU,SACtC,EAAwB,EAAK,uBAAyB,EAAU,sBAChE,EAAyB,EAAK,wBAA0B,EAAU,uBAClE,EAAyB,EAAK,wBAA0B,EAAU,uBAClE,EACJ,EAAK,8BAAgC,EAAU,6BAC3C,EACJ,EAAK,4BAA8B,EAAU,2BACzC,EACJ,EAAK,iBAAmB,IAAA,IAAa,EAAU,wBAA0B,IAAA,GACrE,CAAE,eAAgB,EAAU,qBAAsB,EAClD,CAAC,EAMD,EAAiB,EAAK,gBAAkB,EAAU,eAKlD,EAA4C,CAChD,GAAG,EAAK,oBACR,eAAgB,EAAU,cAC5B,EAEA,GAAI,YAAa,EACf,MAAO,CACL,GAAG,EACH,WACA,GAAI,IAA0B,IAAA,GAAwC,CAAC,EAA7B,CAAE,uBAAsB,EAClE,GAAI,IAA2B,IAAA,GAAyC,CAAC,EAA9B,CAAE,wBAAuB,EACpE,GAAI,IAA2B,IAAA,GAAyC,CAAC,EAA9B,CAAE,wBAAuB,EACpE,GAAI,IAAiC,IAAA,GAA+C,CAAC,EAApC,CAAE,8BAA6B,EAChF,GAAI,IAA+B,IAAA,GAA6C,CAAC,EAAlC,CAAE,4BAA2B,EAC5E,iBACA,sBACA,GAAG,CACL,EAGF,GAAI,IAAa,IAAA,GACf,MAAU,MACR,4JACF,EAGF,MAAO,CACL,GAAG,EACH,WACA,GAAI,IAA0B,IAAA,GAAwC,CAAC,EAA7B,CAAE,uBAAsB,EAClE,GAAI,IAA2B,IAAA,GAAyC,CAAC,EAA9B,CAAE,wBAAuB,EACpE,GAAI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B,CAAE,UAAS,EACxC,oBAAqB,EAAQ,oBAC7B,eAAgB,EAAO,eACvB,MAAO,EAAO,MACd,UAAW,EAAO,UAClB,gBACA,qBAAsB,EACtB,gBACA,UACA,eAAgB,EAAI,IAAY,EAAQ,cAAc,EAAI,CAAO,EACjE,GAAI,EAAQ,kBAAoB,IAAA,GAA2D,CAAC,EAAhD,CAAE,gBAAiB,EAAQ,eAAgB,EACvF,GAAI,IAAkB,IAAA,GAAgC,CAAC,EAArB,CAAE,eAAc,EAClD,sBAAuB,EAAQ,uBAAyB,CAAC,EACzD,GAAI,EAAQ,wBAA0B,IAAA,GAElC,CAAC,EADD,CAAE,sBAAuB,EAAQ,qBAAsB,EAE3D,GAAI,EAAQ,aAAe,IAAA,GAKvB,CAAC,EAJD,CACE,WACE,OAAO,EAAQ,YAAe,WAAa,EAAQ,WAAW,EAAI,EAAQ,UAC9E,EAEJ,sBACA,aAAe,GAAU,EAAoB,EAAoB,CAAK,CAAC,CACzE,CACF"}
package/package.json CHANGED
@@ -1,32 +1,20 @@
1
1
  {
2
2
  "name": "@robota-sdk/agent-product",
3
- "version": "3.0.6",
3
+ "version": "3.1.1",
4
4
  "description": "The product-assembly kernel for the Robota SDK: assembleProduct — a pure, IO-free fold over IProductProfile that delegates runtime construction to agent-framework",
5
5
  "type": "module",
6
- "main": "dist/node/index.js",
7
- "types": "dist/node/index.d.ts",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "source": "./src/index.ts",
11
- "node": {
12
- "import": {
13
- "types": "./dist/node/index.d.ts",
14
- "default": "./dist/node/index.js"
15
- },
16
- "require": {
17
- "types": "./dist/node/index.d.cts",
18
- "default": "./dist/node/index.cjs"
19
- }
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
20
14
  },
21
- "default": {
22
- "import": {
23
- "types": "./dist/node/index.d.ts",
24
- "default": "./dist/node/index.js"
25
- },
26
- "require": {
27
- "types": "./dist/node/index.d.cts",
28
- "default": "./dist/node/index.cjs"
29
- }
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
30
18
  }
31
19
  },
32
20
  "./package.json": "./package.json"
@@ -39,11 +27,11 @@
39
27
  "CHANGELOG.md"
40
28
  ],
41
29
  "dependencies": {
42
- "@robota-sdk/agent-capability-pack": "3.0.6",
43
- "@robota-sdk/agent-core": "3.0.6",
44
- "@robota-sdk/agent-framework": "3.0.6",
45
- "@robota-sdk/agent-preset": "3.0.6",
46
- "@robota-sdk/agent-interface-transport": "3.0.6"
30
+ "@robota-sdk/agent-core": "3.1.1",
31
+ "@robota-sdk/agent-capability-pack": "3.1.1",
32
+ "@robota-sdk/agent-framework": "3.1.1",
33
+ "@robota-sdk/agent-preset": "3.1.1",
34
+ "@robota-sdk/agent-interface-transport": "3.1.1"
47
35
  },
48
36
  "devDependencies": {
49
37
  "rimraf": "^5.0.10",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/product-profile.ts","../../src/assemble-product.ts"],"mappings":";;;;;;;;;;;;;;;;UAwCiB;;EAGf;;EAEA;;EAEA;;;;;;EAQA,8BAA8B;;;;;;;;;;;EAW9B,mBAAmB;;;;;;EAMnB,WAAW;;EAEX,wBAAwB;;EAExB;;EAEA;;EAEA,+BAA+B;;EAE/B,6BAA6B;;;;;EAM7B,mBAAmB;;;;;;;;;;;;EAYnB,iBAAiB;;EAEjB;;;;;;EAMA,gBAAgB;;EAIhB,iBAAiB;;EAEjB,8BAA8B;;EAI9B,iCAAiC;;EAEjC,wBAAwB;;EAExB,aAAa,gCAAgC;;;;;;;UAQ9B;;;;;;EAMf,SAAS;;;;;;UAOM;;EAEf;EACA;EACA;;;;;;EAOA,WAAW;;EAEX,8BAA8B;;EAG9B,yBAAyB;;EAEzB,gBAAgB;;EAEhB,oBAAoB;;EAEpB,+BAA+B;;EAE/B,wBAAwB;;EAExB,wBAAwB;;;;;EAMxB,SAAS;;EAET,gBACE,YACA,UAAU,WAAW,yCAClB;;;;;;EAML;EACA,gBAAgB;;EAGhB,gCAAgC;EAChC,wBAAwB;EACxB,aAAa;;;;;;;;EASb,sBAAsB,OAAO,uBAAuB;;;;;;EAOpD,eAAe,OAAO,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCtC/B,gBAAgB,SAAS,kBAAkB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/product-profile.ts","../../src/assemble-product.ts"],"mappings":";;;;;;;;;;;;;;;;UAwCiB;;EAGf;;EAEA;;EAEA;;;;;;EAQA,8BAA8B;;;;;;;;;;;EAW9B,mBAAmB;;;;;;EAMnB,WAAW;;EAEX,wBAAwB;;EAExB;;EAEA;;EAEA,+BAA+B;;EAE/B,6BAA6B;;;;;EAM7B,mBAAmB;;;;;;;;;;;;EAYnB,iBAAiB;;EAEjB;;;;;;EAMA,gBAAgB;;EAIhB,iBAAiB;;EAEjB,8BAA8B;;EAI9B,iCAAiC;;EAEjC,wBAAwB;;EAExB,aAAa,gCAAgC;;;;;;;UAQ9B;;;;;;EAMf,SAAS;;;;;;UAOM;;EAEf;EACA;EACA;;;;;;EAOA,WAAW;;EAEX,8BAA8B;;EAG9B,yBAAyB;;EAEzB,gBAAgB;;EAEhB,oBAAoB;;EAEpB,+BAA+B;;EAE/B,wBAAwB;;EAExB,wBAAwB;;;;;EAMxB,SAAS;;EAET,gBACE,YACA,UAAU,WAAW,yCAClB;;;;;;EAML;EACA,gBAAgB;;EAGhB,gCAAgC;EAChC,wBAAwB;EACxB,aAAa;;;;;;;;EASb,sBAAsB,OAAO,uBAAuB;;;;;;EAOpD,eAAe,OAAO,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCtC/B,gBAAgB,SAAS,kBAAkB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/assemble-product.ts"],"sourcesContent":["import { mergeCapabilityPacks } from '@robota-sdk/agent-capability-pack';\nimport { createProviderFromConfig } from '@robota-sdk/agent-core';\nimport { buildRuntimeSession } from '@robota-sdk/agent-framework';\nimport { createPresetRegistry } from '@robota-sdk/agent-preset';\n\nimport type { IAssembledProduct, IBuildRuntimeInput, IProductProfile } from './product-profile.js';\nimport type { TCompositionFieldPolicy } from '@robota-sdk/agent-capability-pack';\nimport type {\n FunctionTool,\n IAIProvider,\n IToolWithEventService,\n TPermissionMode,\n} from '@robota-sdk/agent-core';\nimport type {\n IAgentDefinition,\n ICommandHostAdapters,\n ICommandModule,\n TInteractiveSessionOptions,\n} from '@robota-sdk/agent-framework';\nimport type { IPresetRegistry, IResolvedPresetOptions } from '@robota-sdk/agent-preset';\n\nexport const PRODUCT_PROFILE_FIELD_POLICIES = {\n id: 'surfaced',\n agentName: 'surfaced',\n version: 'surfaced',\n providerDefinitions: 'consumed-and-surfaced',\n providerSettings: 'consumed',\n provider: 'consumed-and-surfaced',\n providerErrorGuidance: 'consumed',\n promptFileReferenceTag: 'consumed',\n modelCommandToolPrefix: 'consumed',\n subagentHookEnvironmentNames: 'consumed',\n observerFailureWarningCode: 'consumed',\n presets: 'consumed',\n presetRegistry: 'consumed-and-surfaced',\n defaultPresetId: 'consumed-and-surfaced',\n presetContext: 'consumed',\n packs: 'consumed',\n baseCommandModules: 'consumed',\n backgroundTaskRunners: 'surfaced',\n subagentRunnerFactory: 'surfaced',\n transports: 'consumed-and-surfaced',\n} as const satisfies Record<keyof IProductProfile, TCompositionFieldPolicy>;\n\n/** The product-owned materials the assembler overlays onto the shell-supplied session options. */\ninterface IOverlayMaterials {\n provider: IAIProvider | undefined;\n providerErrorGuidance: IProductProfile['providerErrorGuidance'];\n promptFileReferenceTag: IProductProfile['promptFileReferenceTag'];\n modelCommandToolPrefix: IProductProfile['modelCommandToolPrefix'];\n subagentHookEnvironmentNames: IProductProfile['subagentHookEnvironmentNames'];\n observerFailureWarningCode: IProductProfile['observerFailureWarningCode'];\n commandModules: readonly ICommandModule[];\n tools: readonly FunctionTool[];\n subagents: readonly IAgentDefinition[];\n defaultPermissionMode: TPermissionMode | undefined;\n /** ARCH-009: the instance preset registry, so `/preset` discovers this product's presets. */\n presetRegistry: IPresetRegistry;\n}\n\n/**\n * Overlay the assembled command modules, pack tools, and pack subagents onto the shell's session options.\n * The injected pre-built-session path gets command modules only (its session already owns its tools); the\n * standard construction path also receives the additive pack tools and — via the framework's\n * `agentDefinitions` injection seam (ARCH-005 S2, owner Decision 2) — the merged pack subagents, so a\n * pack's subagents actually reach the runtime instead of being inert material. `agentDefinitions` is left\n * UNSET when no pack contributes one, so the framework's own built-ins + discovery are unchanged.\n *\n * The default preset's `permissionMode` is applied only when the shell left it unset.\n */\nfunction overlaySessionOptions(\n base: TInteractiveSessionOptions,\n materials: IOverlayMaterials,\n): TInteractiveSessionOptions {\n const provider = base.provider ?? materials.provider;\n const providerErrorGuidance = base.providerErrorGuidance ?? materials.providerErrorGuidance;\n const promptFileReferenceTag = base.promptFileReferenceTag ?? materials.promptFileReferenceTag;\n const modelCommandToolPrefix = base.modelCommandToolPrefix ?? materials.modelCommandToolPrefix;\n const subagentHookEnvironmentNames =\n base.subagentHookEnvironmentNames ?? materials.subagentHookEnvironmentNames;\n const observerFailureWarningCode =\n base.observerFailureWarningCode ?? materials.observerFailureWarningCode;\n const permissionModeOverlay =\n base.permissionMode === undefined && materials.defaultPermissionMode !== undefined\n ? { permissionMode: materials.defaultPermissionMode }\n : {};\n // ARCH-007: the shell may hand in a selection it has ALREADY narrowed — the configured shell applies its preset's\n // enabled/disabledCommandModules delta to the merged `base ⊕ packs` superset before calling the seam\n // (the spec's composition order: the merge widens, the preset delta narrows). Overwriting it here would\n // silently undo that narrowing, so the assembled set is overlaid only when the caller left it unset —\n // the same \"only when the shell left it unset\" rule `permissionMode` already follows.\n const commandModules = base.commandModules ?? materials.commandModules;\n // ARCH-009: MERGED into the shell's bag, never substituted for it. The shell wires its own adapters\n // there (remote control, process, settings) and the registry stands beside them; replacing the bag\n // would silently drop capabilities this assembler knows nothing about. Both arms get it — an\n // injected session is exactly the embedded-host case the item is about.\n const commandHostAdapters: ICommandHostAdapters = {\n ...base.commandHostAdapters,\n presetRegistry: materials.presetRegistry,\n };\n\n if ('session' in base) {\n return {\n ...base,\n provider,\n ...(providerErrorGuidance !== undefined ? { providerErrorGuidance } : {}),\n ...(promptFileReferenceTag !== undefined ? { promptFileReferenceTag } : {}),\n ...(modelCommandToolPrefix !== undefined ? { modelCommandToolPrefix } : {}),\n ...(subagentHookEnvironmentNames !== undefined ? { subagentHookEnvironmentNames } : {}),\n ...(observerFailureWarningCode !== undefined ? { observerFailureWarningCode } : {}),\n commandModules,\n commandHostAdapters,\n ...permissionModeOverlay,\n };\n }\n\n if (provider === undefined) {\n throw new Error(\n 'assembleProduct: no provider available — the profile carried neither `providerSettings` nor an injected `provider`, and the session options supplied none.',\n );\n }\n\n return {\n ...base,\n provider,\n ...(providerErrorGuidance !== undefined ? { providerErrorGuidance } : {}),\n ...(promptFileReferenceTag !== undefined ? { promptFileReferenceTag } : {}),\n ...(modelCommandToolPrefix !== undefined ? { modelCommandToolPrefix } : {}),\n ...(subagentHookEnvironmentNames !== undefined ? { subagentHookEnvironmentNames } : {}),\n ...(observerFailureWarningCode !== undefined ? { observerFailureWarningCode } : {}),\n commandModules,\n commandHostAdapters,\n additionalTools: [\n ...(base.additionalTools ?? []),\n ...(materials.tools as readonly IToolWithEventService[]),\n ],\n ...(materials.subagents.length > 0 ? { agentDefinitions: materials.subagents } : {}),\n ...permissionModeOverlay,\n };\n}\n\n/**\n * The single product-composition function — a PURE, deterministic, IO-free fold over `IProductProfile`.\n *\n * `assembleProduct` is a **peer** of the repo's already-blessed pure folds (`resolvePreset`,\n * `mergeSettings`, `mergeCapabilityPacks`): it reads only its argument, calls only pure sub-folds and the\n * framework's runtime-construction seam, and hard-codes **no** product's choices — there is ZERO\n * product-specific branching (no `if (profile.id === '…')` ever). Everything product-specific arrives as\n * `profile` DATA. This property is what makes the `agent-product` carve-out safe under the amended\n * project-structure L129 rule, and it is enforced by the three composition-neutrality guards\n * (dependency-graph neutrality, purity/no-IO, no product-name conditionals).\n *\n * What it does:\n * 1. Builds a PER-CALL instance-scoped preset registry over `profile.presets` (R8) — or adopts the\n * instance the caller already built and handed in as `profile.presetRegistry` (ARCH-008). Either way it\n * never mutates agent-preset's module-level `externalPresets` global, so two products in one process do\n * not share one registry and repeat calls do not accumulate. `defaultPresetId` is resolved over that\n * registry with `profile.presetContext`, so the product's `defaultPreset` is the caller's resolution.\n * 2. Merges the additive capability packs onto `profile.baseCommandModules` via `mergeCapabilityPacks`\n * (base ⊕ packs, with a rejection channel — never a silent override).\n * 3. Constructs the provider from `profile.providerDefinitions` + the shell's already-resolved\n * `profile.providerSettings` (owner Decision 1) via agent-core's pure `createProviderFromConfig`; an\n * injected `profile.provider` overrides it.\n * 4. Produces `buildRuntimeOptions`/`buildRuntime`, which DELEGATE runtime construction to\n * `agent-framework`'s `buildRuntimeSession` seam (R2, RUNTIME-001 SSOT) — never re-implementing runtime\n * assembly — overlaying the assembled modules, pack tools, and pack subagents (`agentDefinitions`).\n *\n * Settings/args/env resolution and concrete transports/presentation stay in the shell; `assembleProduct`\n * receives already-resolved data and returns neutral materials the shell binds its own transport over.\n */\nexport function assembleProduct(profile: IProductProfile): IAssembledProduct {\n // (1) Per-call instance-scoped preset registry — pure w.r.t. process state (R8). A caller that had to\n // resolve a preset BEFORE it could build this profile (a preset can carry the `model`/`agentName` the\n // profile is constructed from) hands its own instance in as `presetRegistry`; the assembler then uses\n // THAT one rather than building a second, equivalent registry, so there is exactly one resolution path\n // (ARCH-008). Either way the registry is instance-scoped — no module-level state is read or mutated.\n const presets = profile.presetRegistry ?? createPresetRegistry(profile.presets ?? []);\n const defaultPreset: IResolvedPresetOptions | undefined =\n profile.defaultPresetId !== undefined\n ? presets.resolvePreset(profile.defaultPresetId, profile.presetContext)\n : undefined;\n\n // (2) Additive capability merge — base ⊕ packs, deterministic, with a rejection channel.\n const { merged, acceptedPacks, rejected, rejectedPacks } = mergeCapabilityPacks(\n profile.baseCommandModules ?? [],\n profile.packs ?? [],\n );\n\n // (3) Provider construction — IN-KERNEL, from the profile's definitions + the shell's ALREADY-RESOLVED\n // settings (owner Decision 1). `createProviderFromConfig` is a pure `config → IAIProvider` factory that\n // lives in `@robota-sdk/agent-core` (relocated there by ARCH-PROVIDER-003), an ALLOWED dependency layer,\n // so this reads no fs/env and the fold stays pure. An injected `profile.provider` wins (advanced/test\n // override, e.g. `--session-log` replay); with neither, no provider is constructed and the consumer\n // supplies one in the `buildRuntime` session options (the Mode A shape).\n const provider =\n profile.provider ??\n (profile.providerSettings !== undefined\n ? createProviderFromConfig(profile.providerSettings, profile.providerDefinitions)\n : undefined);\n\n // (4) The runtime-construction delegate — DELEGATES to the framework seam, never re-implements.\n const buildRuntimeOptions = (input: IBuildRuntimeInput): TInteractiveSessionOptions =>\n overlaySessionOptions(input.session, {\n provider,\n providerErrorGuidance: profile.providerErrorGuidance,\n promptFileReferenceTag: profile.promptFileReferenceTag,\n modelCommandToolPrefix: profile.modelCommandToolPrefix,\n subagentHookEnvironmentNames: profile.subagentHookEnvironmentNames,\n observerFailureWarningCode: profile.observerFailureWarningCode,\n commandModules: merged.commandModules,\n tools: merged.tools,\n subagents: merged.subagents,\n defaultPermissionMode: defaultPreset?.permissionMode,\n // ARCH-009: the instance registry reaches the SESSION through the host-adapter bag, so\n // `/preset` discovers through the same presets this product resolved with. It was already\n // assembled here and surfaced on the product; what was missing was the last hop, which is why\n // `/preset` read a module global and why two products in one process shared one mutable list.\n presetRegistry: presets,\n });\n\n return {\n id: profile.id,\n ...(profile.agentName !== undefined ? { agentName: profile.agentName } : {}),\n ...(profile.version !== undefined ? { version: profile.version } : {}),\n ...(provider !== undefined ? { provider } : {}),\n providerDefinitions: profile.providerDefinitions,\n commandModules: merged.commandModules,\n tools: merged.tools,\n subagents: merged.subagents,\n acceptedPacks,\n rejectedCapabilities: rejected,\n rejectedPacks,\n presets,\n resolvePreset: (id, context) => presets.resolvePreset(id, context),\n ...(profile.defaultPresetId !== undefined ? { defaultPresetId: profile.defaultPresetId } : {}),\n ...(defaultPreset !== undefined ? { defaultPreset } : {}),\n backgroundTaskRunners: profile.backgroundTaskRunners ?? [],\n ...(profile.subagentRunnerFactory !== undefined\n ? { subagentRunnerFactory: profile.subagentRunnerFactory }\n : {}),\n ...(profile.transports !== undefined\n ? {\n transports:\n typeof profile.transports === 'function' ? profile.transports() : profile.transports,\n }\n : {}),\n buildRuntimeOptions,\n buildRuntime: (input) => buildRuntimeSession(buildRuntimeOptions(input)),\n };\n}\n"],"mappings":"6QAsEA,SAAS,EACP,EACA,EAC4B,CAC5B,IAAM,EAAW,EAAK,UAAY,EAAU,SACtC,EAAwB,EAAK,uBAAyB,EAAU,sBAChE,EAAyB,EAAK,wBAA0B,EAAU,uBAClE,EAAyB,EAAK,wBAA0B,EAAU,uBAClE,EACJ,EAAK,8BAAgC,EAAU,6BAC3C,EACJ,EAAK,4BAA8B,EAAU,2BACzC,EACJ,EAAK,iBAAmB,IAAA,IAAa,EAAU,wBAA0B,IAAA,GACrE,CAAE,eAAgB,EAAU,qBAAsB,EAClD,CAAC,EAMD,EAAiB,EAAK,gBAAkB,EAAU,eAKlD,EAA4C,CAChD,GAAG,EAAK,oBACR,eAAgB,EAAU,cAC5B,EAEA,GAAI,YAAa,EACf,MAAO,CACL,GAAG,EACH,WACA,GAAI,IAA0B,IAAA,GAAwC,CAAC,EAA7B,CAAE,uBAAsB,EAClE,GAAI,IAA2B,IAAA,GAAyC,CAAC,EAA9B,CAAE,wBAAuB,EACpE,GAAI,IAA2B,IAAA,GAAyC,CAAC,EAA9B,CAAE,wBAAuB,EACpE,GAAI,IAAiC,IAAA,GAA+C,CAAC,EAApC,CAAE,8BAA6B,EAChF,GAAI,IAA+B,IAAA,GAA6C,CAAC,EAAlC,CAAE,4BAA2B,EAC5E,iBACA,sBACA,GAAG,CACL,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