@jini-ai/server 0.0.0-stage → 0.5.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 +118 -0
- package/LICENSE +201 -0
- package/README.md +56 -2
- package/dist/builtin-features.d.ts +138 -0
- package/dist/builtin-features.js +636 -0
- package/dist/compose-jini-kernel.d.ts +162 -0
- package/dist/compose-jini-kernel.js +208 -0
- package/dist/create-local-node-daemon.d.ts +209 -0
- package/dist/create-local-node-daemon.js +281 -0
- package/dist/feature-activation.d.ts +86 -0
- package/dist/feature-activation.js +112 -0
- package/dist/feature.d.ts +153 -0
- package/dist/feature.js +94 -0
- package/dist/frontend-control.d.ts +76 -0
- package/dist/frontend-control.js +77 -0
- package/dist/host-bootstrap.d.ts +103 -0
- package/dist/host-bootstrap.js +146 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +11 -0
- package/dist/kernel-base.d.ts +83 -0
- package/dist/kernel-base.js +125 -0
- package/dist/lifecycle/boot-lifecycle.d.ts +61 -0
- package/dist/lifecycle/boot-lifecycle.js +74 -0
- package/dist/lifecycle/index.d.ts +3 -0
- package/dist/lifecycle/index.js +3 -0
- package/dist/lifecycle/readiness-state.d.ts +6 -0
- package/dist/lifecycle/readiness-state.js +15 -0
- package/dist/storage/backend-config.d.ts +48 -0
- package/dist/storage/backend-config.js +61 -0
- package/dist/storage/index.d.ts +3 -0
- package/dist/storage/index.js +3 -0
- package/dist/storage/legacy/sqlite.d.ts +26 -0
- package/dist/storage/legacy/sqlite.js +63 -0
- package/dist/store/projects/sqlite.d.ts +161 -0
- package/dist/store/projects/sqlite.js +328 -0
- package/package.json +124 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
## 0.5.1 — 2026-10-08
|
|
2
|
+
|
|
3
|
+
- Align pack contributions, bindings, HTTP mounting, retry classification, executor settings and
|
|
4
|
+
event-log cleanup with the current core/daemon object argument contracts.
|
|
5
|
+
- Compile server tests and fixtures; update their API calls and explicit SQLite opener wiring,
|
|
6
|
+
and keep packed memory-boot support within the server source root.
|
|
7
|
+
|
|
8
|
+
- Keep SQLite composition at the server concern entries; the deprecated sqlite barrel no longer forwards these APIs. Relocate backend-config and missing-opener assertions to server storage tests.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## 0.5.0 — 2026-10-02
|
|
12
|
+
|
|
13
|
+
### BREAKING
|
|
14
|
+
|
|
15
|
+
- Assembly imports follow domain-owned HTTP and core composition surfaces; bundled runtime modules are declared free of import-time side effects.
|
|
16
|
+
- Distribution includes runtime output, release documentation and required assets only. Process records and per-job neutrality checks are no longer part of the package surface.
|
|
17
|
+
|
|
18
|
+
### BREAKING — explicit composition security
|
|
19
|
+
|
|
20
|
+
- `ComposeJiniKernelConfig.security` is required. Omitted or unknown modes now throw before
|
|
21
|
+
resources open; supported-mode middleware order is unchanged.
|
|
22
|
+
- Built-in routes consume daemon/http and reconciled route/catalog argument objects.
|
|
23
|
+
|
|
24
|
+
- Align legacy SQLite integration fixtures with the object arguments of chat, daemon and project stores.
|
|
25
|
+
|
|
26
|
+
## 0.4.0 (unpublished release candidate)
|
|
27
|
+
|
|
28
|
+
- Storage composition consumes chat/daemon/registry/db directly. SQLite hosts must supply an opener; implicit driver loading is removed.
|
|
29
|
+
|
|
30
|
+
# @jini-ai/node-host
|
|
31
|
+
|
|
32
|
+
## 0.2.1
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Add top-level `main`/`types` fields alongside the existing `exports` map. A consumer on
|
|
37
|
+
TypeScript's classic `moduleResolution: "node"` (node10) — which ignores `package.json#exports`
|
|
38
|
+
entirely — could not resolve this package's types at all (`TS2307: Cannot find module`) even
|
|
39
|
+
after the previous exports-map fix restored `require()` at runtime; type resolution and runtime
|
|
40
|
+
resolution are separate algorithms. Verified against a real external consumer (whose
|
|
41
|
+
tsconfig uses this legacy resolution mode): adding these two fields, with its tsconfig completely
|
|
42
|
+
unchanged, made the error disappear. Also fixes absolute-path `require()` (distinct from a bare
|
|
43
|
+
specifier, which already worked) for the same reason — `main` was previously absent.
|
|
44
|
+
|
|
45
|
+
Purely additive: every modern resolver (Node's own runtime `exports` resolution, TypeScript's
|
|
46
|
+
`bundler`/`node16`/`nodenext`) prefers `exports` over `main`/`types` when both are present, so
|
|
47
|
+
this changes nothing for a consumer already on a modern resolver.
|
|
48
|
+
|
|
49
|
+
- Updated dependencies
|
|
50
|
+
- @jini-ai/core@0.1.2
|
|
51
|
+
- @jini-ai/daemon@0.2.1
|
|
52
|
+
- @jini-ai/agent-runtime@0.2.1
|
|
53
|
+
- @jini-ai/sqlite@0.1.2
|
|
54
|
+
- @jini-ai/http@0.2.1
|
|
55
|
+
- @jini-ai/sidecar@0.1.2
|
|
56
|
+
|
|
57
|
+
## 0.2.0
|
|
58
|
+
|
|
59
|
+
### Minor Changes
|
|
60
|
+
|
|
61
|
+
- e181b22: Enforce flat-package domain/runtime/admission metadata, invert optional capability dependencies,
|
|
62
|
+
inject failure-contained run-stream encoders, clean up provisional replay subscribers, and add a
|
|
63
|
+
neutral node-host HTTP-extension composition seam.
|
|
64
|
+
- 0d15314: Add a neutral Composer footer slot for host-owned controls, forward an optional host-selected model through every AgentExecutor runtime transport, expose daemon-owned live agent/model discovery with an explicit rescan route, and recognize Claude Code's partial-stream `message_delta` turn boundary so successful stream-json runs close cleanly.
|
|
65
|
+
|
|
66
|
+
### Patch Changes
|
|
67
|
+
|
|
68
|
+
- Add a `"default"` export condition to every published package's `exports` map — every one of
|
|
69
|
+
them lacked it, which meant `require()` failed with `ERR_PACKAGE_PATH_NOT_EXPORTED` for any
|
|
70
|
+
CommonJS consumer (found via a real external integration attempt; Node needs `require(esm)`
|
|
71
|
+
support, i.e. Node >=22.12, for this to resolve).
|
|
72
|
+
|
|
73
|
+
`@jini-ai/agent-runtime`:
|
|
74
|
+
|
|
75
|
+
- **New**: `RuntimeBuildOptions.permissionMode` (`'bypass' | 'restricted'`) lets a caller opt a
|
|
76
|
+
run OUT of the auto-approve-every-permission-prompt flag every def with one
|
|
77
|
+
(`bypassPermissions` / `--yolo` / `--dangerously-skip-permissions`) previously pushed
|
|
78
|
+
unconditionally, with no way to turn it off. Omitting it keeps today's default (bypass)
|
|
79
|
+
behavior unchanged.
|
|
80
|
+
- **New**: `ClaudeStreamEvent`, `CopilotStreamEvent`, and `QoderEvent` are now real exported
|
|
81
|
+
discriminated unions instead of `Record<string, unknown>` — a real external consumer guessed a
|
|
82
|
+
nonexistent field name (`event.text` instead of the actual `event.delta`) against the old
|
|
83
|
+
untyped sink and silently lost every streamed token with no compile or runtime error.
|
|
84
|
+
- Fixed a doc/implementation mismatch in `claude-stream.ts`: the module doc claimed `tool_result`
|
|
85
|
+
events carry `{ tool_use_id, content, is_error }`; the actual emitted shape is
|
|
86
|
+
`{ toolUseId, content, isError }`.
|
|
87
|
+
|
|
88
|
+
`@jini-ai/daemon`: `AgentExecutorRunInput.permissionMode` forwards the new
|
|
89
|
+
`RuntimeBuildOptions.permissionMode` through to `buildArgs`, so a host can actually reach the new
|
|
90
|
+
opt-out from the daemon's real run-input surface, not just from `@jini-ai/agent-runtime` in
|
|
91
|
+
isolation.
|
|
92
|
+
|
|
93
|
+
`@jini-ai/agentic`: `setAtPointer` no longer throws on a malformed (e.g. missing leading `/`)
|
|
94
|
+
`updateDataModel` path — degrades to a no-op like its sibling `getAtPointer`, matching this
|
|
95
|
+
package's own "a bad binding must not crash the renderer" contract. That path is agent-authored
|
|
96
|
+
wire data with no error boundary above it in any host, so the uncaught throw could unmount an
|
|
97
|
+
entire chat UI from ~40 bytes of malformed input.
|
|
98
|
+
|
|
99
|
+
`@jini-ai/chat-react`: a local (client-resolved) A2UI button action is no longer a silent no-op —
|
|
100
|
+
`A2uiSurfaceCard` now surfaces the resolved value. New `ExtEventErrorBoundary` confines a
|
|
101
|
+
`kind: 'ext'` event group's renderer to its own card instead of letting a render/effect-phase
|
|
102
|
+
throw from agent-controlled content unmount the whole chat root (there was no error boundary
|
|
103
|
+
anywhere in this package or its hosts before this).
|
|
104
|
+
|
|
105
|
+
- Updated dependencies
|
|
106
|
+
- Updated dependencies [e181b22]
|
|
107
|
+
- Updated dependencies [0d15314]
|
|
108
|
+
- @jini-ai/core@0.1.1
|
|
109
|
+
- @jini-ai/sqlite@0.1.1
|
|
110
|
+
- @jini-ai/sidecar@0.1.1
|
|
111
|
+
- @jini-ai/http@0.2.0
|
|
112
|
+
- @jini-ai/agent-runtime@0.2.0
|
|
113
|
+
- @jini-ai/daemon@0.2.0
|
|
114
|
+
|
|
115
|
+
## Unreleased — C2 injected storage
|
|
116
|
+
- Required a host opener for SQLite composition and standalone daemon boot; memory remains driver-free.
|
|
117
|
+
- Replaced old storage imports with daemon/registry/db concern subpaths, preserving shared health ownership.
|
|
118
|
+
- Added explicit backend-config, legacy bootstrap and local-project storage entries.
|
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.
|
package/README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
-
# Temporary Holding Version
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
# @jini-ai/server
|
|
3
|
+
|
|
4
|
+
Host composition requires the external host's SQLite opener for durable storage:
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import Database from 'better-sqlite3';
|
|
8
|
+
import { createLocalNodeDaemon } from '@jini-ai/server';
|
|
9
|
+
const daemon = await createLocalNodeDaemon({
|
|
10
|
+
dataDir, packs: [], open: (file, options) => new Database(file, options),
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`composeJiniKernel` requires an explicit `security` choice: `{ mode: 'host' }` for host-owned
|
|
15
|
+
security, `jini-local` for local bearer/origin middleware, or `sidecar-strict` for mandatory
|
|
16
|
+
bearer validation before body parsing. Omitted and unknown modes fail before resources open.
|
|
17
|
+
|
|
18
|
+
For `composeJiniKernel`, use `storage: { kind: 'sqlite', dataDir, open }`; memory composition
|
|
19
|
+
uses `{ kind: 'memory' }` and needs no SQLite driver. All acquired event/journal/feature handles
|
|
20
|
+
belong to the kernel base, so independently disabling daemonDb/toolCatalog keeps health's
|
|
21
|
+
connection intact. Failed boot closes acquired handles; shutdown is idempotent.
|
|
22
|
+
|
|
23
|
+
`./storage` exports backend configuration resolution only, retaining the existing environment
|
|
24
|
+
names. It never selects or opens a driver. `./storage/legacy/sqlite` exports `openDatabase(root,
|
|
25
|
+
{ dataDir?, open })`, `closeDatabase()` and `migrate(db)`. This explicit local app.sqlite bootstrap
|
|
26
|
+
composes unchanged concern DDL for projects, conversations/messages and rich daemon sessions.
|
|
27
|
+
`./store/projects/sqlite` retains project CRUD and legacy run/awaiting-input projections over a
|
|
28
|
+
borrowed handle. No content/chat file is moved or host migration ledger applied.
|
|
29
|
+
|
|
30
|
+
No permanent package imports the compatibility shim. SQLite is an optional peer supplied by the
|
|
31
|
+
host; the server has no driver hard dependency or autoload behavior.
|
|
32
|
+
|
|
33
|
+
## Design decisions
|
|
34
|
+
|
|
35
|
+
- [Boot failure closes every resource already acquired](docs/decisions/DR-001-partial-boot-rollback.md).
|
|
36
|
+
|
|
37
|
+
Built-in daemon routes import `@jini-ai/daemon/http`. Middleware order is preserved:
|
|
38
|
+
probe routes first; in sidecar-strict mode bearer auth precedes JSON parsing, then the origin
|
|
39
|
+
guard; in jini-local mode JSON parsing precedes bearer auth and the origin guard. API packs,
|
|
40
|
+
the after-API hook and status packs follow. Hosts compose read-only attenuation innermost
|
|
41
|
+
around the bare executor to intercept nested recovery dispatches.
|
|
42
|
+
|
|
43
|
+
Backend config, legacy SQLite acquisition/bootstrap and project CRUD/status remain owned by `@jini-ai/server/{storage,storage/legacy/sqlite,store/projects/sqlite}`. Import these entries directly; the deprecated sqlite package no longer forwards them. Storage behavior and wire data are unchanged.
|
|
44
|
+
|
|
45
|
+
## Composition contracts
|
|
46
|
+
|
|
47
|
+
Built-in and caller packs use `definePack({ name, deps, services }, { tools, http, dispose })`.
|
|
48
|
+
Contribution callbacks receive an object (`{ app, services }` for HTTP, `{ services }` for tools
|
|
49
|
+
and disposal). Kernel composition forwards these hooks through the current core lifecycle helpers.
|
|
50
|
+
|
|
51
|
+
`agentExecutor` accepts the optional settings from `createAgentExecutor`'s second argument;
|
|
52
|
+
the kernel supplies its lifecycle, journal and retry classifier. Event-log cleanup passes `{}` to
|
|
53
|
+
the daemon's close port in both failed boot and normal shutdown.
|
|
54
|
+
|
|
55
|
+
The package TypeScript configuration includes source tests and fixtures. Published files continue
|
|
56
|
+
to exclude test output. The packed memory-boot fixture is local to this package so compiling server
|
|
57
|
+
does not pull another package's test sources outside server's source root.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { type Principal } from '@jini-ai/core';
|
|
2
|
+
import { type DetectedAgent, type OAuthCallbackListener } from '@jini-ai/agent-runtime';
|
|
3
|
+
import { type ResolveRunInput } from '@jini-ai/daemon';
|
|
4
|
+
import { type SqliteDb } from '@jini-ai/db/sqlite';
|
|
5
|
+
import { type AgentSummary, type DaemonDbOperations, type DelegatedToolExecuteRequest, type FrontendSessionsHttpDeps, type MediaHttpDeps, type MemoryHttpDeps, type RemoteToolBridgeTokenConfig, type RoutineHttpDeps, type RunStartHandler, type WorkspaceRootResolver } from '@jini-ai/daemon/http';
|
|
6
|
+
import { type JiniFeature } from './feature.js';
|
|
7
|
+
/**
|
|
8
|
+
* The identity every zero-config, `ToolExecutor`-gated tool this module registers (`terminal.create`,
|
|
9
|
+
* `daemon.db.*`) executes as. A composition using these has no multi-tenant identity subsystem of
|
|
10
|
+
* its own — the bearer gate is authenticated-or-not, not per-caller — so every authenticated caller
|
|
11
|
+
* already shares one trust boundary and a single fixed `Principal` removes no distinction that
|
|
12
|
+
* existed before it.
|
|
13
|
+
*/
|
|
14
|
+
export declare const LOCAL_DAEMON_PRINCIPAL: Principal;
|
|
15
|
+
/**
|
|
16
|
+
* The identity a delegated tool call runs as when the host supplies no resolver. Carries **no
|
|
17
|
+
* roles**, deliberately.
|
|
18
|
+
*
|
|
19
|
+
* ## What actually makes this inert, because an earlier version of this comment named the wrong
|
|
20
|
+
* mechanism
|
|
21
|
+
*
|
|
22
|
+
* It previously claimed inertness came from "every registered tool's own deny-by-default
|
|
23
|
+
* `ToolPolicy`". That is **false**, and believing it is dangerous. `@jini-ai/cms` registers every
|
|
24
|
+
* one of its tools with a pass-through `policy: { authorize: () => 'allow' }` — deliberately, and
|
|
25
|
+
* documented as such in `core/tools/registration-kit.ts`: each tool's permission is evaluated
|
|
26
|
+
* exactly once, inside the domain function or via that file's `requireToolPermission`, so a second
|
|
27
|
+
* evaluator in the policy would be the bug rather than the guard.
|
|
28
|
+
*
|
|
29
|
+
* What actually denies this principal is the identity layer being fail-closed on an UNKNOWN
|
|
30
|
+
* subject: `identity/authorize.ts` starts with `principals.findById(...)` and returns
|
|
31
|
+
* `{ allowed: false, reason: 'principal_disabled' }` when no row comes back. `anonymous-delegated`
|
|
32
|
+
* has no row, so every permission-gated tool refuses it.
|
|
33
|
+
*
|
|
34
|
+
* ## The residual risk that follows from that, stated plainly
|
|
35
|
+
*
|
|
36
|
+
* The protection is the *tool's own* permission check, not this identity and not the registry. A
|
|
37
|
+
* tool registered by some other host with a permissive `ToolPolicy` **and** no internal permission
|
|
38
|
+
* check would execute for this principal. That is exactly why `@jini-ai/http-kit`'s
|
|
39
|
+
* `DelegatedToolsHttpDeps.resolvePrincipal` documents itself as mandatory, and why the fallback
|
|
40
|
+
* below warns rather than staying silent.
|
|
41
|
+
*/
|
|
42
|
+
export declare const ANONYMOUS_DELEGATED_PRINCIPAL: Principal;
|
|
43
|
+
/** Per-feature configuration, closed over when the catalog is built. */
|
|
44
|
+
export interface BuiltInFeatureOptions {
|
|
45
|
+
readonly health?: {
|
|
46
|
+
readonly getVersion?: () => string | Promise<string>;
|
|
47
|
+
/** Folded into readiness as a `notShuttingDown` check. @default always false */
|
|
48
|
+
readonly isShuttingDown?: () => boolean;
|
|
49
|
+
};
|
|
50
|
+
readonly runs?: {
|
|
51
|
+
readonly onRunStarted?: RunStartHandler;
|
|
52
|
+
readonly resolveRunInput?: ResolveRunInput;
|
|
53
|
+
};
|
|
54
|
+
readonly agents?: {
|
|
55
|
+
readonly detector?: () => Promise<readonly DetectedAgent[]>;
|
|
56
|
+
};
|
|
57
|
+
readonly hostTools?: {
|
|
58
|
+
readonly resolveWorkspaceRoot?: WorkspaceRootResolver;
|
|
59
|
+
};
|
|
60
|
+
readonly terminal?: {
|
|
61
|
+
readonly resolveWorkspaceRoot?: WorkspaceRootResolver;
|
|
62
|
+
readonly principal?: Principal;
|
|
63
|
+
};
|
|
64
|
+
readonly daemonDb?: {
|
|
65
|
+
readonly principal?: Principal;
|
|
66
|
+
};
|
|
67
|
+
readonly delegatedToolCalls?: {
|
|
68
|
+
readonly resolvePrincipal?: (request: DelegatedToolExecuteRequest) => Principal | Promise<Principal>;
|
|
69
|
+
};
|
|
70
|
+
readonly remoteRunEvents?: {
|
|
71
|
+
readonly tokenConfig?: RemoteToolBridgeTokenConfig;
|
|
72
|
+
};
|
|
73
|
+
readonly xai?: {
|
|
74
|
+
readonly listenerRef?: {
|
|
75
|
+
current: OAuthCallbackListener | null;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Only `requestShutdown` is required, and deliberately so: everything else here
|
|
80
|
+
* (`getVersion`/`host`/`getPort`/`dataDir`/`isShuttingDown`) is already known to the composition
|
|
81
|
+
* and is derived when omitted, but *what shutdown means* is not something this package can invent
|
|
82
|
+
* on a host's behalf. Defaulting it to a no-op would mount a shutdown endpoint that silently does
|
|
83
|
+
* nothing — the "reports stopped while still serving" failure mode, shipped as a default.
|
|
84
|
+
*/
|
|
85
|
+
readonly daemonStatus?: {
|
|
86
|
+
readonly requestShutdown: () => void;
|
|
87
|
+
readonly getVersion?: () => string | Promise<string>;
|
|
88
|
+
readonly host?: string;
|
|
89
|
+
readonly getPort?: () => number;
|
|
90
|
+
readonly dataDir?: string;
|
|
91
|
+
readonly isShuttingDown?: () => boolean;
|
|
92
|
+
};
|
|
93
|
+
/** Required to activate `memory` — this package has no note store of its own to default to. */
|
|
94
|
+
readonly memory?: MemoryHttpDeps;
|
|
95
|
+
readonly routines?: RoutineHttpDeps;
|
|
96
|
+
readonly media?: MediaHttpDeps;
|
|
97
|
+
readonly frontendSessions?: FrontendSessionsHttpDeps;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* `DaemonDbOperations` over a caller-owned connection. `vacuum` measures the primary file's on-disk
|
|
101
|
+
* size before/after (not the `-wal`/`-shm` sum), since a fresh `VACUUM` checkpoints and shrinks the
|
|
102
|
+
* primary file itself, which is what "reclaimed" means here.
|
|
103
|
+
*/
|
|
104
|
+
export declare function buildDaemonDbOperations(db: SqliteDb, file: string): DaemonDbOperations;
|
|
105
|
+
/**
|
|
106
|
+
* Whether the `agents` feature should advertise this probe result.
|
|
107
|
+
*
|
|
108
|
+
* Discovery scans every runtime definition, but `AgentExecutor` refuses to drive any def its
|
|
109
|
+
* `assessAgentExecutorCompatibility` rejects — see `@jini-ai/daemon`'s own module doc. All currently
|
|
110
|
+
* registered defs pass that check, but a future def may not. Advertising one that doesn't yields an
|
|
111
|
+
* agent a user can select and then cannot run — so the executor's own compatibility answer is applied
|
|
112
|
+
* here, at the surface that offers the choice.
|
|
113
|
+
*
|
|
114
|
+
* Assessed against the **full** `RuntimeAgentDef` resolved by id, not the `DetectedAgent` passed in:
|
|
115
|
+
* the projected type omits `maxPromptArgBytes`, and the argv-bound defs (`aider`, `deepseek`) qualify
|
|
116
|
+
* solely through it, so judging the projection would drop two working agents.
|
|
117
|
+
*
|
|
118
|
+
* An id with no registered def is **kept**, not dropped. A host supplying its own `detector` may
|
|
119
|
+
* legitimately surface agents outside `AGENT_DEFS`, driven by something other than this executor;
|
|
120
|
+
* there is nothing to assess, and refusing to advertise them would break that host on no evidence.
|
|
121
|
+
*
|
|
122
|
+
* @param agent - One probe result from the active detector.
|
|
123
|
+
* @returns `true` when the agent should appear in `GET /api/agents`.
|
|
124
|
+
* @complexity O(1) — one registry lookup plus fixed field checks.
|
|
125
|
+
* @overallScore 100/100
|
|
126
|
+
*/
|
|
127
|
+
export declare function isExecutableDetectedAgent(agent: DetectedAgent): boolean;
|
|
128
|
+
/** Projects a real `DetectedAgent` probe onto the HTTP summary shape. */
|
|
129
|
+
export declare function projectDetectedAgent(agent: DetectedAgent): AgentSummary;
|
|
130
|
+
/**
|
|
131
|
+
* Builds the full built-in feature catalog with `options` closed over.
|
|
132
|
+
*
|
|
133
|
+
* Order is composition order, and it is deliberately the order `createLocalNodeDaemon` has always
|
|
134
|
+
* registered these families in — so the route-registration inventory, the tool-registration order,
|
|
135
|
+
* and therefore which id a duplicate-registration error names, are all unchanged.
|
|
136
|
+
*/
|
|
137
|
+
export declare function createBuiltInFeatures(options?: BuiltInFeatureOptions): readonly JiniFeature[];
|
|
138
|
+
//# sourceMappingURL=builtin-features.d.ts.map
|