rhachet 1.17.0 → 1.19.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 +99 -0
- package/dist/_topublish/rhachet-brain-openai/src/repls/genBrainRepl.js.map +1 -0
- package/dist/contract/cli/invoke.js +14 -2
- package/dist/contract/cli/invoke.js.map +1 -1
- package/dist/contract/cli/invokeAct.d.ts +14 -0
- package/dist/contract/cli/invokeAct.js +92 -0
- package/dist/contract/cli/invokeAct.js.map +1 -0
- package/dist/contract/cli/invokeAsk.d.ts +4 -1
- package/dist/contract/cli/invokeAsk.js +84 -21
- package/dist/contract/cli/invokeAsk.js.map +1 -1
- package/dist/contract/cli/invokeRun.d.ts +6 -2
- package/dist/contract/cli/invokeRun.js +111 -18
- package/dist/contract/cli/invokeRun.js.map +1 -1
- package/dist/contract/sdk.d.ts +3 -0
- package/dist/contract/sdk.js +7 -1
- package/dist/contract/sdk.js.map +1 -1
- package/dist/domain.objects/Actor.d.ts +94 -0
- package/dist/domain.objects/Actor.js +18 -0
- package/dist/domain.objects/Actor.js.map +1 -0
- package/dist/domain.objects/ActorRoleSkill.d.ts +41 -0
- package/dist/domain.objects/ActorRoleSkill.js +8 -0
- package/dist/domain.objects/ActorRoleSkill.js.map +1 -0
- 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/InvokeHooks.d.ts +38 -1
- package/dist/domain.objects/Role.d.ts +43 -2
- package/dist/domain.objects/Role.js +9 -0
- package/dist/domain.objects/Role.js.map +1 -1
- package/dist/domain.objects/index.d.ts +5 -0
- package/dist/domain.objects/index.js +5 -0
- package/dist/domain.objects/index.js.map +1 -1
- package/dist/domain.operations/actor/actorAct.d.ts +15 -0
- package/dist/domain.operations/actor/actorAct.js +30 -0
- package/dist/domain.operations/actor/actorAct.js.map +1 -0
- package/dist/domain.operations/actor/actorAsk.d.ts +15 -0
- package/dist/domain.operations/actor/actorAsk.js +32 -0
- package/dist/domain.operations/actor/actorAsk.js.map +1 -0
- package/dist/domain.operations/actor/actorRun.d.ts +11 -0
- package/dist/domain.operations/actor/actorRun.js +25 -0
- package/dist/domain.operations/actor/actorRun.js.map +1 -0
- package/dist/domain.operations/actor/findActorBrainInAllowlist.d.ts +16 -0
- package/dist/domain.operations/actor/findActorBrainInAllowlist.js +33 -0
- package/dist/domain.operations/actor/findActorBrainInAllowlist.js.map +1 -0
- package/dist/domain.operations/actor/findActorRoleSkillBySlug.d.ts +13 -0
- package/dist/domain.operations/actor/findActorRoleSkillBySlug.js +68 -0
- package/dist/domain.operations/actor/findActorRoleSkillBySlug.js.map +1 -0
- package/dist/domain.operations/actor/genActor.d.ts +18 -0
- package/dist/domain.operations/actor/genActor.js +98 -0
- package/dist/domain.operations/actor/genActor.js.map +1 -0
- 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/invoke/executeSkill.d.ts +3 -1
- package/dist/domain.operations/invoke/executeSkill.js +16 -3
- package/dist/domain.operations/invoke/executeSkill.js.map +1 -1
- package/dist/domain.operations/invoke/getBrainReplsByOpts.d.ts +14 -0
- package/dist/domain.operations/invoke/getBrainReplsByOpts.js +43 -0
- package/dist/domain.operations/invoke/getBrainReplsByOpts.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
- package/readme.md +175 -34
|
@@ -27,6 +27,11 @@ __exportStar(require("./Thread"), exports);
|
|
|
27
27
|
__exportStar(require("./Threads"), exports);
|
|
28
28
|
// export * from './Weave';
|
|
29
29
|
// export * from './Weaver';
|
|
30
|
+
__exportStar(require("./Actor"), exports);
|
|
31
|
+
__exportStar(require("./ActorRoleSkill"), exports);
|
|
32
|
+
__exportStar(require("./BrainAtom"), exports);
|
|
33
|
+
__exportStar(require("./BrainRepl"), exports);
|
|
34
|
+
__exportStar(require("./ContextBrain"), exports);
|
|
30
35
|
__exportStar(require("./InvokeHooks"), exports);
|
|
31
36
|
__exportStar(require("./InvokeOpts"), exports);
|
|
32
37
|
__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,0CAAwB;AACxB,mDAAiC;AACjC,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,15 @@
|
|
|
1
|
+
import type { ActorRoleSkill } from '../../domain.objects/ActorRoleSkill';
|
|
2
|
+
import type { BrainRepl } from '../../domain.objects/BrainRepl';
|
|
3
|
+
import type { Role } from '../../domain.objects/Role';
|
|
4
|
+
/**
|
|
5
|
+
* .what = executes a rigid skill with a brain
|
|
6
|
+
* .why = deterministic harness with probabilistic brain operations
|
|
7
|
+
*
|
|
8
|
+
* .note = skill is pre-resolved by genActor; this just executes
|
|
9
|
+
*/
|
|
10
|
+
export declare const actorAct: (input: {
|
|
11
|
+
role: Role;
|
|
12
|
+
brain: BrainRepl;
|
|
13
|
+
skill: ActorRoleSkill;
|
|
14
|
+
args: Record<string, unknown>;
|
|
15
|
+
}) => Promise<unknown>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.actorAct = void 0;
|
|
4
|
+
const getRoleBriefs_1 = require("../../domain.operations/role/getRoleBriefs");
|
|
5
|
+
/**
|
|
6
|
+
* .what = executes a rigid skill with a brain
|
|
7
|
+
* .why = deterministic harness with probabilistic brain operations
|
|
8
|
+
*
|
|
9
|
+
* .note = skill is pre-resolved by genActor; this just executes
|
|
10
|
+
*/
|
|
11
|
+
const actorAct = async (input) => {
|
|
12
|
+
// resolve briefs from role
|
|
13
|
+
const briefs = await (0, getRoleBriefs_1.getRoleBriefs)({
|
|
14
|
+
by: {
|
|
15
|
+
role: { name: input.role.slug },
|
|
16
|
+
briefs: { glob: '**/*' },
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
// execute rigid skill with brain
|
|
20
|
+
const result = await input.brain.act({
|
|
21
|
+
role: { briefs },
|
|
22
|
+
prompt: `Execute skill "${input.skill.slug}" with args: ${JSON.stringify(input.args)}`,
|
|
23
|
+
schema: {
|
|
24
|
+
output: input.skill.schema?.output ?? {},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
exports.actorAct = actorAct;
|
|
30
|
+
//# sourceMappingURL=actorAct.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actorAct.js","sourceRoot":"","sources":["../../../src/domain.operations/actor/actorAct.ts"],"names":[],"mappings":";;;AAGA,6EAA0E;AAE1E;;;;;GAKG;AACI,MAAM,QAAQ,GAAG,KAAK,EAAE,KAK9B,EAAoB,EAAE;IACrB,2BAA2B;IAC3B,MAAM,MAAM,GAAG,MAAM,IAAA,6BAAa,EAAC;QACjC,EAAE,EAAE;YACF,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE;YAC/B,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACzB;KACF,CAAC,CAAC;IAEH,iCAAiC;IACjC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;QACnC,IAAI,EAAE,EAAE,MAAM,EAAE;QAChB,MAAM,EAAE,kBAAkB,KAAK,CAAC,KAAK,CAAC,IAAI,gBAAgB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACtF,MAAM,EAAE;YACN,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,IAAK,EAAU;SAClD;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAxBW,QAAA,QAAQ,YAwBnB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BrainRepl } from '../../domain.objects/BrainRepl';
|
|
2
|
+
import type { Role } from '../../domain.objects/Role';
|
|
3
|
+
/**
|
|
4
|
+
* .what = starts a fluid conversation with a brain
|
|
5
|
+
* .why = open-ended exploration, brain decides path
|
|
6
|
+
*
|
|
7
|
+
* todo: support --interactive mode for cli invocations
|
|
8
|
+
*/
|
|
9
|
+
export declare const actorAsk: (input: {
|
|
10
|
+
role: Role;
|
|
11
|
+
brain: BrainRepl;
|
|
12
|
+
prompt: string;
|
|
13
|
+
}) => Promise<{
|
|
14
|
+
response: string;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.actorAsk = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const getRoleBriefs_1 = require("../../domain.operations/role/getRoleBriefs");
|
|
6
|
+
/**
|
|
7
|
+
* .what = starts a fluid conversation with a brain
|
|
8
|
+
* .why = open-ended exploration, brain decides path
|
|
9
|
+
*
|
|
10
|
+
* todo: support --interactive mode for cli invocations
|
|
11
|
+
*/
|
|
12
|
+
const actorAsk = async (input) => {
|
|
13
|
+
// resolve briefs from role
|
|
14
|
+
const briefs = await (0, getRoleBriefs_1.getRoleBriefs)({
|
|
15
|
+
by: {
|
|
16
|
+
role: { name: input.role.slug },
|
|
17
|
+
briefs: { glob: '**/*' },
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
// execute fluid conversation with brain
|
|
21
|
+
// note: openai requires object schema, so wrap response in object
|
|
22
|
+
const result = await input.brain.ask({
|
|
23
|
+
role: { briefs },
|
|
24
|
+
prompt: input.prompt,
|
|
25
|
+
schema: {
|
|
26
|
+
output: zod_1.z.object({ response: zod_1.z.string() }),
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
31
|
+
exports.actorAsk = actorAsk;
|
|
32
|
+
//# sourceMappingURL=actorAsk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actorAsk.js","sourceRoot":"","sources":["../../../src/domain.operations/actor/actorAsk.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAIxB,6EAA0E;AAE1E;;;;;GAKG;AACI,MAAM,QAAQ,GAAG,KAAK,EAAE,KAI9B,EAAiC,EAAE;IAClC,2BAA2B;IAC3B,MAAM,MAAM,GAAG,MAAM,IAAA,6BAAa,EAAC;QACjC,EAAE,EAAE;YACF,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE;YAC/B,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACzB;KACF,CAAC,CAAC;IAEH,wCAAwC;IACxC,kEAAkE;IAClE,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;QACnC,IAAI,EAAE,EAAE,MAAM,EAAE;QAChB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,MAAM,EAAE;YACN,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,CAAC;SAC3C;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAxBW,QAAA,QAAQ,YAwBnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ActorRoleSkill } from '../../domain.objects/ActorRoleSkill';
|
|
2
|
+
/**
|
|
3
|
+
* .what = executes a solid skill via spawn
|
|
4
|
+
* .why = deterministic shell execution, no brain
|
|
5
|
+
*
|
|
6
|
+
* .note = skill is pre-resolved by genActor; this just executes
|
|
7
|
+
*/
|
|
8
|
+
export declare const actorRun: (input: {
|
|
9
|
+
skill: ActorRoleSkill;
|
|
10
|
+
args: Record<string, unknown>;
|
|
11
|
+
}) => Promise<unknown>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.actorRun = void 0;
|
|
4
|
+
const executeSkill_1 = require("../../domain.operations/invoke/executeSkill");
|
|
5
|
+
/**
|
|
6
|
+
* .what = executes a solid skill via spawn
|
|
7
|
+
* .why = deterministic shell execution, no brain
|
|
8
|
+
*
|
|
9
|
+
* .note = skill is pre-resolved by genActor; this just executes
|
|
10
|
+
*/
|
|
11
|
+
const actorRun = async (input) => {
|
|
12
|
+
// convert skill args object to CLI args array
|
|
13
|
+
const argsArray = [];
|
|
14
|
+
for (const [key, value] of Object.entries(input.args)) {
|
|
15
|
+
argsArray.push(`--${key}`, String(value));
|
|
16
|
+
}
|
|
17
|
+
// execute skill via spawn
|
|
18
|
+
const result = await (0, executeSkill_1.executeSkill)({
|
|
19
|
+
skill: input.skill.executable,
|
|
20
|
+
args: argsArray,
|
|
21
|
+
});
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
exports.actorRun = actorRun;
|
|
25
|
+
//# sourceMappingURL=actorRun.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actorRun.js","sourceRoot":"","sources":["../../../src/domain.operations/actor/actorRun.ts"],"names":[],"mappings":";;;AACA,6EAA0E;AAE1E;;;;;GAKG;AACI,MAAM,QAAQ,GAAG,KAAK,EAAE,KAG9B,EAAoB,EAAE;IACrB,8CAA8C;IAC9C,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtD,SAAS,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,0BAA0B;IAC1B,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAY,EAAC;QAChC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU;QAC7B,IAAI,EAAE,SAAS;KAChB,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAjBW,QAAA,QAAQ,YAiBnB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BrainRepl } from '../../domain.objects/BrainRepl';
|
|
2
|
+
/**
|
|
3
|
+
* .what = finds a brain in the actor's allowlist
|
|
4
|
+
* .why = validates that a requested brain is permitted by the actor
|
|
5
|
+
*
|
|
6
|
+
* .note = accepts either:
|
|
7
|
+
* - ref: { repo, slug } for lookup by unique key
|
|
8
|
+
* - direct BrainRepl instance for validation against allowlist
|
|
9
|
+
*/
|
|
10
|
+
export declare const findActorBrainInAllowlist: (input: {
|
|
11
|
+
brain: {
|
|
12
|
+
repo: string;
|
|
13
|
+
slug: string;
|
|
14
|
+
} | BrainRepl;
|
|
15
|
+
allowlist: BrainRepl[];
|
|
16
|
+
}) => BrainRepl;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findActorBrainInAllowlist = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
/**
|
|
6
|
+
* .what = finds a brain in the actor's allowlist
|
|
7
|
+
* .why = validates that a requested brain is permitted by the actor
|
|
8
|
+
*
|
|
9
|
+
* .note = accepts either:
|
|
10
|
+
* - ref: { repo, slug } for lookup by unique key
|
|
11
|
+
* - direct BrainRepl instance for validation against allowlist
|
|
12
|
+
*/
|
|
13
|
+
const findActorBrainInAllowlist = (input) => {
|
|
14
|
+
// extract repo and slug from brain (whether ref or instance)
|
|
15
|
+
const brainRef = {
|
|
16
|
+
repo: input.brain.repo,
|
|
17
|
+
slug: input.brain.slug,
|
|
18
|
+
};
|
|
19
|
+
// lookup brain in allowlist by unique key
|
|
20
|
+
const brainFound = input.allowlist.find((b) => b.repo === brainRef.repo && b.slug === brainRef.slug);
|
|
21
|
+
// fail if brain not in allowlist
|
|
22
|
+
if (!brainFound)
|
|
23
|
+
throw new helpful_errors_1.BadRequestError('brain not in actor allowlist', {
|
|
24
|
+
brainRef,
|
|
25
|
+
allowlistRefs: input.allowlist.map((b) => ({
|
|
26
|
+
repo: b.repo,
|
|
27
|
+
slug: b.slug,
|
|
28
|
+
})),
|
|
29
|
+
});
|
|
30
|
+
return brainFound;
|
|
31
|
+
};
|
|
32
|
+
exports.findActorBrainInAllowlist = findActorBrainInAllowlist;
|
|
33
|
+
//# sourceMappingURL=findActorBrainInAllowlist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findActorBrainInAllowlist.js","sourceRoot":"","sources":["../../../src/domain.operations/actor/findActorBrainInAllowlist.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAIjD;;;;;;;GAOG;AACI,MAAM,yBAAyB,GAAG,CAAC,KAGzC,EAAa,EAAE;IACd,6DAA6D;IAC7D,MAAM,QAAQ,GAAG;QACf,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI;QACtB,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI;KACvB,CAAC;IAEF,0CAA0C;IAC1C,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CACrC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,CAC5D,CAAC;IAEF,iCAAiC;IACjC,IAAI,CAAC,UAAU;QACb,MAAM,IAAI,gCAAe,CAAC,8BAA8B,EAAE;YACxD,QAAQ;YACR,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACzC,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,IAAI,EAAE,CAAC,CAAC,IAAI;aACb,CAAC,CAAC;SACJ,CAAC,CAAC;IAEL,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AA1BW,QAAA,yBAAyB,6BA0BpC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ActorRoleSkill } from '../../domain.objects/ActorRoleSkill';
|
|
2
|
+
import type { Role } from '../../domain.objects/Role';
|
|
3
|
+
/**
|
|
4
|
+
* .what = finds a skill by slug for a role
|
|
5
|
+
* .why = resolves skill from role.skills[route] or .agent/ dirs
|
|
6
|
+
*
|
|
7
|
+
* .note = role.skills[route] takes precedence over .agent/ dirs (usecase.8)
|
|
8
|
+
*/
|
|
9
|
+
export declare const findActorRoleSkillBySlug: (input: {
|
|
10
|
+
slug: string;
|
|
11
|
+
role: Role;
|
|
12
|
+
route: 'solid' | 'rigid';
|
|
13
|
+
}) => ActorRoleSkill;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findActorRoleSkillBySlug = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
const ActorRoleSkill_1 = require("../../domain.objects/ActorRoleSkill");
|
|
6
|
+
const discoverSkillExecutables_1 = require("../../domain.operations/invoke/discoverSkillExecutables");
|
|
7
|
+
/**
|
|
8
|
+
* .what = finds a skill by slug for a role
|
|
9
|
+
* .why = resolves skill from role.skills[route] or .agent/ dirs
|
|
10
|
+
*
|
|
11
|
+
* .note = role.skills[route] takes precedence over .agent/ dirs (usecase.8)
|
|
12
|
+
*/
|
|
13
|
+
const findActorRoleSkillBySlug = (input) => {
|
|
14
|
+
// check role.skills[route] first (takes precedence per usecase.8)
|
|
15
|
+
const skillsForRoute = input.route === 'solid' ? input.role.skills.solid : input.role.skills.rigid;
|
|
16
|
+
// lookup schema from role.skills[route]
|
|
17
|
+
const skillSchema = skillsForRoute?.[input.slug];
|
|
18
|
+
if (skillSchema) {
|
|
19
|
+
// find executable from .agent/ dirs (skill schema defines type, but executable runs)
|
|
20
|
+
const executables = (0, discoverSkillExecutables_1.discoverSkillExecutables)({
|
|
21
|
+
roleSlug: input.role.slug,
|
|
22
|
+
skillSlug: input.slug,
|
|
23
|
+
});
|
|
24
|
+
// fail fast if skill is declared but no executable found
|
|
25
|
+
if (executables.length === 0)
|
|
26
|
+
throw new helpful_errors_1.BadRequestError(`skill "${input.slug}" declared in role.skills.${input.route} but no executable found in .agent/`, {
|
|
27
|
+
skillSlug: input.slug,
|
|
28
|
+
roleSlug: input.role.slug,
|
|
29
|
+
route: input.route,
|
|
30
|
+
hint: `create .agent/repo=.this/role=${input.role.slug}/skills/${input.slug}.sh`,
|
|
31
|
+
});
|
|
32
|
+
return new ActorRoleSkill_1.ActorRoleSkill({
|
|
33
|
+
slug: input.slug,
|
|
34
|
+
route: input.route,
|
|
35
|
+
source: 'role.skills',
|
|
36
|
+
schema: skillSchema,
|
|
37
|
+
executable: executables[0],
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
// fall back to .agent/ discovery (executable exists but no schema)
|
|
41
|
+
const executables = (0, discoverSkillExecutables_1.discoverSkillExecutables)({
|
|
42
|
+
roleSlug: input.role.slug,
|
|
43
|
+
skillSlug: input.slug,
|
|
44
|
+
});
|
|
45
|
+
// executable exists but no schema = not usable via actor contracts
|
|
46
|
+
if (executables.length > 0)
|
|
47
|
+
throw new helpful_errors_1.BadRequestError(`skill "${input.slug}" found in .agent/ but lacks schema in role.skills.${input.route}`, {
|
|
48
|
+
skillSlug: input.slug,
|
|
49
|
+
roleSlug: input.role.slug,
|
|
50
|
+
route: input.route,
|
|
51
|
+
hint: `add schema to role.skills.${input.route}.${input.slug} to use via actor contracts`,
|
|
52
|
+
executable: executables[0],
|
|
53
|
+
});
|
|
54
|
+
// skill not found
|
|
55
|
+
throw new helpful_errors_1.BadRequestError(`skill not found: ${input.slug}`, {
|
|
56
|
+
skillSlug: input.slug,
|
|
57
|
+
roleSlug: input.role.slug,
|
|
58
|
+
route: input.route,
|
|
59
|
+
availableSolidSkills: input.role.skills.solid
|
|
60
|
+
? Object.keys(input.role.skills.solid)
|
|
61
|
+
: [],
|
|
62
|
+
availableRigidSkills: input.role.skills.rigid
|
|
63
|
+
? Object.keys(input.role.skills.rigid)
|
|
64
|
+
: [],
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.findActorRoleSkillBySlug = findActorRoleSkillBySlug;
|
|
68
|
+
//# sourceMappingURL=findActorRoleSkillBySlug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findActorRoleSkillBySlug.js","sourceRoot":"","sources":["../../../src/domain.operations/actor/findActorRoleSkillBySlug.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Actor } from '../../domain.objects/Actor';
|
|
2
|
+
import type { BrainRepl } from '../../domain.objects/BrainRepl';
|
|
3
|
+
import type { Role } from '../../domain.objects/Role';
|
|
4
|
+
/**
|
|
5
|
+
* .what = creates an actor from a role and brain allowlist
|
|
6
|
+
* .why = composes role (skills + briefs) with brains for type-safe invocation
|
|
7
|
+
*
|
|
8
|
+
* .note =
|
|
9
|
+
* - first brain in allowlist is the default
|
|
10
|
+
* - .act() uses default brain when none specified
|
|
11
|
+
* - .act() validates brain against allowlist when specified
|
|
12
|
+
* - .run() executes solid skills without brain
|
|
13
|
+
* - .ask() starts fluid conversation with default brain
|
|
14
|
+
*/
|
|
15
|
+
export declare const genActor: <TRole extends Role<import("../../domain.objects/Role").RoleSkillRegistry, import("../../domain.objects/Role").RoleSkillRegistry>>(input: {
|
|
16
|
+
role: TRole;
|
|
17
|
+
brains: BrainRepl[];
|
|
18
|
+
}) => Actor<TRole>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genActor = void 0;
|
|
4
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
5
|
+
const Actor_1 = require("../../domain.objects/Actor");
|
|
6
|
+
const actorAct_1 = require("./actorAct");
|
|
7
|
+
const actorAsk_1 = require("./actorAsk");
|
|
8
|
+
const actorRun_1 = require("./actorRun");
|
|
9
|
+
const findActorBrainInAllowlist_1 = require("./findActorBrainInAllowlist");
|
|
10
|
+
const findActorRoleSkillBySlug_1 = require("./findActorRoleSkillBySlug");
|
|
11
|
+
/**
|
|
12
|
+
* .what = creates an actor from a role and brain allowlist
|
|
13
|
+
* .why = composes role (skills + briefs) with brains for type-safe invocation
|
|
14
|
+
*
|
|
15
|
+
* .note =
|
|
16
|
+
* - first brain in allowlist is the default
|
|
17
|
+
* - .act() uses default brain when none specified
|
|
18
|
+
* - .act() validates brain against allowlist when specified
|
|
19
|
+
* - .run() executes solid skills without brain
|
|
20
|
+
* - .ask() starts fluid conversation with default brain
|
|
21
|
+
*/
|
|
22
|
+
const genActor = (input) => {
|
|
23
|
+
// validate that at least one brain is provided
|
|
24
|
+
if (input.brains.length === 0)
|
|
25
|
+
throw new helpful_errors_1.BadRequestError('genActor requires at least one brain in allowlist', { roleSlug: input.role.slug });
|
|
26
|
+
// extract default brain (first in list)
|
|
27
|
+
const defaultBrain = input.brains[0];
|
|
28
|
+
// create bound .act() method with strong types
|
|
29
|
+
const act = async (actInput) => {
|
|
30
|
+
// resolve brain: use provided or default to first
|
|
31
|
+
const brainResolved = actInput.brain
|
|
32
|
+
? (0, findActorBrainInAllowlist_1.findActorBrainInAllowlist)({
|
|
33
|
+
brain: actInput.brain,
|
|
34
|
+
allowlist: input.brains,
|
|
35
|
+
})
|
|
36
|
+
: defaultBrain;
|
|
37
|
+
// extract skill slug and args from skill object
|
|
38
|
+
const entries = Object.entries(actInput.skill);
|
|
39
|
+
if (entries.length !== 1)
|
|
40
|
+
throw new helpful_errors_1.BadRequestError('actor.act expects exactly one skill entry', {
|
|
41
|
+
entriesCount: entries.length,
|
|
42
|
+
});
|
|
43
|
+
const [skillSlug, skillArgs] = entries[0];
|
|
44
|
+
// resolve skill from role
|
|
45
|
+
const skillResolved = (0, findActorRoleSkillBySlug_1.findActorRoleSkillBySlug)({
|
|
46
|
+
slug: skillSlug,
|
|
47
|
+
role: input.role,
|
|
48
|
+
route: 'rigid',
|
|
49
|
+
});
|
|
50
|
+
// delegate to actorAct with pre-resolved skill
|
|
51
|
+
return (0, actorAct_1.actorAct)({
|
|
52
|
+
role: input.role,
|
|
53
|
+
brain: brainResolved,
|
|
54
|
+
skill: skillResolved,
|
|
55
|
+
args: skillArgs,
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
// create bound .run() method with strong types
|
|
59
|
+
const run = async (runInput) => {
|
|
60
|
+
// extract skill slug and args from skill object
|
|
61
|
+
const entries = Object.entries(runInput.skill);
|
|
62
|
+
if (entries.length !== 1)
|
|
63
|
+
throw new helpful_errors_1.BadRequestError('actor.run expects exactly one skill entry', {
|
|
64
|
+
entriesCount: entries.length,
|
|
65
|
+
});
|
|
66
|
+
const [skillSlug, skillArgs] = entries[0];
|
|
67
|
+
// resolve skill from role
|
|
68
|
+
const skillResolved = (0, findActorRoleSkillBySlug_1.findActorRoleSkillBySlug)({
|
|
69
|
+
slug: skillSlug,
|
|
70
|
+
role: input.role,
|
|
71
|
+
route: 'solid',
|
|
72
|
+
});
|
|
73
|
+
// delegate to actorRun with pre-resolved skill
|
|
74
|
+
return (0, actorRun_1.actorRun)({
|
|
75
|
+
skill: skillResolved,
|
|
76
|
+
args: skillArgs,
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
// create bound .ask() method
|
|
80
|
+
const ask = async (askInput) => {
|
|
81
|
+
// delegate to actorAsk with default brain
|
|
82
|
+
return (0, actorAsk_1.actorAsk)({
|
|
83
|
+
role: input.role,
|
|
84
|
+
brain: defaultBrain,
|
|
85
|
+
prompt: askInput.prompt,
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
// return actor with bound methods via Actor.typed() for strong type preservation
|
|
89
|
+
return Actor_1.Actor.typed({
|
|
90
|
+
role: input.role,
|
|
91
|
+
brains: input.brains,
|
|
92
|
+
act,
|
|
93
|
+
run,
|
|
94
|
+
ask,
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
exports.genActor = genActor;
|
|
98
|
+
//# sourceMappingURL=genActor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genActor.js","sourceRoot":"","sources":["../../../src/domain.operations/actor/genActor.ts"],"names":[],"mappings":"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"}
|
|
@@ -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"}
|