rhachet 1.18.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.
Files changed (55) hide show
  1. package/dist/_topublish/rhachet-brain-openai/src/repls/genBrainRepl.js +3 -1
  2. package/dist/_topublish/rhachet-brain-openai/src/repls/genBrainRepl.js.map +1 -1
  3. package/dist/contract/cli/invoke.js +14 -2
  4. package/dist/contract/cli/invoke.js.map +1 -1
  5. package/dist/contract/cli/invokeAct.d.ts +14 -0
  6. package/dist/contract/cli/invokeAct.js +92 -0
  7. package/dist/contract/cli/invokeAct.js.map +1 -0
  8. package/dist/contract/cli/invokeAsk.d.ts +4 -1
  9. package/dist/contract/cli/invokeAsk.js +84 -21
  10. package/dist/contract/cli/invokeAsk.js.map +1 -1
  11. package/dist/contract/cli/invokeRun.d.ts +6 -2
  12. package/dist/contract/cli/invokeRun.js +111 -18
  13. package/dist/contract/cli/invokeRun.js.map +1 -1
  14. package/dist/contract/sdk.d.ts +1 -0
  15. package/dist/contract/sdk.js +3 -1
  16. package/dist/contract/sdk.js.map +1 -1
  17. package/dist/domain.objects/Actor.d.ts +94 -0
  18. package/dist/domain.objects/Actor.js +18 -0
  19. package/dist/domain.objects/Actor.js.map +1 -0
  20. package/dist/domain.objects/ActorRoleSkill.d.ts +41 -0
  21. package/dist/domain.objects/ActorRoleSkill.js +8 -0
  22. package/dist/domain.objects/ActorRoleSkill.js.map +1 -0
  23. package/dist/domain.objects/InvokeHooks.d.ts +38 -1
  24. package/dist/domain.objects/Role.d.ts +43 -2
  25. package/dist/domain.objects/Role.js +9 -0
  26. package/dist/domain.objects/Role.js.map +1 -1
  27. package/dist/domain.objects/index.d.ts +2 -0
  28. package/dist/domain.objects/index.js +2 -0
  29. package/dist/domain.objects/index.js.map +1 -1
  30. package/dist/domain.operations/actor/actorAct.d.ts +15 -0
  31. package/dist/domain.operations/actor/actorAct.js +30 -0
  32. package/dist/domain.operations/actor/actorAct.js.map +1 -0
  33. package/dist/domain.operations/actor/actorAsk.d.ts +15 -0
  34. package/dist/domain.operations/actor/actorAsk.js +32 -0
  35. package/dist/domain.operations/actor/actorAsk.js.map +1 -0
  36. package/dist/domain.operations/actor/actorRun.d.ts +11 -0
  37. package/dist/domain.operations/actor/actorRun.js +25 -0
  38. package/dist/domain.operations/actor/actorRun.js.map +1 -0
  39. package/dist/domain.operations/actor/findActorBrainInAllowlist.d.ts +16 -0
  40. package/dist/domain.operations/actor/findActorBrainInAllowlist.js +33 -0
  41. package/dist/domain.operations/actor/findActorBrainInAllowlist.js.map +1 -0
  42. package/dist/domain.operations/actor/findActorRoleSkillBySlug.d.ts +13 -0
  43. package/dist/domain.operations/actor/findActorRoleSkillBySlug.js +68 -0
  44. package/dist/domain.operations/actor/findActorRoleSkillBySlug.js.map +1 -0
  45. package/dist/domain.operations/actor/genActor.d.ts +18 -0
  46. package/dist/domain.operations/actor/genActor.js +98 -0
  47. package/dist/domain.operations/actor/genActor.js.map +1 -0
  48. package/dist/domain.operations/invoke/executeSkill.d.ts +3 -1
  49. package/dist/domain.operations/invoke/executeSkill.js +16 -3
  50. package/dist/domain.operations/invoke/executeSkill.js.map +1 -1
  51. package/dist/domain.operations/invoke/getBrainReplsByOpts.d.ts +14 -0
  52. package/dist/domain.operations/invoke/getBrainReplsByOpts.js +43 -0
  53. package/dist/domain.operations/invoke/getBrainReplsByOpts.js.map +1 -0
  54. package/package.json +1 -1
  55. package/readme.md +175 -34
@@ -0,0 +1,94 @@
1
+ import { DomainEntity } from 'domain-objects';
2
+ import type { z } from 'zod';
3
+ import type { BrainRepl } from './BrainRepl';
4
+ import type { Role, RoleSkillSchema } from './Role';
5
+ /**
6
+ * .what = extracts skill input type from a RoleSkillSchema
7
+ * .why = enables type inference for skill arguments
8
+ */
9
+ export type SkillInput<TSchema extends RoleSkillSchema> = z.infer<TSchema['input']>;
10
+ /**
11
+ * .what = extracts skill output type from a RoleSkillSchema
12
+ * .why = enables type inference for skill return values
13
+ */
14
+ export type SkillOutput<TSchema extends RoleSkillSchema> = z.infer<TSchema['output']>;
15
+ /**
16
+ * .what = type for actor.act() method
17
+ * .why = enables type-safe rigid skill invocation
18
+ */
19
+ export type ActorActOp<TRole extends Role> = <TSkillSlug extends keyof NonNullable<TRole['skills']['rigid']>>(input: {
20
+ brain?: {
21
+ repo: string;
22
+ slug: string;
23
+ } | BrainRepl;
24
+ skill: {
25
+ [K in TSkillSlug]: SkillInput<NonNullable<TRole['skills']['rigid']>[K]>;
26
+ };
27
+ }) => Promise<SkillOutput<NonNullable<TRole['skills']['rigid']>[TSkillSlug]>>;
28
+ /**
29
+ * .what = type for actor.run() method
30
+ * .why = enables type-safe solid skill invocation
31
+ */
32
+ export type ActorRunOp<TRole extends Role> = <TSkillSlug extends keyof NonNullable<TRole['skills']['solid']>>(input: {
33
+ skill: {
34
+ [K in TSkillSlug]: SkillInput<NonNullable<TRole['skills']['solid']>[K]>;
35
+ };
36
+ }) => Promise<SkillOutput<NonNullable<TRole['skills']['solid']>[TSkillSlug]>>;
37
+ /**
38
+ * .what = type for actor.ask() method
39
+ * .why = enables fluid conversation with brain
40
+ */
41
+ export type ActorAskOp = (input: {
42
+ prompt: string;
43
+ }) => Promise<{
44
+ response: string;
45
+ }>;
46
+ /**
47
+ * .what = a role assumed by a brain, ready for invocation
48
+ * .why =
49
+ * - enables sdk users to import and invoke actors directly
50
+ * - composes role (skills + briefs) with brain allowlist
51
+ * - provides type-safe .act(), .run(), .ask() methods
52
+ *
53
+ * .note = Actor = BrainRepl + Role composition
54
+ * - first brain in allowlist is the default
55
+ * - .act() invokes rigid skills (deterministic harness, brain operations)
56
+ * - .run() invokes solid skills (deterministic, no brain)
57
+ * - .ask() starts fluid conversation with default brain
58
+ */
59
+ export interface Actor<TRole extends Role = Role> {
60
+ /**
61
+ * .what = the role this actor assumes
62
+ */
63
+ role: TRole;
64
+ /**
65
+ * .what = the brains this actor is allowed to use
66
+ * .note = first brain is the default
67
+ */
68
+ brains: BrainRepl[];
69
+ /**
70
+ * .what = invokes a rigid skill with brain
71
+ * .why = deterministic harness with probabilistic brain operations
72
+ */
73
+ act: ActorActOp<TRole>;
74
+ /**
75
+ * .what = invokes a solid skill via spawn
76
+ * .why = deterministic shell execution, no brain
77
+ */
78
+ run: ActorRunOp<TRole>;
79
+ /**
80
+ * .what = starts a fluid conversation with the default brain
81
+ * .why = open-ended exploration, brain decides path
82
+ */
83
+ ask: ActorAskOp;
84
+ }
85
+ export declare class Actor<TRole extends Role = Role> extends DomainEntity<Actor<TRole>> implements Actor<TRole> {
86
+ static unique: readonly ["role.slug"];
87
+ /**
88
+ * .what = creates an Actor with preserved literal skill types from TRole
89
+ * .why = enables type-safe .act(), .run(), .ask() invocation
90
+ *
91
+ * .note = use Actor.typed() instead of raw object cast for proper type preservation
92
+ */
93
+ static typed<TRole extends Role>(input: Actor<TRole>): Actor<TRole>;
94
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Actor = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class Actor extends domain_objects_1.DomainEntity {
6
+ /**
7
+ * .what = creates an Actor with preserved literal skill types from TRole
8
+ * .why = enables type-safe .act(), .run(), .ask() invocation
9
+ *
10
+ * .note = use Actor.typed() instead of raw object cast for proper type preservation
11
+ */
12
+ static typed(input) {
13
+ return new Actor(input);
14
+ }
15
+ }
16
+ exports.Actor = Actor;
17
+ Actor.unique = ['role.slug'];
18
+ //# sourceMappingURL=Actor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Actor.js","sourceRoot":"","sources":["../../src/domain.objects/Actor.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAmG9C,MAAa,KACX,SAAQ,6BAA0B;IAKlC;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAqB,KAAmB;QACzD,OAAO,IAAI,KAAK,CAAQ,KAAK,CAAC,CAAC;IACjC,CAAC;;AAdH,sBAeC;AAXe,YAAM,GAAG,CAAC,WAAW,CAAU,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { DomainLiteral } from 'domain-objects';
2
+ import type { RoleSkillSchema } from './Role';
3
+ import type { RoleSkillExecutable } from './RoleSkillExecutable';
4
+ /**
5
+ * .what = a role skill that has been resolved and can be acted upon
6
+ * .why =
7
+ * - unified return type for skill resolution
8
+ * - explicit domain object for skill invocation
9
+ * - actors use this to invoke skills via .act() and .run()
10
+ *
11
+ * .note = executable is required; ActorRoleSkill is only constructable
12
+ * when a skill executable has been found
13
+ */
14
+ export interface ActorRoleSkill {
15
+ /**
16
+ * .what = the skill's slug identifier
17
+ */
18
+ slug: string;
19
+ /**
20
+ * .what = the thought route for this skill
21
+ * .note = solid = deterministic, rigid = brain-augmented
22
+ */
23
+ route: 'solid' | 'rigid';
24
+ /**
25
+ * .what = where this skill was resolved from
26
+ * .note = role.skills takes precedence over .agent/ discovery
27
+ */
28
+ source: 'role.skills' | '.agent/';
29
+ /**
30
+ * .what = the zod schema for input/output validation
31
+ * .note = required; skills must have schemas to be executable via actor contracts
32
+ */
33
+ schema: RoleSkillSchema;
34
+ /**
35
+ * .what = the executable file for this skill
36
+ * .note = required; skill cannot be acted upon without an executable
37
+ */
38
+ executable: RoleSkillExecutable;
39
+ }
40
+ export declare class ActorRoleSkill extends DomainLiteral<ActorRoleSkill> implements ActorRoleSkill {
41
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActorRoleSkill = void 0;
4
+ const domain_objects_1 = require("domain-objects");
5
+ class ActorRoleSkill extends domain_objects_1.DomainLiteral {
6
+ }
7
+ exports.ActorRoleSkill = ActorRoleSkill;
8
+ //# sourceMappingURL=ActorRoleSkill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActorRoleSkill.js","sourceRoot":"","sources":["../../src/domain.objects/ActorRoleSkill.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AA6C/C,MAAa,cACX,SAAQ,8BAA6B;CACT;AAF9B,wCAE8B"}
@@ -1,5 +1,31 @@
1
+ import type { z } from 'zod';
1
2
  import type { InvokeOpts } from '.';
2
- export interface InvokeHooks {
3
+ import type { Role, RoleSkillRegistry } from './Role';
4
+ /**
5
+ * .what = extracts input type for a single skill from a skill registry
6
+ * .why = enables type inference for skill inputs in hooks
7
+ */
8
+ type SkillInputFromRegistry<TRegistry extends RoleSkillRegistry, TSkill extends keyof TRegistry> = z.infer<TRegistry[TSkill]['input']>;
9
+ /**
10
+ * .what = union type of all skill inputs from a registry
11
+ * .why = enables onInvokeActInput to accept any valid skill input
12
+ */
13
+ type AnySkillInputFromRegistry<TRegistry extends RoleSkillRegistry> = {
14
+ [K in keyof TRegistry]: {
15
+ skill: K;
16
+ input: SkillInputFromRegistry<TRegistry, K>;
17
+ };
18
+ }[keyof TRegistry];
19
+ /**
20
+ * .what = hooks for customizing invoke behavior
21
+ * .why = enables input transformation before skill execution
22
+ *
23
+ * .note = generic TRole enables type-safe onInvokeActInput when Role.typed() is used
24
+ */
25
+ export interface InvokeHooks<TRole extends Role = Role> {
26
+ /**
27
+ * .what = transforms ask input before execution
28
+ */
3
29
  onInvokeAskInput: Array<(input: InvokeOpts<{
4
30
  ask: string;
5
31
  config: string;
@@ -7,4 +33,15 @@ export interface InvokeHooks {
7
33
  ask: string;
8
34
  config: string;
9
35
  }>>;
36
+ /**
37
+ * .what = transforms act input before skill execution
38
+ * .why = enables input manipulation (e.g., adding defaults, validation)
39
+ *
40
+ * .note = strongly typed when TRole preserves literal skill names via Role.typed()
41
+ */
42
+ onInvokeActInput?: TRole['skills']['rigid'] extends RoleSkillRegistry ? (input: AnySkillInputFromRegistry<NonNullable<TRole['skills']['rigid']>>) => AnySkillInputFromRegistry<NonNullable<TRole['skills']['rigid']>>['input'] : (input: {
43
+ skill: string;
44
+ input: Record<string, unknown>;
45
+ }) => Record<string, unknown>;
10
46
  }
47
+ export {};
@@ -1,13 +1,33 @@
1
1
  import { DomainEntity } from 'domain-objects';
2
+ import type { z } from 'zod';
2
3
  import type { RoleSkill } from './RoleSkill';
3
4
  import type { RoleTrait } from './RoleTrait';
5
+ /**
6
+ * .what = type definition for a skill's schema (input/output zod schemas)
7
+ * .why = enables type-safe skill invocation via .act() and .run()
8
+ */
9
+ export interface RoleSkillSchema {
10
+ input: z.ZodSchema;
11
+ output: z.ZodSchema;
12
+ }
13
+ /**
14
+ * .what = type for a record of skills with literal keys preserved
15
+ * .why = enables type inference of skill names via keyof
16
+ */
17
+ export type RoleSkillRegistry = {
18
+ readonly [slug: string]: RoleSkillSchema;
19
+ };
4
20
  /**
5
21
  * .what = defines a role that can have traits, know skills, and be instantiated across thread.context
6
22
  * .why =
7
23
  * - enables registration of usable roles (e.g., 'mechanic', 'designer', 'architect', 'ecologist')
8
24
  * - enables instantiation of thread.contexts
25
+ *
26
+ * .note = generic type parameters preserve literal skill names for type-safe invocation
27
+ * - TSolid: the solid skills record type (e.g., { 'wordcount': { input, output } })
28
+ * - TRigid: the rigid skills record type (e.g., { 'review': { input, output } })
9
29
  */
10
- export interface Role {
30
+ export interface Role<TSolid extends RoleSkillRegistry = RoleSkillRegistry, TRigid extends RoleSkillRegistry = RoleSkillRegistry> {
11
31
  /**
12
32
  * .what = a unique, readable identifier
13
33
  * .example = "mechanic"
@@ -40,12 +60,26 @@ export interface Role {
40
60
  * .what = the skills known by the role
41
61
  * .why = declares what the role can do
42
62
  * .how =
63
+ * - solid: typed skills for deterministic execution (no brain)
64
+ * - enables type-safe .run() invocation
65
+ * - rigid: typed skills for deterministic harness with brain operations
66
+ * - enables type-safe .act() invocation
43
67
  * - dirs: directory-based skills (e.g., .sh scripts) for linking/booting
44
68
  * - single { uri: string }: symlinks this dir as the full skills dir
45
69
  * - array { uri: string }[]: symlinks each dir within the skills dir
46
70
  * - refs: programmatic RoleSkill references for execution
47
71
  */
48
72
  skills: {
73
+ /**
74
+ * .what = solid skills (deterministic, no brain)
75
+ * .why = type-safe .run() invocation
76
+ */
77
+ solid?: TSolid;
78
+ /**
79
+ * .what = rigid skills (deterministic harness, brain operations)
80
+ * .why = type-safe .act() invocation
81
+ */
82
+ rigid?: TRigid;
49
83
  dirs: {
50
84
  uri: string;
51
85
  } | {
@@ -89,6 +123,13 @@ export interface Role {
89
123
  }[];
90
124
  };
91
125
  }
92
- export declare class Role extends DomainEntity<Role> implements Role {
126
+ export declare class Role<TSolid extends RoleSkillRegistry = RoleSkillRegistry, TRigid extends RoleSkillRegistry = RoleSkillRegistry> extends DomainEntity<Role<TSolid, TRigid>> implements Role<TSolid, TRigid> {
93
127
  static unique: readonly ["slug"];
128
+ /**
129
+ * .what = creates a Role with preserved literal skill names
130
+ * .why = enables type-safe skill invocation via genActor
131
+ *
132
+ * .note = use Role.typed() instead of new Role() to preserve literal types
133
+ */
134
+ static typed<TSolid extends RoleSkillRegistry, TRigid extends RoleSkillRegistry>(input: Role<TSolid, TRigid>): Role<TSolid, TRigid>;
94
135
  }
@@ -3,6 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Role = void 0;
4
4
  const domain_objects_1 = require("domain-objects");
5
5
  class Role extends domain_objects_1.DomainEntity {
6
+ /**
7
+ * .what = creates a Role with preserved literal skill names
8
+ * .why = enables type-safe skill invocation via genActor
9
+ *
10
+ * .note = use Role.typed() instead of new Role() to preserve literal types
11
+ */
12
+ static typed(input) {
13
+ return new Role(input);
14
+ }
6
15
  }
7
16
  exports.Role = Role;
8
17
  Role.unique = ['slug'];
@@ -1 +1 @@
1
- {"version":3,"file":"Role.js","sourceRoot":"","sources":["../../src/domain.objects/Role.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAoF9C,MAAa,IAAK,SAAQ,6BAAkB;;AAA5C,oBAEC;AADe,WAAM,GAAG,CAAC,MAAM,CAAU,CAAC"}
1
+ {"version":3,"file":"Role.js","sourceRoot":"","sources":["../../src/domain.objects/Role.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AA2H9C,MAAa,IAIX,SAAQ,6BAAkC;IAK1C;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAGjB,KAA2B;QAC3B,OAAO,IAAI,IAAI,CAAiB,KAAK,CAAC,CAAC;IACzC,CAAC;;AApBH,oBAqBC;AAde,WAAM,GAAG,CAAC,MAAM,CAAU,CAAC"}
@@ -9,6 +9,8 @@ export * from './StitchStep';
9
9
  export * from './StitchTrail';
10
10
  export * from './Thread';
11
11
  export * from './Threads';
12
+ export * from './Actor';
13
+ export * from './ActorRoleSkill';
12
14
  export * from './BrainAtom';
13
15
  export * from './BrainRepl';
14
16
  export * from './ContextBrain';
@@ -27,6 +27,8 @@ __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);
30
32
  __exportStar(require("./BrainAtom"), exports);
31
33
  __exportStar(require("./BrainRepl"), exports);
32
34
  __exportStar(require("./ContextBrain"), 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,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"}
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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"}