@xemahq/agent-session-runtime 0.6.6 → 0.6.7
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/LICENSE +176 -175
- package/dist/lib/composition-resolution.d.ts +43 -0
- package/dist/lib/composition-resolution.d.ts.map +1 -0
- package/dist/lib/composition-resolution.js +236 -0
- package/dist/lib/composition-resolution.js.map +1 -0
- package/dist/lib/composition-workspace-manifest.d.ts +51 -0
- package/dist/lib/composition-workspace-manifest.d.ts.map +1 -0
- package/dist/lib/composition-workspace-manifest.js +178 -0
- package/dist/lib/composition-workspace-manifest.js.map +1 -0
- package/package.json +14 -4
- package/src/lib/agent-workspace-manifest.ts +2 -2
- package/src/lib/composer.ts +2 -2
- package/src/lib/drift-detector.ts +2 -2
- package/src/lib/environment-resolver.ts +3 -3
- package/src/lib/skill-bundle-template-resolver.ts +1 -1
- package/src/lib/types.ts +1 -1
package/LICENSE
CHANGED
|
@@ -1,175 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ModelRef, type NodeOverlayFragment, type SubAgentBinding } from '@xemahq/kernel-contracts/workflow';
|
|
2
|
+
import type { ResolvedAgent, ResolvedAgentNode } from '@xemahq/kernel-contracts/agent-composition';
|
|
3
|
+
import type { PermissionMap } from '@xemahq/kernel-contracts/agent-permission';
|
|
4
|
+
import { type ToolSelectionEntry } from '@xemahq/kernel-contracts/mcp-tool';
|
|
5
|
+
export declare class AgentResolutionError extends Error {
|
|
6
|
+
constructor(context: string, detail: string);
|
|
7
|
+
}
|
|
8
|
+
export interface FlattenedAgentNode {
|
|
9
|
+
readonly slug: string;
|
|
10
|
+
readonly alias?: string;
|
|
11
|
+
readonly modelOverride?: ModelRef;
|
|
12
|
+
readonly instructions?: string;
|
|
13
|
+
readonly permission?: PermissionMap;
|
|
14
|
+
}
|
|
15
|
+
export interface CollectScopeOptions {
|
|
16
|
+
readonly scope?: 'tree' | 'root';
|
|
17
|
+
}
|
|
18
|
+
export interface RuntimeAgentConfig {
|
|
19
|
+
readonly agentRef: string;
|
|
20
|
+
readonly primaryAgentSlug: string;
|
|
21
|
+
readonly primaryInstructions: string | null;
|
|
22
|
+
readonly primaryPermission: PermissionMap | null;
|
|
23
|
+
readonly primaryModelOverride: ModelRef | null;
|
|
24
|
+
readonly subAgentBindings: readonly SubAgentBinding[];
|
|
25
|
+
readonly subAgentInstructionsBySlug: Readonly<Record<string, string>>;
|
|
26
|
+
readonly subAgentPermissionBySlug: Readonly<Record<string, PermissionMap>>;
|
|
27
|
+
readonly subAgentModelOverridesBySlug: Readonly<Record<string, ModelRef>>;
|
|
28
|
+
readonly defaultSkillSlugs: readonly string[];
|
|
29
|
+
readonly allSkillSlugs: readonly string[];
|
|
30
|
+
readonly defaultToolSelection: readonly ToolSelectionEntry[];
|
|
31
|
+
}
|
|
32
|
+
export declare function flattenAgentTree(root: ResolvedAgentNode): readonly FlattenedAgentNode[];
|
|
33
|
+
export declare function collectSkills(root: ResolvedAgentNode, opts?: CollectScopeOptions): readonly string[];
|
|
34
|
+
export declare function collectTools(root: ResolvedAgentNode, opts?: CollectScopeOptions): readonly ToolSelectionEntry[];
|
|
35
|
+
export declare function collectInstructionsBySlug(root: ResolvedAgentNode): Readonly<Record<string, string>>;
|
|
36
|
+
export declare function collectPermissionsBySlug(root: ResolvedAgentNode): Readonly<Record<string, PermissionMap>>;
|
|
37
|
+
export declare function collectModelOverridesBySlug(root: ResolvedAgentNode): Readonly<Record<string, ModelRef>>;
|
|
38
|
+
export declare function appendInstructions(baseSystemPrompt: string, nodeInstructions: string | null): string;
|
|
39
|
+
export declare function normalizeInstructions(raw: string | undefined): string | null;
|
|
40
|
+
export declare function normalizePermission(raw: PermissionMap | undefined): PermissionMap | null;
|
|
41
|
+
export declare function projectModelOverride(raw: ModelRef | undefined, context: string): ModelRef | null;
|
|
42
|
+
export declare function projectAgentToRuntimeConfig(resolved: ResolvedAgent, overlay?: NodeOverlayFragment): RuntimeAgentConfig;
|
|
43
|
+
//# sourceMappingURL=composition-resolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition-resolution.d.ts","sourceRoot":"","sources":["../../src/lib/composition-resolution.ts"],"names":[],"mappings":"AA4BA,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EAClB,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,mCAAmC,CAAC;AAU3C,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAI5C;AAWD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC;IAClC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC;CACrC;AAGD,MAAM,W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B,yBAAyB,CACvC,IAAI,EAAE,iBAAiB,GACtB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAIlC;AAMD,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,iBAAiB,GACtB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAIzC;AAOD,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,iBAAiB,GACtB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAIpC;AA2CD,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAC9B,MAAM,CAWR;AAWD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAM5E;AAQD,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,aAAa,GAAG,SAAS,GAC7B,aAAa,GAAG,IAAI,CAKtB;AAOD,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,QAAQ,GAAG,SAAS,EACzB,OAAO,EAAE,MAAM,GACd,QAAQ,GAAG,IAAI,CA4BjB;AAqGD,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,kBAAkB,CAyCpB"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentResolutionError = void 0;
|
|
4
|
+
exports.flattenAgentTree = flattenAgentTree;
|
|
5
|
+
exports.collectSkills = collectSkills;
|
|
6
|
+
exports.collectTools = collectTools;
|
|
7
|
+
exports.collectInstructionsBySlug = collectInstructionsBySlug;
|
|
8
|
+
exports.collectPermissionsBySlug = collectPermissionsBySlug;
|
|
9
|
+
exports.collectModelOverridesBySlug = collectModelOverridesBySlug;
|
|
10
|
+
exports.appendInstructions = appendInstructions;
|
|
11
|
+
exports.normalizeInstructions = normalizeInstructions;
|
|
12
|
+
exports.normalizePermission = normalizePermission;
|
|
13
|
+
exports.projectModelOverride = projectModelOverride;
|
|
14
|
+
exports.projectAgentToRuntimeConfig = projectAgentToRuntimeConfig;
|
|
15
|
+
const workflow_1 = require("@xemahq/kernel-contracts/workflow");
|
|
16
|
+
const mcp_tool_1 = require("@xemahq/kernel-contracts/mcp-tool");
|
|
17
|
+
class AgentResolutionError extends Error {
|
|
18
|
+
constructor(context, detail) {
|
|
19
|
+
super(`Agent resolution failed for "${context}": ${detail}`);
|
|
20
|
+
this.name = 'AgentResolutionError';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.AgentResolutionError = AgentResolutionError;
|
|
24
|
+
function flattenAgentTree(root) {
|
|
25
|
+
const seen = new Set();
|
|
26
|
+
const out = [];
|
|
27
|
+
const visit = (node) => {
|
|
28
|
+
for (const child of node.children) {
|
|
29
|
+
const slug = child.kernel.slug;
|
|
30
|
+
if (slug.length === 0) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (!seen.has(slug)) {
|
|
34
|
+
seen.add(slug);
|
|
35
|
+
out.push({
|
|
36
|
+
slug,
|
|
37
|
+
...(child.alias ? { alias: child.alias } : {}),
|
|
38
|
+
...(child.modelOverride
|
|
39
|
+
? { modelOverride: child.modelOverride }
|
|
40
|
+
: {}),
|
|
41
|
+
...(child.instructions ? { instructions: child.instructions } : {}),
|
|
42
|
+
...(child.permission ? { permission: child.permission } : {}),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
visit(child);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
visit(root);
|
|
49
|
+
return out;
|
|
50
|
+
}
|
|
51
|
+
function collectSkills(root, opts) {
|
|
52
|
+
const scope = opts?.scope ?? 'tree';
|
|
53
|
+
const seen = new Set();
|
|
54
|
+
const out = [];
|
|
55
|
+
const addNode = (node) => {
|
|
56
|
+
for (const slug of projectSkillSlugs(node.skills)) {
|
|
57
|
+
if (!seen.has(slug)) {
|
|
58
|
+
seen.add(slug);
|
|
59
|
+
out.push(slug);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
addNode(root);
|
|
64
|
+
if (scope === 'tree') {
|
|
65
|
+
const visit = (node) => {
|
|
66
|
+
for (const child of node.children) {
|
|
67
|
+
addNode(child);
|
|
68
|
+
visit(child);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
visit(root);
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
function collectTools(root, opts) {
|
|
76
|
+
const scope = opts?.scope ?? 'root';
|
|
77
|
+
const ctx = root.kernel.slug;
|
|
78
|
+
if (scope === 'root') {
|
|
79
|
+
return projectToolSelection(root.tools, ctx);
|
|
80
|
+
}
|
|
81
|
+
const out = [...projectToolSelection(root.tools, ctx)];
|
|
82
|
+
const visit = (node) => {
|
|
83
|
+
for (const child of node.children) {
|
|
84
|
+
out.push(...projectToolSelection(child.tools, child.kernel.slug));
|
|
85
|
+
visit(child);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
visit(root);
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
function collectInstructionsBySlug(root) {
|
|
92
|
+
return collectDescendantOverlay(root, (child) => normalizeInstructions(child.instructions));
|
|
93
|
+
}
|
|
94
|
+
function collectPermissionsBySlug(root) {
|
|
95
|
+
return collectDescendantOverlay(root, (child) => normalizePermission(child.permission));
|
|
96
|
+
}
|
|
97
|
+
function collectModelOverridesBySlug(root) {
|
|
98
|
+
return collectDescendantOverlay(root, (child) => projectModelOverride(child.modelOverride, child.kernel.slug));
|
|
99
|
+
}
|
|
100
|
+
function collectDescendantOverlay(root, project) {
|
|
101
|
+
const out = {};
|
|
102
|
+
const seen = new Set();
|
|
103
|
+
const visit = (node) => {
|
|
104
|
+
for (const child of node.children) {
|
|
105
|
+
const slug = child.kernel.slug;
|
|
106
|
+
if (slug.length === 0) {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (!seen.has(slug)) {
|
|
110
|
+
seen.add(slug);
|
|
111
|
+
const value = project(child);
|
|
112
|
+
if (value !== null) {
|
|
113
|
+
out[slug] = value;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
visit(child);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
visit(root);
|
|
120
|
+
return out;
|
|
121
|
+
}
|
|
122
|
+
function appendInstructions(baseSystemPrompt, nodeInstructions) {
|
|
123
|
+
const trimmed = nodeInstructions === null ? '' : nodeInstructions.trim();
|
|
124
|
+
if (trimmed.length === 0) {
|
|
125
|
+
return baseSystemPrompt;
|
|
126
|
+
}
|
|
127
|
+
if (baseSystemPrompt.length === 0) {
|
|
128
|
+
return trimmed;
|
|
129
|
+
}
|
|
130
|
+
return `${baseSystemPrompt}\n\n${trimmed}`;
|
|
131
|
+
}
|
|
132
|
+
function normalizeInstructions(raw) {
|
|
133
|
+
if (typeof raw !== 'string') {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
const trimmed = raw.trim();
|
|
137
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
138
|
+
}
|
|
139
|
+
function normalizePermission(raw) {
|
|
140
|
+
if (!raw || typeof raw !== 'object' || Object.keys(raw).length === 0) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
return raw;
|
|
144
|
+
}
|
|
145
|
+
function projectModelOverride(raw, context) {
|
|
146
|
+
if (raw === undefined) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
if (raw.kind === workflow_1.ModelRefKind.CONCRETE) {
|
|
150
|
+
if (typeof raw.modelId !== 'string' || raw.modelId.trim().length === 0) {
|
|
151
|
+
throw new AgentResolutionError(context, 'concrete modelOverride is missing a modelId');
|
|
152
|
+
}
|
|
153
|
+
return raw;
|
|
154
|
+
}
|
|
155
|
+
const modelClass = raw.modelClass;
|
|
156
|
+
if (modelClass === undefined ||
|
|
157
|
+
!workflow_1.MODEL_CLASS_VALUES.includes(modelClass)) {
|
|
158
|
+
throw new AgentResolutionError(context, `strategy modelOverride.modelClass must be one of ${workflow_1.MODEL_CLASS_VALUES.join(', ')}`);
|
|
159
|
+
}
|
|
160
|
+
return raw;
|
|
161
|
+
}
|
|
162
|
+
function projectSkillSlugs(skills) {
|
|
163
|
+
if (!Array.isArray(skills)) {
|
|
164
|
+
return [];
|
|
165
|
+
}
|
|
166
|
+
return skills
|
|
167
|
+
.map((s) => s.slug)
|
|
168
|
+
.filter((slug) => typeof slug === 'string' && slug.length > 0);
|
|
169
|
+
}
|
|
170
|
+
function projectToolSelection(tools, context) {
|
|
171
|
+
if (!Array.isArray(tools)) {
|
|
172
|
+
return [];
|
|
173
|
+
}
|
|
174
|
+
const validKinds = new Set(Object.values(mcp_tool_1.ToolProviderKind));
|
|
175
|
+
const out = [];
|
|
176
|
+
for (const [idx, tool] of tools.entries()) {
|
|
177
|
+
if (typeof tool.providerKind !== 'string' ||
|
|
178
|
+
!validKinds.has(tool.providerKind)) {
|
|
179
|
+
throw new AgentResolutionError(context, `tools[${idx}].providerKind must be one of ${Object.values(mcp_tool_1.ToolProviderKind).join(', ')}`);
|
|
180
|
+
}
|
|
181
|
+
if (typeof tool.resourceId !== 'string' ||
|
|
182
|
+
tool.resourceId.trim().length === 0) {
|
|
183
|
+
throw new AgentResolutionError(context, `tools[${idx}].resourceId must be a non-empty string`);
|
|
184
|
+
}
|
|
185
|
+
if (tool.kind === 'provider') {
|
|
186
|
+
out.push({
|
|
187
|
+
kind: 'provider',
|
|
188
|
+
providerKind: tool.providerKind,
|
|
189
|
+
resourceId: tool.resourceId,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
else if (tool.kind === 'tool') {
|
|
193
|
+
if (typeof tool.toolName !== 'string' ||
|
|
194
|
+
tool.toolName.trim().length === 0) {
|
|
195
|
+
throw new AgentResolutionError(context, `tools[${idx}].toolName must be a non-empty string for kind='tool'`);
|
|
196
|
+
}
|
|
197
|
+
out.push({
|
|
198
|
+
kind: 'tool',
|
|
199
|
+
providerKind: tool.providerKind,
|
|
200
|
+
resourceId: tool.resourceId,
|
|
201
|
+
toolName: tool.toolName,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
throw new AgentResolutionError(context, `tools[${idx}].kind must be "provider" or "tool"`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return out;
|
|
209
|
+
}
|
|
210
|
+
function projectAgentToRuntimeConfig(resolved, overlay) {
|
|
211
|
+
const root = resolved.root;
|
|
212
|
+
const agentRef = `${resolved.slug}@${resolved.version}`;
|
|
213
|
+
const rootInstructions = normalizeInstructions(root.instructions);
|
|
214
|
+
const overlayInstructions = normalizeInstructions(overlay?.instructions);
|
|
215
|
+
const primaryInstructions = appendInstructions(rootInstructions ?? '', overlayInstructions);
|
|
216
|
+
const rootModelOverride = projectModelOverride(root.modelOverride, agentRef);
|
|
217
|
+
const overlayModelOverride = projectModelOverride(overlay?.modelOverride, `${agentRef}#overlay`);
|
|
218
|
+
const rootPermission = normalizePermission(root.permission);
|
|
219
|
+
const overlayPermission = normalizePermission(overlay?.permission);
|
|
220
|
+
const flattened = flattenAgentTree(root);
|
|
221
|
+
return {
|
|
222
|
+
agentRef,
|
|
223
|
+
primaryAgentSlug: root.kernel.slug,
|
|
224
|
+
primaryInstructions: primaryInstructions.length > 0 ? primaryInstructions : null,
|
|
225
|
+
primaryPermission: overlayPermission ?? rootPermission,
|
|
226
|
+
primaryModelOverride: overlayModelOverride ?? rootModelOverride,
|
|
227
|
+
subAgentBindings: flattened.map((n) => ({ ...n })),
|
|
228
|
+
subAgentInstructionsBySlug: collectInstructionsBySlug(root),
|
|
229
|
+
subAgentPermissionBySlug: collectPermissionsBySlug(root),
|
|
230
|
+
subAgentModelOverridesBySlug: collectModelOverridesBySlug(root),
|
|
231
|
+
defaultSkillSlugs: collectSkills(root, { scope: 'root' }),
|
|
232
|
+
allSkillSlugs: collectSkills(root, { scope: 'tree' }),
|
|
233
|
+
defaultToolSelection: collectTools(root, { scope: 'root' }),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=composition-resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition-resolution.js","sourceRoot":"","sources":["../../src/lib/composition-resolution.ts"],"names":[],"mappings":";;;AA6HA,4CA4BC;AAQD,sCA0BC;AAQD,oCAkBC;AAOD,8DAMC;AAMD,4DAMC;AAOD,kEAMC;AA2CD,gDAcC;AAWD,sDAMC;AAQD,kDAOC;AAOD,oDA+BC;AAqGD,kEA4CC;AA/eD,gEAO2C;AAM3C,gEAG2C;AAU3C,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe,EAAE,MAAc;QACzC,KAAK,CAAC,gCAAgC,OAAO,MAAM,MAAM,EAAE,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AALD,oDAKC;AAkED,SAAgB,gBAAgB,CAC9B,IAAuB;IAEvB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,GAAG,GAAyB,EAAE,CAAC;IACrC,MAAM,KAAK,GAAG,CAAC,IAAuB,EAAQ,EAAE;QAC9C,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;YAC/B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACtB,SAAS;YACX,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACpB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACf,GAAG,CAAC,IAAI,CAAC;oBACP,IAAI;oBACJ,GAAG,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C;QAC3D,wBAAwB,EAAE,wBAAwB,CAAC,IAAI,CAAC;QACxD,4BAA4B,EAAE,2BAA2B,CAAC,IAAI,CAAC;QAC/D,iBAAiB,EAAE,aAAa,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QACzD,aAAa,EAAE,aAAa,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QACrD,oBAAoB,EAAE,YAAY,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;KAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type CompiledManifestCredential, type CompiledManifestPermissions, type ModelRef } from '@xemahq/kernel-contracts/workflow';
|
|
2
|
+
import type { PermissionMap } from '@xemahq/kernel-contracts/agent-permission';
|
|
3
|
+
import { type CompiledWorkspaceManifest } from '@xemahq/dsl/workspace-manifest';
|
|
4
|
+
export type { CompiledWorkspaceManifest };
|
|
5
|
+
export declare class AgentMountLayoutError extends Error {
|
|
6
|
+
constructor(agentRef: string, detail: string);
|
|
7
|
+
}
|
|
8
|
+
export interface AgentRunConfigInput {
|
|
9
|
+
readonly stage: string;
|
|
10
|
+
readonly role: string;
|
|
11
|
+
readonly deliverableSpecRef?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface AgentMountLayoutInput {
|
|
14
|
+
readonly mounts: Readonly<Record<string, unknown>>;
|
|
15
|
+
readonly agentRunConfig: AgentRunConfigInput;
|
|
16
|
+
readonly seedFiles: readonly unknown[];
|
|
17
|
+
readonly inputs: Readonly<Record<string, unknown>>;
|
|
18
|
+
}
|
|
19
|
+
export interface AgentSubAgentBindingInput {
|
|
20
|
+
readonly slug: string;
|
|
21
|
+
readonly alias?: string;
|
|
22
|
+
readonly modelOverride?: ModelRef;
|
|
23
|
+
readonly instructions?: string;
|
|
24
|
+
readonly permission?: PermissionMap;
|
|
25
|
+
}
|
|
26
|
+
export interface AgentOutputSurfaceInput {
|
|
27
|
+
readonly kind: 'none' | 'web' | 'static' | 'app' | 'tunnel';
|
|
28
|
+
readonly port?: number;
|
|
29
|
+
readonly healthPath?: string;
|
|
30
|
+
readonly autoOpen?: boolean;
|
|
31
|
+
readonly mode?: 'single' | 'multi';
|
|
32
|
+
readonly root?: string;
|
|
33
|
+
readonly defaultDocument?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface AgentManifestSource {
|
|
36
|
+
readonly agentRef: string;
|
|
37
|
+
readonly primaryAgentSlug: string;
|
|
38
|
+
readonly subAgentBindings: readonly AgentSubAgentBindingInput[];
|
|
39
|
+
readonly mountLayout: AgentMountLayoutInput | undefined;
|
|
40
|
+
readonly outputSurface?: AgentOutputSurfaceInput;
|
|
41
|
+
readonly credentials?: readonly CompiledManifestCredential[];
|
|
42
|
+
readonly permissions?: CompiledManifestPermissions;
|
|
43
|
+
}
|
|
44
|
+
export interface AgentManifestImplicitInputs {
|
|
45
|
+
readonly orgId: string;
|
|
46
|
+
readonly projectId: string;
|
|
47
|
+
readonly sessionId?: string;
|
|
48
|
+
}
|
|
49
|
+
export declare function compileAgentWorkspaceManifest(source: AgentManifestSource, bindInputs: Readonly<Record<string, unknown>>): CompiledWorkspaceManifest;
|
|
50
|
+
export declare function buildAgentManifestBindInputs(source: AgentManifestSource, explicitInputs: Record<string, unknown> | null, implicitInputs: AgentManifestImplicitInputs): Readonly<Record<string, unknown>>;
|
|
51
|
+
//# sourceMappingURL=composition-workspace-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition-workspace-manifest.d.ts","sourceRoot":"","sources":["../../src/lib/composition-workspace-manifest.ts"],"names":[],"mappings":"AA6BA,OAAO,EAIL,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,QAAQ,EACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAEL,KAAK,yB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|
+
exports.compileAgentWorkspaceManifest = compileAgentWorkspaceManifest;
|
|
5
|
+
exports.buildAgentManifestBindInputs = buildAgentManifestBindInputs;
|
|
6
|
+
const workflow_1 = require("@xemahq/kernel-contracts/workflow");
|
|
7
|
+
const workspace_manifest_1 = require("@xemahq/dsl/workspace-manifest");
|
|
8
|
+
class AgentMountLayoutError extends Error {
|
|
9
|
+
constructor(agentRef, detail) {
|
|
10
|
+
super(`Cannot derive a workspace mount layout from Agent ` +
|
|
11
|
+
`"${agentRef}": ${detail}`);
|
|
12
|
+
this.name = 'AgentMountLayoutError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.AgentMountLayoutError = AgentMountLayoutError;
|
|
16
|
+
function compileAgentWorkspaceManifest(source, bindInputs) {
|
|
17
|
+
const mountLayout = source.mountLayout;
|
|
18
|
+
if (!mountLayout) {
|
|
19
|
+
throw new AgentMountLayoutError(source.agentRef, 'the composition declares no `workspace.mountLayout` block — its ' +
|
|
20
|
+
'source workspace manifest was not projected by the llm-registry-api ' +
|
|
21
|
+
'composition seeder. Re-seed compositions (boot llm-registry-api) or ' +
|
|
22
|
+
'fix the source manifest.');
|
|
23
|
+
}
|
|
24
|
+
const [slug, version] = splitAgentRef(source.agentRef);
|
|
25
|
+
const subAgents = source.subAgentBindings.map((binding) => ({
|
|
26
|
+
slug: binding.slug,
|
|
27
|
+
...(binding.alias !== undefined ? { alias: binding.alias } : {}),
|
|
28
|
+
...(binding.modelOverride !== undefined
|
|
29
|
+
? { defaultModel: binding.modelOverride }
|
|
30
|
+
: {}),
|
|
31
|
+
...(binding.instructions !== undefined
|
|
32
|
+
? { instructions: binding.instructions }
|
|
33
|
+
: {}),
|
|
34
|
+
...(binding.permission !== undefined
|
|
35
|
+
? { permission: binding.permission }
|
|
36
|
+
: {}),
|
|
37
|
+
}));
|
|
38
|
+
const outputSurface = projectOutputSurface(source.outputSurface);
|
|
39
|
+
const credentials = projectCredentials(source.credentials);
|
|
40
|
+
const permissions = projectPermissions(source.permissions);
|
|
41
|
+
const spec = {
|
|
42
|
+
mounts: mountLayout.mounts,
|
|
43
|
+
agent: {
|
|
44
|
+
slug: source.primaryAgentSlug,
|
|
45
|
+
stage: mountLayout.agentRunConfig.stage,
|
|
46
|
+
role: mountLayout.agentRunConfig.role,
|
|
47
|
+
...(mountLayout.agentRunConfig.deliverableSpecRef !== undefined
|
|
48
|
+
? { deliverableSpecRef: mountLayout.agentRunConfig.deliverableSpecRef }
|
|
49
|
+
: {}),
|
|
50
|
+
...(subAgents.length > 0 ? { subAgents } : {}),
|
|
51
|
+
},
|
|
52
|
+
...(Object.keys(mountLayout.inputs).length > 0
|
|
53
|
+
? {
|
|
54
|
+
inputs: mountLayout.inputs,
|
|
55
|
+
}
|
|
56
|
+
: {}),
|
|
57
|
+
...(mountLayout.seedFiles.length > 0
|
|
58
|
+
? {
|
|
59
|
+
seedFiles: mountLayout.seedFiles,
|
|
60
|
+
}
|
|
61
|
+
: {}),
|
|
62
|
+
...(outputSurface === undefined ? {} : { outputSurface }),
|
|
63
|
+
...(credentials === undefined ? {} : { credentials }),
|
|
64
|
+
...(permissions === undefined ? {} : { permissions }),
|
|
65
|
+
};
|
|
66
|
+
const envelope = {
|
|
67
|
+
apiVersion: 'xema.dev/workspace/v1',
|
|
68
|
+
kind: 'WorkspaceManifest',
|
|
69
|
+
metadata: {
|
|
70
|
+
slug,
|
|
71
|
+
version,
|
|
72
|
+
surfaceCompat: [workflow_1.ManifestSurface.AGENT_SESSION],
|
|
73
|
+
},
|
|
74
|
+
spec,
|
|
75
|
+
};
|
|
76
|
+
const result = (0, workspace_manifest_1.compileManifest)(envelope, bindInputs);
|
|
77
|
+
if (!result.ok) {
|
|
78
|
+
throw new AgentMountLayoutError(source.agentRef, `reconstructed manifest failed to compile: ${result.errors
|
|
79
|
+
.map((e) => `${e.path}: ${e.message}`)
|
|
80
|
+
.join('; ')}`);
|
|
81
|
+
}
|
|
82
|
+
return result.compiled;
|
|
83
|
+
}
|
|
84
|
+
function projectOutputSurface(surface) {
|
|
85
|
+
if (!surface)
|
|
86
|
+
return undefined;
|
|
87
|
+
return {
|
|
88
|
+
kind: surface.kind,
|
|
89
|
+
...(surface.port === undefined ? {} : { port: surface.port }),
|
|
90
|
+
...(surface.healthPath === undefined
|
|
91
|
+
? {}
|
|
92
|
+
: { healthPath: surface.healthPath }),
|
|
93
|
+
...(surface.autoOpen === undefined ? {} : { autoOpen: surface.autoOpen }),
|
|
94
|
+
...(surface.mode === undefined ? {} : { mode: surface.mode }),
|
|
95
|
+
...(surface.root === undefined ? {} : { root: surface.root }),
|
|
96
|
+
...(surface.defaultDocument === undefined
|
|
97
|
+
? {}
|
|
98
|
+
: { defaultDocument: surface.defaultDocument }),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function projectCredentials(credentials) {
|
|
102
|
+
if (credentials === undefined)
|
|
103
|
+
return undefined;
|
|
104
|
+
return credentials.map((credential) => ({
|
|
105
|
+
name: credential.name,
|
|
106
|
+
kind: credential.kind,
|
|
107
|
+
sourceRef: credential.sourceRef,
|
|
108
|
+
required: credential.required,
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
function projectPermissions(permissions) {
|
|
112
|
+
if (permissions === undefined)
|
|
113
|
+
return undefined;
|
|
114
|
+
return {
|
|
115
|
+
tools: {
|
|
116
|
+
allow: permissions.tools.allow,
|
|
117
|
+
deny: permissions.tools.deny,
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function buildAgentManifestBindInputs(source, explicitInputs, implicitInputs) {
|
|
122
|
+
const declared = new Set(Object.keys(source.mountLayout?.inputs ?? {}));
|
|
123
|
+
if (declared.size === 0) {
|
|
124
|
+
return {};
|
|
125
|
+
}
|
|
126
|
+
if (explicitInputs !== null &&
|
|
127
|
+
(typeof explicitInputs !== 'object' || Array.isArray(explicitInputs))) {
|
|
128
|
+
throw new AgentMountLayoutError(source.agentRef, 'explicit manifest inputs must be an object when provided');
|
|
129
|
+
}
|
|
130
|
+
const explicit = explicitInputs ?? {};
|
|
131
|
+
for (const [key, value] of Object.entries(explicit)) {
|
|
132
|
+
if (!declared.has(key)) {
|
|
133
|
+
throw new AgentMountLayoutError(source.agentRef, `manifest inputs contain undeclared key "${key}"`);
|
|
134
|
+
}
|
|
135
|
+
assertManifestInputValue(source.agentRef, key, value);
|
|
136
|
+
}
|
|
137
|
+
const implicit = {
|
|
138
|
+
orgId: implicitInputs.orgId,
|
|
139
|
+
projectId: implicitInputs.projectId,
|
|
140
|
+
...(implicitInputs.sessionId !== undefined
|
|
141
|
+
? { sessionId: implicitInputs.sessionId }
|
|
142
|
+
: {}),
|
|
143
|
+
};
|
|
144
|
+
const out = {};
|
|
145
|
+
for (const key of declared) {
|
|
146
|
+
if (Object.hasOwn(explicit, key)) {
|
|
147
|
+
out[key] = explicit[key];
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (Object.hasOwn(implicit, key)) {
|
|
151
|
+
out[key] = implicit[key];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return out;
|
|
155
|
+
}
|
|
156
|
+
function splitAgentRef(ref) {
|
|
157
|
+
const at = ref.lastIndexOf('@');
|
|
158
|
+
if (at <= 0 || at === ref.length - 1) {
|
|
159
|
+
throw new AgentMountLayoutError(ref, 'expected a version-pinned `slug@version` composition ref — the ' +
|
|
160
|
+
'session resolver always pins the resolved version');
|
|
161
|
+
}
|
|
162
|
+
return [ref.slice(0, at), ref.slice(at + 1)];
|
|
163
|
+
}
|
|
164
|
+
function assertManifestInputValue(agentRef, key, value) {
|
|
165
|
+
if (value !== null &&
|
|
166
|
+
typeof value !== 'string' &&
|
|
167
|
+
typeof value !== 'number' &&
|
|
168
|
+
typeof value !== 'boolean' &&
|
|
169
|
+
!Array.isArray(value)) {
|
|
170
|
+
throw new AgentMountLayoutError(agentRef, `manifest input "${key}" must be a primitive ` +
|
|
171
|
+
`(string, number, boolean, string[]) — got ${typeof value}`);
|
|
172
|
+
}
|
|
173
|
+
if (Array.isArray(value) &&
|
|
174
|
+
!value.every((entry) => typeof entry === 'string')) {
|
|
175
|
+
throw new AgentMountLayoutError(agentRef, `manifest input "${key}" is an array — every element must be a string`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=composition-workspace-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition-workspace-manifest.js","sourceRoot":"","sources":["../../src/lib/composition-workspace-manifest.ts"],"names":[],"mappings":";;;AAwPA,sEAyGC;AA0GD,oEAiDC;AA/dD,gEAO2C;AAE3C,uEAYwC;AAcxC,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,QAAgB,EAAE,MAAc;QAC1C,KAAK,CACH,oDAAoD;YAClD,IAAI,QAAQ,MAAM,MAAM,EAAE,CAC7B,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AARD,sDAQC;AAgLD,SAAgB,6BAA6B,CAC3C,MAA2B,EAC3B,UAA6C;IAE7C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;IACvC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,qBAAqB,CAC7B,MAAM,CAAC,QAAQ,EACf,kEAAkE;YAChE,sEAAsE;YACtE,sEAAsE;YACtE,0BAA0B,CAC7B,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAOvD,MAAM,SAAS,GAAuB,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAC/D,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACZ,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAA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,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EACrB,CAAC;QACD,MAAM,IAAI,qBAAqB,CAC7B,QAAQ,EACR,mBAAmB,GAAG,wBAAwB;YAC5C,6CAA6C,OAAO,KAAK,EAAE,CAC9D,CAAC;IACJ,CAAC;IACD,IACE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,EAClD,CAAC;QACD,MAAM,IAAI,qBAAqB,CAC7B,QAAQ,EACR,mBAAmB,GAAG,gDAAgD,CACvE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/agent-session-runtime",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.7",
|
|
4
|
+
"description": "Runtime for composing and running Xema agent sessions — workspace manifests, skill bundles, environment resolution, and drift detection.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "Neuralchowder Inc. <developer@xema.dev> (https://xema.dev)",
|
|
7
|
+
"homepage": "https://xema.dev",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/xema-dev/xema-runtime-core.git",
|
|
11
|
+
"directory": "packages/runtime/agent-session-runtime"
|
|
12
|
+
},
|
|
13
|
+
"bugs": "https://github.com/xema-dev/xema-runtime-core/issues",
|
|
4
14
|
"publishConfig": {
|
|
5
15
|
"registry": "https://registry.npmjs.org/",
|
|
6
16
|
"access": "public"
|
|
@@ -35,11 +45,11 @@
|
|
|
35
45
|
"prettier": "3.6.2",
|
|
36
46
|
"ts-jest": "^29.4.9",
|
|
37
47
|
"typescript": "5.9.3",
|
|
38
|
-
"@xemahq/kernel-contracts": "^0.
|
|
48
|
+
"@xemahq/kernel-contracts": "^0.58.0"
|
|
39
49
|
},
|
|
40
50
|
"dependencies": {
|
|
41
|
-
"@xemahq/dsl": "^0.
|
|
42
|
-
"@xemahq/kernel-contracts": "^0.
|
|
51
|
+
"@xemahq/dsl": "^0.6.1",
|
|
52
|
+
"@xemahq/kernel-contracts": "^0.58.0"
|
|
43
53
|
},
|
|
44
54
|
"peerDependencies": {
|
|
45
55
|
"@xemahq/kernel-contracts": ">=0.13.0"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
2
|
// ── Agent → CompiledWorkspaceManifest reconstruction ──
|
|
3
3
|
//
|
|
4
|
-
//
|
|
4
|
+
// The composer turns a
|
|
5
5
|
// `CompiledWorkspaceManifest` into a `WorkspaceMountPlan`; before this
|
|
6
6
|
// module the only way to obtain that compiled manifest was to fetch the
|
|
7
7
|
// `WorkspaceManifest` row from `workspace-manifests-api` and run
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
type ManifestSeedFile,
|
|
48
48
|
type ManifestSubAgent,
|
|
49
49
|
type ManifestWorkingFile,
|
|
50
|
-
type
|
|
50
|
+
type AgentWorkspaceSpec as DslWorkspaceManifest,
|
|
51
51
|
type WorkspaceManifestSpec,
|
|
52
52
|
} from '@xemahq/dsl/workspace-manifest';
|
|
53
53
|
|
package/src/lib/composer.ts
CHANGED
|
@@ -328,8 +328,8 @@ export class DefaultWorkspaceImageComposer implements WorkspaceImageComposer {
|
|
|
328
328
|
// `/<skillKey>` in a session loads and applies that skill natively.
|
|
329
329
|
//
|
|
330
330
|
// Kernel-shipped System skills are PREPENDED to whatever skills the
|
|
331
|
-
// caller already named in `agentContext.skills` (
|
|
332
|
-
//
|
|
331
|
+
// caller already named in `agentContext.skills` (per the skill
|
|
332
|
+
// composition rules — `SkillSpace.System`
|
|
333
333
|
// skills are auto-injected into every agent's mounted bundle).
|
|
334
334
|
// `dedupe` collapses any overlap so a caller that re-mentions a
|
|
335
335
|
// System skill in `agentContext.skills` does not double-mount it.
|
|
@@ -57,8 +57,8 @@ export enum DriftKind {
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* Advisory drift severity — `info` (benign) or `warning` (worth a look).
|
|
60
|
-
* There is deliberately no `critical`: resume is non-blocking by design
|
|
61
|
-
*
|
|
60
|
+
* There is deliberately no `critical`: resume is non-blocking by design,
|
|
61
|
+
* so severity only drives how the operator's drift
|
|
62
62
|
* toast renders, never whether the session resumes.
|
|
63
63
|
*/
|
|
64
64
|
export type DriftSeverity = 'info' | 'warning';
|
|
@@ -124,7 +124,7 @@ export interface EnvironmentResolverRequest {
|
|
|
124
124
|
*/
|
|
125
125
|
readonly systemSkillSlugs?: readonly string[];
|
|
126
126
|
/**
|
|
127
|
-
* Optional MCP stanza resolver
|
|
127
|
+
* Optional MCP stanza resolver. Translates the manifest's
|
|
128
128
|
* `toolSelection` into a `mcpServers` map suitable for direct write
|
|
129
129
|
* into `opencode.jsonc:mcp`. When absent, the resolved environment
|
|
130
130
|
* carries no MCP stanzas — appropriate for workflow surfaces today
|
|
@@ -205,7 +205,7 @@ export interface ResolvedEnvironment {
|
|
|
205
205
|
readonly mountPlan: WorkspaceMountPlan;
|
|
206
206
|
readonly env: readonly { readonly name: string; readonly value: string }[];
|
|
207
207
|
/**
|
|
208
|
-
*
|
|
208
|
+
* Resolved `mcpServers` map ready to drop into
|
|
209
209
|
* `opencode.jsonc:mcp`. Empty `{}` when the manifest declares no
|
|
210
210
|
* toolSelection or when the request omits an `mcpResolver`. Keeps
|
|
211
211
|
* the snapshot self-contained so downstream callers (workflow
|
|
@@ -279,7 +279,7 @@ export class DefaultEnvironmentResolver implements EnvironmentResolver {
|
|
|
279
279
|
req.briefcase?.mcpTools,
|
|
280
280
|
);
|
|
281
281
|
|
|
282
|
-
//
|
|
282
|
+
// Capability federation. When an `mcpResolver` is wired
|
|
283
283
|
// (session-boot, workflow-runtime-worker) the resolver ALWAYS runs —
|
|
284
284
|
// the returned stanza is the fixed three meta-tool surface
|
|
285
285
|
// (`xema-capabilities-{list,describe,invoke}`), regardless of
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
2
|
// ── Skill-bundle-backed TemplateResolver ──
|
|
3
3
|
//
|
|
4
|
-
//
|
|
4
|
+
// Seed-file templates used to
|
|
5
5
|
// live in `workspace-manifests-api` (the `workspace_manifest_templates` table)
|
|
6
6
|
// and were fetched by name. They are now SKILL-BUNDLE RESOURCES served by
|
|
7
7
|
// `skill-registry-api` (`GET /skills/bundle`): a biome that ships templates
|
package/src/lib/types.ts
CHANGED
|
@@ -69,7 +69,7 @@ export interface ComposeWorkspaceImageRequest {
|
|
|
69
69
|
readonly templateResolver?: TemplateResolver;
|
|
70
70
|
/**
|
|
71
71
|
* Kernel-shipped System-scope skill slugs to PREPEND to the composer's
|
|
72
|
-
* mounted skill set. Per
|
|
72
|
+
* mounted skill set. Per the skill composition rules,
|
|
73
73
|
* skills owned by `SkillSpace.System` are auto-injected into every
|
|
74
74
|
* agent's mounted bundle — they ship from `@xemahq/system-skills`
|
|
75
75
|
* via the System-tier seeder in `skill-registry-api`. The caller
|