@robota-sdk/agent-product 3.2.2 → 3.3.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 +41 -0
- package/README.md +22 -8
- package/dist/capability-pack/index.cjs +1 -0
- package/dist/capability-pack/index.d.cts +2 -0
- package/dist/capability-pack/index.d.ts +2 -0
- package/dist/capability-pack/index.js +1 -0
- package/dist/capability-pack-D389p-Cv.js +2 -0
- package/dist/capability-pack-D389p-Cv.js.map +1 -0
- package/dist/capability-pack-Dc6eJ76H.cjs +1 -0
- package/dist/coding/index.cjs +1 -0
- package/dist/coding/index.d.cts +75 -0
- package/dist/coding/index.d.cts.map +1 -0
- package/dist/coding/index.d.ts +75 -0
- package/dist/coding/index.d.ts.map +1 -0
- package/dist/coding/index.js +2 -0
- package/dist/coding/index.js.map +1 -0
- package/dist/command/index.cjs +1 -0
- package/dist/command/index.d.cts +948 -0
- package/dist/command/index.d.cts.map +1 -0
- package/dist/command/index.d.ts +948 -0
- package/dist/command/index.d.ts.map +1 -0
- package/dist/command/index.js +1 -0
- package/dist/command/node.cjs +1 -0
- package/dist/command/node.d.cts +100 -0
- package/dist/command/node.d.cts.map +1 -0
- package/dist/command/node.d.ts +100 -0
- package/dist/command/node.d.ts.map +1 -0
- package/dist/command/node.js +1 -0
- package/dist/command-DZUsxxG3.cjs +120 -0
- package/dist/command-DynprfoA.js +121 -0
- package/dist/command-DynprfoA.js.map +1 -0
- package/dist/index-BNDTmhmd.d.cts +109 -0
- package/dist/index-BNDTmhmd.d.cts.map +1 -0
- package/dist/index-BNDTmhmd.d.ts +109 -0
- package/dist/index-BNDTmhmd.d.ts.map +1 -0
- package/dist/index-Cz8aDRO3.d.cts +156 -0
- package/dist/index-Cz8aDRO3.d.cts.map +1 -0
- package/dist/index-jksIH551.d.ts +156 -0
- package/dist/index-jksIH551.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +11 -10
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/keybindings-command-module-CcA9-Xqi.d.cts +126 -0
- package/dist/keybindings-command-module-CcA9-Xqi.d.cts.map +1 -0
- package/dist/keybindings-command-module-CcA9-Xqi.d.ts +126 -0
- package/dist/keybindings-command-module-CcA9-Xqi.d.ts.map +1 -0
- package/dist/load-external-presets-CJeFbxNF.js +5 -0
- package/dist/load-external-presets-CJeFbxNF.js.map +1 -0
- package/dist/load-external-presets-DCY3HJ8d.d.cts +107 -0
- package/dist/load-external-presets-DCY3HJ8d.d.cts.map +1 -0
- package/dist/load-external-presets-DCY3HJ8d.d.ts +107 -0
- package/dist/load-external-presets-DCY3HJ8d.d.ts.map +1 -0
- package/dist/load-external-presets-DyoUUA3V.cjs +4 -0
- package/dist/node-BgupUyg0.cjs +1 -0
- package/dist/node-Cw2VT1HG.js +2 -0
- package/dist/node-Cw2VT1HG.js.map +1 -0
- package/dist/preset/index.cjs +1 -0
- package/dist/preset/index.d.cts +3 -0
- package/dist/preset/index.d.ts +3 -0
- package/dist/preset/index.js +1 -0
- package/dist/preset/node.cjs +1 -0
- package/dist/preset/node.d.cts +13 -0
- package/dist/preset/node.d.cts.map +1 -0
- package/dist/preset/node.d.ts +13 -0
- package/dist/preset/node.d.ts.map +1 -0
- package/dist/preset/node.js +2 -0
- package/dist/preset/node.js.map +1 -0
- package/dist/preset-nuw37AF-.js +4 -0
- package/dist/preset-nuw37AF-.js.map +1 -0
- package/dist/preset-tH5pgRIC.cjs +3 -0
- package/dist/theme-command-module-DYJhjKuI.cjs +2 -0
- package/dist/theme-command-module-GyqgVqV9.js +3 -0
- package/dist/theme-command-module-GyqgVqV9.js.map +1 -0
- package/package.json +78 -8
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { FunctionTool } from "@robota-sdk/agent-core";
|
|
2
|
+
import { IAgentDefinition, ICommandModule } from "@robota-sdk/agent-framework";
|
|
3
|
+
//#region src/capability-pack/capability-pack-types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The additive capability-bundle contract.
|
|
6
|
+
*
|
|
7
|
+
* An `ICapabilityPack` is the *additive* composition unit of a product surface: a plain data
|
|
8
|
+
* record of named capability buckets a consumer brings on top of a product's base command modules. It is
|
|
9
|
+
* the additive analog of `IPreset` — where a preset dials **behavior** (subtractive tool/command
|
|
10
|
+
* selection, persona, permission posture), a pack contributes **capability** (new tools, command modules,
|
|
11
|
+
* and subagents).
|
|
12
|
+
*
|
|
13
|
+
* **A pack is NOT declarative JSON (R6).** Unlike a serialized manifest (e.g. VS Code's `contributes`
|
|
14
|
+
* block, which the host reads without running contributor code), a pack carries **executable code
|
|
15
|
+
* objects** — `ICommandModule` values with `systemCommands` handlers, `FunctionTool` instances with
|
|
16
|
+
* `execute` functions, and subagent definitions. It is an **in-process composition argument**, a live
|
|
17
|
+
* value handed to the assembler, not a serialized declaration. The "no function across a serialization
|
|
18
|
+
* boundary" property that applies to VS Code manifests is therefore simply N/A here.
|
|
19
|
+
*
|
|
20
|
+
* The honest safety property is not "inert JSON" but: **packs are OPT-IN** (present only when a product
|
|
21
|
+
* profile lists them), **the merge is pure** (`mergeCapabilityPacks` executes none of the contributed
|
|
22
|
+
* code), and **any contributed command/tool runs ONLY through the existing permission-gated runtime**
|
|
23
|
+
* (`PermissionEnforcer`) at call time — never by the mere act of being merged.
|
|
24
|
+
*
|
|
25
|
+
* The contract layer performs no IO and declares no classes with side effects. It depends on
|
|
26
|
+
* `@robota-sdk/agent-framework` and `@robota-sdk/agent-core` for **contract types only**.
|
|
27
|
+
*/
|
|
28
|
+
interface ICapabilityPack {
|
|
29
|
+
/** Stable pack id (diagnostics + duplicate-pack reporting). */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Human-readable pack title for discovery/UX. */
|
|
32
|
+
title?: string;
|
|
33
|
+
/** Human-readable pack description for discovery/UX. */
|
|
34
|
+
description?: string;
|
|
35
|
+
/** Command modules the pack contributes (identified by `ICommandModule.name`). */
|
|
36
|
+
commandModules?: readonly ICommandModule[];
|
|
37
|
+
/** Tools the pack contributes (identified by `FunctionTool.getName()`). */
|
|
38
|
+
tools?: readonly FunctionTool[];
|
|
39
|
+
/** Subagent definitions the pack contributes (identified by `IAgentDefinition.name`). */
|
|
40
|
+
subagents?: readonly IAgentDefinition[];
|
|
41
|
+
}
|
|
42
|
+
/** Exhaustive classification used by pure public-contract folds. */
|
|
43
|
+
type TCompositionFieldPolicy = 'consumed' | 'surfaced' | 'consumed-and-surfaced' | 'explicitly-rejected';
|
|
44
|
+
/** Discovery/UX metadata retained for every accepted pack in profile order. */
|
|
45
|
+
interface ICapabilityPackMetadata {
|
|
46
|
+
id: string;
|
|
47
|
+
title?: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
}
|
|
50
|
+
/** The `kind` of a rejected capability contribution. */
|
|
51
|
+
type TCapabilityKind = 'commandModule' | 'tool' | 'subagent';
|
|
52
|
+
/**
|
|
53
|
+
* A capability contribution that was NOT merged because its id was already claimed. Mirrors the
|
|
54
|
+
* `IPresetRegistrationResult` rejection shape (`resolve-preset.ts`) — a colliding contribution is
|
|
55
|
+
* reported here, never silently overridden.
|
|
56
|
+
*/
|
|
57
|
+
interface IRejectedCapability {
|
|
58
|
+
packId: string;
|
|
59
|
+
kind: TCapabilityKind;
|
|
60
|
+
id: string;
|
|
61
|
+
reason: string;
|
|
62
|
+
}
|
|
63
|
+
/** A whole pack rejected before bucket folding because an earlier pack claimed its id. */
|
|
64
|
+
interface IRejectedCapabilityPack {
|
|
65
|
+
packId: string;
|
|
66
|
+
reason: 'duplicate pack id';
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The pure result of {@link mergeCapabilityPacks}: the merged additive superset plus the rejection
|
|
70
|
+
* channel. Mirrors `IPresetRegistrationResult` — the merger returns both the merged set AND every
|
|
71
|
+
* collision, never a bare array.
|
|
72
|
+
*/
|
|
73
|
+
interface IMergedCapabilities {
|
|
74
|
+
merged: {
|
|
75
|
+
commandModules: readonly ICommandModule[];
|
|
76
|
+
tools: readonly FunctionTool[];
|
|
77
|
+
subagents: readonly IAgentDefinition[];
|
|
78
|
+
};
|
|
79
|
+
acceptedPacks: readonly ICapabilityPackMetadata[];
|
|
80
|
+
rejected: readonly IRejectedCapability[];
|
|
81
|
+
rejectedPacks: readonly IRejectedCapabilityPack[];
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/capability-pack/merge-capability-packs.d.ts
|
|
85
|
+
/**
|
|
86
|
+
* Merge capability packs additively into the product's base command modules.
|
|
87
|
+
*
|
|
88
|
+
* The additive analog of `resolvePreset` — a PURE, deterministic, IO-free fold. Given a product's
|
|
89
|
+
* `baseCommandModules` and its `packs` (in profile order), it produces the `base ⊕ pack` superset and a
|
|
90
|
+
* `{ merged, rejected }` result (mirroring `IPresetRegistrationResult`).
|
|
91
|
+
*
|
|
92
|
+
* **ONE precedence order, no silent override:** `baseCommandModules` < packs in profile order. A later
|
|
93
|
+
* contribution whose id duplicates an already-claimed id is REJECTED and reported in `rejected` — never
|
|
94
|
+
* silently overridden (mirrors `partitionExternalPresets`' "the first one wins / report rejection").
|
|
95
|
+
* Ids are claimed per bucket: command modules by `ICommandModule.name`, tools by `FunctionTool.getName()`,
|
|
96
|
+
* subagents by `IAgentDefinition.name`.
|
|
97
|
+
*
|
|
98
|
+
* This merger produces only the base ⊕ pack **superset**. A preset's
|
|
99
|
+
* `enabledCommandModules`/`disabledCommandModules` delta is applied AFTER this merge by the product shell's
|
|
100
|
+
* command-setup (as it does today) — the two compose (this widens, the preset delta filters), they do not
|
|
101
|
+
* fight.
|
|
102
|
+
*
|
|
103
|
+
* Pure w.r.t. its arguments: it reads only its inputs and returns fresh arrays; it mutates neither
|
|
104
|
+
* `baseCommandModules` nor any pack.
|
|
105
|
+
*/
|
|
106
|
+
declare function mergeCapabilityPacks(baseCommandModules: readonly ICommandModule[], packs: readonly ICapabilityPack[]): IMergedCapabilities;
|
|
107
|
+
//#endregion
|
|
108
|
+
export { IRejectedCapability as a, TCompositionFieldPolicy as c, IMergedCapabilities as i, ICapabilityPack as n, IRejectedCapabilityPack as o, ICapabilityPackMetadata as r, TCapabilityKind as s, mergeCapabilityPacks as t };
|
|
109
|
+
//# sourceMappingURL=index-BNDTmhmd.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BNDTmhmd.d.cts","names":[],"sources":["../src/capability-pack/capability-pack-types.ts","../src/capability-pack/merge-capability-packs.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;UA2BiB;;EAEf;;EAEA;;EAEA;;EAKA,0BAA0B;;EAE1B,iBAAiB;;EAEjB,qBAAqB;;;KAIX;;UAIK;EACf;EACA;EACA;;;KAIU;;;;;;UAOK;EACf;EACA,MAAM;EACN;EACA;;;UAIe;EACf;EACA;;;;;;;UAQe;EACf;IACE,yBAAyB;IACzB,gBAAgB;IAChB,oBAAoB;;EAEtB,wBAAwB;EACxB,mBAAmB;EACnB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;iBCnBV,qBACd,6BAA6B,kBAC7B,gBAAgB,oBACf"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { FunctionTool } from "@robota-sdk/agent-core";
|
|
2
|
+
import { IAgentDefinition, ICommandModule } from "@robota-sdk/agent-framework";
|
|
3
|
+
//#region src/capability-pack/capability-pack-types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The additive capability-bundle contract.
|
|
6
|
+
*
|
|
7
|
+
* An `ICapabilityPack` is the *additive* composition unit of a product surface: a plain data
|
|
8
|
+
* record of named capability buckets a consumer brings on top of a product's base command modules. It is
|
|
9
|
+
* the additive analog of `IPreset` — where a preset dials **behavior** (subtractive tool/command
|
|
10
|
+
* selection, persona, permission posture), a pack contributes **capability** (new tools, command modules,
|
|
11
|
+
* and subagents).
|
|
12
|
+
*
|
|
13
|
+
* **A pack is NOT declarative JSON (R6).** Unlike a serialized manifest (e.g. VS Code's `contributes`
|
|
14
|
+
* block, which the host reads without running contributor code), a pack carries **executable code
|
|
15
|
+
* objects** — `ICommandModule` values with `systemCommands` handlers, `FunctionTool` instances with
|
|
16
|
+
* `execute` functions, and subagent definitions. It is an **in-process composition argument**, a live
|
|
17
|
+
* value handed to the assembler, not a serialized declaration. The "no function across a serialization
|
|
18
|
+
* boundary" property that applies to VS Code manifests is therefore simply N/A here.
|
|
19
|
+
*
|
|
20
|
+
* The honest safety property is not "inert JSON" but: **packs are OPT-IN** (present only when a product
|
|
21
|
+
* profile lists them), **the merge is pure** (`mergeCapabilityPacks` executes none of the contributed
|
|
22
|
+
* code), and **any contributed command/tool runs ONLY through the existing permission-gated runtime**
|
|
23
|
+
* (`PermissionEnforcer`) at call time — never by the mere act of being merged.
|
|
24
|
+
*
|
|
25
|
+
* The contract layer performs no IO and declares no classes with side effects. It depends on
|
|
26
|
+
* `@robota-sdk/agent-framework` and `@robota-sdk/agent-core` for **contract types only**.
|
|
27
|
+
*/
|
|
28
|
+
interface ICapabilityPack {
|
|
29
|
+
/** Stable pack id (diagnostics + duplicate-pack reporting). */
|
|
30
|
+
id: string;
|
|
31
|
+
/** Human-readable pack title for discovery/UX. */
|
|
32
|
+
title?: string;
|
|
33
|
+
/** Human-readable pack description for discovery/UX. */
|
|
34
|
+
description?: string;
|
|
35
|
+
/** Command modules the pack contributes (identified by `ICommandModule.name`). */
|
|
36
|
+
commandModules?: readonly ICommandModule[];
|
|
37
|
+
/** Tools the pack contributes (identified by `FunctionTool.getName()`). */
|
|
38
|
+
tools?: readonly FunctionTool[];
|
|
39
|
+
/** Subagent definitions the pack contributes (identified by `IAgentDefinition.name`). */
|
|
40
|
+
subagents?: readonly IAgentDefinition[];
|
|
41
|
+
}
|
|
42
|
+
/** Exhaustive classification used by pure public-contract folds. */
|
|
43
|
+
type TCompositionFieldPolicy = 'consumed' | 'surfaced' | 'consumed-and-surfaced' | 'explicitly-rejected';
|
|
44
|
+
/** Discovery/UX metadata retained for every accepted pack in profile order. */
|
|
45
|
+
interface ICapabilityPackMetadata {
|
|
46
|
+
id: string;
|
|
47
|
+
title?: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
}
|
|
50
|
+
/** The `kind` of a rejected capability contribution. */
|
|
51
|
+
type TCapabilityKind = 'commandModule' | 'tool' | 'subagent';
|
|
52
|
+
/**
|
|
53
|
+
* A capability contribution that was NOT merged because its id was already claimed. Mirrors the
|
|
54
|
+
* `IPresetRegistrationResult` rejection shape (`resolve-preset.ts`) — a colliding contribution is
|
|
55
|
+
* reported here, never silently overridden.
|
|
56
|
+
*/
|
|
57
|
+
interface IRejectedCapability {
|
|
58
|
+
packId: string;
|
|
59
|
+
kind: TCapabilityKind;
|
|
60
|
+
id: string;
|
|
61
|
+
reason: string;
|
|
62
|
+
}
|
|
63
|
+
/** A whole pack rejected before bucket folding because an earlier pack claimed its id. */
|
|
64
|
+
interface IRejectedCapabilityPack {
|
|
65
|
+
packId: string;
|
|
66
|
+
reason: 'duplicate pack id';
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The pure result of {@link mergeCapabilityPacks}: the merged additive superset plus the rejection
|
|
70
|
+
* channel. Mirrors `IPresetRegistrationResult` — the merger returns both the merged set AND every
|
|
71
|
+
* collision, never a bare array.
|
|
72
|
+
*/
|
|
73
|
+
interface IMergedCapabilities {
|
|
74
|
+
merged: {
|
|
75
|
+
commandModules: readonly ICommandModule[];
|
|
76
|
+
tools: readonly FunctionTool[];
|
|
77
|
+
subagents: readonly IAgentDefinition[];
|
|
78
|
+
};
|
|
79
|
+
acceptedPacks: readonly ICapabilityPackMetadata[];
|
|
80
|
+
rejected: readonly IRejectedCapability[];
|
|
81
|
+
rejectedPacks: readonly IRejectedCapabilityPack[];
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/capability-pack/merge-capability-packs.d.ts
|
|
85
|
+
/**
|
|
86
|
+
* Merge capability packs additively into the product's base command modules.
|
|
87
|
+
*
|
|
88
|
+
* The additive analog of `resolvePreset` — a PURE, deterministic, IO-free fold. Given a product's
|
|
89
|
+
* `baseCommandModules` and its `packs` (in profile order), it produces the `base ⊕ pack` superset and a
|
|
90
|
+
* `{ merged, rejected }` result (mirroring `IPresetRegistrationResult`).
|
|
91
|
+
*
|
|
92
|
+
* **ONE precedence order, no silent override:** `baseCommandModules` < packs in profile order. A later
|
|
93
|
+
* contribution whose id duplicates an already-claimed id is REJECTED and reported in `rejected` — never
|
|
94
|
+
* silently overridden (mirrors `partitionExternalPresets`' "the first one wins / report rejection").
|
|
95
|
+
* Ids are claimed per bucket: command modules by `ICommandModule.name`, tools by `FunctionTool.getName()`,
|
|
96
|
+
* subagents by `IAgentDefinition.name`.
|
|
97
|
+
*
|
|
98
|
+
* This merger produces only the base ⊕ pack **superset**. A preset's
|
|
99
|
+
* `enabledCommandModules`/`disabledCommandModules` delta is applied AFTER this merge by the product shell's
|
|
100
|
+
* command-setup (as it does today) — the two compose (this widens, the preset delta filters), they do not
|
|
101
|
+
* fight.
|
|
102
|
+
*
|
|
103
|
+
* Pure w.r.t. its arguments: it reads only its inputs and returns fresh arrays; it mutates neither
|
|
104
|
+
* `baseCommandModules` nor any pack.
|
|
105
|
+
*/
|
|
106
|
+
declare function mergeCapabilityPacks(baseCommandModules: readonly ICommandModule[], packs: readonly ICapabilityPack[]): IMergedCapabilities;
|
|
107
|
+
//#endregion
|
|
108
|
+
export { IRejectedCapability as a, TCompositionFieldPolicy as c, IMergedCapabilities as i, ICapabilityPack as n, IRejectedCapabilityPack as o, ICapabilityPackMetadata as r, TCapabilityKind as s, mergeCapabilityPacks as t };
|
|
109
|
+
//# sourceMappingURL=index-BNDTmhmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BNDTmhmd.d.ts","names":[],"sources":["../src/capability-pack/capability-pack-types.ts","../src/capability-pack/merge-capability-packs.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;UA2BiB;;EAEf;;EAEA;;EAEA;;EAKA,0BAA0B;;EAE1B,iBAAiB;;EAEjB,qBAAqB;;;KAIX;;UAIK;EACf;EACA;EACA;;;KAIU;;;;;;UAOK;EACf;EACA,MAAM;EACN;EACA;;;UAIe;EACf;EACA;;;;;;;UAQe;EACf;IACE,yBAAyB;IACzB,gBAAgB;IAChB,oBAAoB;;EAEtB,wBAAwB;EACxB,mBAAmB;EACnB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;iBCnBV,qBACd,6BAA6B,kBAC7B,gBAAgB,oBACf"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { a as IResolvedPresetOptions, i as IPreset } from "./load-external-presets-DCY3HJ8d.cjs";
|
|
2
|
+
//#region src/preset/output-style-types.d.ts
|
|
3
|
+
type TOutputStyleSource = 'built-in' | 'managed' | 'user' | 'project';
|
|
4
|
+
type TOutputStyleTokenCost = 'baseline' | 'low' | 'medium' | 'high' | 'unspecified';
|
|
5
|
+
/** The provider-neutral response-shaping value carried into the framework prompt. */
|
|
6
|
+
interface IOutputStyle {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly description: string;
|
|
10
|
+
readonly instructions: string;
|
|
11
|
+
readonly keepCodingInstructions: boolean;
|
|
12
|
+
readonly tokenCost: TOutputStyleTokenCost;
|
|
13
|
+
readonly source: TOutputStyleSource;
|
|
14
|
+
}
|
|
15
|
+
/** Secret-free discovery projection used by command and UI surfaces. */
|
|
16
|
+
type IOutputStyleSummary = Pick<IOutputStyle, 'id' | 'name' | 'description' | 'tokenCost' | 'source'>;
|
|
17
|
+
interface IOutputStyleFile {
|
|
18
|
+
readonly fileName: string;
|
|
19
|
+
readonly content: string;
|
|
20
|
+
}
|
|
21
|
+
/** A source is already bounded by its owner; this package only decodes the supplied Markdown. */
|
|
22
|
+
interface IOutputStyleSource {
|
|
23
|
+
readonly scope: Exclude<TOutputStyleSource, 'built-in'>;
|
|
24
|
+
readonly displayName: string;
|
|
25
|
+
/** Lower values are applied first. The last scope with an id wins. */
|
|
26
|
+
readonly precedence: number;
|
|
27
|
+
readonly files: readonly IOutputStyleFile[];
|
|
28
|
+
}
|
|
29
|
+
interface IOutputStyleLoadResult {
|
|
30
|
+
readonly styles: readonly IOutputStyle[];
|
|
31
|
+
readonly loaded: readonly string[];
|
|
32
|
+
readonly errors: readonly {
|
|
33
|
+
file: string;
|
|
34
|
+
error: string;
|
|
35
|
+
}[];
|
|
36
|
+
}
|
|
37
|
+
interface IOutputStyleRegistry {
|
|
38
|
+
listOutputStyles(): readonly IOutputStyleSummary[];
|
|
39
|
+
getOutputStyle(id: string): IOutputStyle | undefined;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/preset/presets/default.d.ts
|
|
43
|
+
/**
|
|
44
|
+
* The neutral baseline preset. It carries NO option overrides so that resolving it is a
|
|
45
|
+
* pure no-op — applying `default` reproduces the standard agent behaviour exactly (no regression).
|
|
46
|
+
* The default agent identity is chosen by the product shell, not here,
|
|
47
|
+
* so that this preset stays a true identity element under merging.
|
|
48
|
+
*/
|
|
49
|
+
declare const defaultPreset: IPreset;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/preset/presets/autonomous-builder.d.ts
|
|
52
|
+
/**
|
|
53
|
+
* The first opinionated built-in preset: an autonomous, self-verifying builder posture.
|
|
54
|
+
*
|
|
55
|
+
* It both ships a portable persona block AND sets the framework/executor mechanism flags
|
|
56
|
+
* (`effort`, `autonomy`, `enableParallelSubagents`, `selfVerification`) so the style is backed
|
|
57
|
+
* by real, observable behaviour rather than persona text alone. The identifier is generic; the
|
|
58
|
+
* sourcing footnote in `description` is the only place a work-style attribution appears.
|
|
59
|
+
*
|
|
60
|
+
* For long-running tasks the effort dial may be raised to a higher tier; `'high'` is the
|
|
61
|
+
* neutral default carried here.
|
|
62
|
+
*/
|
|
63
|
+
declare const autonomousBuilderPreset: IPreset;
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/preset/resolve-preset.d.ts
|
|
66
|
+
/** Lightweight `{ id, title, description }` view of a preset for discovery/UX. */
|
|
67
|
+
interface IPresetSummary {
|
|
68
|
+
id: string;
|
|
69
|
+
title: string;
|
|
70
|
+
description: string;
|
|
71
|
+
}
|
|
72
|
+
/** Outcome of {@link partitionExternalPresets}: which presets were accepted and which rejected. */
|
|
73
|
+
interface IPresetRegistrationResult {
|
|
74
|
+
accepted: readonly IPreset[];
|
|
75
|
+
rejected: readonly {
|
|
76
|
+
id: string;
|
|
77
|
+
reason: string;
|
|
78
|
+
}[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Apply the external-preset conflict policy to one list, reading and mutating NOTHING outside it.
|
|
82
|
+
*
|
|
83
|
+
* Conflict policy: an external preset whose id matches a BUILT-IN preset is rejected
|
|
84
|
+
* (`'collides with built-in preset'`) — built-ins always win. An external preset whose id matches an
|
|
85
|
+
* earlier ACCEPTED external preset is rejected (`'duplicate preset id'`) — first one wins.
|
|
86
|
+
*
|
|
87
|
+
* The policy is not the process's to hold, only the list it is applied to is. Both callers —
|
|
88
|
+
* {@link createPresetRegistry} and the external-preset loader — now pass their own list, so two
|
|
89
|
+
* products in one process cannot see each other's presets, and a repeated load cannot accumulate.
|
|
90
|
+
*/
|
|
91
|
+
declare function partitionExternalPresets(presets: readonly IPreset[]): IPresetRegistrationResult;
|
|
92
|
+
/**
|
|
93
|
+
* Override layers for {@link resolvePreset}, in increasing precedence.
|
|
94
|
+
* `cliOverrides` model CLI flags; `explicit` models programmatic/SDK options.
|
|
95
|
+
*/
|
|
96
|
+
interface IResolvePresetContext {
|
|
97
|
+
cliOverrides?: IResolvedPresetOptions;
|
|
98
|
+
explicit?: IResolvedPresetOptions;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A per-call, instance-scoped preset registry — the ONLY one there is.
|
|
102
|
+
*
|
|
103
|
+
* A registry holds its own merged list `[built-ins, ...accepted externals]`, so two products in one
|
|
104
|
+
* process do not share one and repeat construction does not accumulate. The
|
|
105
|
+
* `@robota-sdk/agent-product` assembler builds one per `assembleProduct` call and surfaces it on the
|
|
106
|
+
* command-host context, which is how `/preset` inside a live session reaches THIS product's presets
|
|
107
|
+
* rather than the process's.
|
|
108
|
+
*/
|
|
109
|
+
interface IPresetRegistry {
|
|
110
|
+
/** Resolve a preset id against this registry's presets. */
|
|
111
|
+
resolvePreset(id: string, context?: IResolvePresetContext): IResolvedPresetOptions;
|
|
112
|
+
/** Look up a preset by id within this registry, or `undefined`. */
|
|
113
|
+
getPreset(id: string): IPreset | undefined;
|
|
114
|
+
/** `{ id, title, description }` summaries of every preset in this registry. */
|
|
115
|
+
listPresets(): readonly IPresetSummary[];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Build an instance-scoped {@link IPresetRegistry} over `[built-ins, ...externalPresets]`.
|
|
119
|
+
*
|
|
120
|
+
* The conflict policy is {@link partitionExternalPresets}, applied to the argument list only: built-ins
|
|
121
|
+
* always win, and among the external presets the first one wins. No module-level state is read or
|
|
122
|
+
* mutated — this is a pure factory, and there is no module-level state to read.
|
|
123
|
+
*
|
|
124
|
+
* Called with no argument it is the BUILT-INS, which is the registry a host that supplies none gets.
|
|
125
|
+
*/
|
|
126
|
+
declare function createPresetRegistry(externalPresets?: readonly IPreset[]): IPresetRegistry;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/preset/preset-validation.d.ts
|
|
129
|
+
/** Result of {@link validateExternalPreset}: the validated preset, or a single error message. */
|
|
130
|
+
type TPresetValidationResult = {
|
|
131
|
+
ok: true;
|
|
132
|
+
preset: IPreset;
|
|
133
|
+
} | {
|
|
134
|
+
ok: false;
|
|
135
|
+
error: string;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Manually validate an unknown value as an {@link IPreset} (no schema library).
|
|
139
|
+
*
|
|
140
|
+
* Required fields: non-empty `id`, `title`, `description` strings. Every other field is
|
|
141
|
+
* optional and is validated only when present; an unrecognised field is dropped (the built
|
|
142
|
+
* preset carries the recognised fields only, never unknown keys). On the first failed check
|
|
143
|
+
* returns `{ ok: false, error: '<field>: <reason>' }`.
|
|
144
|
+
*/
|
|
145
|
+
declare function validateExternalPreset(value: unknown): TPresetValidationResult;
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/preset/output-styles.d.ts
|
|
148
|
+
declare const builtInOutputStyles: readonly IOutputStyle[];
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/preset/output-style-registry.d.ts
|
|
151
|
+
declare function parseOutputStyleFile(file: IOutputStyleFile, source: TOutputStyleSource): IOutputStyle;
|
|
152
|
+
declare function loadOutputStylesFromSources(sources: readonly IOutputStyleSource[]): IOutputStyleLoadResult;
|
|
153
|
+
declare function createOutputStyleRegistry(sources?: readonly IOutputStyleSource[]): IOutputStyleRegistry;
|
|
154
|
+
//#endregion
|
|
155
|
+
export { TOutputStyleTokenCost as S, IOutputStyleLoadResult as _, TPresetValidationResult as a, IOutputStyleSummary as b, IPresetRegistry as c, createPresetRegistry as d, partitionExternalPresets as f, IOutputStyleFile as g, IOutputStyle as h, builtInOutputStyles as i, IPresetSummary as l, defaultPreset as m, loadOutputStylesFromSources as n, validateExternalPreset as o, autonomousBuilderPreset as p, parseOutputStyleFile as r, IPresetRegistrationResult as s, createOutputStyleRegistry as t, IResolvePresetContext as u, IOutputStyleRegistry as v, TOutputStyleSource as x, IOutputStyleSource as y };
|
|
156
|
+
//# sourceMappingURL=index-Cz8aDRO3.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Cz8aDRO3.d.cts","names":[],"sources":["../src/preset/output-style-types.ts","../src/preset/presets/default.ts","../src/preset/presets/autonomous-builder.ts","../src/preset/resolve-preset.ts","../src/preset/preset-validation.ts","../src/preset/output-styles.ts","../src/preset/output-style-registry.ts"],"mappings":";;KAAY;KAEA;;UAGK;WACN;WACA;WACA;WACA;WACA;WACA,WAAW;WACX,QAAQ;;;KAIP,sBAAsB,KAChC;UAIe;WACN;WACA;;;UAIM;WACN,OAAO,QAAQ;WACf;;WAEA;WACA,gBAAgB;;UAGV;WACN,iBAAiB;WACjB;WACA;IAAmB;IAAc;;;UAG3B;EACf,6BAA6B;EAC7B,eAAe,aAAa;;;;;;;;;;cCnCjB,eAAe;;;;;;;;;;;;;;cCsCf,yBAAyB;;;;UCXrB;EACf;EACA;EACA;;;UAIe;EACf,mBAAmB;EACnB;IAAqB;IAAY;;;;;;;;;;;;;;iBAcnB,yBAAyB,kBAAkB,YAAY;;;;;UAwBtD;EACf,eAAe;EACf,WAAW;;;;;;;;;;;UAuFI;;EAEf,cAAc,YAAY,UAAU,wBAAwB;;EAE5D,UAAU,aAAa;;EAEvB,wBAAwB;;;;;;;;;;;iBAYV,qBAAqB,2BAA0B,YAAiB;;;;KCnLpE;EAA4B;EAAU,QAAQ;;EAAc;EAAW;;;;;;;;;;iBAyKnE,uBAAuB,iBAAiB;;;cC/K3C,8BAA8B;;;iBCyF3B,qBACd,MAAM,kBACN,QAAQ,qBACP;iBA6Ca,4BACd,kBAAkB,uBACjB;iBA4Ca,0BACd,mBAAkB,uBACjB"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { a as IResolvedPresetOptions, i as IPreset } from "./load-external-presets-DCY3HJ8d.js";
|
|
2
|
+
//#region src/preset/output-style-types.d.ts
|
|
3
|
+
type TOutputStyleSource = 'built-in' | 'managed' | 'user' | 'project';
|
|
4
|
+
type TOutputStyleTokenCost = 'baseline' | 'low' | 'medium' | 'high' | 'unspecified';
|
|
5
|
+
/** The provider-neutral response-shaping value carried into the framework prompt. */
|
|
6
|
+
interface IOutputStyle {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly description: string;
|
|
10
|
+
readonly instructions: string;
|
|
11
|
+
readonly keepCodingInstructions: boolean;
|
|
12
|
+
readonly tokenCost: TOutputStyleTokenCost;
|
|
13
|
+
readonly source: TOutputStyleSource;
|
|
14
|
+
}
|
|
15
|
+
/** Secret-free discovery projection used by command and UI surfaces. */
|
|
16
|
+
type IOutputStyleSummary = Pick<IOutputStyle, 'id' | 'name' | 'description' | 'tokenCost' | 'source'>;
|
|
17
|
+
interface IOutputStyleFile {
|
|
18
|
+
readonly fileName: string;
|
|
19
|
+
readonly content: string;
|
|
20
|
+
}
|
|
21
|
+
/** A source is already bounded by its owner; this package only decodes the supplied Markdown. */
|
|
22
|
+
interface IOutputStyleSource {
|
|
23
|
+
readonly scope: Exclude<TOutputStyleSource, 'built-in'>;
|
|
24
|
+
readonly displayName: string;
|
|
25
|
+
/** Lower values are applied first. The last scope with an id wins. */
|
|
26
|
+
readonly precedence: number;
|
|
27
|
+
readonly files: readonly IOutputStyleFile[];
|
|
28
|
+
}
|
|
29
|
+
interface IOutputStyleLoadResult {
|
|
30
|
+
readonly styles: readonly IOutputStyle[];
|
|
31
|
+
readonly loaded: readonly string[];
|
|
32
|
+
readonly errors: readonly {
|
|
33
|
+
file: string;
|
|
34
|
+
error: string;
|
|
35
|
+
}[];
|
|
36
|
+
}
|
|
37
|
+
interface IOutputStyleRegistry {
|
|
38
|
+
listOutputStyles(): readonly IOutputStyleSummary[];
|
|
39
|
+
getOutputStyle(id: string): IOutputStyle | undefined;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/preset/presets/default.d.ts
|
|
43
|
+
/**
|
|
44
|
+
* The neutral baseline preset. It carries NO option overrides so that resolving it is a
|
|
45
|
+
* pure no-op — applying `default` reproduces the standard agent behaviour exactly (no regression).
|
|
46
|
+
* The default agent identity is chosen by the product shell, not here,
|
|
47
|
+
* so that this preset stays a true identity element under merging.
|
|
48
|
+
*/
|
|
49
|
+
declare const defaultPreset: IPreset;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/preset/presets/autonomous-builder.d.ts
|
|
52
|
+
/**
|
|
53
|
+
* The first opinionated built-in preset: an autonomous, self-verifying builder posture.
|
|
54
|
+
*
|
|
55
|
+
* It both ships a portable persona block AND sets the framework/executor mechanism flags
|
|
56
|
+
* (`effort`, `autonomy`, `enableParallelSubagents`, `selfVerification`) so the style is backed
|
|
57
|
+
* by real, observable behaviour rather than persona text alone. The identifier is generic; the
|
|
58
|
+
* sourcing footnote in `description` is the only place a work-style attribution appears.
|
|
59
|
+
*
|
|
60
|
+
* For long-running tasks the effort dial may be raised to a higher tier; `'high'` is the
|
|
61
|
+
* neutral default carried here.
|
|
62
|
+
*/
|
|
63
|
+
declare const autonomousBuilderPreset: IPreset;
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/preset/resolve-preset.d.ts
|
|
66
|
+
/** Lightweight `{ id, title, description }` view of a preset for discovery/UX. */
|
|
67
|
+
interface IPresetSummary {
|
|
68
|
+
id: string;
|
|
69
|
+
title: string;
|
|
70
|
+
description: string;
|
|
71
|
+
}
|
|
72
|
+
/** Outcome of {@link partitionExternalPresets}: which presets were accepted and which rejected. */
|
|
73
|
+
interface IPresetRegistrationResult {
|
|
74
|
+
accepted: readonly IPreset[];
|
|
75
|
+
rejected: readonly {
|
|
76
|
+
id: string;
|
|
77
|
+
reason: string;
|
|
78
|
+
}[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Apply the external-preset conflict policy to one list, reading and mutating NOTHING outside it.
|
|
82
|
+
*
|
|
83
|
+
* Conflict policy: an external preset whose id matches a BUILT-IN preset is rejected
|
|
84
|
+
* (`'collides with built-in preset'`) — built-ins always win. An external preset whose id matches an
|
|
85
|
+
* earlier ACCEPTED external preset is rejected (`'duplicate preset id'`) — first one wins.
|
|
86
|
+
*
|
|
87
|
+
* The policy is not the process's to hold, only the list it is applied to is. Both callers —
|
|
88
|
+
* {@link createPresetRegistry} and the external-preset loader — now pass their own list, so two
|
|
89
|
+
* products in one process cannot see each other's presets, and a repeated load cannot accumulate.
|
|
90
|
+
*/
|
|
91
|
+
declare function partitionExternalPresets(presets: readonly IPreset[]): IPresetRegistrationResult;
|
|
92
|
+
/**
|
|
93
|
+
* Override layers for {@link resolvePreset}, in increasing precedence.
|
|
94
|
+
* `cliOverrides` model CLI flags; `explicit` models programmatic/SDK options.
|
|
95
|
+
*/
|
|
96
|
+
interface IResolvePresetContext {
|
|
97
|
+
cliOverrides?: IResolvedPresetOptions;
|
|
98
|
+
explicit?: IResolvedPresetOptions;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A per-call, instance-scoped preset registry — the ONLY one there is.
|
|
102
|
+
*
|
|
103
|
+
* A registry holds its own merged list `[built-ins, ...accepted externals]`, so two products in one
|
|
104
|
+
* process do not share one and repeat construction does not accumulate. The
|
|
105
|
+
* `@robota-sdk/agent-product` assembler builds one per `assembleProduct` call and surfaces it on the
|
|
106
|
+
* command-host context, which is how `/preset` inside a live session reaches THIS product's presets
|
|
107
|
+
* rather than the process's.
|
|
108
|
+
*/
|
|
109
|
+
interface IPresetRegistry {
|
|
110
|
+
/** Resolve a preset id against this registry's presets. */
|
|
111
|
+
resolvePreset(id: string, context?: IResolvePresetContext): IResolvedPresetOptions;
|
|
112
|
+
/** Look up a preset by id within this registry, or `undefined`. */
|
|
113
|
+
getPreset(id: string): IPreset | undefined;
|
|
114
|
+
/** `{ id, title, description }` summaries of every preset in this registry. */
|
|
115
|
+
listPresets(): readonly IPresetSummary[];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Build an instance-scoped {@link IPresetRegistry} over `[built-ins, ...externalPresets]`.
|
|
119
|
+
*
|
|
120
|
+
* The conflict policy is {@link partitionExternalPresets}, applied to the argument list only: built-ins
|
|
121
|
+
* always win, and among the external presets the first one wins. No module-level state is read or
|
|
122
|
+
* mutated — this is a pure factory, and there is no module-level state to read.
|
|
123
|
+
*
|
|
124
|
+
* Called with no argument it is the BUILT-INS, which is the registry a host that supplies none gets.
|
|
125
|
+
*/
|
|
126
|
+
declare function createPresetRegistry(externalPresets?: readonly IPreset[]): IPresetRegistry;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/preset/preset-validation.d.ts
|
|
129
|
+
/** Result of {@link validateExternalPreset}: the validated preset, or a single error message. */
|
|
130
|
+
type TPresetValidationResult = {
|
|
131
|
+
ok: true;
|
|
132
|
+
preset: IPreset;
|
|
133
|
+
} | {
|
|
134
|
+
ok: false;
|
|
135
|
+
error: string;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Manually validate an unknown value as an {@link IPreset} (no schema library).
|
|
139
|
+
*
|
|
140
|
+
* Required fields: non-empty `id`, `title`, `description` strings. Every other field is
|
|
141
|
+
* optional and is validated only when present; an unrecognised field is dropped (the built
|
|
142
|
+
* preset carries the recognised fields only, never unknown keys). On the first failed check
|
|
143
|
+
* returns `{ ok: false, error: '<field>: <reason>' }`.
|
|
144
|
+
*/
|
|
145
|
+
declare function validateExternalPreset(value: unknown): TPresetValidationResult;
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/preset/output-styles.d.ts
|
|
148
|
+
declare const builtInOutputStyles: readonly IOutputStyle[];
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/preset/output-style-registry.d.ts
|
|
151
|
+
declare function parseOutputStyleFile(file: IOutputStyleFile, source: TOutputStyleSource): IOutputStyle;
|
|
152
|
+
declare function loadOutputStylesFromSources(sources: readonly IOutputStyleSource[]): IOutputStyleLoadResult;
|
|
153
|
+
declare function createOutputStyleRegistry(sources?: readonly IOutputStyleSource[]): IOutputStyleRegistry;
|
|
154
|
+
//#endregion
|
|
155
|
+
export { TOutputStyleTokenCost as S, IOutputStyleLoadResult as _, TPresetValidationResult as a, IOutputStyleSummary as b, IPresetRegistry as c, createPresetRegistry as d, partitionExternalPresets as f, IOutputStyleFile as g, IOutputStyle as h, builtInOutputStyles as i, IPresetSummary as l, defaultPreset as m, loadOutputStylesFromSources as n, validateExternalPreset as o, autonomousBuilderPreset as p, parseOutputStyleFile as r, IPresetRegistrationResult as s, createOutputStyleRegistry as t, IResolvePresetContext as u, IOutputStyleRegistry as v, TOutputStyleSource as x, IOutputStyleSource as y };
|
|
156
|
+
//# sourceMappingURL=index-jksIH551.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-jksIH551.d.ts","names":[],"sources":["../src/preset/output-style-types.ts","../src/preset/presets/default.ts","../src/preset/presets/autonomous-builder.ts","../src/preset/resolve-preset.ts","../src/preset/preset-validation.ts","../src/preset/output-styles.ts","../src/preset/output-style-registry.ts"],"mappings":";;KAAY;KAEA;;UAGK;WACN;WACA;WACA;WACA;WACA;WACA,WAAW;WACX,QAAQ;;;KAIP,sBAAsB,KAChC;UAIe;WACN;WACA;;;UAIM;WACN,OAAO,QAAQ;WACf;;WAEA;WACA,gBAAgB;;UAGV;WACN,iBAAiB;WACjB;WACA;IAAmB;IAAc;;;UAG3B;EACf,6BAA6B;EAC7B,eAAe,aAAa;;;;;;;;;;cCnCjB,eAAe;;;;;;;;;;;;;;cCsCf,yBAAyB;;;;UCXrB;EACf;EACA;EACA;;;UAIe;EACf,mBAAmB;EACnB;IAAqB;IAAY;;;;;;;;;;;;;;iBAcnB,yBAAyB,kBAAkB,YAAY;;;;;UAwBtD;EACf,eAAe;EACf,WAAW;;;;;;;;;;;UAuFI;;EAEf,cAAc,YAAY,UAAU,wBAAwB;;EAE5D,UAAU,aAAa;;EAEvB,wBAAwB;;;;;;;;;;;iBAYV,qBAAqB,2BAA0B,YAAiB;;;;KCnLpE;EAA4B;EAAU,QAAQ;;EAAc;EAAW;;;;;;;;;;iBAyKnE,uBAAuB,iBAAiB;;;cC/K3C,8BAA8B;;;iBCyF3B,qBACd,MAAM,kBACN,QAAQ,qBACP;iBA6Ca,4BACd,kBAAkB,uBACjB;iBA4Ca,0BACd,mBAAkB,uBACjB"}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./capability-pack-Dc6eJ76H.cjs"),t=require("./load-external-presets-DyoUUA3V.cjs");require("./preset-tH5pgRIC.cjs");let n=require("@robota-sdk/agent-core"),r=require("@robota-sdk/agent-framework");function i(e,t){let n=e.provider??t.provider,r=e.providerErrorGuidance??t.providerErrorGuidance,i=e.promptFileReferenceTag??t.promptFileReferenceTag,a=e.modelCommandToolPrefix??t.modelCommandToolPrefix,o=e.subagentHookEnvironmentNames??t.subagentHookEnvironmentNames,s=e.observerFailureWarningCode??t.observerFailureWarningCode,c=e.permissionMode===void 0&&t.defaultPermissionMode!==void 0?{permissionMode:t.defaultPermissionMode}:{},l=e.commandModules??t.commandModules,u={...e.commandHostAdapters,presetRegistry:t.presetRegistry};if(`session`in e)return{...e,provider:n,...r===void 0?{}:{providerErrorGuidance:r},...i===void 0?{}:{promptFileReferenceTag:i},...a===void 0?{}:{modelCommandToolPrefix:a},...o===void 0?{}:{subagentHookEnvironmentNames:o},...s===void 0?{}:{observerFailureWarningCode:s},commandModules:l,commandHostAdapters:u,...c};if(n===void 0)throw Error("assembleProduct: no provider available — the profile carried neither `providerSettings` nor an injected `provider`, and the session options supplied none.");return{...e,provider:n,...r===void 0?{}:{providerErrorGuidance:r},...i===void 0?{}:{promptFileReferenceTag:i},...a===void 0?{}:{modelCommandToolPrefix:a},...o===void 0?{}:{subagentHookEnvironmentNames:o},...s===void 0?{}:{observerFailureWarningCode:s},commandModules:l,commandHostAdapters:u,additionalTools:[...e.additionalTools??[],...t.tools],...t.subagents.length>0?{agentDefinitions:t.subagents}:{},...c}}function a(a){let o=a.presetRegistry??t.r(a.presets??[]),s=a.defaultPresetId===void 0?void 0:o.resolvePreset(a.defaultPresetId,a.presetContext),{merged:c,acceptedPacks:l,rejected:u,rejectedPacks:d}=e.t(a.baseCommandModules??[],a.packs??[]),f=a.provider??(a.providerSettings===void 0?void 0:(0,n.createProviderFromConfig)(a.providerSettings,a.providerDefinitions)),p=e=>i(e.session,{provider:f,providerErrorGuidance:a.providerErrorGuidance,promptFileReferenceTag:a.promptFileReferenceTag,modelCommandToolPrefix:a.modelCommandToolPrefix,subagentHookEnvironmentNames:a.subagentHookEnvironmentNames,observerFailureWarningCode:a.observerFailureWarningCode,commandModules:c.commandModules,tools:c.tools,subagents:c.subagents,defaultPermissionMode:s?.permissionMode,presetRegistry:o});return{id:a.id,...a.agentName===void 0?{}:{agentName:a.agentName},...a.version===void 0?{}:{version:a.version},...f===void 0?{}:{provider:f},providerDefinitions:a.providerDefinitions,commandModules:c.commandModules,tools:c.tools,subagents:c.subagents,acceptedPacks:l,rejectedCapabilities:u,rejectedPacks:d,presets:o,resolvePreset:(e,t)=>o.resolvePreset(e,t),...a.defaultPresetId===void 0?{}:{defaultPresetId:a.defaultPresetId},...s===void 0?{}:{defaultPreset:s},backgroundTaskRunners:a.backgroundTaskRunners??[],...a.subagentRunnerFactory===void 0?{}:{subagentRunnerFactory:a.subagentRunnerFactory},...a.transports===void 0?{}:{transports:typeof a.transports==`function`?a.transports():a.transports},buildRuntimeOptions:p,buildRuntime:e=>(0,r.buildRuntimeSession)(p(e))}}exports.assembleProduct=a;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as IRejectedCapability, n as ICapabilityPack, o as IRejectedCapabilityPack, r as ICapabilityPackMetadata } from "./index-BNDTmhmd.cjs";
|
|
2
|
+
import { a as IResolvedPresetOptions, i as IPreset } from "./load-external-presets-DCY3HJ8d.cjs";
|
|
3
|
+
import { c as IPresetRegistry, u as IResolvePresetContext } from "./index-Cz8aDRO3.cjs";
|
|
2
4
|
import { FunctionTool, IAIProvider, IProviderDefinition, IProviderDefinitionConfig } from "@robota-sdk/agent-core";
|
|
3
5
|
import { IAgentDefinition, IBackgroundTaskRunner, ICommandModule, ICreateSessionOptions, IProviderErrorGuidance, InteractiveSession, TInteractiveSessionOptions, TSubagentRunnerFactory } from "@robota-sdk/agent-framework";
|
|
4
|
-
import { ITransportRegistryView } from "@robota-sdk/agent-interface
|
|
5
|
-
import { IPreset, IPresetRegistry, IResolvePresetContext, IResolvedPresetOptions } from "@robota-sdk/agent-preset";
|
|
6
|
+
import { ITransportRegistryView } from "@robota-sdk/agent-interface/transport";
|
|
6
7
|
//#region src/product-profile.d.ts
|
|
7
8
|
/**
|
|
8
9
|
* A declarative "this is my product" object — the sole argument of {@link assembleProduct}. Everything
|
|
@@ -10,7 +11,7 @@ import { IPreset, IPresetRegistry, IResolvePresetContext, IResolvedPresetOptions
|
|
|
10
11
|
* assembler hard-codes no product's choices. the configured CLI is one profile among many; an external host brings
|
|
11
12
|
* its own.
|
|
12
13
|
*
|
|
13
|
-
* The responsibility split
|
|
14
|
+
* The responsibility split: **preset = behavior/persona**, **pack = capability**, **profile =
|
|
14
15
|
* product assembly** — the profile carries neither behavior nor capability *definitions*, it only
|
|
15
16
|
* *references* them and supplies identity + injected adapters.
|
|
16
17
|
*/
|
|
@@ -60,14 +61,14 @@ interface IProductProfile {
|
|
|
60
61
|
*/
|
|
61
62
|
presets?: readonly IPreset[];
|
|
62
63
|
/**
|
|
63
|
-
* An ALREADY-BUILT instance-scoped registry (from `
|
|
64
|
+
* An ALREADY-BUILT instance-scoped registry (from the `preset` subpath's `createPresetRegistry`) to use
|
|
64
65
|
* instead of building one from {@link presets}. When supplied it WINS over `presets`.
|
|
65
66
|
*
|
|
66
67
|
* This is the seam for a shell that must resolve a preset BEFORE it can build the profile — a preset
|
|
67
68
|
* can carry the `model` and `agentName` the profile itself is constructed from, so "resolve, then
|
|
68
69
|
* assemble" is a real ordering constraint, not a product-specific quirk. Handing the registry in (rather than the
|
|
69
70
|
* presets) is what keeps that pre-assembly resolution and `assembleProduct`'s own resolution on ONE
|
|
70
|
-
* registry instead of two equivalent-but-separate ones
|
|
71
|
+
* registry instead of two equivalent-but-separate ones. R8 is unaffected: the registry is
|
|
71
72
|
* still instance-scoped and no module-level state is read or mutated.
|
|
72
73
|
*/
|
|
73
74
|
presetRegistry?: IPresetRegistry;
|
|
@@ -142,7 +143,7 @@ interface IAssembledProduct {
|
|
|
142
143
|
/**
|
|
143
144
|
* The default preset id (passthrough) and its resolved posture — resolved over {@link presets} with the
|
|
144
145
|
* profile's `presetContext`, so a shell that resolved the same id with the same overrides gets the same
|
|
145
|
-
* value here
|
|
146
|
+
* value here, not a variant missing its override layers.
|
|
146
147
|
*/
|
|
147
148
|
defaultPresetId?: string;
|
|
148
149
|
defaultPreset?: IResolvedPresetOptions;
|
|
@@ -180,8 +181,8 @@ interface IAssembledProduct {
|
|
|
180
181
|
*
|
|
181
182
|
* What it does:
|
|
182
183
|
* 1. Builds a PER-CALL instance-scoped preset registry over `profile.presets` (R8) — or adopts the
|
|
183
|
-
* instance the caller already built and handed in as `profile.presetRegistry
|
|
184
|
-
* never mutates
|
|
184
|
+
* instance the caller already built and handed in as `profile.presetRegistry`. Either way it
|
|
185
|
+
* never mutates the `preset` subpath's module-level `externalPresets` global, so two products in one process do
|
|
185
186
|
* not share one registry and repeat calls do not accumulate. `defaultPresetId` is resolved over that
|
|
186
187
|
* registry with `profile.presetContext`, so the product's `defaultPreset` is the caller's resolution.
|
|
187
188
|
* 2. Merges the additive capability packs onto `profile.baseCommandModules` via `mergeCapabilityPacks`
|
|
@@ -190,7 +191,7 @@ interface IAssembledProduct {
|
|
|
190
191
|
* `profile.providerSettings` (owner Decision 1) via agent-core's pure `createProviderFromConfig`; an
|
|
191
192
|
* injected `profile.provider` overrides it.
|
|
192
193
|
* 4. Produces `buildRuntimeOptions`/`buildRuntime`, which DELEGATE runtime construction to
|
|
193
|
-
* `agent-framework`'s `buildRuntimeSession` seam (
|
|
194
|
+
* `agent-framework`'s `buildRuntimeSession` seam (the SSOT for runtime assembly) — never re-implementing runtime
|
|
194
195
|
* assembly — overlaying the assembled modules, pack tools, and pack subagents (`agentDefinitions`).
|
|
195
196
|
*
|
|
196
197
|
* Settings/args/env resolution and concrete transports/presentation stay in the shell; `assembleProduct`
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/product-profile.ts","../src/assemble-product.ts"],"mappings":"
|
|
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"}
|