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.
- package/dist/_topublish/rhachet-brain-anthropic/src/atoms/genBrainAtom.d.ts +19 -0
- package/dist/_topublish/rhachet-brain-anthropic/src/atoms/genBrainAtom.js +95 -0
- package/dist/_topublish/rhachet-brain-anthropic/src/atoms/genBrainAtom.js.map +1 -0
- package/dist/_topublish/rhachet-brain-anthropic/src/index.d.ts +14 -0
- package/dist/_topublish/rhachet-brain-anthropic/src/index.js +27 -0
- package/dist/_topublish/rhachet-brain-anthropic/src/index.js.map +1 -0
- package/dist/_topublish/rhachet-brain-anthropic/src/repls/genBrainRepl.d.ts +19 -0
- package/dist/_topublish/rhachet-brain-anthropic/src/repls/genBrainRepl.js +137 -0
- package/dist/_topublish/rhachet-brain-anthropic/src/repls/genBrainRepl.js.map +1 -0
- package/dist/_topublish/rhachet-brain-openai/src/atoms/genBrainAtom.d.ts +19 -0
- package/dist/_topublish/rhachet-brain-openai/src/atoms/genBrainAtom.js +86 -0
- package/dist/_topublish/rhachet-brain-openai/src/atoms/genBrainAtom.js.map +1 -0
- package/dist/_topublish/rhachet-brain-openai/src/index.d.ts +14 -0
- package/dist/_topublish/rhachet-brain-openai/src/index.js +27 -0
- package/dist/_topublish/rhachet-brain-openai/src/index.js.map +1 -0
- package/dist/_topublish/rhachet-brain-openai/src/repls/genBrainRepl.d.ts +19 -0
- package/dist/_topublish/rhachet-brain-openai/src/repls/genBrainRepl.js +97 -0
- package/dist/_topublish/rhachet-brain-openai/src/repls/genBrainRepl.js.map +1 -0
- package/dist/contract/sdk.d.ts +2 -0
- package/dist/contract/sdk.js +5 -1
- package/dist/contract/sdk.js.map +1 -1
- package/dist/domain.objects/BrainAtom.d.ts +54 -0
- package/dist/domain.objects/BrainAtom.js +9 -0
- package/dist/domain.objects/BrainAtom.js.map +1 -0
- package/dist/domain.objects/BrainAtomPlugs.d.ts +17 -0
- package/dist/domain.objects/BrainAtomPlugs.js +8 -0
- package/dist/domain.objects/BrainAtomPlugs.js.map +1 -0
- package/dist/domain.objects/BrainRepl.d.ts +74 -0
- package/dist/domain.objects/BrainRepl.js +9 -0
- package/dist/domain.objects/BrainRepl.js.map +1 -0
- package/dist/domain.objects/BrainReplPlugs.d.ts +34 -0
- package/dist/domain.objects/BrainReplPlugs.js +8 -0
- package/dist/domain.objects/BrainReplPlugs.js.map +1 -0
- package/dist/domain.objects/ContextBrain.d.ts +73 -0
- package/dist/domain.objects/ContextBrain.js +8 -0
- package/dist/domain.objects/ContextBrain.js.map +1 -0
- package/dist/domain.objects/index.d.ts +3 -0
- package/dist/domain.objects/index.js +3 -0
- package/dist/domain.objects/index.js.map +1 -1
- package/dist/domain.operations/brainAtom/askViaBrainAtom.d.ts +22 -0
- package/dist/domain.operations/brainAtom/askViaBrainAtom.js +19 -0
- package/dist/domain.operations/brainAtom/askViaBrainAtom.js.map +1 -0
- package/dist/domain.operations/brainRepl/actViaBrainRepl.d.ts +26 -0
- package/dist/domain.operations/brainRepl/actViaBrainRepl.js +23 -0
- package/dist/domain.operations/brainRepl/actViaBrainRepl.js.map +1 -0
- package/dist/domain.operations/brainRepl/askViaBrainRepl.d.ts +26 -0
- package/dist/domain.operations/brainRepl/askViaBrainRepl.js +23 -0
- package/dist/domain.operations/brainRepl/askViaBrainRepl.js.map +1 -0
- package/dist/domain.operations/briefs/castBriefsToPrompt.d.ts +13 -0
- package/dist/domain.operations/briefs/castBriefsToPrompt.js +21 -0
- package/dist/domain.operations/briefs/castBriefsToPrompt.js.map +1 -0
- package/dist/domain.operations/context/findBrainAtomByRef.d.ts +10 -0
- package/dist/domain.operations/context/findBrainAtomByRef.js +23 -0
- package/dist/domain.operations/context/findBrainAtomByRef.js.map +1 -0
- package/dist/domain.operations/context/findBrainReplByRef.d.ts +10 -0
- package/dist/domain.operations/context/findBrainReplByRef.js +23 -0
- package/dist/domain.operations/context/findBrainReplByRef.js.map +1 -0
- package/dist/domain.operations/context/genContextBrain.d.ts +14 -0
- package/dist/domain.operations/context/genContextBrain.js +51 -0
- package/dist/domain.operations/context/genContextBrain.js.map +1 -0
- package/dist/domain.operations/schema/castZodToJsonSchema.d.ts +14 -0
- package/dist/domain.operations/schema/castZodToJsonSchema.js +23 -0
- package/dist/domain.operations/schema/castZodToJsonSchema.js.map +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findBrainReplByRef = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
/**
|
|
6
|
+
* .what = finds a brain repl by its unique reference
|
|
7
|
+
* .why = enables lookup of registered repls by { repo, slug }
|
|
8
|
+
*/
|
|
9
|
+
const findBrainReplByRef = (input) => {
|
|
10
|
+
// fail fast if no repls available
|
|
11
|
+
if (input.repls.length === 0)
|
|
12
|
+
throw new helpful_errors_1.BadRequestError('no repls available in context', {
|
|
13
|
+
ref: input.ref,
|
|
14
|
+
});
|
|
15
|
+
// lookup repl by ref
|
|
16
|
+
const replFound = input.repls.find((r) => r.repo === input.ref.repo && r.slug === input.ref.slug);
|
|
17
|
+
// fail if not found
|
|
18
|
+
if (!replFound)
|
|
19
|
+
throw new helpful_errors_1.BadRequestError('brain repl not found', { ref: input.ref });
|
|
20
|
+
return replFound;
|
|
21
|
+
};
|
|
22
|
+
exports.findBrainReplByRef = findBrainReplByRef;
|
|
23
|
+
//# sourceMappingURL=findBrainReplByRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findBrainReplByRef.js","sourceRoot":"","sources":["../../../src/domain.operations/context/findBrainReplByRef.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,14 @@
|
|
|
1
|
+
import type { BrainAtom } from '../../domain.objects/BrainAtom';
|
|
2
|
+
import type { BrainRepl } from '../../domain.objects/BrainRepl';
|
|
3
|
+
import type { ContextBrain } from '../../domain.objects/ContextBrain';
|
|
4
|
+
/**
|
|
5
|
+
* .what = factory to create a brain context from plugin-provided atoms and repls
|
|
6
|
+
* .why =
|
|
7
|
+
* - provides a clean entry point for context creation
|
|
8
|
+
* - validates no duplicate { repo, slug } identifiers
|
|
9
|
+
* - composes the context with lookup and delegation logic
|
|
10
|
+
*/
|
|
11
|
+
export declare const genContextBrain: (input: {
|
|
12
|
+
atoms?: BrainAtom[];
|
|
13
|
+
repls?: BrainRepl[];
|
|
14
|
+
}) => ContextBrain;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genContextBrain = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
const findBrainAtomByRef_1 = require("./findBrainAtomByRef");
|
|
6
|
+
const findBrainReplByRef_1 = require("./findBrainReplByRef");
|
|
7
|
+
/**
|
|
8
|
+
* .what = factory to create a brain context from plugin-provided atoms and repls
|
|
9
|
+
* .why =
|
|
10
|
+
* - provides a clean entry point for context creation
|
|
11
|
+
* - validates no duplicate { repo, slug } identifiers
|
|
12
|
+
* - composes the context with lookup and delegation logic
|
|
13
|
+
*/
|
|
14
|
+
const genContextBrain = (input) => {
|
|
15
|
+
// default to empty arrays
|
|
16
|
+
const atoms = input.atoms ?? [];
|
|
17
|
+
const repls = input.repls ?? [];
|
|
18
|
+
// validate no duplicate atoms
|
|
19
|
+
const atomKeys = atoms.map((a) => `${a.repo}:${a.slug}`);
|
|
20
|
+
const duplicateAtom = atomKeys.find((k, i) => atomKeys.indexOf(k) !== i);
|
|
21
|
+
if (duplicateAtom)
|
|
22
|
+
throw new helpful_errors_1.BadRequestError('duplicate atom identifier', { duplicateAtom });
|
|
23
|
+
// validate no duplicate repls
|
|
24
|
+
const replKeys = repls.map((r) => `${r.repo}:${r.slug}`);
|
|
25
|
+
const duplicateRepl = replKeys.find((k, i) => replKeys.indexOf(k) !== i);
|
|
26
|
+
if (duplicateRepl)
|
|
27
|
+
throw new helpful_errors_1.BadRequestError('duplicate repl identifier', { duplicateRepl });
|
|
28
|
+
// return context with lookup and delegation
|
|
29
|
+
return {
|
|
30
|
+
brain: {
|
|
31
|
+
atom: {
|
|
32
|
+
ask: async (askInput) => {
|
|
33
|
+
const atom = (0, findBrainAtomByRef_1.findBrainAtomByRef)({ atoms, ref: askInput.brain });
|
|
34
|
+
return atom.ask(askInput, {});
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
repl: {
|
|
38
|
+
ask: async (askInput) => {
|
|
39
|
+
const repl = (0, findBrainReplByRef_1.findBrainReplByRef)({ repls, ref: askInput.brain });
|
|
40
|
+
return repl.ask(askInput, {});
|
|
41
|
+
},
|
|
42
|
+
act: async (actInput) => {
|
|
43
|
+
const repl = (0, findBrainReplByRef_1.findBrainReplByRef)({ repls, ref: actInput.brain });
|
|
44
|
+
return repl.act(actInput, {});
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
exports.genContextBrain = genContextBrain;
|
|
51
|
+
//# sourceMappingURL=genContextBrain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genContextBrain.js","sourceRoot":"","sources":["../../../src/domain.operations/context/genContextBrain.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAMjD,6DAA0D;AAC1D,6DAA0D;AAE1D;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAAC,KAG/B,EAAgB,EAAE;IACjB,0BAA0B;IAC1B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;IAEhC,8BAA8B;IAC9B,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACzD,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACzE,IAAI,aAAa;QACf,MAAM,IAAI,gCAAe,CAAC,2BAA2B,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;IAE5E,8BAA8B;IAC9B,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACzD,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACzE,IAAI,aAAa;QACf,MAAM,IAAI,gCAAe,CAAC,2BAA2B,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;IAE5E,4CAA4C;IAC5C,OAAO;QACL,KAAK,EAAE;YACL,IAAI,EAAE;gBACJ,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;oBACtB,MAAM,IAAI,GAAG,IAAA,uCAAkB,EAAC,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;oBAChE,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAQ,CAAC;gBACvC,CAAC;aACF;YACD,IAAI,EAAE;gBACJ,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;oBACtB,MAAM,IAAI,GAAG,IAAA,uCAAkB,EAAC,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;oBAChE,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAQ,CAAC;gBACvC,CAAC;gBACD,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;oBACtB,MAAM,IAAI,GAAG,IAAA,uCAAkB,EAAC,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;oBAChE,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAQ,CAAC;gBACvC,CAAC;aACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAzCW,QAAA,eAAe,mBAyC1B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* .what = convert a zod schema to JSON schema for native SDK enforcement
|
|
4
|
+
* .why = enables native structured output support in SDKs, reducing
|
|
5
|
+
* token waste on validation retries
|
|
6
|
+
*
|
|
7
|
+
* .note = different SDKs require different conversion options:
|
|
8
|
+
* - claude-agent-sdk: { $refStrategy: 'root' }
|
|
9
|
+
* - codex-sdk: { target: 'openAi' }
|
|
10
|
+
*/
|
|
11
|
+
export declare const castZodToJsonSchema: (input: {
|
|
12
|
+
schema: z.ZodSchema;
|
|
13
|
+
target: 'claude' | 'openai';
|
|
14
|
+
}) => object;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.castZodToJsonSchema = void 0;
|
|
4
|
+
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
5
|
+
/**
|
|
6
|
+
* .what = convert a zod schema to JSON schema for native SDK enforcement
|
|
7
|
+
* .why = enables native structured output support in SDKs, reducing
|
|
8
|
+
* token waste on validation retries
|
|
9
|
+
*
|
|
10
|
+
* .note = different SDKs require different conversion options:
|
|
11
|
+
* - claude-agent-sdk: { $refStrategy: 'root' }
|
|
12
|
+
* - codex-sdk: { target: 'openAi' }
|
|
13
|
+
*/
|
|
14
|
+
const castZodToJsonSchema = (input) => {
|
|
15
|
+
// convert based on target SDK
|
|
16
|
+
if (input.target === 'claude') {
|
|
17
|
+
return (0, zod_to_json_schema_1.zodToJsonSchema)(input.schema, { $refStrategy: 'root' });
|
|
18
|
+
}
|
|
19
|
+
// openai target
|
|
20
|
+
return (0, zod_to_json_schema_1.zodToJsonSchema)(input.schema, { target: 'openAi' });
|
|
21
|
+
};
|
|
22
|
+
exports.castZodToJsonSchema = castZodToJsonSchema;
|
|
23
|
+
//# sourceMappingURL=castZodToJsonSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"castZodToJsonSchema.js","sourceRoot":"","sources":["../../../src/domain.operations/schema/castZodToJsonSchema.ts"],"names":[],"mappings":";;;AACA,2DAAqD;AAErD;;;;;;;;GAQG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAGnC,EAAU,EAAE;IACX,8BAA8B;IAC9B,IAAI,KAAK,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAA,oCAAe,EAAC,KAAK,CAAC,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,gBAAgB;IAChB,OAAO,IAAA,oCAAe,EAAC,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC7D,CAAC,CAAC;AAXW,QAAA,mBAAmB,uBAW9B"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "rhachet",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "A framework for reliable, thorough thought. Weave threads of thought via stitches.",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.18.0",
|
|
6
6
|
"repository": "ehmpathy/rhachet",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/rhachet",
|
|
8
8
|
"keywords": [
|
|
@@ -54,6 +54,8 @@
|
|
|
54
54
|
"prepare:rhachet": "rhachet init && rhachet roles link --repo ehmpathy --role mechanic && rhachet roles link --repo bhuild --role behaver && rhachet roles link --repo bhrain --role reviewer && rhachet roles init --role mechanic && rhachet roles init --role behaver"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
+
"@anthropic-ai/claude-agent-sdk": "0.1.76",
|
|
58
|
+
"@anthropic-ai/sdk": "0.71.2",
|
|
57
59
|
"@ehmpathy/uni-time": "1.9.0",
|
|
58
60
|
"as-procedure": "1.1.6",
|
|
59
61
|
"bottleneck": "2.19.5",
|
|
@@ -63,12 +65,15 @@
|
|
|
63
65
|
"fast-glob": "3.3.3",
|
|
64
66
|
"flattie": "1.1.1",
|
|
65
67
|
"helpful-errors": "1.5.3",
|
|
68
|
+
"@openai/codex-sdk": "0.77.0",
|
|
66
69
|
"openai": "5.8.2",
|
|
67
70
|
"rhachet-artifact": "1.0.1",
|
|
68
71
|
"rhachet-artifact-git": "1.1.3",
|
|
69
72
|
"serde-fns": "1.3.1",
|
|
70
73
|
"type-fns": "1.21.0",
|
|
71
|
-
"uuid-fns": "1.0.1"
|
|
74
|
+
"uuid-fns": "1.0.1",
|
|
75
|
+
"zod": "3.25.76",
|
|
76
|
+
"zod-to-json-schema": "3.25.1"
|
|
72
77
|
},
|
|
73
78
|
"devDependencies": {
|
|
74
79
|
"@biomejs/biome": "2.3.8",
|