@lloyal-labs/rig 2.1.0 → 3.0.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.
Files changed (100) hide show
  1. package/LICENSE +107 -0
  2. package/LICENSE-FAQ.md +256 -0
  3. package/README.md +93 -74
  4. package/dist/bundle.d.ts +211 -0
  5. package/dist/bundle.d.ts.map +1 -0
  6. package/dist/bundle.js +296 -0
  7. package/dist/bundle.js.map +1 -0
  8. package/dist/cancellable-fetch.d.ts +98 -0
  9. package/dist/cancellable-fetch.d.ts.map +1 -0
  10. package/dist/cancellable-fetch.js +133 -0
  11. package/dist/cancellable-fetch.js.map +1 -0
  12. package/dist/config-store.d.ts +30 -0
  13. package/dist/config-store.d.ts.map +1 -0
  14. package/dist/config-store.js +45 -0
  15. package/dist/config-store.js.map +1 -0
  16. package/dist/define-app.d.ts +98 -0
  17. package/dist/define-app.d.ts.map +1 -0
  18. package/dist/define-app.js +232 -0
  19. package/dist/define-app.js.map +1 -0
  20. package/dist/grant-store.d.ts +31 -0
  21. package/dist/grant-store.d.ts.map +1 -0
  22. package/dist/grant-store.js +49 -0
  23. package/dist/grant-store.js.map +1 -0
  24. package/dist/index.d.ts +13 -6
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +37 -11
  27. package/dist/index.js.map +1 -1
  28. package/dist/node.d.ts +3 -2
  29. package/dist/node.d.ts.map +1 -1
  30. package/dist/node.js +3 -2
  31. package/dist/node.js.map +1 -1
  32. package/dist/protocol.d.ts +155 -0
  33. package/dist/protocol.d.ts.map +1 -0
  34. package/dist/protocol.js +184 -0
  35. package/dist/protocol.js.map +1 -0
  36. package/dist/registry.d.ts +87 -0
  37. package/dist/registry.d.ts.map +1 -0
  38. package/dist/registry.js +245 -0
  39. package/dist/registry.js.map +1 -0
  40. package/dist/reranker.d.ts +25 -7
  41. package/dist/reranker.d.ts.map +1 -1
  42. package/dist/reranker.js +103 -63
  43. package/dist/reranker.js.map +1 -1
  44. package/dist/resources/types.d.ts +10 -37
  45. package/dist/resources/types.d.ts.map +1 -1
  46. package/dist/resources/types.js +12 -0
  47. package/dist/resources/types.js.map +1 -1
  48. package/dist/spine-render.d.ts +97 -0
  49. package/dist/spine-render.d.ts.map +1 -0
  50. package/dist/spine-render.js +121 -0
  51. package/dist/spine-render.js.map +1 -0
  52. package/dist/tools/index.d.ts +26 -22
  53. package/dist/tools/index.d.ts.map +1 -1
  54. package/dist/tools/index.js +24 -28
  55. package/dist/tools/index.js.map +1 -1
  56. package/dist/tools/keyless-search.d.ts +67 -0
  57. package/dist/tools/keyless-search.d.ts.map +1 -0
  58. package/dist/tools/keyless-search.js +401 -0
  59. package/dist/tools/keyless-search.js.map +1 -0
  60. package/dist/tools/plan.d.ts +31 -4
  61. package/dist/tools/plan.d.ts.map +1 -1
  62. package/dist/tools/plan.js +46 -11
  63. package/dist/tools/plan.js.map +1 -1
  64. package/dist/tools/types.d.ts +12 -56
  65. package/dist/tools/types.d.ts.map +1 -1
  66. package/dist/tools/types.js +17 -0
  67. package/dist/tools/types.js.map +1 -1
  68. package/dist/tools/web-search.d.ts +9 -25
  69. package/dist/tools/web-search.d.ts.map +1 -1
  70. package/dist/tools/web-search.js +11 -119
  71. package/dist/tools/web-search.js.map +1 -1
  72. package/package.json +10 -7
  73. package/dist/sources/corpus.d.ts +0 -80
  74. package/dist/sources/corpus.d.ts.map +0 -1
  75. package/dist/sources/corpus.js +0 -100
  76. package/dist/sources/corpus.js.map +0 -1
  77. package/dist/sources/index.d.ts +0 -12
  78. package/dist/sources/index.d.ts.map +0 -1
  79. package/dist/sources/index.js +0 -14
  80. package/dist/sources/index.js.map +0 -1
  81. package/dist/sources/web.d.ts +0 -67
  82. package/dist/sources/web.d.ts.map +0 -1
  83. package/dist/sources/web.js +0 -104
  84. package/dist/sources/web.js.map +0 -1
  85. package/dist/tools/fetch-page.d.ts +0 -48
  86. package/dist/tools/fetch-page.d.ts.map +0 -1
  87. package/dist/tools/fetch-page.js +0 -309
  88. package/dist/tools/fetch-page.js.map +0 -1
  89. package/dist/tools/grep.d.ts +0 -35
  90. package/dist/tools/grep.d.ts.map +0 -1
  91. package/dist/tools/grep.js +0 -84
  92. package/dist/tools/grep.js.map +0 -1
  93. package/dist/tools/read-file.d.ts +0 -74
  94. package/dist/tools/read-file.d.ts.map +0 -1
  95. package/dist/tools/read-file.js +0 -192
  96. package/dist/tools/read-file.js.map +0 -1
  97. package/dist/tools/search.d.ts +0 -34
  98. package/dist/tools/search.d.ts.map +0 -1
  99. package/dist/tools/search.js +0 -101
  100. package/dist/tools/search.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -10,14 +10,21 @@
10
10
  * @packageDocumentation
11
11
  * @category Rig
12
12
  */
13
- export { createTools, reportTool, ReportTool, WebSearchTool, TavilyProvider, FetchPageTool, DelegateTool, PlanTool, taskToContent, } from './tools';
14
- export type { DelegateToolOpts, PlanToolOpts, PlanResult, PlanIntent, ResearchTask, SearchProvider, SearchResult, Reranker, ScoredChunk, ScoredResult, } from './tools';
15
- export { WebSource } from './sources/web';
16
- export type { WebSourceOpts } from './sources/web';
17
- export { CorpusSource } from './sources/corpus';
18
- export type { CorpusSourceOpts, CorpusPromptData } from './sources/corpus';
13
+ export { reportTool, ReportTool, TavilyProvider, createKeylessSearchProvider, DelegateTool, PlanTool, taskToContent, } from './tools';
14
+ export type { DelegateToolOpts, KeylessSearchOptions, PlanToolOpts, PlanResult, PlanIntent, ResearchTask, SearchProvider, SearchResult, Reranker, ScoredChunk, ScoredResult, } from './tools';
19
15
  export type { SourceContext } from './sources/types';
20
16
  export { chunkFetchedPages, chunkHtml } from './sources/chunking';
21
17
  export type { FetchedPage } from './sources/chunking';
22
18
  export type { Resource, Chunk } from './resources/types';
19
+ export { BOUNDARY_MARKER, FRAMEWORK_INTRO, TOOL_SELECTION_RULE, CATALOG_ENTRY, VALIDATED_MODELS_3_0, APP_PROTOCOL_VERSION, SUPPORTED_APP_PROTOCOL_VERSIONS, CHANNEL_CATALOG_URL, CHANNEL_TRUST_ROOTS, } from './protocol';
20
+ export { defineApp } from './define-app';
21
+ export { cancellableFetch, FetchTimeoutError } from './cancellable-fetch';
22
+ export { createInMemoryConfigStore } from './config-store';
23
+ export { createGrantStore } from './grant-store';
24
+ export { createAppRegistry } from './registry';
25
+ export type { CreateAppRegistryOpts } from './registry';
26
+ export { verifyBundle, resolveAppEntry, BundleVerificationError, AppNotFoundError, } from './bundle';
27
+ export type { AppBundleManifest, CatalogEntry, CatalogVersion, SignedCatalog } from './bundle';
28
+ export { renderSpine, renderAgentPreamble } from './spine-render';
29
+ export type { RenderSpineOptions } from './spine-render';
23
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EACL,WAAW,EAAE,UAAU,EAAE,UAAU,EACnC,aAAa,EAAE,cAAc,EAAE,aAAa,EAC5C,YAAY,EACZ,QAAQ,EAAE,aAAa,GACxB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,UAAU,EAAE,UAAU,EAAE,YAAY,EACpC,cAAc,EAAE,YAAY,EAC5B,QAAQ,EAAE,WAAW,EAAE,YAAY,GACpC,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EACL,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,2BAA2B,EAC3C,YAAY,EACZ,QAAQ,EAAE,aAAa,GACxB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,UAAU,EAAE,UAAU,EAAE,YAAY,EACpC,cAAc,EAAE,YAAY,EAC5B,QAAQ,EAAE,WAAW,EAAE,YAAY,GACpC,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,EACL,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,+BAA+B,EAC/B,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EACL,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -12,25 +12,51 @@
12
12
  * @category Rig
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.chunkHtml = exports.chunkFetchedPages = exports.CorpusSource = exports.WebSource = exports.taskToContent = exports.PlanTool = exports.DelegateTool = exports.FetchPageTool = exports.TavilyProvider = exports.WebSearchTool = exports.ReportTool = exports.reportTool = exports.createTools = void 0;
16
- // Tools (pure TS + Effection + linkedom — platform-agnostic)
15
+ exports.renderAgentPreamble = exports.renderSpine = exports.AppNotFoundError = exports.BundleVerificationError = exports.resolveAppEntry = exports.verifyBundle = exports.createAppRegistry = exports.createGrantStore = exports.createInMemoryConfigStore = exports.FetchTimeoutError = exports.cancellableFetch = exports.defineApp = exports.CHANNEL_TRUST_ROOTS = exports.CHANNEL_CATALOG_URL = exports.SUPPORTED_APP_PROTOCOL_VERSIONS = exports.APP_PROTOCOL_VERSION = exports.VALIDATED_MODELS_3_0 = exports.CATALOG_ENTRY = exports.TOOL_SELECTION_RULE = exports.FRAMEWORK_INTRO = exports.BOUNDARY_MARKER = exports.chunkHtml = exports.chunkFetchedPages = exports.taskToContent = exports.PlanTool = exports.DelegateTool = exports.createKeylessSearchProvider = exports.TavilyProvider = exports.ReportTool = exports.reportTool = void 0;
16
+ // Framework tools (consumed by harnesses) + search providers (consumed by
17
+ // apps' Source implementations). App-scoped Tool classes live in their
18
+ // owning app (`@lloyal-labs/{web,corpus,wikipedia}-app`).
17
19
  var tools_1 = require("./tools");
18
- Object.defineProperty(exports, "createTools", { enumerable: true, get: function () { return tools_1.createTools; } });
19
20
  Object.defineProperty(exports, "reportTool", { enumerable: true, get: function () { return tools_1.reportTool; } });
20
21
  Object.defineProperty(exports, "ReportTool", { enumerable: true, get: function () { return tools_1.ReportTool; } });
21
- Object.defineProperty(exports, "WebSearchTool", { enumerable: true, get: function () { return tools_1.WebSearchTool; } });
22
22
  Object.defineProperty(exports, "TavilyProvider", { enumerable: true, get: function () { return tools_1.TavilyProvider; } });
23
- Object.defineProperty(exports, "FetchPageTool", { enumerable: true, get: function () { return tools_1.FetchPageTool; } });
23
+ Object.defineProperty(exports, "createKeylessSearchProvider", { enumerable: true, get: function () { return tools_1.createKeylessSearchProvider; } });
24
24
  Object.defineProperty(exports, "DelegateTool", { enumerable: true, get: function () { return tools_1.DelegateTool; } });
25
25
  Object.defineProperty(exports, "PlanTool", { enumerable: true, get: function () { return tools_1.PlanTool; } });
26
26
  Object.defineProperty(exports, "taskToContent", { enumerable: true, get: function () { return tools_1.taskToContent; } });
27
- // Sources (platform-agnostic — no node:fs)
28
- var web_1 = require("./sources/web");
29
- Object.defineProperty(exports, "WebSource", { enumerable: true, get: function () { return web_1.WebSource; } });
30
- var corpus_1 = require("./sources/corpus");
31
- Object.defineProperty(exports, "CorpusSource", { enumerable: true, get: function () { return corpus_1.CorpusSource; } });
32
- // Chunking (platform-agnostic — linkedom is pure JS)
27
+ // Chunking helpers (platform-agnostic — linkedom is pure JS).
28
+ // Shared by the web app's source and the rig-resident fetch_page tool.
33
29
  var chunking_1 = require("./sources/chunking");
34
30
  Object.defineProperty(exports, "chunkFetchedPages", { enumerable: true, get: function () { return chunking_1.chunkFetchedPages; } });
35
31
  Object.defineProperty(exports, "chunkHtml", { enumerable: true, get: function () { return chunking_1.chunkHtml; } });
32
+ // HDK 3.0 App Protocol surfaces
33
+ var protocol_1 = require("./protocol");
34
+ Object.defineProperty(exports, "BOUNDARY_MARKER", { enumerable: true, get: function () { return protocol_1.BOUNDARY_MARKER; } });
35
+ Object.defineProperty(exports, "FRAMEWORK_INTRO", { enumerable: true, get: function () { return protocol_1.FRAMEWORK_INTRO; } });
36
+ Object.defineProperty(exports, "TOOL_SELECTION_RULE", { enumerable: true, get: function () { return protocol_1.TOOL_SELECTION_RULE; } });
37
+ Object.defineProperty(exports, "CATALOG_ENTRY", { enumerable: true, get: function () { return protocol_1.CATALOG_ENTRY; } });
38
+ Object.defineProperty(exports, "VALIDATED_MODELS_3_0", { enumerable: true, get: function () { return protocol_1.VALIDATED_MODELS_3_0; } });
39
+ Object.defineProperty(exports, "APP_PROTOCOL_VERSION", { enumerable: true, get: function () { return protocol_1.APP_PROTOCOL_VERSION; } });
40
+ Object.defineProperty(exports, "SUPPORTED_APP_PROTOCOL_VERSIONS", { enumerable: true, get: function () { return protocol_1.SUPPORTED_APP_PROTOCOL_VERSIONS; } });
41
+ Object.defineProperty(exports, "CHANNEL_CATALOG_URL", { enumerable: true, get: function () { return protocol_1.CHANNEL_CATALOG_URL; } });
42
+ Object.defineProperty(exports, "CHANNEL_TRUST_ROOTS", { enumerable: true, get: function () { return protocol_1.CHANNEL_TRUST_ROOTS; } });
43
+ var define_app_1 = require("./define-app");
44
+ Object.defineProperty(exports, "defineApp", { enumerable: true, get: function () { return define_app_1.defineApp; } });
45
+ var cancellable_fetch_1 = require("./cancellable-fetch");
46
+ Object.defineProperty(exports, "cancellableFetch", { enumerable: true, get: function () { return cancellable_fetch_1.cancellableFetch; } });
47
+ Object.defineProperty(exports, "FetchTimeoutError", { enumerable: true, get: function () { return cancellable_fetch_1.FetchTimeoutError; } });
48
+ var config_store_1 = require("./config-store");
49
+ Object.defineProperty(exports, "createInMemoryConfigStore", { enumerable: true, get: function () { return config_store_1.createInMemoryConfigStore; } });
50
+ var grant_store_1 = require("./grant-store");
51
+ Object.defineProperty(exports, "createGrantStore", { enumerable: true, get: function () { return grant_store_1.createGrantStore; } });
52
+ var registry_1 = require("./registry");
53
+ Object.defineProperty(exports, "createAppRegistry", { enumerable: true, get: function () { return registry_1.createAppRegistry; } });
54
+ var bundle_1 = require("./bundle");
55
+ Object.defineProperty(exports, "verifyBundle", { enumerable: true, get: function () { return bundle_1.verifyBundle; } });
56
+ Object.defineProperty(exports, "resolveAppEntry", { enumerable: true, get: function () { return bundle_1.resolveAppEntry; } });
57
+ Object.defineProperty(exports, "BundleVerificationError", { enumerable: true, get: function () { return bundle_1.BundleVerificationError; } });
58
+ Object.defineProperty(exports, "AppNotFoundError", { enumerable: true, get: function () { return bundle_1.AppNotFoundError; } });
59
+ var spine_render_1 = require("./spine-render");
60
+ Object.defineProperty(exports, "renderSpine", { enumerable: true, get: function () { return spine_render_1.renderSpine; } });
61
+ Object.defineProperty(exports, "renderAgentPreamble", { enumerable: true, get: function () { return spine_render_1.renderAgentPreamble; } });
36
62
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,6DAA6D;AAC7D,iCAKiB;AAJf,oGAAA,WAAW,OAAA;AAAE,mGAAA,UAAU,OAAA;AAAE,mGAAA,UAAU,OAAA;AACnC,sGAAA,aAAa,OAAA;AAAE,uGAAA,cAAc,OAAA;AAAE,sGAAA,aAAa,OAAA;AAC5C,qGAAA,YAAY,OAAA;AACZ,iGAAA,QAAQ,OAAA;AAAE,sGAAA,aAAa,OAAA;AAUzB,2CAA2C;AAC3C,qCAA0C;AAAjC,gGAAA,SAAS,OAAA;AAElB,2CAAgD;AAAvC,sGAAA,YAAY,OAAA;AAIrB,qDAAqD;AACrD,+CAAkE;AAAzD,6GAAA,iBAAiB,OAAA;AAAE,qGAAA,SAAS,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,0EAA0E;AAC1E,uEAAuE;AACvE,0DAA0D;AAC1D,iCAKiB;AAJf,mGAAA,UAAU,OAAA;AAAE,mGAAA,UAAU,OAAA;AACtB,uGAAA,cAAc,OAAA;AAAE,oHAAA,2BAA2B,OAAA;AAC3C,qGAAA,YAAY,OAAA;AACZ,iGAAA,QAAQ,OAAA;AAAE,sGAAA,aAAa,OAAA;AAczB,8DAA8D;AAC9D,uEAAuE;AACvE,+CAAkE;AAAzD,6GAAA,iBAAiB,OAAA;AAAE,qGAAA,SAAS,OAAA;AAMrC,gCAAgC;AAChC,uCAUoB;AATlB,2GAAA,eAAe,OAAA;AACf,2GAAA,eAAe,OAAA;AACf,+GAAA,mBAAmB,OAAA;AACnB,yGAAA,aAAa,OAAA;AACb,gHAAA,oBAAoB,OAAA;AACpB,gHAAA,oBAAoB,OAAA;AACpB,2HAAA,+BAA+B,OAAA;AAC/B,+GAAA,mBAAmB,OAAA;AACnB,+GAAA,mBAAmB,OAAA;AAErB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,yDAA0E;AAAjE,qHAAA,gBAAgB,OAAA;AAAE,sHAAA,iBAAiB,OAAA;AAC5C,+CAA2D;AAAlD,yHAAA,yBAAyB,OAAA;AAClC,6CAAiD;AAAxC,+GAAA,gBAAgB,OAAA;AACzB,uCAA+C;AAAtC,6GAAA,iBAAiB,OAAA;AAE1B,mCAKkB;AAJhB,sGAAA,YAAY,OAAA;AACZ,yGAAA,eAAe,OAAA;AACf,iHAAA,uBAAuB,OAAA;AACvB,0GAAA,gBAAgB,OAAA;AAGlB,+CAAkE;AAAzD,2GAAA,WAAW,OAAA;AAAE,mHAAA,mBAAmB,OAAA"}
package/dist/node.d.ts CHANGED
@@ -4,8 +4,9 @@
4
4
  * These require node:fs and/or @lloyal-labs/lloyal.node.
5
5
  * Import from `@lloyal-labs/rig/node` only in Node.js environments.
6
6
  *
7
- * Sources (WebSource, CorpusSource) are now platform-agnostic and
8
- * exported from the main `@lloyal-labs/rig` entry.
7
+ * Per-source bundles (web, corpus) live in their own packages
8
+ * (`@lloyal-labs/web-app`, `@lloyal-labs/corpus-app`); rig now owns
9
+ * only cross-app primitives (chunking, types, tools, reranker).
9
10
  *
10
11
  * @packageDocumentation
11
12
  * @category Rig
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC"}
package/dist/node.js CHANGED
@@ -5,8 +5,9 @@
5
5
  * These require node:fs and/or @lloyal-labs/lloyal.node.
6
6
  * Import from `@lloyal-labs/rig/node` only in Node.js environments.
7
7
  *
8
- * Sources (WebSource, CorpusSource) are now platform-agnostic and
9
- * exported from the main `@lloyal-labs/rig` entry.
8
+ * Per-source bundles (web, corpus) live in their own packages
9
+ * (`@lloyal-labs/web-app`, `@lloyal-labs/corpus-app`); rig now owns
10
+ * only cross-app primitives (chunking, types, tools, reranker).
10
11
  *
11
12
  * @packageDocumentation
12
13
  * @category Rig
package/dist/node.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;AAEH,yDAAyD;AACzD,0CAAwB;AAExB,kEAAkE;AAClE,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AAEvB,iDAAiD;AACjD,yCAAgF;AAAvE,0GAAA,aAAa,OAAA;AAAE,2GAAA,cAAc,OAAA;AAAE,+GAAA,kBAAkB,OAAA"}
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;AAEH,yDAAyD;AACzD,0CAAwB;AAExB,kEAAkE;AAClE,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AAEvB,iDAAiD;AACjD,yCAAgF;AAAvE,0GAAA,aAAa,OAAA;AAAE,2GAAA,cAAc,OAAA;AAAE,+GAAA,kBAAkB,OAAA"}
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Codified App-protocol constants — the bytes-locked strings the model
3
+ * sees in every spawn's prompt and in every pool's shared spine prefix.
4
+ *
5
+ * These five exports are the entire shape of the HDK 3.0 App protocol.
6
+ * Every byte the model encounters in framework-controlled prompt content
7
+ * traces back to one of these constants (or to grammar-sanitized
8
+ * `app.json` metadata interpolated through them).
9
+ *
10
+ * Lifted verbatim from production (`reasoning.run/src/prompts/playbooks.eta`,
11
+ * `web-worker.eta`, `corpus-worker.eta`) with one substitution at the
12
+ * noun position — see the Architectural reference section
13
+ * for the rationale.
14
+ *
15
+ * **Do not duplicate these literals anywhere else.** `renderSpine` and
16
+ * `renderAgentPreamble` reference these constants by name. Changing the
17
+ * codified protocol is one edit here plus a trace-gate re-run; the
18
+ * framework's internal call graph does not need touching.
19
+ *
20
+ * @packageDocumentation
21
+ * @category Protocol
22
+ */
23
+ /**
24
+ * Boundary marker prepended to every per-spawn user-role message.
25
+ *
26
+ * Exact rendered shape: `Apply the **<name>** protocol.\n\n`
27
+ * (marker line + blank line). The `<name>` comes from
28
+ * `app.manifest.protocol.name`, grammar-sanitized to
29
+ * `[a-z][a-z0-9_-]{1,63}` at `defineApp` time so it cannot break
30
+ * the markdown bold or inject newlines.
31
+ *
32
+ * Framework-prepended by `renderAgentPreamble`. App `skill.eta` source
33
+ * MUST NOT contain the literal `Apply the **` substring — `defineApp`
34
+ * rejects sources that do.
35
+ */
36
+ export declare const BOUNDARY_MARKER: (name: string) => string;
37
+ /**
38
+ * Framework intro paragraph emitted at the start of every spine.
39
+ *
40
+ * Verbatim from `reasoning.run/src/prompts/playbooks.eta:1`, with the noun
41
+ * substituted (three occurrences inside the sentence). Followed at render
42
+ * time by a blank line + `# Protocols` header + the per-app catalog
43
+ * entries.
44
+ */
45
+ export declare const FRAMEWORK_INTRO: string;
46
+ /**
47
+ * Tool-selection rule emitted after all per-app catalog entries.
48
+ *
49
+ * Verbatim from `reasoning.run/src/prompts/playbooks.eta:17-19` with the
50
+ * noun substituted and the trailing `palette` → `tools` (palette was
51
+ * retired from the framework vocabulary — see Architectural reference).
52
+ * This is the abstract invariant the model routes against; concrete
53
+ * cross-protocol BAD examples are NOT generated by the framework — the
54
+ * abstract rule + dispatch-time auth-guard carry the discipline.
55
+ */
56
+ export declare const TOOL_SELECTION_RULE: string;
57
+ /**
58
+ * Per-app catalog entry shape emitted under the `# Protocols` header.
59
+ *
60
+ * Exact rendered shape (three lines + trailing blank line):
61
+ * ```
62
+ * ## <name>
63
+ * Tools: <t1>, <t2>, ...
64
+ * Use when: <useWhen>
65
+ *
66
+ * ```
67
+ *
68
+ * `name` is grammar-sanitized at `defineApp` time. `tools` is the
69
+ * `protocol.tools` array joined with `, `. `useWhen` is grammar-constrained
70
+ * to a single sentence of printable characters with no chat-role markers,
71
+ * no markdown code fences, no newlines.
72
+ */
73
+ export declare const CATALOG_ENTRY: (name: string, tools: readonly string[], useWhen: string) => string;
74
+ /**
75
+ * Model family entry in {@link VALIDATED_MODELS_3_0}.
76
+ */
77
+ export interface ValidatedModelFamily {
78
+ /** Model family identifier (e.g., `'qwen3'`, `'llama-3'`). */
79
+ family: string;
80
+ /**
81
+ * Validated revisions of the family. `['*']` means all revisions of
82
+ * the family pass; specific revision strings (e.g., `['3.5']`) restrict
83
+ * to a subset.
84
+ */
85
+ revisions: readonly string[];
86
+ }
87
+ /**
88
+ * Model families against which the HDK 3.0 App protocol has been
89
+ * validated via production traces.
90
+ *
91
+ * Off-fleet models are unvalidated: the boundary marker, catalog format,
92
+ * and tool-selection rule have not been verified to elicit correct
93
+ * routing. Consumers running off-fleet models get best-effort routing —
94
+ * the protocol may degrade silently. The framework does not gate on the
95
+ * running model's family; HDK is model-agnostic by design.
96
+ *
97
+ * Extending the fleet for a new family requires re-running the
98
+ * verification gates against that family and updating this
99
+ * constant. `appProtocolVersion` does NOT bump for fleet expansion —
100
+ * only for changes to the marker, catalog format, or tool-selection
101
+ * rule that require re-validation across all listed families.
102
+ */
103
+ export declare const VALIDATED_MODELS_3_0: readonly ValidatedModelFamily[];
104
+ /**
105
+ * The App protocol version this build of `@lloyal-labs/rig` ships.
106
+ *
107
+ * Apps declare `appProtocolVersion` in `app.json`; `defineApp` and the
108
+ * registry (`createAppRegistry({ apps })` / `registry.enable`) refuse to
109
+ * enable apps whose declared version is not in
110
+ * {@link SUPPORTED_APP_PROTOCOL_VERSIONS}.
111
+ */
112
+ export declare const APP_PROTOCOL_VERSION = "3.0";
113
+ /**
114
+ * The set of App protocol versions this build of `@lloyal-labs/rig`
115
+ * accepts at app-registration time. Within rig 3.x the only valid value
116
+ * is `'3.0'`. A 4.0 protocol would require re-validation across every
117
+ * family in {@link VALIDATED_MODELS_3_0}. Framework semver (rig 3.0 →
118
+ * 3.1) does NOT bump the App protocol; that's the point of the separate
119
+ * version line.
120
+ */
121
+ export declare const SUPPORTED_APP_PROTOCOL_VERSIONS: readonly string[];
122
+ /**
123
+ * Canonical channel endpoint — `apps.lloyal.ai/v1/catalog.json`.
124
+ * Framework-vendored compile-time constant; the harness cannot override.
125
+ *
126
+ * The `harness.dev install` CLI uses {@link resolveAppEntry} to look up
127
+ * a name + semver range against this catalog, verifies the catalog's
128
+ * Ed25519 signature against {@link CHANNEL_TRUST_ROOTS}, then fetches +
129
+ * verifies the resolved manifest and tarball bytes before shelling out
130
+ * to `npm install <tarballUrl>`. The CLI never supplies a URL.
131
+ *
132
+ * To use a different channel, fork `@lloyal-labs/rig`, edit this constant
133
+ * (and {@link CHANNEL_TRUST_ROOTS}), and republish under a different name.
134
+ * The fork is a maintained source divergence; apps signed by the canonical
135
+ * trust roots will not load in the fork, and apps signed by the fork's
136
+ * trust roots will not load in unmodified upstream rig.
137
+ */
138
+ export declare const CHANNEL_CATALOG_URL = "https://apps.lloyal.ai/v1/catalog.json";
139
+ /**
140
+ * Framework-vendored trust roots — map from `publisherKeyId` (e.g.,
141
+ * `'lloyal-platform-2026-q2'`) to the corresponding Ed25519 raw public key
142
+ * bytes (32 bytes). The harness does NOT configure trust roots;
143
+ * {@link verifyBundle} consumers (notably the `harness.dev install` CLI)
144
+ * read this constant directly.
145
+ *
146
+ * Multi-entry from day 1 to support key rotation: a new key is added in a
147
+ * rig minor release while the previous key remains valid for N quarters,
148
+ * then is removed in a future major. Apps signed during the overlap window
149
+ * verify under either key.
150
+ *
151
+ * To use a different set, fork `@lloyal-labs/rig`, edit this constant (and
152
+ * {@link CHANNEL_CATALOG_URL}), and republish under a different name.
153
+ */
154
+ export declare const CHANNEL_TRUST_ROOTS: ReadonlyMap<string, Uint8Array>;
155
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,MACR,CAAC;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,QAImC,CAAC;AAEhE;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,QAM0C,CAAC;AAE3E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,GACxB,MAAM,MAAM,EACZ,OAAO,SAAS,MAAM,EAAE,EACxB,SAAS,MAAM,KACd,MAC+D,CAAC;AAInE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,oBAAoB,EAM/D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAE1C;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,EAAE,SAAS,MAAM,EAAY,CAAC;AAI1E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mBAAmB,2CACU,CAAC;AAuB3C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAI/D,CAAC"}
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ /**
3
+ * Codified App-protocol constants — the bytes-locked strings the model
4
+ * sees in every spawn's prompt and in every pool's shared spine prefix.
5
+ *
6
+ * These five exports are the entire shape of the HDK 3.0 App protocol.
7
+ * Every byte the model encounters in framework-controlled prompt content
8
+ * traces back to one of these constants (or to grammar-sanitized
9
+ * `app.json` metadata interpolated through them).
10
+ *
11
+ * Lifted verbatim from production (`reasoning.run/src/prompts/playbooks.eta`,
12
+ * `web-worker.eta`, `corpus-worker.eta`) with one substitution at the
13
+ * noun position — see the Architectural reference section
14
+ * for the rationale.
15
+ *
16
+ * **Do not duplicate these literals anywhere else.** `renderSpine` and
17
+ * `renderAgentPreamble` reference these constants by name. Changing the
18
+ * codified protocol is one edit here plus a trace-gate re-run; the
19
+ * framework's internal call graph does not need touching.
20
+ *
21
+ * @packageDocumentation
22
+ * @category Protocol
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.CHANNEL_TRUST_ROOTS = exports.CHANNEL_CATALOG_URL = exports.SUPPORTED_APP_PROTOCOL_VERSIONS = exports.APP_PROTOCOL_VERSION = exports.VALIDATED_MODELS_3_0 = exports.CATALOG_ENTRY = exports.TOOL_SELECTION_RULE = exports.FRAMEWORK_INTRO = exports.BOUNDARY_MARKER = void 0;
26
+ /**
27
+ * Boundary marker prepended to every per-spawn user-role message.
28
+ *
29
+ * Exact rendered shape: `Apply the **<name>** protocol.\n\n`
30
+ * (marker line + blank line). The `<name>` comes from
31
+ * `app.manifest.protocol.name`, grammar-sanitized to
32
+ * `[a-z][a-z0-9_-]{1,63}` at `defineApp` time so it cannot break
33
+ * the markdown bold or inject newlines.
34
+ *
35
+ * Framework-prepended by `renderAgentPreamble`. App `skill.eta` source
36
+ * MUST NOT contain the literal `Apply the **` substring — `defineApp`
37
+ * rejects sources that do.
38
+ */
39
+ const BOUNDARY_MARKER = (name) => `Apply the **${name}** protocol.\n\n`;
40
+ exports.BOUNDARY_MARKER = BOUNDARY_MARKER;
41
+ /**
42
+ * Framework intro paragraph emitted at the start of every spine.
43
+ *
44
+ * Verbatim from `reasoning.run/src/prompts/playbooks.eta:1`, with the noun
45
+ * substituted (three occurrences inside the sentence). Followed at render
46
+ * time by a blank line + `# Protocols` header + the per-app catalog
47
+ * entries.
48
+ */
49
+ exports.FRAMEWORK_INTRO = 'You are an assistant working as part of a multi-agent workflow. ' +
50
+ 'You have access to the tools below, grouped by protocol. ' +
51
+ 'You should only use the tools for a given protocol when that particular ' +
52
+ 'protocol is requested explicitly in your task instructions.';
53
+ /**
54
+ * Tool-selection rule emitted after all per-app catalog entries.
55
+ *
56
+ * Verbatim from `reasoning.run/src/prompts/playbooks.eta:17-19` with the
57
+ * noun substituted and the trailing `palette` → `tools` (palette was
58
+ * retired from the framework vocabulary — see Architectural reference).
59
+ * This is the abstract invariant the model routes against; concrete
60
+ * cross-protocol BAD examples are NOT generated by the framework — the
61
+ * abstract rule + dispatch-time auth-guard carry the discipline.
62
+ */
63
+ exports.TOOL_SELECTION_RULE = '# Tool selection rule\n\n' +
64
+ 'The agent system message will tell you which protocol to apply. ' +
65
+ "Use only that protocol's tools. " +
66
+ 'The agent system message also carries an engineered PROCESS that dictates ' +
67
+ 'intra-protocol ordering. ' +
68
+ "Follow that PROCESS, but constrained to the assigned protocol's tools.";
69
+ /**
70
+ * Per-app catalog entry shape emitted under the `# Protocols` header.
71
+ *
72
+ * Exact rendered shape (three lines + trailing blank line):
73
+ * ```
74
+ * ## <name>
75
+ * Tools: <t1>, <t2>, ...
76
+ * Use when: <useWhen>
77
+ *
78
+ * ```
79
+ *
80
+ * `name` is grammar-sanitized at `defineApp` time. `tools` is the
81
+ * `protocol.tools` array joined with `, `. `useWhen` is grammar-constrained
82
+ * to a single sentence of printable characters with no chat-role markers,
83
+ * no markdown code fences, no newlines.
84
+ */
85
+ const CATALOG_ENTRY = (name, tools, useWhen) => `## ${name}\nTools: ${tools.join(', ')}\nUse when: ${useWhen}\n`;
86
+ exports.CATALOG_ENTRY = CATALOG_ENTRY;
87
+ /**
88
+ * Model families against which the HDK 3.0 App protocol has been
89
+ * validated via production traces.
90
+ *
91
+ * Off-fleet models are unvalidated: the boundary marker, catalog format,
92
+ * and tool-selection rule have not been verified to elicit correct
93
+ * routing. Consumers running off-fleet models get best-effort routing —
94
+ * the protocol may degrade silently. The framework does not gate on the
95
+ * running model's family; HDK is model-agnostic by design.
96
+ *
97
+ * Extending the fleet for a new family requires re-running the
98
+ * verification gates against that family and updating this
99
+ * constant. `appProtocolVersion` does NOT bump for fleet expansion —
100
+ * only for changes to the marker, catalog format, or tool-selection
101
+ * rule that require re-validation across all listed families.
102
+ */
103
+ exports.VALIDATED_MODELS_3_0 = [
104
+ { family: 'qwen3', revisions: ['*'] },
105
+ { family: 'qwen3.5', revisions: ['*'] },
106
+ { family: 'llama-3', revisions: ['*'] },
107
+ { family: 'phi-3.5', revisions: ['*'] },
108
+ { family: 'gemma-3', revisions: ['*'] },
109
+ ];
110
+ /**
111
+ * The App protocol version this build of `@lloyal-labs/rig` ships.
112
+ *
113
+ * Apps declare `appProtocolVersion` in `app.json`; `defineApp` and the
114
+ * registry (`createAppRegistry({ apps })` / `registry.enable`) refuse to
115
+ * enable apps whose declared version is not in
116
+ * {@link SUPPORTED_APP_PROTOCOL_VERSIONS}.
117
+ */
118
+ exports.APP_PROTOCOL_VERSION = '3.0';
119
+ /**
120
+ * The set of App protocol versions this build of `@lloyal-labs/rig`
121
+ * accepts at app-registration time. Within rig 3.x the only valid value
122
+ * is `'3.0'`. A 4.0 protocol would require re-validation across every
123
+ * family in {@link VALIDATED_MODELS_3_0}. Framework semver (rig 3.0 →
124
+ * 3.1) does NOT bump the App protocol; that's the point of the separate
125
+ * version line.
126
+ */
127
+ exports.SUPPORTED_APP_PROTOCOL_VERSIONS = ['3.0'];
128
+ // ── Distribution channel ─────────────────────────────────
129
+ /**
130
+ * Canonical channel endpoint — `apps.lloyal.ai/v1/catalog.json`.
131
+ * Framework-vendored compile-time constant; the harness cannot override.
132
+ *
133
+ * The `harness.dev install` CLI uses {@link resolveAppEntry} to look up
134
+ * a name + semver range against this catalog, verifies the catalog's
135
+ * Ed25519 signature against {@link CHANNEL_TRUST_ROOTS}, then fetches +
136
+ * verifies the resolved manifest and tarball bytes before shelling out
137
+ * to `npm install <tarballUrl>`. The CLI never supplies a URL.
138
+ *
139
+ * To use a different channel, fork `@lloyal-labs/rig`, edit this constant
140
+ * (and {@link CHANNEL_TRUST_ROOTS}), and republish under a different name.
141
+ * The fork is a maintained source divergence; apps signed by the canonical
142
+ * trust roots will not load in the fork, and apps signed by the fork's
143
+ * trust roots will not load in unmodified upstream rig.
144
+ */
145
+ exports.CHANNEL_CATALOG_URL = 'https://apps.lloyal.ai/v1/catalog.json';
146
+ /**
147
+ * Canonical channel's `lloyal-platform-2026-q2` Ed25519 public key
148
+ * (raw 32 bytes). Used to verify the apps.lloyal.ai catalog signature
149
+ * and, transitively (via cross-checked `publisherKeyId`), bundle
150
+ * signatures from lloyal-internal publishers.
151
+ *
152
+ * Generation: 2026-06-03, Node webcrypto Ed25519, private half stored
153
+ * offline (1Password).
154
+ * SHA-256 fingerprint: 9e0df3d25b8968a8b2ae9b86cb17a6922368c7cff9674a84b4a2527dd6457ec1
155
+ * Base64: bUz2SCkISzbzD4/WftUw4Nou2bJixs6OYh/5lomQylI=
156
+ *
157
+ * Tests override {@link CHANNEL_TRUST_ROOTS} via `setTestTrustRoot()` in
158
+ * `bundle.ts`, so this constant is inert under `NODE_ENV=test`.
159
+ *
160
+ * @internal
161
+ */
162
+ const LLOYAL_PLATFORM_KEY_2026_Q2 = new Uint8Array([
163
+ 109, 76, 246, 72, 41, 8, 75, 54, 243, 15, 143, 214, 126, 213, 48, 224,
164
+ 218, 46, 217, 178, 98, 198, 206, 142, 98, 31, 249, 150, 137, 144, 202, 82,
165
+ ]);
166
+ /**
167
+ * Framework-vendored trust roots — map from `publisherKeyId` (e.g.,
168
+ * `'lloyal-platform-2026-q2'`) to the corresponding Ed25519 raw public key
169
+ * bytes (32 bytes). The harness does NOT configure trust roots;
170
+ * {@link verifyBundle} consumers (notably the `harness.dev install` CLI)
171
+ * read this constant directly.
172
+ *
173
+ * Multi-entry from day 1 to support key rotation: a new key is added in a
174
+ * rig minor release while the previous key remains valid for N quarters,
175
+ * then is removed in a future major. Apps signed during the overlap window
176
+ * verify under either key.
177
+ *
178
+ * To use a different set, fork `@lloyal-labs/rig`, edit this constant (and
179
+ * {@link CHANNEL_CATALOG_URL}), and republish under a different name.
180
+ */
181
+ exports.CHANNEL_TRUST_ROOTS = Object.freeze(new Map([
182
+ ['lloyal-platform-2026-q2', LLOYAL_PLATFORM_KEY_2026_Q2],
183
+ ]));
184
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAEH;;;;;;;;;;;;GAYG;AACI,MAAM,eAAe,GAAG,CAAC,IAAY,EAAU,EAAE,CACtD,eAAe,IAAI,kBAAkB,CAAC;AAD3B,QAAA,eAAe,mBACY;AAExC;;;;;;;GAOG;AACU,QAAA,eAAe,GAC1B,kEAAkE;IAClE,2DAA2D;IAC3D,0EAA0E;IAC1E,6DAA6D,CAAC;AAEhE;;;;;;;;;GASG;AACU,QAAA,mBAAmB,GAC9B,2BAA2B;IAC3B,kEAAkE;IAClE,kCAAkC;IAClC,4EAA4E;IAC5E,2BAA2B;IAC3B,wEAAwE,CAAC;AAE3E;;;;;;;;;;;;;;;GAeG;AACI,MAAM,aAAa,GAAG,CAC3B,IAAY,EACZ,KAAwB,EACxB,OAAe,EACP,EAAE,CACV,MAAM,IAAI,YAAY,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,OAAO,IAAI,CAAC;AALtD,QAAA,aAAa,iBAKyC;AAkBnE;;;;;;;;;;;;;;;GAeG;AACU,QAAA,oBAAoB,GAAoC;IACnE,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,EAAE;IACrC,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,EAAE;IACvC,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,EAAE;IACvC,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,EAAE;IACvC,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,EAAE;CACxC,CAAC;AAEF;;;;;;;GAOG;AACU,QAAA,oBAAoB,GAAG,KAAK,CAAC;AAE1C;;;;;;;GAOG;AACU,QAAA,+BAA+B,GAAsB,CAAC,KAAK,CAAC,CAAC;AAE1E,4DAA4D;AAE5D;;;;;;;;;;;;;;;GAeG;AACU,QAAA,mBAAmB,GAC9B,wCAAwC,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,2BAA2B,GAAe,IAAI,UAAU,CAAC;IAC7D,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG;IACrE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;CAC1E,CAAC,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACU,QAAA,mBAAmB,GAAoC,MAAM,CAAC,MAAM,CAC/E,IAAI,GAAG,CAAqB;IAC1B,CAAC,yBAAyB,EAAE,2BAA2B,CAAC;CACzD,CAAC,CACH,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * `createAppRegistry` — harness-wide app registry with a **declarative**
3
+ * app set and structured, **isolated** per-app lifecycle.
4
+ *
5
+ * The harness declares its apps as factories; the registry owns the rest:
6
+ *
7
+ * - `createAppRegistry({ configStore, apps })` runs each factory in its own
8
+ * **detached** Effection scope, seeded with the app-facing framework
9
+ * contexts (`AppConfigStoreCtx`, `RerankerCtx`) so the factory
10
+ * reads config + reranker. The factory body is setup; a `resource()`
11
+ * factory's `ensure(...)` is teardown. The registry tears the scopes
12
+ * down on its own scope exit, reverse register-order, **best-effort** —
13
+ * a throwing teardown is logged but never strands a sibling, and never
14
+ * crashes the harness. The harness does **not** call a per-app register
15
+ * verb at boot.
16
+ * - `registry.enable(factory)` / `registry.disable(name)` handle the
17
+ * genuine dynamic case (mid-session enable/disable). `enable` →
18
+ * `'enabled'`, `disable` → `'disabled'` (matching {@link AppState}).
19
+ * `disable` swallows + logs a throwing teardown, so a mid-session
20
+ * uninstall can't crash the session — possible only because each app
21
+ * owns a detached scope whose teardown errors don't propagate to a
22
+ * parent.
23
+ *
24
+ * There are no install/uninstall/enable/disable hooks on the App. A
25
+ * factory that throws (or whose manifest fails validation) tears down its
26
+ * partial scope and propagates; the app never enters the registry.
27
+ * Per-app independent — one app's failure can't roll back another.
28
+ *
29
+ * @packageDocumentation
30
+ * @category Protocol
31
+ */
32
+ import type { Operation } from 'effection';
33
+ import type { AppFactory, AppRegistry, AppConfigStore, GrantStore } from '@lloyal-labs/lloyal-agents';
34
+ /**
35
+ * Options for {@link createAppRegistry}.
36
+ */
37
+ export interface CreateAppRegistryOpts {
38
+ /**
39
+ * The harness-supplied per-app config store. The registry sets it on
40
+ * `AppConfigStoreCtx` and seeds it into each app's scope so factories
41
+ * read config at construction.
42
+ */
43
+ configStore: AppConfigStore;
44
+ /**
45
+ * The session's protected-tool grant store. The
46
+ * registry seeds it on `GrantStoreCtx` so the agent pool's authGuard can
47
+ * resolve which `protected` tools the session is authorized to call.
48
+ * Optional — omit it when no app exposes protected tools (the authGuard
49
+ * is a no-op then). When omitted with protected tools present, the
50
+ * authGuard fails closed (every protected tool denied).
51
+ */
52
+ grantStore?: GrantStore;
53
+ /**
54
+ * App factories to enable at construction (the boot set). Each runs in
55
+ * its own detached scope and is torn down on registry scope exit. The
56
+ * harness assembles this list from static imports of installed apps
57
+ * (`import { createXxxApp } from '@lloyal-labs/<name>-app'`).
58
+ * **Set `RerankerCtx` before calling** if any factory reads the
59
+ * shared reranker.
60
+ */
61
+ apps?: readonly AppFactory[];
62
+ }
63
+ /**
64
+ * Create the harness-wide app registry.
65
+ *
66
+ * Sets `AppRegistryCtx` and `AppConfigStoreCtx` in the caller's scope (the
67
+ * `initAgents` pattern), enables each factory in `opts.apps`, and tears
68
+ * every enabled app's scope down on the caller's scope exit (reverse
69
+ * order, best-effort).
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * import { createWebApp } from '@lloyal-labs/web-app';
74
+ * import { createCorpusApp } from '@lloyal-labs/corpus-app';
75
+ * import { createJiraApp } from '@lloyal-labs/jira-app';
76
+ *
77
+ * yield* RerankerCtx.set(reranker); // before, if factories read it
78
+ * const registry = yield* createAppRegistry({
79
+ * configStore,
80
+ * apps: [createWebApp, createCorpusApp, createJiraApp],
81
+ * });
82
+ * // ... pool dispatch ...
83
+ * // registry scope exit tears down every app (factory ensures fire)
84
+ * ```
85
+ */
86
+ export declare function createAppRegistry(opts: CreateAppRegistryOpts): Operation<AppRegistry>;
87
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAO3C,OAAO,KAAK,EAEV,UAAU,EACV,WAAW,EACX,cAAc,EACd,UAAU,EAEX,MAAM,4BAA4B,CAAC;AAGpC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,WAAW,EAAE,cAAc,CAAC;IAC5B;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;CAC9B;AAQD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAiB,iBAAiB,CAChC,IAAI,EAAE,qBAAqB,GAC1B,SAAS,CAAC,WAAW,CAAC,CAgJxB"}