rhachet 1.17.0 → 1.18.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 (64) hide show
  1. package/dist/_topublish/rhachet-brain-anthropic/src/atoms/genBrainAtom.d.ts +19 -0
  2. package/dist/_topublish/rhachet-brain-anthropic/src/atoms/genBrainAtom.js +95 -0
  3. package/dist/_topublish/rhachet-brain-anthropic/src/atoms/genBrainAtom.js.map +1 -0
  4. package/dist/_topublish/rhachet-brain-anthropic/src/index.d.ts +14 -0
  5. package/dist/_topublish/rhachet-brain-anthropic/src/index.js +27 -0
  6. package/dist/_topublish/rhachet-brain-anthropic/src/index.js.map +1 -0
  7. package/dist/_topublish/rhachet-brain-anthropic/src/repls/genBrainRepl.d.ts +19 -0
  8. package/dist/_topublish/rhachet-brain-anthropic/src/repls/genBrainRepl.js +137 -0
  9. package/dist/_topublish/rhachet-brain-anthropic/src/repls/genBrainRepl.js.map +1 -0
  10. package/dist/_topublish/rhachet-brain-openai/src/atoms/genBrainAtom.d.ts +19 -0
  11. package/dist/_topublish/rhachet-brain-openai/src/atoms/genBrainAtom.js +86 -0
  12. package/dist/_topublish/rhachet-brain-openai/src/atoms/genBrainAtom.js.map +1 -0
  13. package/dist/_topublish/rhachet-brain-openai/src/index.d.ts +14 -0
  14. package/dist/_topublish/rhachet-brain-openai/src/index.js +27 -0
  15. package/dist/_topublish/rhachet-brain-openai/src/index.js.map +1 -0
  16. package/dist/_topublish/rhachet-brain-openai/src/repls/genBrainRepl.d.ts +19 -0
  17. package/dist/_topublish/rhachet-brain-openai/src/repls/genBrainRepl.js +97 -0
  18. package/dist/_topublish/rhachet-brain-openai/src/repls/genBrainRepl.js.map +1 -0
  19. package/dist/contract/sdk.d.ts +2 -0
  20. package/dist/contract/sdk.js +5 -1
  21. package/dist/contract/sdk.js.map +1 -1
  22. package/dist/domain.objects/BrainAtom.d.ts +54 -0
  23. package/dist/domain.objects/BrainAtom.js +9 -0
  24. package/dist/domain.objects/BrainAtom.js.map +1 -0
  25. package/dist/domain.objects/BrainAtomPlugs.d.ts +17 -0
  26. package/dist/domain.objects/BrainAtomPlugs.js +8 -0
  27. package/dist/domain.objects/BrainAtomPlugs.js.map +1 -0
  28. package/dist/domain.objects/BrainRepl.d.ts +74 -0
  29. package/dist/domain.objects/BrainRepl.js +9 -0
  30. package/dist/domain.objects/BrainRepl.js.map +1 -0
  31. package/dist/domain.objects/BrainReplPlugs.d.ts +34 -0
  32. package/dist/domain.objects/BrainReplPlugs.js +8 -0
  33. package/dist/domain.objects/BrainReplPlugs.js.map +1 -0
  34. package/dist/domain.objects/ContextBrain.d.ts +73 -0
  35. package/dist/domain.objects/ContextBrain.js +8 -0
  36. package/dist/domain.objects/ContextBrain.js.map +1 -0
  37. package/dist/domain.objects/index.d.ts +3 -0
  38. package/dist/domain.objects/index.js +3 -0
  39. package/dist/domain.objects/index.js.map +1 -1
  40. package/dist/domain.operations/brainAtom/askViaBrainAtom.d.ts +22 -0
  41. package/dist/domain.operations/brainAtom/askViaBrainAtom.js +19 -0
  42. package/dist/domain.operations/brainAtom/askViaBrainAtom.js.map +1 -0
  43. package/dist/domain.operations/brainRepl/actViaBrainRepl.d.ts +26 -0
  44. package/dist/domain.operations/brainRepl/actViaBrainRepl.js +23 -0
  45. package/dist/domain.operations/brainRepl/actViaBrainRepl.js.map +1 -0
  46. package/dist/domain.operations/brainRepl/askViaBrainRepl.d.ts +26 -0
  47. package/dist/domain.operations/brainRepl/askViaBrainRepl.js +23 -0
  48. package/dist/domain.operations/brainRepl/askViaBrainRepl.js.map +1 -0
  49. package/dist/domain.operations/briefs/castBriefsToPrompt.d.ts +13 -0
  50. package/dist/domain.operations/briefs/castBriefsToPrompt.js +21 -0
  51. package/dist/domain.operations/briefs/castBriefsToPrompt.js.map +1 -0
  52. package/dist/domain.operations/context/findBrainAtomByRef.d.ts +10 -0
  53. package/dist/domain.operations/context/findBrainAtomByRef.js +23 -0
  54. package/dist/domain.operations/context/findBrainAtomByRef.js.map +1 -0
  55. package/dist/domain.operations/context/findBrainReplByRef.d.ts +10 -0
  56. package/dist/domain.operations/context/findBrainReplByRef.js +23 -0
  57. package/dist/domain.operations/context/findBrainReplByRef.js.map +1 -0
  58. package/dist/domain.operations/context/genContextBrain.d.ts +14 -0
  59. package/dist/domain.operations/context/genContextBrain.js +51 -0
  60. package/dist/domain.operations/context/genContextBrain.js.map +1 -0
  61. package/dist/domain.operations/schema/castZodToJsonSchema.d.ts +14 -0
  62. package/dist/domain.operations/schema/castZodToJsonSchema.js +23 -0
  63. package/dist/domain.operations/schema/castZodToJsonSchema.js.map +1 -0
  64. package/package.json +7 -2
@@ -14,10 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.enweaveOneStitcher = exports.genStitchRoute = exports.genStitchFanout = exports.genStitchCycle = exports.genStitchChoice = exports.asStitcherFlat = exports.asStitcher = exports.getStitch = exports.useTemplate = exports.getTemplateVarsFromRoleInherit = exports.getTemplateValFromArtifacts = exports.getTemplatePathByCallerPath = exports.genTemplate = exports.genStepImagineViaTemplate = exports.getRoleBriefs = exports.genRoleSkill = exports.enrollThread = exports.genContextStitchTrail = exports.withImmute = void 0;
17
+ exports.enweaveOneStitcher = exports.genStitchRoute = exports.genStitchFanout = exports.genStitchCycle = exports.genStitchChoice = exports.asStitcherFlat = exports.asStitcher = exports.getStitch = exports.useTemplate = exports.getTemplateVarsFromRoleInherit = exports.getTemplateValFromArtifacts = exports.getTemplatePathByCallerPath = exports.genTemplate = exports.genStepImagineViaTemplate = exports.getRoleBriefs = exports.genRoleSkill = exports.enrollThread = exports.genContextStitchTrail = exports.genContextBrain = exports.castBriefsToPrompt = exports.withImmute = void 0;
18
18
  var domain_objects_1 = require("domain-objects");
19
19
  Object.defineProperty(exports, "withImmute", { enumerable: true, get: function () { return domain_objects_1.withImmute; } });
20
20
  __exportStar(require("../domain.objects"), exports);
21
+ var castBriefsToPrompt_1 = require("../domain.operations/briefs/castBriefsToPrompt");
22
+ Object.defineProperty(exports, "castBriefsToPrompt", { enumerable: true, get: function () { return castBriefsToPrompt_1.castBriefsToPrompt; } });
23
+ var genContextBrain_1 = require("../domain.operations/context/genContextBrain");
24
+ Object.defineProperty(exports, "genContextBrain", { enumerable: true, get: function () { return genContextBrain_1.genContextBrain; } });
21
25
  var genContextStitchTrail_1 = require("../domain.operations/context/genContextStitchTrail");
22
26
  Object.defineProperty(exports, "genContextStitchTrail", { enumerable: true, get: function () { return genContextStitchTrail_1.genContextStitchTrail; } });
23
27
  var enrollThread_1 = require("../domain.operations/role/enrollThread");
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/contract/sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAAnC,4GAAA,UAAU,OAAA;AAEnB,sDAAoC;AACpC,8FAA6F;AAApF,8HAAA,qBAAqB,OAAA;AAC9B,yEAAwE;AAA/D,4GAAA,YAAY,OAAA;AACrB,yEAAwE;AAA/D,4GAAA,YAAY,OAAA;AACrB,2EAA0E;AAAjE,8GAAA,aAAa,OAAA;AAEtB,uGAAsG;AAA7F,sIAAA,yBAAyB,OAAA;AAClC,2EAA0E;AAAjE,0GAAA,WAAW,OAAA;AACpB,2GAA0G;AAAjG,0IAAA,2BAA2B,OAAA;AACpC,2GAA0G;AAAjG,0IAAA,2BAA2B,OAAA;AACpC,iHAAgH;AAAvG,gJAAA,8BAA8B,OAAA;AACvC,2EAA0E;AAAjE,0GAAA,WAAW,OAAA;AACpB,qEAAoE;AAA3D,sGAAA,SAAS,OAAA;AAClB,8EAA6E;AAApE,wGAAA,UAAU,OAAA;AACnB,sFAAqF;AAA5E,gHAAA,cAAc,OAAA;AACvB,wFAAuF;AAA9E,kHAAA,eAAe,OAAA;AACxB,sFAAqF;AAA5E,gHAAA,cAAc,OAAA;AACvB,wFAAuF;AAA9E,kHAAA,eAAe,OAAA;AACxB,sFAAqF;AAA5E,gHAAA,cAAc,OAAA;AACvB,sFAAqF;AAA5E,wHAAA,kBAAkB,OAAA"}
1
+ {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/contract/sdk.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA4C;AAAnC,4GAAA,UAAU,OAAA;AAEnB,sDAAoC;AACpC,uFAAsF;AAA7E,wHAAA,kBAAkB,OAAA;AAC3B,kFAAiF;AAAxE,kHAAA,eAAe,OAAA;AACxB,8FAA6F;AAApF,8HAAA,qBAAqB,OAAA;AAC9B,yEAAwE;AAA/D,4GAAA,YAAY,OAAA;AACrB,yEAAwE;AAA/D,4GAAA,YAAY,OAAA;AACrB,2EAA0E;AAAjE,8GAAA,aAAa,OAAA;AAEtB,uGAAsG;AAA7F,sIAAA,yBAAyB,OAAA;AAClC,2EAA0E;AAAjE,0GAAA,WAAW,OAAA;AACpB,2GAA0G;AAAjG,0IAAA,2BAA2B,OAAA;AACpC,2GAA0G;AAAjG,0IAAA,2BAA2B,OAAA;AACpC,iHAAgH;AAAvG,gJAAA,8BAA8B,OAAA;AACvC,2EAA0E;AAAjE,0GAAA,WAAW,OAAA;AACpB,qEAAoE;AAA3D,sGAAA,SAAS,OAAA;AAClB,8EAA6E;AAApE,wGAAA,UAAU,OAAA;AACnB,sFAAqF;AAA5E,gHAAA,cAAc,OAAA;AACvB,wFAAuF;AAA9E,kHAAA,eAAe,OAAA;AACxB,sFAAqF;AAA5E,gHAAA,cAAc,OAAA;AACvB,wFAAuF;AAA9E,kHAAA,eAAe,OAAA;AACxB,sFAAqF;AAA5E,gHAAA,cAAc,OAAA;AACvB,sFAAqF;AAA5E,wHAAA,kBAAkB,OAAA"}
@@ -0,0 +1,54 @@
1
+ import { DomainEntity } from 'domain-objects';
2
+ import type { Artifact } from 'rhachet-artifact';
3
+ import type { GitFile } from 'rhachet-artifact-git';
4
+ import type { Empty } from 'type-fns';
5
+ import type { z } from 'zod';
6
+ import type { BrainAtomPlugs } from './BrainAtomPlugs';
7
+ /**
8
+ * .what = an LLM inference endpoint capable of creative language imagination
9
+ * .why =
10
+ * - enables registration of pluggable LLM atoms (e.g., claude, gpt, llama)
11
+ * - provides a standardized contract for single-turn or multi-turn inference
12
+ * - enables dynamic swapping of models at runtime
13
+ */
14
+ export interface BrainAtom {
15
+ /**
16
+ * .what = identifier for the plugin package that provides this atom
17
+ * .example = "anthropic", "openai", "ollama"
18
+ */
19
+ repo: string;
20
+ /**
21
+ * .what = unique identifier for this specific atom within the repo
22
+ * .example = "claude-opus-4.5", "gpt-4o", "llama-3-70b"
23
+ */
24
+ slug: string;
25
+ /**
26
+ * .what = human-readable description of this atom's capabilities
27
+ * .why = helps developers understand what this atom is best suited for
28
+ */
29
+ description: string;
30
+ /**
31
+ * .what = the ask operation contract (renamed from imagine)
32
+ * .why = standardizes how all atoms are invoked, regardless of provider
33
+ *
34
+ * .note = plugin is responsible for handling role.briefs appropriately.
35
+ * this design maximizes leverage of each brain's unique capabilities:
36
+ * - context window optimization (e.g., claude's 200k vs gpt's 128k)
37
+ * - provider-specific caching (e.g., anthropic prompt caching)
38
+ * - finetuned behaviors (e.g., system prompt placement, formatting)
39
+ * - native JSON schema enforcement for structured outputs
40
+ */
41
+ ask: <TOutput>(input: {
42
+ plugs?: BrainAtomPlugs;
43
+ role: {
44
+ briefs?: Artifact<typeof GitFile>[];
45
+ };
46
+ prompt: string;
47
+ schema: {
48
+ output: z.Schema<TOutput>;
49
+ };
50
+ }, context?: Empty) => Promise<TOutput>;
51
+ }
52
+ export declare class BrainAtom extends DomainEntity<BrainAtom> implements BrainAtom {
53
+ static unique: readonly ["repo", "slug"];
54
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BrainAtom = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class BrainAtom extends domain_objects_1.DomainEntity {
6
+ }
7
+ exports.BrainAtom = BrainAtom;
8
+ BrainAtom.unique = ['repo', 'slug'];
9
+ //# sourceMappingURL=BrainAtom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrainAtom.js","sourceRoot":"","sources":["../../src/domain.objects/BrainAtom.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAuD9C,MAAa,SAAU,SAAQ,6BAAuB;;AAAtD,8BAEC;AADe,gBAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { DomainLiteral } from 'domain-objects';
2
+ /**
3
+ * .what = configuration plugs for BrainAtom instances
4
+ * .why = enables extensible configuration for single-turn inference
5
+ * without coupling to specific SDK implementations
6
+ *
7
+ * .note = placeholder interface; actual configuration TBD
8
+ */
9
+ export interface BrainAtomPlugs {
10
+ /**
11
+ * .what = structured output configuration
12
+ * .why = enables native JSON schema enforcement for reduced token waste
13
+ */
14
+ output?: never;
15
+ }
16
+ export declare class BrainAtomPlugs extends DomainLiteral<BrainAtomPlugs> implements BrainAtomPlugs {
17
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BrainAtomPlugs = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class BrainAtomPlugs extends domain_objects_1.DomainLiteral {
6
+ }
7
+ exports.BrainAtomPlugs = BrainAtomPlugs;
8
+ //# sourceMappingURL=BrainAtomPlugs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrainAtomPlugs.js","sourceRoot":"","sources":["../../src/domain.objects/BrainAtomPlugs.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAiB/C,MAAa,cACX,SAAQ,8BAA6B;CACT;AAF9B,wCAE8B"}
@@ -0,0 +1,74 @@
1
+ import { DomainEntity } from 'domain-objects';
2
+ import type { Artifact } from 'rhachet-artifact';
3
+ import type { GitFile } from 'rhachet-artifact-git';
4
+ import type { Empty } from 'type-fns';
5
+ import type { z } from 'zod';
6
+ import type { BrainReplPlugs } from './BrainReplPlugs';
7
+ /**
8
+ * .what = a brain.atom operating behind a REPL (read-execute-print-loop)
9
+ * .why =
10
+ * - enables registration of pluggable agentic repls (e.g., claude-code, codex)
11
+ * - provides a standardized contract for agentic tool-using inference
12
+ * - enables dynamic swapping of agentic systems at runtime
13
+ *
14
+ * .note = repls differ from atoms in that they execute iterative agentic loops
15
+ * with tool use, rather than single-turn inference
16
+ */
17
+ export interface BrainRepl {
18
+ /**
19
+ * .what = identifier for the plugin package that provides this repl
20
+ * .example = "anthropic", "openai"
21
+ */
22
+ repo: string;
23
+ /**
24
+ * .what = unique identifier for this specific repl within the repo
25
+ * .example = "claude-code", "codex"
26
+ */
27
+ slug: string;
28
+ /**
29
+ * .what = human-readable description of this repl's capabilities
30
+ * .why = helps developers understand what this repl is best suited for
31
+ */
32
+ description: string;
33
+ /**
34
+ * .what = readonly analysis operation (research, queries, code review)
35
+ * .why = provides safe, non-mutating agent interactions
36
+ * with only read access to filesystem and tools
37
+ *
38
+ * .sdk.mapping =
39
+ * - claude-agent-sdk: disallowedTools=["Edit","Write","Bash","NotebookEdit"]
40
+ * - codex-sdk: --sandbox read-only
41
+ */
42
+ ask: <TOutput>(input: {
43
+ plugs?: BrainReplPlugs;
44
+ role: {
45
+ briefs?: Artifact<typeof GitFile>[];
46
+ };
47
+ prompt: string;
48
+ schema: {
49
+ output: z.Schema<TOutput>;
50
+ };
51
+ }, context?: Empty) => Promise<TOutput>;
52
+ /**
53
+ * .what = read+write action operation (code changes, file edits)
54
+ * .why = provides full agentic capabilities with write access
55
+ * for tasks that require modifying the codebase
56
+ *
57
+ * .sdk.mapping =
58
+ * - claude-agent-sdk: allowedTools=["Read","Edit","Write","Bash","Glob","Grep"]
59
+ * - codex-sdk: --sandbox workspace-write
60
+ */
61
+ act: <TOutput>(input: {
62
+ plugs?: BrainReplPlugs;
63
+ role: {
64
+ briefs?: Artifact<typeof GitFile>[];
65
+ };
66
+ prompt: string;
67
+ schema: {
68
+ output: z.Schema<TOutput>;
69
+ };
70
+ }, context?: Empty) => Promise<TOutput>;
71
+ }
72
+ export declare class BrainRepl extends DomainEntity<BrainRepl> implements BrainRepl {
73
+ static unique: readonly ["repo", "slug"];
74
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BrainRepl = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class BrainRepl extends domain_objects_1.DomainEntity {
6
+ }
7
+ exports.BrainRepl = BrainRepl;
8
+ BrainRepl.unique = ['repo', 'slug'];
9
+ //# sourceMappingURL=BrainRepl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrainRepl.js","sourceRoot":"","sources":["../../src/domain.objects/BrainRepl.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AA2E9C,MAAa,SAAU,SAAQ,6BAAuB;;AAAtD,8BAEC;AADe,gBAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { DomainLiteral } from 'domain-objects';
2
+ /**
3
+ * .what = configuration plugs for BrainRepl instances
4
+ * .why = enables extensible tooling, memory management, and access control
5
+ * for agentic workloads without coupling to specific SDK implementations
6
+ */
7
+ export interface BrainReplPlugs {
8
+ /**
9
+ * .what = additional tool providers beyond built-in tools
10
+ * .why = enables domain-specific tooling (databases, browsers, APIs)
11
+ * via MCP servers or custom tool definitions
12
+ *
13
+ * .example = playwright browser, postgres database, custom APIs
14
+ */
15
+ toolboxes?: never;
16
+ /**
17
+ * .what = memory and context management strategy
18
+ * .why = enables custom context compression, session persistence,
19
+ * and artifact management for long-running workflows
20
+ *
21
+ * .example = session resume, context compaction hooks
22
+ */
23
+ memory?: never;
24
+ /**
25
+ * .what = permission guard and access control
26
+ * .why = enables custom authorization logic, audit logging,
27
+ * and tool-level access policies beyond SDK defaults
28
+ *
29
+ * .example = canUseTool callbacks, preToolUse hooks
30
+ */
31
+ access?: never;
32
+ }
33
+ export declare class BrainReplPlugs extends DomainLiteral<BrainReplPlugs> implements BrainReplPlugs {
34
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BrainReplPlugs = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class BrainReplPlugs extends domain_objects_1.DomainLiteral {
6
+ }
7
+ exports.BrainReplPlugs = BrainReplPlugs;
8
+ //# sourceMappingURL=BrainReplPlugs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrainReplPlugs.js","sourceRoot":"","sources":["../../src/domain.objects/BrainReplPlugs.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAsC/C,MAAa,cACX,SAAQ,8BAA6B;CACT;AAF9B,wCAE8B"}
@@ -0,0 +1,73 @@
1
+ import { DomainLiteral, type RefByUnique } from 'domain-objects';
2
+ import type { Artifact } from 'rhachet-artifact';
3
+ import type { GitFile } from 'rhachet-artifact-git';
4
+ import type { z } from 'zod';
5
+ import type { BrainAtom } from './BrainAtom';
6
+ import type { BrainAtomPlugs } from './BrainAtomPlugs';
7
+ import type { BrainRepl } from './BrainRepl';
8
+ import type { BrainReplPlugs } from './BrainReplPlugs';
9
+ /**
10
+ * .what = runtime context providing unified access to brain atoms and repls
11
+ * .why =
12
+ * - provides a clean interface for invoking brains by reference
13
+ * - handles lookup, role embedding, and delegation transparently
14
+ * - enables dynamic brain swapping without caller changes
15
+ */
16
+ export interface ContextBrain {
17
+ /**
18
+ * .what = interface for invoking brain atoms and repls
19
+ */
20
+ brain: {
21
+ atom: {
22
+ /**
23
+ * .what = lookup and invoke a brain atom for single-turn inference
24
+ * .why = provides ergonomic access to atoms with automatic lookup
25
+ */
26
+ ask: <TOutput>(input: {
27
+ brain: RefByUnique<typeof BrainAtom>;
28
+ plugs?: BrainAtomPlugs;
29
+ role: {
30
+ briefs?: Artifact<typeof GitFile>[];
31
+ };
32
+ prompt: string;
33
+ schema: {
34
+ output: z.Schema<TOutput>;
35
+ };
36
+ }) => Promise<TOutput>;
37
+ };
38
+ repl: {
39
+ /**
40
+ * .what = lookup and invoke a brain repl for readonly analysis
41
+ * .why = provides safe agentic analysis without file modifications
42
+ */
43
+ ask: <TOutput>(input: {
44
+ brain: RefByUnique<typeof BrainRepl>;
45
+ plugs?: BrainReplPlugs;
46
+ role: {
47
+ briefs?: Artifact<typeof GitFile>[];
48
+ };
49
+ prompt: string;
50
+ schema: {
51
+ output: z.Schema<TOutput>;
52
+ };
53
+ }) => Promise<TOutput>;
54
+ /**
55
+ * .what = lookup and invoke a brain repl for read+write actions
56
+ * .why = provides full agentic capabilities with file modifications
57
+ */
58
+ act: <TOutput>(input: {
59
+ brain: RefByUnique<typeof BrainRepl>;
60
+ plugs?: BrainReplPlugs;
61
+ role: {
62
+ briefs?: Artifact<typeof GitFile>[];
63
+ };
64
+ prompt: string;
65
+ schema: {
66
+ output: z.Schema<TOutput>;
67
+ };
68
+ }) => Promise<TOutput>;
69
+ };
70
+ };
71
+ }
72
+ export declare class ContextBrain extends DomainLiteral<ContextBrain> implements ContextBrain {
73
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContextBrain = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class ContextBrain extends domain_objects_1.DomainLiteral {
6
+ }
7
+ exports.ContextBrain = ContextBrain;
8
+ //# sourceMappingURL=ContextBrain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContextBrain.js","sourceRoot":"","sources":["../../src/domain.objects/ContextBrain.ts"],"names":[],"mappings":";;;AAAA,mDAAiE;AA+DjE,MAAa,YACX,SAAQ,8BAA2B;CACT;AAF5B,oCAE4B"}
@@ -9,6 +9,9 @@ export * from './StitchStep';
9
9
  export * from './StitchTrail';
10
10
  export * from './Thread';
11
11
  export * from './Threads';
12
+ export * from './BrainAtom';
13
+ export * from './BrainRepl';
14
+ export * from './ContextBrain';
12
15
  export * from './InvokeHooks';
13
16
  export * from './InvokeOpts';
14
17
  export * from './Role';
@@ -27,6 +27,9 @@ __exportStar(require("./Thread"), exports);
27
27
  __exportStar(require("./Threads"), exports);
28
28
  // export * from './Weave';
29
29
  // export * from './Weaver';
30
+ __exportStar(require("./BrainAtom"), exports);
31
+ __exportStar(require("./BrainRepl"), exports);
32
+ __exportStar(require("./ContextBrain"), exports);
30
33
  __exportStar(require("./InvokeHooks"), exports);
31
34
  __exportStar(require("./InvokeOpts"), exports);
32
35
  __exportStar(require("./Role"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain.objects/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,iDAA+B;AAC/B,gDAA8B;AAC9B,6CAA2B;AAC3B,iDAA+B;AAC/B,gDAA8B;AAC9B,mDAAiC;AACjC,+CAA6B;AAC7B,gDAA8B;AAC9B,2CAAyB;AACzB,4CAA0B;AAE1B,2BAA2B;AAC3B,4BAA4B;AAE5B,gDAA8B;AAC9B,+CAA6B;AAC7B,yCAAuB;AACvB,gDAA8B;AAC9B,iDAA+B;AAC/B,8CAA4B;AAC5B,uDAAqC;AACrC,wDAAsC;AACtC,8CAA4B;AAC5B,6CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain.objects/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,iDAA+B;AAC/B,gDAA8B;AAC9B,6CAA2B;AAC3B,iDAA+B;AAC/B,gDAA8B;AAC9B,mDAAiC;AACjC,+CAA6B;AAC7B,gDAA8B;AAC9B,2CAAyB;AACzB,4CAA0B;AAE1B,2BAA2B;AAC3B,4BAA4B;AAE5B,8CAA4B;AAC5B,8CAA4B;AAC5B,iDAA+B;AAC/B,gDAA8B;AAC9B,+CAA6B;AAC7B,yCAAuB;AACvB,gDAA8B;AAC9B,iDAA+B;AAC/B,8CAA4B;AAC5B,uDAAqC;AACrC,wDAAsC;AACtC,8CAA4B;AAC5B,6CAA2B"}
@@ -0,0 +1,22 @@
1
+ import type { Artifact } from 'rhachet-artifact';
2
+ import type { GitFile } from 'rhachet-artifact-git';
3
+ import type { Empty } from 'type-fns';
4
+ import type { z } from 'zod';
5
+ import type { BrainAtom } from '../../domain.objects/BrainAtom';
6
+ import type { BrainAtomPlugs } from '../../domain.objects/BrainAtomPlugs';
7
+ /**
8
+ * .what = invoke a brain atom for single-turn inference
9
+ * .why = provides the core operation for atom-based imagination
10
+ * with automatic role brief embedding and schema enforcement
11
+ */
12
+ export declare const askViaBrainAtom: <TOutput>(input: {
13
+ atom: BrainAtom;
14
+ plugs?: BrainAtomPlugs;
15
+ role: {
16
+ briefs?: Artifact<typeof GitFile>[];
17
+ };
18
+ prompt: string;
19
+ schema: {
20
+ output: z.Schema<TOutput>;
21
+ };
22
+ }, context?: Empty) => Promise<TOutput>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.askViaBrainAtom = void 0;
4
+ /**
5
+ * .what = invoke a brain atom for single-turn inference
6
+ * .why = provides the core operation for atom-based imagination
7
+ * with automatic role brief embedding and schema enforcement
8
+ */
9
+ const askViaBrainAtom = async (input, context) => {
10
+ // delegate to the atom's ask implementation
11
+ return input.atom.ask({
12
+ plugs: input.plugs,
13
+ role: input.role,
14
+ prompt: input.prompt,
15
+ schema: input.schema,
16
+ }, context);
17
+ };
18
+ exports.askViaBrainAtom = askViaBrainAtom;
19
+ //# sourceMappingURL=askViaBrainAtom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"askViaBrainAtom.js","sourceRoot":"","sources":["../../../src/domain.operations/brainAtom/askViaBrainAtom.ts"],"names":[],"mappings":";;;AAQA;;;;GAIG;AACI,MAAM,eAAe,GAAG,KAAK,EAClC,KAMC,EACD,OAAe,EACG,EAAE;IACpB,4CAA4C;IAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CACnB;QACE,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,eAAe,mBAoB1B"}
@@ -0,0 +1,26 @@
1
+ import type { Artifact } from 'rhachet-artifact';
2
+ import type { GitFile } from 'rhachet-artifact-git';
3
+ import type { Empty } from 'type-fns';
4
+ import type { z } from 'zod';
5
+ import type { BrainRepl } from '../../domain.objects/BrainRepl';
6
+ import type { BrainReplPlugs } from '../../domain.objects/BrainReplPlugs';
7
+ /**
8
+ * .what = invoke a brain repl for read+write agentic actions
9
+ * .why = provides full agentic capabilities for code changes,
10
+ * file edits, and command execution tasks
11
+ *
12
+ * .sdk.implementation =
13
+ * - claude-agent-sdk: query() with allowedTools=["Read","Edit","Write","Bash",...]
14
+ * - codex-sdk: thread.run() with sandbox=workspace-write
15
+ */
16
+ export declare const actViaBrainRepl: <TOutput>(input: {
17
+ repl: BrainRepl;
18
+ plugs?: BrainReplPlugs;
19
+ role: {
20
+ briefs?: Artifact<typeof GitFile>[];
21
+ };
22
+ prompt: string;
23
+ schema: {
24
+ output: z.Schema<TOutput>;
25
+ };
26
+ }, context?: Empty) => Promise<TOutput>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.actViaBrainRepl = void 0;
4
+ /**
5
+ * .what = invoke a brain repl for read+write agentic actions
6
+ * .why = provides full agentic capabilities for code changes,
7
+ * file edits, and command execution tasks
8
+ *
9
+ * .sdk.implementation =
10
+ * - claude-agent-sdk: query() with allowedTools=["Read","Edit","Write","Bash",...]
11
+ * - codex-sdk: thread.run() with sandbox=workspace-write
12
+ */
13
+ const actViaBrainRepl = async (input, context) => {
14
+ // delegate to the repl's act implementation
15
+ return input.repl.act({
16
+ plugs: input.plugs,
17
+ role: input.role,
18
+ prompt: input.prompt,
19
+ schema: input.schema,
20
+ }, context);
21
+ };
22
+ exports.actViaBrainRepl = actViaBrainRepl;
23
+ //# sourceMappingURL=actViaBrainRepl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actViaBrainRepl.js","sourceRoot":"","sources":["../../../src/domain.operations/brainRepl/actViaBrainRepl.ts"],"names":[],"mappings":";;;AAQA;;;;;;;;GAQG;AACI,MAAM,eAAe,GAAG,KAAK,EAClC,KAMC,EACD,OAAe,EACG,EAAE;IACpB,4CAA4C;IAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CACnB;QACE,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,eAAe,mBAoB1B"}
@@ -0,0 +1,26 @@
1
+ import type { Artifact } from 'rhachet-artifact';
2
+ import type { GitFile } from 'rhachet-artifact-git';
3
+ import type { Empty } from 'type-fns';
4
+ import type { z } from 'zod';
5
+ import type { BrainRepl } from '../../domain.objects/BrainRepl';
6
+ import type { BrainReplPlugs } from '../../domain.objects/BrainReplPlugs';
7
+ /**
8
+ * .what = invoke a brain repl for readonly agentic analysis
9
+ * .why = provides safe, non-mutating agent interactions for research,
10
+ * code analysis, and information gathering tasks
11
+ *
12
+ * .sdk.implementation =
13
+ * - claude-agent-sdk: query() with disallowedTools=["Edit","Write","Bash"]
14
+ * - codex-sdk: thread.run() with sandbox=read-only
15
+ */
16
+ export declare const askViaBrainRepl: <TOutput>(input: {
17
+ repl: BrainRepl;
18
+ plugs?: BrainReplPlugs;
19
+ role: {
20
+ briefs?: Artifact<typeof GitFile>[];
21
+ };
22
+ prompt: string;
23
+ schema: {
24
+ output: z.Schema<TOutput>;
25
+ };
26
+ }, context?: Empty) => Promise<TOutput>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.askViaBrainRepl = void 0;
4
+ /**
5
+ * .what = invoke a brain repl for readonly agentic analysis
6
+ * .why = provides safe, non-mutating agent interactions for research,
7
+ * code analysis, and information gathering tasks
8
+ *
9
+ * .sdk.implementation =
10
+ * - claude-agent-sdk: query() with disallowedTools=["Edit","Write","Bash"]
11
+ * - codex-sdk: thread.run() with sandbox=read-only
12
+ */
13
+ const askViaBrainRepl = async (input, context) => {
14
+ // delegate to the repl's ask implementation
15
+ return input.repl.ask({
16
+ plugs: input.plugs,
17
+ role: input.role,
18
+ prompt: input.prompt,
19
+ schema: input.schema,
20
+ }, context);
21
+ };
22
+ exports.askViaBrainRepl = askViaBrainRepl;
23
+ //# sourceMappingURL=askViaBrainRepl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"askViaBrainRepl.js","sourceRoot":"","sources":["../../../src/domain.operations/brainRepl/askViaBrainRepl.ts"],"names":[],"mappings":";;;AAQA;;;;;;;;GAQG;AACI,MAAM,eAAe,GAAG,KAAK,EAClC,KAMC,EACD,OAAe,EACG,EAAE;IACpB,4CAA4C;IAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CACnB;QACE,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,eAAe,mBAoB1B"}
@@ -0,0 +1,13 @@
1
+ import type { Artifact } from 'rhachet-artifact';
2
+ import type { GitFile } from 'rhachet-artifact-git';
3
+ /**
4
+ * .what = converts briefs artifacts to concatenated prompt text
5
+ * .why = utility for plugin authors to easily compose briefs into system prompts
6
+ *
7
+ * .note = generalized from bootRoleResources logic;
8
+ * bootRoleResources should be refactored to use this shared utility,
9
+ * ensuring consistent briefs handling across boot and brain.imagine
10
+ */
11
+ export declare const castBriefsToPrompt: (input: {
12
+ briefs: Artifact<typeof GitFile>[];
13
+ }) => Promise<string>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.castBriefsToPrompt = void 0;
4
+ /**
5
+ * .what = converts briefs artifacts to concatenated prompt text
6
+ * .why = utility for plugin authors to easily compose briefs into system prompts
7
+ *
8
+ * .note = generalized from bootRoleResources logic;
9
+ * bootRoleResources should be refactored to use this shared utility,
10
+ * ensuring consistent briefs handling across boot and brain.imagine
11
+ */
12
+ const castBriefsToPrompt = async (input) => {
13
+ // resolve all artifacts to get their content
14
+ const contents = await Promise.all(input.briefs.map(async (brief) => {
15
+ const file = await brief.get();
16
+ return file?.content;
17
+ }));
18
+ return contents.filter(Boolean).join('\n\n');
19
+ };
20
+ exports.castBriefsToPrompt = castBriefsToPrompt;
21
+ //# sourceMappingURL=castBriefsToPrompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"castBriefsToPrompt.js","sourceRoot":"","sources":["../../../src/domain.operations/briefs/castBriefsToPrompt.ts"],"names":[],"mappings":";;;AAGA;;;;;;;GAOG;AACI,MAAM,kBAAkB,GAAG,KAAK,EAAE,KAExC,EAAmB,EAAE;IACpB,6CAA6C;IAC7C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAChC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC/B,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,CAAC;QAC/B,OAAO,IAAI,EAAE,OAAO,CAAC;IACvB,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC,CAAC;AAZW,QAAA,kBAAkB,sBAY7B"}
@@ -0,0 +1,10 @@
1
+ import type { RefByUnique } from 'domain-objects';
2
+ import type { BrainAtom } from '../../domain.objects/BrainAtom';
3
+ /**
4
+ * .what = finds a brain atom by its unique reference
5
+ * .why = enables lookup of registered atoms by { repo, slug }
6
+ */
7
+ export declare const findBrainAtomByRef: (input: {
8
+ atoms: BrainAtom[];
9
+ ref: RefByUnique<typeof BrainAtom>;
10
+ }) => BrainAtom;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findBrainAtomByRef = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ /**
6
+ * .what = finds a brain atom by its unique reference
7
+ * .why = enables lookup of registered atoms by { repo, slug }
8
+ */
9
+ const findBrainAtomByRef = (input) => {
10
+ // fail fast if no atoms available
11
+ if (input.atoms.length === 0)
12
+ throw new helpful_errors_1.BadRequestError('no atoms available in context', {
13
+ ref: input.ref,
14
+ });
15
+ // lookup atom by ref
16
+ const atomFound = input.atoms.find((a) => a.repo === input.ref.repo && a.slug === input.ref.slug);
17
+ // fail if not found
18
+ if (!atomFound)
19
+ throw new helpful_errors_1.BadRequestError('brain atom not found', { ref: input.ref });
20
+ return atomFound;
21
+ };
22
+ exports.findBrainAtomByRef = findBrainAtomByRef;
23
+ //# sourceMappingURL=findBrainAtomByRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findBrainAtomByRef.js","sourceRoot":"","sources":["../../../src/domain.operations/context/findBrainAtomByRef.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAIjD;;;GAGG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAGlC,EAAa,EAAE;IACd,kCAAkC;IAClC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;QAC1B,MAAM,IAAI,gCAAe,CAAC,+BAA+B,EAAE;YACzD,GAAG,EAAE,KAAK,CAAC,GAAG;SACf,CAAC,CAAC;IAEL,qBAAqB;IACrB,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAChC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,CAC9D,CAAC;IAEF,oBAAoB;IACpB,IAAI,CAAC,SAAS;QACZ,MAAM,IAAI,gCAAe,CAAC,sBAAsB,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;IAExE,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AApBW,QAAA,kBAAkB,sBAoB7B"}
@@ -0,0 +1,10 @@
1
+ import type { RefByUnique } from 'domain-objects';
2
+ import type { BrainRepl } from '../../domain.objects/BrainRepl';
3
+ /**
4
+ * .what = finds a brain repl by its unique reference
5
+ * .why = enables lookup of registered repls by { repo, slug }
6
+ */
7
+ export declare const findBrainReplByRef: (input: {
8
+ repls: BrainRepl[];
9
+ ref: RefByUnique<typeof BrainRepl>;
10
+ }) => BrainRepl;