@lloyal-labs/lloyal-agents 2.0.0 → 3.0.0

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 (79) hide show
  1. package/LICENSE +107 -0
  2. package/LICENSE-FAQ.md +256 -0
  3. package/README.md +31 -15
  4. package/dist/Agent.d.ts +15 -4
  5. package/dist/Agent.d.ts.map +1 -1
  6. package/dist/Agent.js +12 -2
  7. package/dist/Agent.js.map +1 -1
  8. package/dist/AgentPolicy.d.ts +92 -15
  9. package/dist/AgentPolicy.d.ts.map +1 -1
  10. package/dist/AgentPolicy.js +42 -14
  11. package/dist/AgentPolicy.js.map +1 -1
  12. package/dist/Tool.d.ts +45 -1
  13. package/dist/Tool.d.ts.map +1 -1
  14. package/dist/Tool.js +50 -2
  15. package/dist/Tool.js.map +1 -1
  16. package/dist/agent-pool.d.ts +4 -4
  17. package/dist/agent-pool.d.ts.map +1 -1
  18. package/dist/agent-pool.js +224 -53
  19. package/dist/agent-pool.js.map +1 -1
  20. package/dist/app-config.d.ts +50 -0
  21. package/dist/app-config.d.ts.map +1 -0
  22. package/dist/app-config.js +27 -0
  23. package/dist/app-config.js.map +1 -0
  24. package/dist/app-types.d.ts +309 -0
  25. package/dist/app-types.d.ts.map +1 -0
  26. package/dist/app-types.js +28 -0
  27. package/dist/app-types.js.map +1 -0
  28. package/dist/chunk.d.ts +118 -0
  29. package/dist/chunk.d.ts.map +1 -0
  30. package/dist/chunk.js +19 -0
  31. package/dist/chunk.js.map +1 -0
  32. package/dist/context.d.ts +76 -20
  33. package/dist/context.d.ts.map +1 -1
  34. package/dist/context.js +72 -20
  35. package/dist/context.js.map +1 -1
  36. package/dist/create-agent-pool.d.ts +18 -12
  37. package/dist/create-agent-pool.d.ts.map +1 -1
  38. package/dist/create-agent-pool.js +30 -29
  39. package/dist/create-agent-pool.js.map +1 -1
  40. package/dist/grant-store.d.ts +49 -0
  41. package/dist/grant-store.d.ts.map +1 -0
  42. package/dist/grant-store.js +33 -0
  43. package/dist/grant-store.js.map +1 -0
  44. package/dist/index.d.ts +10 -6
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +9 -5
  47. package/dist/index.js.map +1 -1
  48. package/dist/orchestrators.d.ts +15 -8
  49. package/dist/orchestrators.d.ts.map +1 -1
  50. package/dist/orchestrators.js +10 -10
  51. package/dist/orchestrators.js.map +1 -1
  52. package/dist/replay.d.ts +19 -19
  53. package/dist/replay.d.ts.map +1 -1
  54. package/dist/replay.js +29 -29
  55. package/dist/replay.js.map +1 -1
  56. package/dist/source.d.ts +31 -1
  57. package/dist/source.d.ts.map +1 -1
  58. package/dist/source.js +32 -2
  59. package/dist/source.js.map +1 -1
  60. package/dist/spine.d.ts +100 -0
  61. package/dist/spine.d.ts.map +1 -0
  62. package/dist/{shared-root.js → spine.js} +57 -38
  63. package/dist/spine.js.map +1 -0
  64. package/dist/toolkit.d.ts +44 -17
  65. package/dist/toolkit.d.ts.map +1 -1
  66. package/dist/toolkit.js +24 -14
  67. package/dist/toolkit.js.map +1 -1
  68. package/dist/trace-types.d.ts +36 -4
  69. package/dist/trace-types.d.ts.map +1 -1
  70. package/dist/types.d.ts +46 -15
  71. package/dist/types.d.ts.map +1 -1
  72. package/dist/use-agent.d.ts +10 -5
  73. package/dist/use-agent.d.ts.map +1 -1
  74. package/dist/use-agent.js +18 -15
  75. package/dist/use-agent.js.map +1 -1
  76. package/package.json +7 -5
  77. package/dist/shared-root.d.ts +0 -96
  78. package/dist/shared-root.d.ts.map +0 -1
  79. package/dist/shared-root.js.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,107 @@
1
+ # Functional Source License, Version 1.1, Apache 2.0 Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-Apache-2.0
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 Lloyal Labs
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publish, and distribute the
28
+ Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A "Permitted Purpose" is any purpose other than a Competing Use. A
33
+ "Competing Use" means making the Software available to others in a
34
+ commercial product or service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a Licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives
65
+ of the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND,
74
+ INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE,
75
+ MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO
78
+ THE SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
79
+ DAMAGES, EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software
90
+ under the Apache License, Version 2.0 that is effective on the second
91
+ anniversary of the date we make the Software available. On or after that
92
+ date, you may use the Software under the Apache License, Version 2.0, in
93
+ which case the following will apply:
94
+
95
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not
96
+ use this file except in compliance with the License.
97
+
98
+ You may obtain a copy of the License at
99
+
100
+ http://www.apache.org/licenses/LICENSE-2.0
101
+
102
+ Unless required by applicable law or agreed to in writing, software
103
+ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
104
+ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
105
+
106
+ See the License for the specific language governing permissions and
107
+ limitations under the License.
package/LICENSE-FAQ.md ADDED
@@ -0,0 +1,256 @@
1
+ # Licensing FAQ
2
+
3
+ > Canonical version at https://docs.lloyal.ai/licensing/faq.
4
+ > This file is a synced copy. Edit the canonical source and re-run
5
+ > `scripts/sync-license-faq.sh` in lloyal-sdk to update all copies.
6
+
7
+
8
+ **You can build and sell commercial products using HDK.**
9
+
10
+ > HDK is free to build products with; it is not free to become the
11
+ > replacement HDK platform.
12
+
13
+ That single sentence is the entire restriction reduced to one line. The rest
14
+ of this page is illustration.
15
+
16
+ ## The short version
17
+
18
+ HDK 3.0 runtime packages — `liblloyal`, `lloyal-node`, and the lloyal-sdk
19
+ packages (`agents`, `sdk`, `rig`, `apps/corpus`, `apps/web`) — are
20
+ source-available under **FSL-1.1-Apache-2.0** (the Functional Source License,
21
+ Apache 2.0 future grant). FSL is a [Fair Source](https://fair.io) license.
22
+
23
+ Each version converts to Apache 2.0 two years after its release. The
24
+ restriction during those two years is narrow: **you cannot offer a competing
25
+ HDK runtime, a managed HDK service, or an alternative HDK App distribution
26
+ channel.** Everything else — commercial use, redistribution, modification,
27
+ sale, embedding in shipped products — is freely permitted.
28
+
29
+ The reason the channel restriction exists is consumer-protective: every App
30
+ listed on `apps.lloyal.ai` is reviewed by Lloyal Labs for tool-safety,
31
+ manifest conformance, and signature provenance before publication. Pinning
32
+ the App ecosystem to one verified channel keeps the AI-safety review meaningful
33
+ (consumers can rely on a single trust boundary) and prevents protocol
34
+ fragmentation (an App that works on one harness works on every harness).
35
+
36
+ The `harness.dev` CLI and `hdk-create-app` scaffolder are licensed under
37
+ **Apache 2.0** (unrestricted). They're not part of the runtime stack.
38
+
39
+ ## Can I ship a commercial product built on HDK?
40
+
41
+ **Yes.** This is the question everyone has and the answer is straightforward.
42
+ Concretely:
43
+
44
+ - **Shipping a paid intelligent inbox app to consumers** — permitted ✅
45
+ - **Selling an Excel-with-AI desktop app to enterprises** — permitted ✅
46
+ - **Embedding HDK in a medical device sold commercially** — permitted ✅
47
+ - **A consulting firm building a custom intelligent harness for a Fortune
48
+ 500 client, charging $500K for the engagement, deploying on client
49
+ infrastructure** — permitted ✅
50
+ - **An indie dev shipping a paid productivity app on the Mac App Store** —
51
+ permitted ✅
52
+ - **An OEM shipping HDK inside an infotainment system or industrial device**
53
+ — permitted ✅
54
+ - **A startup building an end-user product on top of HDK** — including
55
+ vertical research apps, workflow tools, and agent applications — permitted
56
+ ✅, *as long as the product is not offering HDK itself as a substitute
57
+ runtime, managed HDK service, or competing App distribution channel*.
58
+ - **A research lab using HDK in published academic work** — permitted ✅
59
+ - **Forking HDK on GitHub to learn, modify, demo, or contribute** — permitted ✅
60
+ - **Running HDK internally inside your company for any business use** —
61
+ permitted ✅
62
+
63
+ If you are building something *with* HDK, you are almost certainly fine.
64
+
65
+ ## What is actually restricted?
66
+
67
+ The restriction is narrow and specific: **don't become the replacement
68
+ platform vendor**. Concretely:
69
+
70
+ - **AWS / Google / Microsoft launching "Bedrock Managed HDK" or "Vertex HDK"
71
+ as a hosted runtime service** — restricted ❌
72
+ - **A competitor publishing "OpenHDK" as a forked harness runtime under a
73
+ different name** — restricted ❌
74
+ - **A clean-room reimplementation of the HDK runtime in Python / Rust / Go
75
+ intended as a drop-in replacement** — restricted ❌ (Competing Use doesn't
76
+ require forking source code — a reimplementation that competes is the
77
+ same problem)
78
+ - **Launching `apps.competitor.com` as an alternative HDK App distribution
79
+ channel** — restricted ❌
80
+ - **Offering "managed HDK hosting" or "HDK-as-a-Service" as a competing
81
+ SaaS** — restricted ❌
82
+ - **A hosted orchestration service exposing HDK-compatible APIs as a
83
+ substitute for the HDK runtime** — restricted ❌
84
+
85
+ Notice the pattern: every restricted scenario is "become the platform
86
+ vendor," not "build products with HDK." If your project doesn't compete
87
+ directly with the HDK runtime or its distribution channel, FSL doesn't
88
+ affect you.
89
+
90
+ ## Why does the LICENSE list four narrow Permitted Purposes then?
91
+
92
+ You may read the FSL LICENSE and see this section:
93
+
94
+ > Permitted Purposes specifically include using the Software:
95
+ > 1. for your internal use and access;
96
+ > 2. for non-commercial education;
97
+ > 3. for non-commercial research; and
98
+ > 4. in connection with professional services that you provide to a
99
+ > Licensee using the Software in accordance with these Terms and
100
+ > Conditions.
101
+
102
+ A careful first reading can mistake this list for the *exclusive* set of
103
+ permitted uses — leading to the (incorrect) conclusion that commercial
104
+ product distribution is prohibited.
105
+
106
+ It isn't. **The operative definition is broader.** Earlier in the same
107
+ section, the license states:
108
+
109
+ > A "Permitted Purpose" is any purpose other than a Competing Use.
110
+
111
+ The four enumerated items are **illustrative examples** added because those
112
+ specific cases are ones a careful reader might otherwise hesitate about
113
+ ("is research permitted? is consulting permitted?"). The four items are
114
+ additive clarifications, not a closing of the open-ended definition.
115
+
116
+ Sentry, who authored FSL and uses it on their own software, [confirms this
117
+ explicitly in their FAQ](https://fsl.software):
118
+
119
+ > "You can do anything with FSL software except undermine its producer. You
120
+ > can run it for almost all purposes, study it, modify it, and distribute
121
+ > your changes…"
122
+
123
+ If the license felt restrictive on first read, that's a documented
124
+ [FSL adoption hazard](https://fair.io) — many developers hit the same wall.
125
+ The answer is to read the "any purpose other than a Competing Use" line as
126
+ the operative definition and treat the four enumerated items as examples,
127
+ not as a closed list.
128
+
129
+ ## Will it become Apache 2.0?
130
+
131
+ **Yes — automatically, on a per-version schedule.** Each released version of
132
+ the runtime stack converts to Apache 2.0 exactly two years after its release
133
+ date. The conversion is irrevocable and written into the license text — it's
134
+ not a promise from Lloyal Labs, it's a contractual clause.
135
+
136
+ For example: if `lloyal-sdk @lloyal-labs/lloyal-agents` v3.0.0 is released
137
+ on 2026-06-01, that exact version becomes available under Apache 2.0 on
138
+ 2028-06-01. Any consumer can elect to use that version under Apache 2.0
139
+ from that date forward — Lloyal Labs takes no action; the grant is
140
+ automatic.
141
+
142
+ New versions released after v3.0.0 start their own two-year clock from
143
+ their own release dates. There is no single global Change Date.
144
+
145
+ ## Is this OSI-approved open source?
146
+
147
+ **No, and we want to be honest about that.** FSL is not OSI-approved
148
+ because the OSI definition of open source (clause 6, "No Discrimination
149
+ Against Fields of Endeavor") does not permit restrictions on specific
150
+ use cases. FSL restricts Competing Use. That restriction takes it out of
151
+ strict OSI compliance.
152
+
153
+ FSL falls under the [Fair Source](https://fair.io) classification —
154
+ source-available licenses that are explicitly developer-friendly:
155
+ commercial use permitted, free redistribution, eventual open-source
156
+ conversion. Fair Source is a more developer-friendly framing than the
157
+ generic "source-available" label, which has been tainted by the
158
+ SSPL / Elastic / MongoDB relicensing trauma cycles.
159
+
160
+ What this means practically:
161
+
162
+ - **You can read the source.** ✅
163
+ - **You can modify it.** ✅
164
+ - **You can sell products built with it.** ✅
165
+ - **You can redistribute it (with the same FSL terms).** ✅
166
+ - **It will be Apache 2.0 in two years.** ✅
167
+ - Some enterprise procurement policies that strictly require OSI-approved
168
+ licenses will require an exception for this. We're working on making
169
+ that exception easy to grant.
170
+
171
+ ## Why FSL specifically — why not stay Apache?
172
+
173
+ HDK 3.0 introduces installable HDK Apps. Every App declares against a
174
+ specific App protocol — the bytes-locked intro, catalog format,
175
+ tool-selection rule, and boundary marker that the runtime renders into
176
+ the spine. Your App's reliability depends on every HDK runtime your users
177
+ install agreeing on the same protocol.
178
+
179
+ Under a permissive license alone, the protocol is forkable. A
180
+ well-resourced redistributor could fork the runtime, modify the protocol
181
+ surface, and distribute a variant under a different name with captive
182
+ distribution. App developers then face a fragmented ecosystem: target one
183
+ protocol, target both, or pick the bigger distribution and abandon the
184
+ others. The cost of that split is paid by App developers in testing
185
+ burden, divergent behavior, and reliability degradation across runtimes.
186
+
187
+ FSL's two-year Competing Use restriction is shaped to block that
188
+ fragmentation specifically. After the conversion, anyone can build
189
+ whatever they want — by which time the protocol has had enough time to
190
+ stabilize through ecosystem use and the protection is no longer the load-
191
+ bearing thing keeping it coherent.
192
+
193
+ For the longer treatment of this argument, see
194
+ [Why FSL](./why-fsl).
195
+
196
+ We could have used Apache 2.0 and tried to protect only the channel via
197
+ terms-of-service. We could have written a custom license. We chose
198
+ standard FSL because it's:
199
+
200
+ - **Off-the-shelf** — no bespoke license review at every adopter
201
+ - **Recognizable** — Sentry, PowerSync, and others use it
202
+ - **Documented** — the FAQ, definitions, and edge cases have been
203
+ litigated publicly
204
+ - **Time-bounded** — the protocolual Apache 2.0 conversion is the answer
205
+ to the "is this just source-available forever?" critique
206
+ - **Pre-launch** — relicensing at HDK 3.0 launch is structurally
207
+ different from MongoDB / Elastic / HashiCorp relicensing under an
208
+ existing installed base, which is what causes the backlash cycle
209
+
210
+ ## What about the lloyal stack — what's under FSL and what's not?
211
+
212
+ | Component | License | Why |
213
+ |---|---|---|
214
+ | `liblloyal` (C++ engine) | FSL-1.1-Apache-2.0 | Native primitives the runtime is built on |
215
+ | `lloyal-node` (N-API binding) | FSL-1.1-Apache-2.0 | The binding that lets Effection drive llama.cpp |
216
+ | `@lloyal-labs/lloyal-agents` | FSL-1.1-Apache-2.0 | Runtime framework |
217
+ | `@lloyal-labs/lloyal-sdk` | FSL-1.1-Apache-2.0 | Runtime framework |
218
+ | `@lloyal-labs/rig` | FSL-1.1-Apache-2.0 | Runtime framework — holds the App protocol |
219
+ | `@lloyal-labs/corpus`, `@lloyal-labs/web` | FSL-1.1-Apache-2.0 | Reference Apps shipped in-tree |
220
+ | **`@lloyal-labs/harness-cli` (the `harness.dev` CLI)** | **Apache 2.0** | Scaffolder — unrestricted for scaffolding new harnesses and Apps |
221
+ | **`hdk-create-app`** (when shipped) | **Apache 2.0** | Scaffolder — same as above |
222
+ | `llama.cpp` (vendored dependency) | MIT (unchanged) | External upstream library; we don't relicense their code |
223
+
224
+ ## Can I contribute to HDK?
225
+
226
+ **Yes.** Contributions are welcome under the same FSL license terms. If you
227
+ submit a PR, you're granting Lloyal Labs the right to distribute your
228
+ contribution under FSL-1.1-Apache-2.0 (and automatically under Apache 2.0
229
+ two years after each release that includes it). The CONTRIBUTING file in
230
+ each repo has the details.
231
+
232
+ ## I have a use case that's borderline — who do I ask?
233
+
234
+ Email [legal@lloyal.ai](mailto:legal@lloyal.ai) (or open a discussion in the repo). The runtime
235
+ team will help you confirm whether your use case falls under Permitted
236
+ Purpose or Competing Use. We'd rather give you a quick yes than have you
237
+ worry about it.
238
+
239
+ ## Further reading
240
+
241
+ - [FSL official site](https://fsl.software) — Sentry's canonical FSL
242
+ resources and FAQ
243
+ - [Fair Source](https://fair.io) — the category FSL belongs to
244
+ - [The FSL template, instantiated for each repo](./fsl-template)
245
+ - [Why we chose FSL over BSL, Apache, or a custom license](./why-fsl)
246
+
247
+ ## Is there a safe harbor for building products with the HDK?
248
+
249
+ Yes. The [Lloyal Harness Builder Grant](https://github.com/lloyal-ai/hdk/blob/main/GRANT.md)
250
+ irrevocably guarantees that building, selling, and hosting Harnesses and Apps
251
+ is a Permitted Purpose and never a Competing Use — even products that compete
252
+ head-on with Lloyal's own (including reasoning.run). Only three uses remain
253
+ restricted: offering the HDK itself as a developer framework, hosting the HDK
254
+ as-a-service for third-party developers, and operating a general-purpose App
255
+ distribution channel. Private/internal App distribution and your Harness's
256
+ own plugin system are explicitly permitted.
package/README.md CHANGED
@@ -27,11 +27,20 @@ import {
27
27
  useAgentPool, // lower-level Effection resource (advanced)
28
28
  diverge, // multi-branch perplexity selection
29
29
  parallel, chain, fanout, dag, reduce, // orchestrators / combinators
30
- withSharedRoot, // scoped shared KV prefix with guaranteed teardown
31
- createToolkit, // tool registry from Tool[] → toolMap + toolsJson
30
+ withSpine, // scoped spine branch with guaranteed teardown
32
31
  Tool, Source,
33
32
  DefaultAgentPolicy,
34
33
  Ctx, Store, Events,
34
+ // App protocol primitives — types + contexts the registry + agent pool
35
+ // pick up. Construction lives in `@lloyal-labs/rig` (`defineApp`,
36
+ // `createAppRegistry`).
37
+ AppRegistryCtx, AppConfigStoreCtx, GrantStoreCtx, RerankerCtx,
38
+ } from "@lloyal-labs/lloyal-agents";
39
+
40
+ import type {
41
+ App, AppManifest, AppProtocol, AppFactory, AppState,
42
+ AgentRenderCtx, SkillTemplateFn,
43
+ AppConfigStore, GrantStore,
35
44
  } from "@lloyal-labs/lloyal-agents";
36
45
  ```
37
46
 
@@ -66,11 +75,11 @@ When agents fork from a common branch, they inherit its KV cache — the full at
66
75
  Everything before the frontier is shared context. Everything after is independent reasoning. The model doesn't need to be told what the other agents know — it already attended over the same prefix. Communication happened at prefill time, through the attention mechanism, with zero serialization overhead.
67
76
 
68
77
  ```typescript
69
- yield* withSharedRoot(
70
- { systemPrompt: SKILL_CATALOG, toolsJson: toolkit.toolsJson },
71
- function* (root) {
72
- // root is a prefilled branch — system prompt + tool schemas already in KV.
73
- // Every agent forked from root shares that prefix.
78
+ yield* withSpine(
79
+ { systemPrompt: PLAYBOOKS, tools },
80
+ function* (spine) {
81
+ // spine is a prefilled branch — system prompt + tool schemas already in KV.
82
+ // Every agent forked from spine shares that prefix.
74
83
  return yield* agentPool({
75
84
  orchestrate: parallel(
76
85
  questions.map((q) => ({
@@ -79,21 +88,21 @@ yield* withSharedRoot(
79
88
  })),
80
89
  ),
81
90
  tools: [...sourceTools, reportTool],
82
- parent: root,
91
+ parent: spine,
83
92
  terminalTool: "report",
84
93
  });
85
94
  },
86
95
  );
87
96
  ```
88
97
 
89
- `withSharedRoot` creates the prefix, passes it to the body, and guarantees cleanup via `try/finally` — the root branch cannot leak out of the block. Effection enforces the lifetime.
98
+ `withSpine` creates the spine branch, passes it to the body, and guarantees cleanup via `try/finally` — the spine cannot leak out of the block. Effection enforces the lifetime.
90
99
 
91
100
  ## Orchestrators
92
101
 
93
102
  `agentPool` accepts an orchestrator that determines how agents are spawned and sequenced:
94
103
 
95
- - **`parallel(specs[])`** — agents run concurrently from the shared root.
96
- - **`chain(specs[], factory)`** — sequential, with `extendRoot` writing each task's findings onto the spine before the next forks.
104
+ - **`parallel(specs[])`** — agents run concurrently from the shared spine.
105
+ - **`chain(specs[], factory)`** — sequential, with `extendSpine` writing each task's findings onto the spine before the next forks.
97
106
  - **`fanout(landscapeSpec, domainSpecs[])`** — landscape pass that informs N parallel domain agents.
98
107
  - **`dag(nodes[])`** — arbitrary acyclic graph with multi-parent edges (Task-as-Future pattern).
99
108
 
@@ -103,7 +112,7 @@ Same `agentPool` call shape; the orchestrator argument changes the topology.
103
112
 
104
113
  All active agents advance together in a five-phase tick loop:
105
114
 
106
- **SPAWN+EXTEND.** The rendezvous point with the orchestrator fiber. Pending agent spawns and `extendRoot` calls are queued via Effection `action()` and drained at the start of each tick — batched into a single `store.prefill()`. Single-fiber discipline preserved across concurrent orchestrator extends.
115
+ **SPAWN+EXTEND.** The rendezvous point with the orchestrator fiber. Pending agent spawns and `extendSpine` calls are queued via Effection `action()` and drained at the start of each tick — batched into a single `store.prefill()`. Single-fiber discipline preserved across concurrent orchestrator extends.
107
116
 
108
117
  **PRODUCE.** Every generating agent calls `produceSync()` — synchronous sampling with no async gap between agents. The entire produce phase is a single uninterrupted pass over the active set.
109
118
 
@@ -217,7 +226,7 @@ class SearchTool extends Tool<{ query: string }> {
217
226
  }
218
227
  ```
219
228
 
220
- `createToolkit(tools)` aggregates tools into a `{ toolMap, toolsJson }` pair `toolMap` for runtime dispatch, `toolsJson` for prompt formatting. With `withSharedRoot({ systemPrompt, toolsJson })`, the schemas are decoded once at the root and inherited by every fork — see the [skill catalog](https://docs.lloyal.ai/reference/skill-catalog) convention for mixed-role pools.
229
+ Pass the same `Tool[]` to `withSpine({ systemPrompt, tools })` and to `agentPool({ tools })`: the spine decodes the tool schemas into KV once at setup, and the pool's dispatcher registers the same instances for runtime `execute()`. Two roles, one input — see the [playbooks](https://hdk.lloyal.ai/reference/playbooks) convention for mixed-role pools. (Advanced: `createToolkit(tools)` is still exported if you need direct access to the `{ toolMap, toolsJson }` pair, e.g. for the low-level `useAgentPool` primitive.)
221
230
 
222
231
  ## Events
223
232
 
@@ -230,13 +239,20 @@ The runtime emits structured events for TUI, logging, or telemetry:
230
239
  | `agent:tool_call` | `agentId`, `tool`, `args` |
231
240
  | `agent:tool_result` | `agentId`, `tool`, `result` |
232
241
  | `agent:tool_progress` | `agentId`, `tool`, `filled`, `total` |
233
- | `agent:report` | `agentId`, `findings` |
242
+ | `agent:return` | `agentId`, `result` — voluntary completion via terminal tool |
243
+ | `agent:recovered` | `agentId`, `result` — recovery extracted findings from killed agent |
234
244
  | `agent:done` | `agentId` |
235
245
 
246
+ ## App protocol
247
+
248
+ `lloyal-agents` ships the App protocol primitives — types ({@link App}, {@link AppManifest}, {@link AppProtocol}, {@link AppRegistry}), contexts (`AppRegistryCtx`, `AppConfigStoreCtx`, `GrantStoreCtx`, `RerankerCtx`), and the `Tool.protected` flag + authGuard hook in the agent policy. Construction primitives — `defineApp`, `createAppRegistry`, `createInMemoryConfigStore`, `createGrantStore`, `renderSpine`, `renderAgentPreamble` — live in [`@lloyal-labs/rig`](../rig). Reference Apps (`@lloyal-labs/web-app`, `@lloyal-labs/corpus-app`, `@lloyal-labs/wikipedia-app`) consume both.
249
+
250
+ Scaffold an App with `npx harness.dev app <name>`; install one with `npx harness.dev install <publisher>/<name>`.
251
+
236
252
  ## Documentation
237
253
 
238
254
  Full positioning, mechanics, learn pages, and reference at [docs.lloyal.ai](https://docs.lloyal.ai).
239
255
 
240
256
  ## License
241
257
 
242
- Apache-2.0
258
+ See [LICENSE](./LICENSE) (Functional Source License 1.1 — Apache 2.0 Future License) and the [licensing FAQ](./LICENSE-FAQ.md).
package/dist/Agent.d.ts CHANGED
@@ -6,7 +6,7 @@ import type { TraceToken } from './types';
6
6
  * Agent status — domain language for where the agent is in its lifecycle.
7
7
  *
8
8
  * - `idle`: created but not yet generating, OR finished but branch still
9
- * alive (extraction window for scratchpad)
9
+ * alive (extraction window for recovery)
10
10
  * - `active`: generating tokens (between PRODUCE start and stop token)
11
11
  * - `awaiting_tool`: tool call parsed, waiting for result in SETTLE
12
12
  * - `disposed`: branch pruned, agent no longer usable
@@ -19,7 +19,7 @@ export type AgentStatus = 'idle' | 'active' | 'awaiting_tool' | 'disposed';
19
19
  *
20
20
  * @category Agents
21
21
  */
22
- export type ResultSource = 'report_tool' | 'free_text' | 'scratchpad' | 'nudge' | 'tool_error';
22
+ export type ResultSource = 'voluntary_return' | 'free_text' | 'recovery' | 'nudge' | 'tool_error';
23
23
  /**
24
24
  * Immutable prompt format configuration set at agent creation.
25
25
  * Derived from `formatChatSync()` output.
@@ -91,6 +91,15 @@ export declare class Agent {
91
91
  readonly fmt: FormatConfig;
92
92
  /** The task text this agent was assigned — used by echo detection guard */
93
93
  readonly task: string;
94
+ /**
95
+ * Optional non-enforcing label naming the App a spawn nominally belongs
96
+ * to (`SpawnSpec.assignedApp`), or `null` for harness-internal spawns.
97
+ * Purely informational since the authGuard moved the security boundary
98
+ * into the tool: tool access is gated by {@link Tool.protected}
99
+ * + session grants, not by app membership. Carried so trace events
100
+ * (`tool:authReject`) and harness UI can attribute work to an app.
101
+ */
102
+ readonly assignedApp: string | null;
94
103
  private _status;
95
104
  private _statusSignal;
96
105
  private _startedAt;
@@ -115,6 +124,8 @@ export declare class Agent {
115
124
  fmt: FormatConfig;
116
125
  parent?: Agent | null;
117
126
  task?: string;
127
+ /** Optional non-enforcing app label — see {@link assignedApp}. */
128
+ assignedApp?: string | null;
118
129
  });
119
130
  get status(): AgentStatus;
120
131
  /**
@@ -194,8 +205,8 @@ export declare class Agent {
194
205
  walkAncestors<T>(fn: (agent: Agent) => readonly T[]): T[];
195
206
  get result(): string | null;
196
207
  get resultSource(): ResultSource | null;
197
- /** Set findings with provenance tracking — single write path */
198
- reportResult(content: string, source: ResultSource): void;
208
+ /** Set the agent's result with provenance tracking — single write path */
209
+ setResult(content: string, source: ResultSource): void;
199
210
  get position(): number;
200
211
  get forkHead(): number;
201
212
  /** Number of unique KV cells this agent owns above the fork point */
@@ -1 +1 @@
1
- {"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../src/Agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,GAAG,UAAU,CAAC;AAE3E;;;;GAIG;AACH,MAAM,MAAM,YAAY,GACpB,aAAa,GACb,WAAW,GACX,YAAY,GACZ,OAAO,GACP,YAAY,CAAC;AAIjB;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC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,QAAQ,IAAI,MAAM,CAAiC;IACvD,IAAI,QAAQ,IAAI,MAAM,CAAiC;IACvD,qEAAqE;IACrE,IAAI,WAAW,IAAI,MAAM,CAAwD;IAEjF,uEAAuE;IACvE,IAAI,qBAAqB,IAAI,OAAO,CAEnC;IAID;;;;;;;;;;OAUG;IACI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,qBAAqB,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IASvF,oEAAoE;IACpE,OAAO,IAAI,IAAI;CAIhB"}
package/dist/Agent.js CHANGED
@@ -32,6 +32,15 @@ class Agent {
32
32
  fmt;
33
33
  /** The task text this agent was assigned — used by echo detection guard */
34
34
  task;
35
+ /**
36
+ * Optional non-enforcing label naming the App a spawn nominally belongs
37
+ * to (`SpawnSpec.assignedApp`), or `null` for harness-internal spawns.
38
+ * Purely informational since the authGuard moved the security boundary
39
+ * into the tool: tool access is gated by {@link Tool.protected}
40
+ * + session grants, not by app membership. Carried so trace events
41
+ * (`tool:authReject`) and harness UI can attribute work to an app.
42
+ */
43
+ assignedApp;
35
44
  // ── Mutable state ───────────────────────────────────────
36
45
  _status = 'idle';
37
46
  _statusSignal = (0, effection_1.createSignal)();
@@ -58,6 +67,7 @@ class Agent {
58
67
  this.fmt = opts.fmt;
59
68
  this.task = opts.task ?? '';
60
69
  this.parent = opts.parent ?? null;
70
+ this.assignedApp = opts.assignedApp ?? null;
61
71
  }
62
72
  // ── Status ──────────────────────────────────────────────
63
73
  get status() { return this._status; }
@@ -202,8 +212,8 @@ class Agent {
202
212
  // ── Findings ────────────────────────────────────────────
203
213
  get result() { return this._result; }
204
214
  get resultSource() { return this._resultSource; }
205
- /** Set findings with provenance tracking — single write path */
206
- reportResult(content, source) {
215
+ /** Set the agent's result with provenance tracking — single write path */
216
+ setResult(content, source) {
207
217
  this._result = content;
208
218
  this._resultSource = source;
209
219
  }
package/dist/Agent.js.map CHANGED
@@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