@jini-ai/http-kit 0.3.1 → 0.3.3

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.
Files changed (74) hide show
  1. package/LICENSE +201 -0
  2. package/dist/delegated-tools.d.ts +89 -0
  3. package/dist/delegated-tools.d.ts.map +1 -1
  4. package/dist/delegated-tools.js +106 -1
  5. package/dist/delegated-tools.js.map +1 -1
  6. package/package.json +15 -15
  7. package/dist/express/run-stream.d.ts +0 -15
  8. package/dist/express/run-stream.d.ts.map +0 -1
  9. package/dist/express/run-stream.js +0 -11
  10. package/dist/express/run-stream.js.map +0 -1
  11. package/dist/express-index.d.ts +0 -32
  12. package/dist/express-index.d.ts.map +0 -1
  13. package/dist/express-index.js +0 -14
  14. package/dist/express-index.js.map +0 -1
  15. package/dist/fastify/adapter.d.ts +0 -31
  16. package/dist/fastify/adapter.d.ts.map +0 -1
  17. package/dist/fastify/adapter.js +0 -64
  18. package/dist/fastify/adapter.js.map +0 -1
  19. package/dist/fastify/agents.d.ts +0 -13
  20. package/dist/fastify/agents.d.ts.map +0 -1
  21. package/dist/fastify/agents.js +0 -7
  22. package/dist/fastify/agents.js.map +0 -1
  23. package/dist/fastify/api-security-middleware.d.ts +0 -64
  24. package/dist/fastify/api-security-middleware.d.ts.map +0 -1
  25. package/dist/fastify/api-security-middleware.js +0 -139
  26. package/dist/fastify/api-security-middleware.js.map +0 -1
  27. package/dist/fastify/compat.d.ts +0 -22
  28. package/dist/fastify/compat.d.ts.map +0 -1
  29. package/dist/fastify/compat.js +0 -16
  30. package/dist/fastify/compat.js.map +0 -1
  31. package/dist/fastify/daemon-status.d.ts +0 -22
  32. package/dist/fastify/daemon-status.d.ts.map +0 -1
  33. package/dist/fastify/daemon-status.js +0 -9
  34. package/dist/fastify/daemon-status.js.map +0 -1
  35. package/dist/fastify/host-tools.d.ts +0 -13
  36. package/dist/fastify/host-tools.d.ts.map +0 -1
  37. package/dist/fastify/host-tools.js +0 -8
  38. package/dist/fastify/host-tools.js.map +0 -1
  39. package/dist/fastify/index.d.ts +0 -36
  40. package/dist/fastify/index.d.ts.map +0 -1
  41. package/dist/fastify/index.js +0 -18
  42. package/dist/fastify/index.js.map +0 -1
  43. package/dist/fastify/local-daemon-request.d.ts +0 -43
  44. package/dist/fastify/local-daemon-request.d.ts.map +0 -1
  45. package/dist/fastify/local-daemon-request.js +0 -155
  46. package/dist/fastify/local-daemon-request.js.map +0 -1
  47. package/dist/fastify/origin.d.ts +0 -21
  48. package/dist/fastify/origin.d.ts.map +0 -1
  49. package/dist/fastify/origin.js +0 -14
  50. package/dist/fastify/origin.js.map +0 -1
  51. package/dist/fastify/request.d.ts +0 -20
  52. package/dist/fastify/request.d.ts.map +0 -1
  53. package/dist/fastify/request.js +0 -25
  54. package/dist/fastify/request.js.map +0 -1
  55. package/dist/fastify/response.d.ts +0 -20
  56. package/dist/fastify/response.d.ts.map +0 -1
  57. package/dist/fastify/response.js +0 -41
  58. package/dist/fastify/response.js.map +0 -1
  59. package/dist/fastify/route-registration-guard.d.ts +0 -70
  60. package/dist/fastify/route-registration-guard.d.ts.map +0 -1
  61. package/dist/fastify/route-registration-guard.js +0 -69
  62. package/dist/fastify/route-registration-guard.js.map +0 -1
  63. package/dist/fastify/run-stream.d.ts +0 -18
  64. package/dist/fastify/run-stream.d.ts.map +0 -1
  65. package/dist/fastify/run-stream.js +0 -10
  66. package/dist/fastify/run-stream.js.map +0 -1
  67. package/dist/fastify/runs.d.ts +0 -17
  68. package/dist/fastify/runs.d.ts.map +0 -1
  69. package/dist/fastify/runs.js +0 -33
  70. package/dist/fastify/runs.js.map +0 -1
  71. package/dist/run-stream.d.ts +0 -60
  72. package/dist/run-stream.d.ts.map +0 -1
  73. package/dist/run-stream.js +0 -108
  74. package/dist/run-stream.js.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,201 @@
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 describing the origin of the Work and
141
+ 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 Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Open Design contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -77,6 +77,95 @@ export declare function readOnlyRefusalMessage(toolId: string): string;
77
77
  * fix is one line in the host's own wiring rather than an investigation.
78
78
  */
79
79
  export declare const READ_ONLY_UNVERIFIABLE_MESSAGE = "this host cannot verify read-only tools \u2014 POST /api/delegated-tool-calls was mounted without DelegatedToolsHttpDeps.toolRegistry, so a requireReadOnly call cannot be checked and is refused";
80
+ /**
81
+ * A `Principal` narrowed to tools that only read.
82
+ *
83
+ * `checkReadOnlyConstraint` above only ever validates the OUTER `toolId` — the one the caller
84
+ * named in this request. It cannot see what a consumer's own `ToolExecutor` composition does
85
+ * once `bridge.execute()` hands control to `deps.toolExecutor`: a decorator that composition
86
+ * stacks on top of the bare executor (a recovery loop that retries through a different tool id
87
+ * after a failure, for instance) can dispatch a tool the caller never named, using the exact same
88
+ * `principal` the outer call carried — one hop past the only check this route ever ran. Adding a
89
+ * second request-shaped flag would not close that gap either: it would have to be threaded, by
90
+ * hand, through every decorator between here and the handler, and a decorator that forgot would
91
+ * fail open silently. `principal` is the one value every layer already passes unchanged, so the
92
+ * constraint travels as an ATTENUATED IDENTITY instead — a principal permitted to invoke only
93
+ * read-only tools, checkable by {@link refuseNonReadOnlyDispatch} at any depth a consumer's own
94
+ * composition cares to ask.
95
+ *
96
+ * A distinct field rather than a `Principal.roles` entry: `roles` is what a `ToolPolicy` branches
97
+ * on, and a synthetic role would silently join that decision for every registration in the
98
+ * process. This field is inert to everything except {@link refuseNonReadOnlyDispatch}.
99
+ */
100
+ export interface ReadOnlyConstrainedPrincipal extends Principal {
101
+ readonly toolAccess: 'read-only';
102
+ }
103
+ /** Attenuates `principal` for one execution: it may now invoke only tools registered read-only. */
104
+ export declare function constrainPrincipalToReadOnlyTools(principal: Principal): ReadOnlyConstrainedPrincipal;
105
+ /**
106
+ * Whether `principal` is carrying the read-only attenuation.
107
+ *
108
+ * Reads the field structurally, so a principal that travelled through layers typed as the plain
109
+ * `Principal` (every decorator between here and wherever a dispatch is about to happen) still
110
+ * answers truthfully.
111
+ *
112
+ * @complexity O(1).
113
+ */
114
+ export declare function principalIsReadOnlyConstrained(principal: Principal): boolean;
115
+ /**
116
+ * THE read-only dispatch decision for any tool id a consumer's own `ToolExecutor` composition is
117
+ * about to invoke — the outer call this route already checked, or a nested one a decorator issues
118
+ * one or more hops in. Every consumer's own composition should ask this before dispatching on
119
+ * behalf of a principal it did not itself resolve; none should re-implement the check, so changing
120
+ * what the constraint means stays one edit.
121
+ *
122
+ * @param options.principal - The principal the dispatch would run under. Unconstrained ⇒ always
123
+ * `null` — this is a no-op for every pre-existing caller that never attenuates a principal.
124
+ * @param options.toolId - The id actually about to be dispatched, which is not necessarily the id
125
+ * named in the original request — that difference is the whole reason this function exists.
126
+ * @param options.registry - Descriptors to resolve `toolId` against; `undefined` ⇒ refuse (an
127
+ * unverifiable constrained dispatch is refused, never waived, matching `checkReadOnlyConstraint`).
128
+ * @returns `null` when the dispatch may proceed, otherwise the refusal text to report.
129
+ * @complexity O(1) for an unconstrained principal; O(n) in registered tool count for a constrained
130
+ * one, since `ToolRegistry` exposes enumeration rather than lookup by id.
131
+ */
132
+ export declare function refuseNonReadOnlyDispatch(options: {
133
+ readonly principal: Principal;
134
+ readonly toolId: string;
135
+ readonly registry: Pick<ToolRegistry, 'list'> | undefined;
136
+ }): string | null;
137
+ export interface ReadOnlyToolConstraintDeps {
138
+ /** The same registry `inner` was built over — descriptors only; this gate never reaches a handler. */
139
+ readonly registry: Pick<ToolRegistry, 'list'> | undefined;
140
+ }
141
+ /**
142
+ * Wraps `inner` so a read-only-constrained principal (one {@link constrainPrincipalToReadOnlyTools}
143
+ * attenuated) cannot dispatch a tool that isn't registered read-only — whichever layer chose the
144
+ * id. This is what turns the attenuation into an actual gate rather than a field nobody reads:
145
+ * {@link refuseNonReadOnlyDispatch} is the decision, this is its enforcement point.
146
+ *
147
+ * **Compose this as close to the bare `ToolExecutor` as your own stack allows** — directly around
148
+ * `@jini-ai/daemon`'s `createToolExecutor` output, beneath any decorator of your own that might
149
+ * dispatch a tool id the caller never named (a retry, a recovery loop that calls a different tool
150
+ * as a remedy, ...). Every such decorator's own `inner.execute` call still has to come through here
151
+ * to reach a handler, which is what makes this a gate on the CLASS of defect (an unnamed nested
152
+ * dispatch) rather than on one instance of it — see `read-only-tool-constraint.ts` in Tovu's own
153
+ * `apps/website`, the consumer this was ported from, for the composition this mirrors.
154
+ *
155
+ * `delegatedToolExecuteRoute`'s own `handle` additionally composes this around whatever
156
+ * `ToolExecutor` a host supplies, whenever a call attenuates its principal. That outer composition
157
+ * only re-covers the SAME outer `toolId` {@link checkReadOnlyConstraint} already checked — it
158
+ * cannot see a nested dispatch a host's own inner decorator issues, because that decorator holds a
159
+ * reference to whatever `ToolExecutor` IT was built with, not to this route's wrapped one. Closing
160
+ * the nested case for a given host's stack requires that host to compose this decorator itself,
161
+ * innermost, in its own `ToolExecutor` construction — this export exists so it can, without having
162
+ * to rediscover or reimplement the mechanism.
163
+ *
164
+ * @returns A drop-in `ToolExecutor`; `resumeConfirmation`/`cancel`/`getAuditRecord` delegate
165
+ * straight through.
166
+ * @complexity One extra property read per unconstrained call; one registry scan per constrained one.
167
+ */
168
+ export declare function withReadOnlyToolConstraint(inner: ToolExecutor, deps: ReadOnlyToolConstraintDeps): ToolExecutor;
80
169
  /**
81
170
  * `POST /api/delegated-tool-calls` — executes one delegated tool call against an already-started
82
171
  * run. Maps `ToolExecutionResult.status` to the HTTP response via `toolExecutionResultToApiResult`
@@ -1 +1 @@
1
- {"version":3,"file":"delegated-tools.d.ts","sourceRoot":"","sources":["../src/delegated-tools.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAkB,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAA6B,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC5H,OAAO,EAAmC,KAAK,cAAc,EAAE,MAAM,cAAc,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;;GA0BG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,0BAA0B,GAAG,YAAY,CAsB9G;AAwHD;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,uHAqEpC,CAAC;AAEH,4GAA4G;AAC5G,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAErH"}
@@ -55,6 +55,93 @@ export function readOnlyRefusalMessage(toolId) {
55
55
  * fix is one line in the host's own wiring rather than an investigation.
56
56
  */
57
57
  export const READ_ONLY_UNVERIFIABLE_MESSAGE = 'this host cannot verify read-only tools — POST /api/delegated-tool-calls was mounted without DelegatedToolsHttpDeps.toolRegistry, so a requireReadOnly call cannot be checked and is refused';
58
+ /** Attenuates `principal` for one execution: it may now invoke only tools registered read-only. */
59
+ export function constrainPrincipalToReadOnlyTools(principal) {
60
+ return { ...principal, toolAccess: 'read-only' };
61
+ }
62
+ /**
63
+ * Whether `principal` is carrying the read-only attenuation.
64
+ *
65
+ * Reads the field structurally, so a principal that travelled through layers typed as the plain
66
+ * `Principal` (every decorator between here and wherever a dispatch is about to happen) still
67
+ * answers truthfully.
68
+ *
69
+ * @complexity O(1).
70
+ */
71
+ export function principalIsReadOnlyConstrained(principal) {
72
+ return principal.toolAccess === 'read-only';
73
+ }
74
+ /**
75
+ * THE read-only dispatch decision for any tool id a consumer's own `ToolExecutor` composition is
76
+ * about to invoke — the outer call this route already checked, or a nested one a decorator issues
77
+ * one or more hops in. Every consumer's own composition should ask this before dispatching on
78
+ * behalf of a principal it did not itself resolve; none should re-implement the check, so changing
79
+ * what the constraint means stays one edit.
80
+ *
81
+ * @param options.principal - The principal the dispatch would run under. Unconstrained ⇒ always
82
+ * `null` — this is a no-op for every pre-existing caller that never attenuates a principal.
83
+ * @param options.toolId - The id actually about to be dispatched, which is not necessarily the id
84
+ * named in the original request — that difference is the whole reason this function exists.
85
+ * @param options.registry - Descriptors to resolve `toolId` against; `undefined` ⇒ refuse (an
86
+ * unverifiable constrained dispatch is refused, never waived, matching `checkReadOnlyConstraint`).
87
+ * @returns `null` when the dispatch may proceed, otherwise the refusal text to report.
88
+ * @complexity O(1) for an unconstrained principal; O(n) in registered tool count for a constrained
89
+ * one, since `ToolRegistry` exposes enumeration rather than lookup by id.
90
+ */
91
+ export function refuseNonReadOnlyDispatch(options) {
92
+ if (!principalIsReadOnlyConstrained(options.principal))
93
+ return null;
94
+ if (options.registry === undefined)
95
+ return READ_ONLY_UNVERIFIABLE_MESSAGE;
96
+ const descriptor = options.registry.list().find((candidate) => candidate.id === options.toolId);
97
+ if (isReadOnlyTool(descriptor))
98
+ return null;
99
+ return readOnlyRefusalMessage(options.toolId);
100
+ }
101
+ /**
102
+ * Wraps `inner` so a read-only-constrained principal (one {@link constrainPrincipalToReadOnlyTools}
103
+ * attenuated) cannot dispatch a tool that isn't registered read-only — whichever layer chose the
104
+ * id. This is what turns the attenuation into an actual gate rather than a field nobody reads:
105
+ * {@link refuseNonReadOnlyDispatch} is the decision, this is its enforcement point.
106
+ *
107
+ * **Compose this as close to the bare `ToolExecutor` as your own stack allows** — directly around
108
+ * `@jini-ai/daemon`'s `createToolExecutor` output, beneath any decorator of your own that might
109
+ * dispatch a tool id the caller never named (a retry, a recovery loop that calls a different tool
110
+ * as a remedy, ...). Every such decorator's own `inner.execute` call still has to come through here
111
+ * to reach a handler, which is what makes this a gate on the CLASS of defect (an unnamed nested
112
+ * dispatch) rather than on one instance of it — see `read-only-tool-constraint.ts` in Tovu's own
113
+ * `apps/website`, the consumer this was ported from, for the composition this mirrors.
114
+ *
115
+ * `delegatedToolExecuteRoute`'s own `handle` additionally composes this around whatever
116
+ * `ToolExecutor` a host supplies, whenever a call attenuates its principal. That outer composition
117
+ * only re-covers the SAME outer `toolId` {@link checkReadOnlyConstraint} already checked — it
118
+ * cannot see a nested dispatch a host's own inner decorator issues, because that decorator holds a
119
+ * reference to whatever `ToolExecutor` IT was built with, not to this route's wrapped one. Closing
120
+ * the nested case for a given host's stack requires that host to compose this decorator itself,
121
+ * innermost, in its own `ToolExecutor` construction — this export exists so it can, without having
122
+ * to rediscover or reimplement the mechanism.
123
+ *
124
+ * @returns A drop-in `ToolExecutor`; `resumeConfirmation`/`cancel`/`getAuditRecord` delegate
125
+ * straight through.
126
+ * @complexity One extra property read per unconstrained call; one registry scan per constrained one.
127
+ */
128
+ export function withReadOnlyToolConstraint(inner, deps) {
129
+ return {
130
+ execute: async (principal, run, toolId, input, signal, emitSurface) => {
131
+ const refusal = refuseNonReadOnlyDispatch({ principal, toolId, registry: deps.registry });
132
+ // Refused BEFORE `inner` — no handler runs, nothing durable happens. `denied` rather than a
133
+ // throw: this is an authorization outcome `ToolExecutionResult` already models, so every
134
+ // caller handles it without a special case. `executionId` is minted here since there is no
135
+ // kernel execution to borrow one from.
136
+ if (refusal !== null)
137
+ return { executionId: randomUUID(), status: 'denied', error: refusal };
138
+ return inner.execute(principal, run, toolId, input, signal, emitSurface);
139
+ },
140
+ resumeConfirmation: (executionId, decision) => inner.resumeConfirmation(executionId, decision),
141
+ cancel: (executionId) => inner.cancel(executionId),
142
+ getAuditRecord: (executionId) => inner.getAuditRecord(executionId),
143
+ };
144
+ }
58
145
  /**
59
146
  * Evaluates a request's read-only constraint against the live registry.
60
147
  *
@@ -187,7 +274,25 @@ export const delegatedToolExecuteRoute = defineJsonRoute({
187
274
  catch (error) {
188
275
  return err(reportInternalError(deps, 'resolve-principal', error, input.runId, input.toolId));
189
276
  }
190
- const bridge = createDelegatedToolBridge({ lifecycle: deps.lifecycle, toolExecutor: deps.toolExecutor });
277
+ // Attenuates the resolved principal itself for a `requireReadOnly` call, so the constraint
278
+ // survives past this route: a consumer's own `ToolExecutor` composition may dispatch a tool id
279
+ // one or more hops past the one checked above (a nested/recovery dispatch using this same
280
+ // principal), and only the principal — not this request's `requireReadOnly` flag, which dies
281
+ // at this function's return — reaches that far. See `constrainPrincipalToReadOnlyTools`'s own
282
+ // doc. A no-op for every existing unconstrained caller.
283
+ if (input.requireReadOnly === true) {
284
+ principal = constrainPrincipalToReadOnlyTools(principal);
285
+ }
286
+ // Composes the SAME enforcement decorator this package exports for a host's own use, here,
287
+ // around whatever `ToolExecutor` the host supplied — a second, independent check of the OUTER
288
+ // `toolId` `checkReadOnlyConstraint` already ran (never a WEAKER outcome than that check, only
289
+ // ever redundant with it; see `withReadOnlyToolConstraint`'s own doc for why this alone cannot
290
+ // close a nested dispatch a host's own inner decorator issues). Skipped entirely for an
291
+ // unconstrained call so the pre-existing gateway's executor reference is untouched.
292
+ const toolExecutor = input.requireReadOnly === true
293
+ ? withReadOnlyToolConstraint(deps.toolExecutor, { registry: deps.toolRegistry })
294
+ : deps.toolExecutor;
295
+ const bridge = createDelegatedToolBridge({ lifecycle: deps.lifecycle, toolExecutor });
191
296
  try {
192
297
  // `signal` carries the caller's HTTP connection dropping — see `mountJsonRoute`
193
298
  // (`adapter.ts`). The bridge already combines it with the run's own cancellation
@@ -1 +1 @@
1
- {"version":3,"file":"delegated-tools.js","sourceRoot":"","sources":["../src/delegated-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAqC,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAkE,MAAM,iBAAiB,CAAC;AAC5H,OAAO,EAAE,eAAe,EAAE,cAAc,EAAuB,MAAM,cAAc,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,EAAE,EAAuC,MAAM,YAAY,CAAC;AA4D1E;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAc;IACnD,OAAO,SAAS,MAAM,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E,yBAAyB,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/http-kit",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Composable Express route packs and JSON-route transport for a @jini-ai/core daemon composition: request parsing, response serialization, same-origin guard, and a route-pack registrar.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -36,23 +36,23 @@
36
36
  "access": "public",
37
37
  "registry": "https://registry.npmjs.org"
38
38
  },
39
+ "dependencies": {
40
+ "express": "^4.21.0",
41
+ "@jini-ai/agent-runtime": "0.3.2",
42
+ "@jini-ai/daemon": "0.3.2",
43
+ "@jini-ai/protocol": "0.3.1",
44
+ "@jini-ai/core": "0.3.1",
45
+ "@jini-ai/platform": "0.3.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/express": "^4.17.21",
49
+ "@vitest/coverage-v8": "^2.1.9",
50
+ "@jini-ai/chat": "0.3.3"
51
+ },
39
52
  "scripts": {
40
53
  "build": "tsc -p tsconfig.json",
41
54
  "typecheck": "tsc -p tsconfig.json --noEmit",
42
55
  "test": "vitest run",
43
56
  "test:coverage": "vitest run --coverage"
44
- },
45
- "dependencies": {
46
- "@jini-ai/agent-runtime": "workspace:*",
47
- "@jini-ai/core": "workspace:*",
48
- "@jini-ai/daemon": "workspace:*",
49
- "@jini-ai/platform": "workspace:*",
50
- "@jini-ai/protocol": "workspace:*",
51
- "express": "^4.21.0"
52
- },
53
- "devDependencies": {
54
- "@jini-ai/chat": "workspace:*",
55
- "@types/express": "^4.17.21",
56
- "@vitest/coverage-v8": "^2.1.9"
57
57
  }
58
- }
58
+ }
@@ -1,15 +0,0 @@
1
- /**
2
- * @module express/run-stream
3
- *
4
- * Express-specific mounting glue for the shared AG-UI SSE run-stream handler (`../run-stream.js`).
5
- * Express's `Request`/`Response` already *are* Node's raw `http.IncomingMessage`/
6
- * `http.ServerResponse` (Express's `Response` extends `http.ServerResponse` directly), so this
7
- * file's only job is resolving `req.params.runId` and handing the request/response straight
8
- * through — a few lines, not a reimplementation, per the design decision that motivated building
9
- * the SSE primitive once instead of duplicating it per transport.
10
- */
11
- import type { Express } from 'express';
12
- import { type RunStreamDeps } from '../run-stream.js';
13
- /** Mounts the AG-UI SSE run-stream route on `app`. A pack's `http(app, services)` calls this directly. */
14
- export declare function registerRunStreamRoute(app: Express, deps: RunStreamDeps): void;
15
- //# sourceMappingURL=run-stream.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-stream.d.ts","sourceRoot":"","sources":["../../src/express/run-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,EAAqB,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAiD,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAErG,0GAA0G;AAC1G,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CAO9E"}
@@ -1,11 +0,0 @@
1
- import { handleRunStreamRequest, RUN_STREAM_ROUTE_PATH } from '../run-stream.js';
2
- /** Mounts the AG-UI SSE run-stream route on `app`. A pack's `http(app, services)` calls this directly. */
3
- export function registerRunStreamRoute(app, deps) {
4
- app.get(RUN_STREAM_ROUTE_PATH, async (req, res) => {
5
- // `:runId` is a required path segment of RUN_STREAM_ROUTE_PATH — this handler is only ever
6
- // reached via a URL that already matched it, so the param is always present at runtime even
7
- // though @types/express types every param as possibly `undefined` in general.
8
- await handleRunStreamRequest(req, res, req.params.runId, deps);
9
- });
10
- }
11
- //# sourceMappingURL=run-stream.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-stream.js","sourceRoot":"","sources":["../../src/express/run-stream.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAsB,MAAM,kBAAkB,CAAC;AAErG,0GAA0G;AAC1G,MAAM,UAAU,sBAAsB,CAAC,GAAY,EAAE,IAAmB;IACtE,GAAG,CAAC,GAAG,CAAC,qBAAqB,EAAE,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QACnE,2FAA2F;QAC3F,4FAA4F;QAC5F,8EAA8E;QAC9E,MAAM,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,KAAM,EAAE,IAAI,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,32 +0,0 @@
1
- /**
2
- * @module @jini/http/express
3
- *
4
- * The Express-native transport namespace: re-exports this package's existing flat Express
5
- * implementation (request parsing, response serialization, the mounting Adapter, the `/api`
6
- * security middleware, the route-registration guard, compat error helpers, the daemon-status
7
- * routes, and the runs/agents/host-tools route packs) under one namespace, mirroring
8
- * `./fastify/index.js`'s shape so a transport-switchable caller (`@jini/node-host`'s
9
- * `createLocalNodeDaemon`) can import either namespace symmetrically. Nothing here is a new
10
- * implementation — every export is the same flat file every other consumer of this package
11
- * already imports directly from the root barrel; this module exists only so `httpExpress.*` and
12
- * `httpFastify.*` read the same at call sites that need to pick a transport explicitly.
13
- */
14
- export type { AdapterContext } from './adapter.js';
15
- export { defineJsonRoute, mountJsonRoute } from './adapter.js';
16
- export type { ApiBearerAuthMiddlewareDeps, ApiOriginGuardMiddlewareDeps } from './api-security-middleware.js';
17
- export { registerApiBearerAuthMiddleware, registerApiOriginGuardMiddleware } from './api-security-middleware.js';
18
- export { createCompatApiError, createCompatApiErrorResponse, sendApiError as sendCompatApiError, } from './compat.js';
19
- export type { DaemonShutdownResponse, DaemonStatusDeps, DaemonStatusResponse, } from './daemon-status.js';
20
- export { daemonShutdownRoute, daemonStatusRoute, registerDaemonStatusRoutes } from './daemon-status.js';
21
- export { isLoopbackHostname, isLoopbackPeerAddress, localOriginFromHeader, normalizeLocalAuthority, requireLocalDaemonRequest, validateLocalDaemonRequest, } from './local-daemon-request.js';
22
- export type { OriginContext } from './origin.js';
23
- export { guardSameOrigin } from './origin.js';
24
- export { rawInput, validationError } from './request.js';
25
- export { registerRunStreamRoute } from './express/run-stream.js';
26
- export { sendApiError, sendJson, statusForError } from './response.js';
27
- export type { InstallRouteRegistrationGuardOptions, RouteRegistration } from './route-registration-guard.js';
28
- export { getRouteRegistrationInventory, guardedRouteKey, installRouteRegistrationGuard, } from './route-registration-guard.js';
29
- export { registerRunRoutes } from './runs.js';
30
- export { registerAgentRoutes } from './agents.js';
31
- export { registerHostToolsRoutes } from './host-tools.js';
32
- //# sourceMappingURL=express-index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"express-index.d.ts","sourceRoot":"","sources":["../src/express-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE/D,YAAY,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC9G,OAAO,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAEjH,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,YAAY,IAAI,kBAAkB,GACnC,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAExG,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEvE,YAAY,EAAE,oCAAoC,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAC7G,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,6BAA6B,GAC9B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,14 +0,0 @@
1
- export { defineJsonRoute, mountJsonRoute } from './adapter.js';
2
- export { registerApiBearerAuthMiddleware, registerApiOriginGuardMiddleware } from './api-security-middleware.js';
3
- export { createCompatApiError, createCompatApiErrorResponse, sendApiError as sendCompatApiError, } from './compat.js';
4
- export { daemonShutdownRoute, daemonStatusRoute, registerDaemonStatusRoutes } from './daemon-status.js';
5
- export { isLoopbackHostname, isLoopbackPeerAddress, localOriginFromHeader, normalizeLocalAuthority, requireLocalDaemonRequest, validateLocalDaemonRequest, } from './local-daemon-request.js';
6
- export { guardSameOrigin } from './origin.js';
7
- export { rawInput, validationError } from './request.js';
8
- export { registerRunStreamRoute } from './express/run-stream.js';
9
- export { sendApiError, sendJson, statusForError } from './response.js';
10
- export { getRouteRegistrationInventory, guardedRouteKey, installRouteRegistrationGuard, } from './route-registration-guard.js';
11
- export { registerRunRoutes } from './runs.js';
12
- export { registerAgentRoutes } from './agents.js';
13
- export { registerHostToolsRoutes } from './host-tools.js';
14
- //# sourceMappingURL=express-index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"express-index.js","sourceRoot":"","sources":["../src/express-index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG/D,OAAO,EAAE,+BAA+B,EAAE,gCAAgC,EAAE,MAAM,8BAA8B,CAAC;AAEjH,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,YAAY,IAAI,kBAAkB,GACnC,MAAM,aAAa,CAAC;AAOrB,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAExG,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGvE,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,6BAA6B,GAC9B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC"}