rhachet 1.19.7 → 1.19.9
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-openai/src/repls/genBrainRepl.js +5 -2
- package/dist/_topublish/rhachet-brain-openai/src/repls/genBrainRepl.js.map +1 -1
- package/dist/contract/cli/invokeAct.js +4 -2
- package/dist/contract/cli/invokeAct.js.map +1 -1
- package/dist/contract/cli/invokeAsk.js +8 -3
- package/dist/contract/cli/invokeAsk.js.map +1 -1
- package/dist/contract/cli/invokeRolesBoot.js +6 -6
- package/dist/contract/cli/invokeRolesCost.js +8 -8
- package/dist/contract/cli/invokeRolesInit.js +36 -10
- package/dist/contract/cli/invokeRolesInit.js.map +1 -1
- package/dist/contract/cli/invokeRolesLink.js +10 -1
- package/dist/contract/cli/invokeRolesLink.js.map +1 -1
- package/dist/contract/cli/invokeRun.js +7 -7
- package/dist/contract/cli/invokeRun.js.map +1 -1
- package/dist/domain.objects/RoleInitExecutable.d.ts +3 -3
- package/dist/domain.objects/RoleInitExecutable.js +1 -1
- package/dist/domain.objects/RoleSkillArgGetter.d.ts +1 -1
- package/dist/domain.objects/RoleSkillExecutable.d.ts +3 -3
- package/dist/domain.objects/RoleSkillExecutable.js +1 -1
- package/dist/domain.operations/actor/findActorRoleSkillBySlug.js +10 -10
- package/dist/domain.operations/actor/genActor.js +5 -5
- package/dist/domain.operations/invoke/bootRoleResources.d.ts +3 -3
- package/dist/domain.operations/invoke/bootRoleResources.js +6 -6
- package/dist/domain.operations/invoke/discoverInitExecutables.d.ts +3 -3
- package/dist/domain.operations/invoke/discoverInitExecutables.js +10 -10
- package/dist/domain.operations/invoke/discoverSkillExecutables.d.ts +3 -3
- package/dist/domain.operations/invoke/discoverSkillExecutables.js +10 -10
- package/dist/domain.operations/invoke/findUniqueInitExecutable.d.ts +3 -3
- package/dist/domain.operations/invoke/findUniqueInitExecutable.js +12 -12
- package/dist/domain.operations/invoke/findUniqueSkillExecutable.d.ts +3 -3
- package/dist/domain.operations/invoke/findUniqueSkillExecutable.js +12 -12
- package/dist/domain.operations/invoke/inferRepoByRole.d.ts +1 -1
- package/dist/domain.operations/invoke/inferRepoByRole.js +3 -3
- package/dist/domain.operations/role/getRoleFileCosts.d.ts +2 -2
- package/dist/domain.operations/role/getRoleFileCosts.js +2 -2
- package/package.json +3 -2
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.genBrainRepl = void 0;
|
|
4
4
|
const codex_sdk_1 = require("@openai/codex-sdk");
|
|
5
|
+
const wrapper_fns_1 = require("wrapper-fns");
|
|
5
6
|
const BrainRepl_1 = require("../../../../domain.objects/BrainRepl");
|
|
6
7
|
const castBriefsToPrompt_1 = require("../../../../domain.operations/briefs/castBriefsToPrompt");
|
|
7
8
|
const castZodToJsonSchema_1 = require("../../../../domain.operations/schema/castZodToJsonSchema");
|
|
@@ -60,9 +61,11 @@ const invokeCodex = async (input) => {
|
|
|
60
61
|
model: input.model,
|
|
61
62
|
sandboxMode,
|
|
62
63
|
});
|
|
63
|
-
// compose full prompt and run
|
|
64
|
+
// compose full prompt and run with timeout + retry for resilience
|
|
64
65
|
const fullPrompt = composePromptWithSystem(input.prompt, systemPrompt);
|
|
65
|
-
const response = await thread.run(fullPrompt, { outputSchema })
|
|
66
|
+
const response = await (0, wrapper_fns_1.withRetry)((0, wrapper_fns_1.withTimeout)(async () => thread.run(fullPrompt, { outputSchema }), {
|
|
67
|
+
threshold: { seconds: 60 },
|
|
68
|
+
}))();
|
|
66
69
|
// parse output via schema for runtime validation
|
|
67
70
|
return input.schema.output.parse(JSON.parse(response.finalResponse));
|
|
68
71
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genBrainRepl.js","sourceRoot":"","sources":["../../../../../src/_topublish/rhachet-brain-openai/src/repls/genBrainRepl.ts"],"names":[],"mappings":";;;AAAA,iDAA0C;
|
|
1
|
+
{"version":3,"file":"genBrainRepl.js","sourceRoot":"","sources":["../../../../../src/_topublish/rhachet-brain-openai/src/repls/genBrainRepl.ts"],"names":[],"mappings":";;;AAAA,iDAA0C;AAI1C,6CAAqD;AAGrD,6DAA0D;AAC1D,yFAAsF;AACtF,2FAAwF;AAYxF;;;GAGG;AACH,MAAM,cAAc,GAGhB;IACF,cAAc,EAAE;QACd,KAAK,EAAE,SAAS,EAAE,sCAAsC;QACxD,WAAW,EAAE,kDAAkD;KAChE;IACD,kBAAkB,EAAE;QAClB,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,uDAAuD;KACrE;IACD,mBAAmB,EAAE;QACnB,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE,sCAAsC;KACpD;IACD,kBAAkB,EAAE;QAClB,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,gDAAgD;KAC9D;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,uBAAuB,GAAG,CAC9B,UAAkB,EAClB,YAAgC,EACxB,EAAE;IACV,IAAI,CAAC,YAAY;QAAE,OAAO,UAAU,CAAC;IACrC,OAAO,GAAG,YAAY,cAAc,UAAU,EAAE,CAAC;AACnD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,GAAG,KAAK,EAAW,KAMnC,EAAoB,EAAE;IACrB,oCAAoC;IACpC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM;QACpC,CAAC,CAAC,MAAM,IAAA,uCAAkB,EAAC,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACzD,CAAC,CAAC,SAAS,CAAC;IAEd,2DAA2D;IAC3D,MAAM,YAAY,GAAG,IAAA,yCAAmB,EAAC;QACvC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;QAC3B,MAAM,EAAE,QAAQ;KACjB,CAAC,CAAC;IAEH,sBAAsB;IACtB,MAAM,KAAK,GAAG,IAAI,iBAAK,CAAC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B,WAAW,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;QAEhE;;;WAGG;QACH,GAAG,EAAE,KAAK,EACR,QAIC,EACD,QAAgB,EACE,EAAE,CACpB,WAAW,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;KACjE,CAAC,CAAC;AACL,CAAC,CAAC;AAvCW,QAAA,YAAY,gBAuCvB"}
|
|
@@ -4,6 +4,7 @@ exports.invokeAct = void 0;
|
|
|
4
4
|
const helpful_errors_1 = require("helpful-errors");
|
|
5
5
|
const genActor_1 = require("../../domain.operations/actor/genActor");
|
|
6
6
|
const assureFindRole_1 = require("../../domain.operations/invoke/assureFindRole");
|
|
7
|
+
const inferRepoByRole_1 = require("../../domain.operations/invoke/inferRepoByRole");
|
|
7
8
|
const node_fs_1 = require("node:fs");
|
|
8
9
|
const node_path_1 = require("node:path");
|
|
9
10
|
/**
|
|
@@ -28,12 +29,13 @@ const invokeAct = ({ program, registries, brains, hooks, }) => {
|
|
|
28
29
|
// validate brains are available
|
|
29
30
|
if (brains.length === 0)
|
|
30
31
|
throw new helpful_errors_1.BadRequestError('no brains available. add getBrainRepls() to your rhachet.use.ts');
|
|
31
|
-
// find the role
|
|
32
|
+
// find the role and repo
|
|
32
33
|
const role = (0, assureFindRole_1.assureFindRole)({ registries, slug: opts.role });
|
|
33
34
|
if (!role)
|
|
34
35
|
throw new helpful_errors_1.BadRequestError(`role "${opts.role}" not found`, {
|
|
35
36
|
availableRoles: registries.flatMap((r) => r.roles.map((rr) => rr)),
|
|
36
37
|
});
|
|
38
|
+
const repo = (0, inferRepoByRole_1.inferRepoByRole)({ registries, slugRole: opts.role });
|
|
37
39
|
// resolve brain reference if provided
|
|
38
40
|
let brainRef;
|
|
39
41
|
if (opts.brain) {
|
|
@@ -64,7 +66,7 @@ const invokeAct = ({ program, registries, brains, hooks, }) => {
|
|
|
64
66
|
for (let attempt = 1; attempt <= attempts; attempt++) {
|
|
65
67
|
// log which skill will run
|
|
66
68
|
console.log(``);
|
|
67
|
-
console.log(`🔩 skill
|
|
69
|
+
console.log(`🔩 act rigid skill repo=${repo.slug}/role=${opts.role}/skill=${opts.skill} attempt=${attempt}/${attempts}`);
|
|
68
70
|
console.log(``);
|
|
69
71
|
// invoke actor.act with skill
|
|
70
72
|
const result = await actor.act({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invokeAct.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeAct.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAKjD,oEAAiE;AACjE,iFAA8E;
|
|
1
|
+
{"version":3,"file":"invokeAct.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeAct.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAKjD,oEAAiE;AACjE,iFAA8E;AAC9E,mFAAgF;AAEhF,qCAAwC;AACxC,yCAAoC;AAEpC;;;GAGG;AACI,MAAM,SAAS,GAAG,CAAC,EACxB,OAAO,EACP,UAAU,EACV,MAAM,EACN,KAAK,GAMN,EAAQ,EAAE;IACT,MAAM,UAAU,GAAG,OAAO;SACvB,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,iCAAiC,CAAC;SAC9C,cAAc,CAAC,mBAAmB,EAAE,gBAAgB,CAAC;SACrD,cAAc,CAAC,oBAAoB,EAAE,iBAAiB,CAAC;SACvD,MAAM,CAAC,mBAAmB,EAAE,kCAAkC,CAAC;SAC/D,MAAM,CAAC,oBAAoB,EAAE,0BAA0B,CAAC;SACxD,MAAM,CAAC,qBAAqB,EAAE,kBAAkB,CAAC;SACjD,MAAM,CACL,kBAAkB,EAClB,sDAAsD,CACvD;SACA,MAAM,CAAC,qBAAqB,EAAE,uCAAuC,CAAC;SACtE,kBAAkB,CAAC,IAAI,CAAC;SACxB,oBAAoB,CAAC,IAAI,CAAC,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AAC;YAEhB,8BAA8B;YAC9B,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC;gBAC7B,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,cAAc,EAAE;aACxC,CAAC,CAAC;YAEH,gBAAgB;YAChB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,oDAAoD;gBACpD,MAAM,UAAU,GACd,QAAQ,GAAG,CAAC;oBACV,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,OAAO,IAAI,CAAC;oBACnD,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;gBAClB,MAAM,YAAY,GAAG,IAAA,mBAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;gBACxD,IAAA,uBAAa,EAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC7D,OAAO,CAAC,GAAG,CAAC,wBAAwB,UAAU,EAAE,CAAC,CAAC;YACpD,CAAC;iBAAM,CAAC;gBACN,mBAAmB;gBACnB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAxHW,QAAA,SAAS,aAwHpB"}
|
|
@@ -5,6 +5,7 @@ const helpful_errors_1 = require("helpful-errors");
|
|
|
5
5
|
const genActor_1 = require("../../domain.operations/actor/genActor");
|
|
6
6
|
const assureFindRole_1 = require("../../domain.operations/invoke/assureFindRole");
|
|
7
7
|
const onInvokeAskInput_1 = require("../../domain.operations/invoke/hooks/onInvokeAskInput");
|
|
8
|
+
const inferRepoByRole_1 = require("../../domain.operations/invoke/inferRepoByRole");
|
|
8
9
|
const performInCurrentThread_1 = require("../../domain.operations/invoke/performInCurrentThread");
|
|
9
10
|
const performInIsolatedThreads_1 = require("../../domain.operations/invoke/performInIsolatedThreads");
|
|
10
11
|
/**
|
|
@@ -48,8 +49,12 @@ const performAskViaActorMode = async (input) => {
|
|
|
48
49
|
if (!input.opts.ask)
|
|
49
50
|
throw new helpful_errors_1.BadRequestError('--ask is required (e.g., --ask "review my code")');
|
|
50
51
|
// log which role will be asked
|
|
52
|
+
const repo = (0, inferRepoByRole_1.inferRepoByRole)({
|
|
53
|
+
registries: input.registries,
|
|
54
|
+
slugRole: input.opts.role,
|
|
55
|
+
});
|
|
51
56
|
console.log(``);
|
|
52
|
-
console.log(
|
|
57
|
+
console.log(`💧 ask fluid skill repo=${repo.slug}/role=${input.opts.role}`);
|
|
53
58
|
console.log(``);
|
|
54
59
|
// invoke actor.ask
|
|
55
60
|
const result = await actor.ask({ prompt: input.opts.ask });
|
|
@@ -112,14 +117,14 @@ const invokeAsk = ({ program, registries, brains, ...input }) => {
|
|
|
112
117
|
hooks: input.hooks,
|
|
113
118
|
});
|
|
114
119
|
}
|
|
115
|
-
//
|
|
120
|
+
// 💧 actor-mode: invoke fluid conversation via brain.repl
|
|
116
121
|
if (isActorMode) {
|
|
117
122
|
const role = (0, assureFindRole_1.assureFindRole)({ registries, slug: opts.role });
|
|
118
123
|
if (!role)
|
|
119
124
|
throw new helpful_errors_1.BadRequestError(`role "${opts.role}" not found`, {
|
|
120
125
|
availableRoles: registries.flatMap((r) => r.roles),
|
|
121
126
|
});
|
|
122
|
-
return await performAskViaActorMode({ opts, role, brains });
|
|
127
|
+
return await performAskViaActorMode({ opts, role, brains, registries });
|
|
123
128
|
}
|
|
124
129
|
// neither mode matched - unexpected
|
|
125
130
|
throw new helpful_errors_1.UnexpectedCodePathError('invokeAsk: neither stitch-mode nor actor-mode matched', { opts });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invokeAsk.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeAsk.ts"],"names":[],"mappings":";;;AACA,mDAA0E;AAO1E,oEAAiE;AACjE,iFAA8E;AAC9E,2FAAwF;AACxF,iGAA8F;AAC9F,qGAAkG;AAElG;;;GAGG;AACH,MAAM,uBAAuB,GAAG,KAAK,EAAE,KAKtC,EAAiB,EAAE;IAClB,gCAAgC;IAChC,MAAM,WAAW,GAAgD;QAC/D,GAAG,KAAK,CAAC,IAAI;QACb,GAAG,EACD,KAAK,CAAC,IAAI,CAAC,GAAG;YACd,wCAAuB,CAAC,KAAK,CAAC,sBAAsB,EAAE;gBACpD,IAAI,EAAE,KAAK,CAAC,IAAI;aACjB,CAAC;QACJ,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,8DAA8D;KAC1F,CAAC;IAEF,6BAA6B;IAC7B,MAAM,aAAa,GAAgD,KAAK,CAAC,KAAK;QAC5E,CAAC,CAAC,IAAA,mCAAgB,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;QAC7D,CAAC,CAAC,WAAW,CAAC;IAEhB,gFAAgF;IAChF,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ;QACrB,OAAO,MAAM,IAAA,mDAAwB,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;IAEjE,mDAAmD;IACnD,OAAO,MAAM,IAAA,+CAAsB,EAAC;QAClC,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE,KAAK,CAAC,UAAU;KAC7B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,sBAAsB,GAAG,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"invokeAsk.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeAsk.ts"],"names":[],"mappings":";;;AACA,mDAA0E;AAO1E,oEAAiE;AACjE,iFAA8E;AAC9E,2FAAwF;AACxF,mFAAgF;AAChF,iGAA8F;AAC9F,qGAAkG;AAElG;;;GAGG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,CAC/B,uDAAuD,EACvD,EAAE,IAAI,EAAE,CACT,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAlGW,QAAA,SAAS,aAkGpB"}
|
|
@@ -20,9 +20,9 @@ const invokeRolesBoot = ({ command, registries, }) => {
|
|
|
20
20
|
// require --role for all cases
|
|
21
21
|
if (!opts.role)
|
|
22
22
|
helpful_errors_1.BadRequestError.throw('--role is required (e.g., --role mechanic)');
|
|
23
|
-
const
|
|
24
|
-
// resolve
|
|
25
|
-
const
|
|
23
|
+
const slugRole = opts.role;
|
|
24
|
+
// resolve slugRepo
|
|
25
|
+
const slugRepo = (() => {
|
|
26
26
|
// normalize "this"/"THIS"/".this" to ".this"
|
|
27
27
|
const normalized = opts.repo?.trim().toLowerCase();
|
|
28
28
|
if (normalized === 'this' || normalized === '.this')
|
|
@@ -30,15 +30,15 @@ const invokeRolesBoot = ({ command, registries, }) => {
|
|
|
30
30
|
// otherwise lookup from registries
|
|
31
31
|
const repo = opts.repo
|
|
32
32
|
? registries.find((r) => r.slug === opts.repo)
|
|
33
|
-
: (0, inferRepoByRole_1.inferRepoByRole)({ registries,
|
|
33
|
+
: (0, inferRepoByRole_1.inferRepoByRole)({ registries, slugRole });
|
|
34
34
|
if (!repo)
|
|
35
35
|
helpful_errors_1.BadRequestError.throw(`No repo found with slug "${opts.repo}"`);
|
|
36
36
|
return repo.slug;
|
|
37
37
|
})();
|
|
38
38
|
// boot the role resources
|
|
39
39
|
await (0, bootRoleResources_1.bootRoleResources)({
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
slugRepo,
|
|
41
|
+
slugRole,
|
|
42
42
|
ifPresent: opts.ifPresent ?? false,
|
|
43
43
|
});
|
|
44
44
|
});
|
|
@@ -22,24 +22,24 @@ const invokeRolesCost = ({ command, registries, }) => {
|
|
|
22
22
|
// validate role is provided
|
|
23
23
|
if (!opts.role)
|
|
24
24
|
helpful_errors_1.BadRequestError.throw('--role is required (e.g., --role mechanic)');
|
|
25
|
-
const
|
|
25
|
+
const slugRole = opts.role;
|
|
26
26
|
// resolve repo from option or inference
|
|
27
27
|
const repo = opts.repo
|
|
28
28
|
? registries.find((r) => r.slug === opts.repo)
|
|
29
|
-
: (0, inferRepoByRole_1.inferRepoByRole)({ registries,
|
|
29
|
+
: (0, inferRepoByRole_1.inferRepoByRole)({ registries, slugRole });
|
|
30
30
|
if (!repo)
|
|
31
31
|
helpful_errors_1.BadRequestError.throw(`No repo found with slug "${opts.repo}"`);
|
|
32
32
|
// build role directory path
|
|
33
|
-
const roleDir = (0, node_path_1.resolve)(process.cwd(), '.agent', `repo=${repo.slug}`, `role=${
|
|
33
|
+
const roleDir = (0, node_path_1.resolve)(process.cwd(), '.agent', `repo=${repo.slug}`, `role=${slugRole}`);
|
|
34
34
|
// check if role directory exists
|
|
35
35
|
if (!(0, node_fs_1.existsSync)(roleDir)) {
|
|
36
|
-
helpful_errors_1.BadRequestError.throw(`Role directory not found: ${roleDir}\nRun "rhachet roles link --repo ${repo.slug} --role ${
|
|
36
|
+
helpful_errors_1.BadRequestError.throw(`Role directory not found: ${roleDir}\nRun "rhachet roles link --repo ${repo.slug} --role ${slugRole}" first`);
|
|
37
37
|
}
|
|
38
38
|
// get file costs
|
|
39
39
|
const fileCosts = (0, getRoleFileCosts_1.getRoleFileCosts)({
|
|
40
40
|
roleDir,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
slugRepo: repo.slug,
|
|
42
|
+
slugRole,
|
|
43
43
|
});
|
|
44
44
|
// handle empty role
|
|
45
45
|
if (fileCosts.length === 0) {
|
|
@@ -54,10 +54,10 @@ const invokeRolesCost = ({ command, registries, }) => {
|
|
|
54
54
|
const costFormatted = summary.totalCost < 0.01 ? `< $0.01` : (0, formatCostTree_1.formatCost)(summary.totalCost);
|
|
55
55
|
// print header
|
|
56
56
|
console.log(``);
|
|
57
|
-
console.log(`🌊 Role Cost Report: ${
|
|
57
|
+
console.log(`🌊 Role Cost Report: ${slugRole} @ ${repo.slug}`);
|
|
58
58
|
console.log(``);
|
|
59
59
|
// print tree structure with costs
|
|
60
|
-
const rootPath = `.agent/repo=${repo.slug}/role=${
|
|
60
|
+
const rootPath = `.agent/repo=${repo.slug}/role=${slugRole}`;
|
|
61
61
|
const tree = (0, formatCostTree_1.formatCostTree)({ fileCosts, rootPath });
|
|
62
62
|
console.log(tree);
|
|
63
63
|
console.log(``);
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.invokeRolesInit = void 0;
|
|
4
27
|
const helpful_errors_1 = require("helpful-errors");
|
|
@@ -7,6 +30,7 @@ const executeInit_1 = require("../../domain.operations/invoke/executeInit");
|
|
|
7
30
|
const findUniqueInitExecutable_1 = require("../../domain.operations/invoke/findUniqueInitExecutable");
|
|
8
31
|
const inferRepoByRole_1 = require("../../domain.operations/invoke/inferRepoByRole");
|
|
9
32
|
const node_child_process_1 = require("node:child_process");
|
|
33
|
+
const path = __importStar(require("node:path"));
|
|
10
34
|
/**
|
|
11
35
|
* .what = extracts all args after 'init' command from process.argv
|
|
12
36
|
* .why = captures full arg list for passthrough to init script
|
|
@@ -36,13 +60,13 @@ const invokeRolesInit = ({ command, registries, }) => {
|
|
|
36
60
|
// handle --command mode: run a specific init from linked inits directory
|
|
37
61
|
if (opts.command) {
|
|
38
62
|
const init = (0, findUniqueInitExecutable_1.findUniqueInitExecutable)({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
63
|
+
slugRepo: opts.repo,
|
|
64
|
+
slugRole: opts.role,
|
|
65
|
+
slugInit: opts.command,
|
|
42
66
|
});
|
|
43
67
|
// log which init will run
|
|
44
68
|
console.log(``);
|
|
45
|
-
console.log(`🔧 init
|
|
69
|
+
console.log(`🔧 run init repo=${init.slugRepo}/role=${init.slugRole}/init=${init.slug}`);
|
|
46
70
|
console.log(``);
|
|
47
71
|
// get all args after 'init' for passthrough
|
|
48
72
|
const rawArgs = getRawArgsAfterInit();
|
|
@@ -56,7 +80,7 @@ const invokeRolesInit = ({ command, registries, }) => {
|
|
|
56
80
|
const role = (0, assureFindRole_1.assureFindRole)({ registries, slug: opts.role });
|
|
57
81
|
const repo = opts.repo
|
|
58
82
|
? registries.find((r) => r.slug === opts.repo)
|
|
59
|
-
: (0, inferRepoByRole_1.inferRepoByRole)({ registries,
|
|
83
|
+
: (0, inferRepoByRole_1.inferRepoByRole)({ registries, slugRole: opts.role });
|
|
60
84
|
if (!repo)
|
|
61
85
|
helpful_errors_1.BadRequestError.throw(`No repo found with slug "${opts.repo}"`);
|
|
62
86
|
// check if role has init commands
|
|
@@ -68,11 +92,13 @@ const invokeRolesInit = ({ command, registries, }) => {
|
|
|
68
92
|
return;
|
|
69
93
|
}
|
|
70
94
|
console.log(``);
|
|
71
|
-
console.log(`🔧
|
|
72
|
-
console.log(``);
|
|
95
|
+
console.log(`🔧 run init repo=${repo.slug}/role=${role.slug}`);
|
|
73
96
|
// execute each command sequentially with explicit stdin passthrough
|
|
74
|
-
for (
|
|
75
|
-
|
|
97
|
+
for (let i = 0; i < execCmds.length; i++) {
|
|
98
|
+
const { cmd } = execCmds[i];
|
|
99
|
+
const cmdRelative = path.relative(process.cwd(), cmd);
|
|
100
|
+
const branch = i === execCmds.length - 1 ? '└─' : '├─';
|
|
101
|
+
console.log(` ${branch} ${cmdRelative}`);
|
|
76
102
|
const result = (0, node_child_process_1.spawnSync)(cmd, [], {
|
|
77
103
|
cwd: process.cwd(),
|
|
78
104
|
stdio: [process.stdin, process.stdout, process.stderr],
|
|
@@ -84,7 +110,7 @@ const invokeRolesInit = ({ command, registries, }) => {
|
|
|
84
110
|
}
|
|
85
111
|
}
|
|
86
112
|
console.log(``);
|
|
87
|
-
console.log(`✨
|
|
113
|
+
console.log(`✨ repo=${repo.slug}/role=${role.slug} init complete`);
|
|
88
114
|
console.log(``);
|
|
89
115
|
});
|
|
90
116
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invokeRolesInit.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeRolesInit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invokeRolesInit.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeRolesInit.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mDAAiD;AAGjD,iFAA8E;AAC9E,2EAAwE;AACxE,qGAAkG;AAClG,mFAAgF;AAEhF,2DAA+C;AAC/C,gDAAkC;AAElC;;;GAGG;AACH,MAAM,mBAAmB,GAAG,GAAa,EAAE;IACzC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,MAAM,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EAAE,GAAG,QAAQ,CAAC,CAAC,CAAE,CAAC;YAC7B,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;YACtD,MAAM,MAAM,GAAG,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;YACvD,OAAO,CAAC,GAAG,CAAC,MAAM,MAAM,IAAI,WAAW,EAAE,CAAC,CAAC;YAC3C,MAAM,MAAM,GAAG,IAAA,8BAAS,EAAC,GAAG,EAAE,EAAE,EAAE;gBAChC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;gBAClB,KAAK,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;gBACtD,KAAK,EAAE,WAAW;aACnB,CAAC,CAAC;YAEH,gCAAgC;YAChC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACxB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,IAAI,SAAS,IAAI,CAAC,IAAI,gBAAgB,CAAC,CAAC;QACnE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AApFW,QAAA,eAAe,mBAoF1B"}
|
|
@@ -26,7 +26,7 @@ const invokeRolesLink = ({ command, registries, }) => {
|
|
|
26
26
|
const role = (0, assureFindRole_1.assureFindRole)({ registries, slug: opts.role });
|
|
27
27
|
const repo = opts.repo
|
|
28
28
|
? registries.find((r) => r.slug === opts.repo)
|
|
29
|
-
: (0, inferRepoByRole_1.inferRepoByRole)({ registries,
|
|
29
|
+
: (0, inferRepoByRole_1.inferRepoByRole)({ registries, slugRole: opts.role });
|
|
30
30
|
if (!repo)
|
|
31
31
|
helpful_errors_1.BadRequestError.throw(`No repo found with slug "${opts.repo}"`);
|
|
32
32
|
console.log(``);
|
|
@@ -36,8 +36,10 @@ const invokeRolesLink = ({ command, registries, }) => {
|
|
|
36
36
|
const agentDir = (0, node_path_1.resolve)(process.cwd(), '.agent');
|
|
37
37
|
const repoThisDir = (0, node_path_1.resolve)(agentDir, 'repo=.this');
|
|
38
38
|
const repoRoleDir = (0, node_path_1.resolve)(agentDir, `repo=${repo.slug}`, `role=${role.slug}`);
|
|
39
|
+
const repoDir = (0, node_path_1.resolve)(agentDir, `repo=${repo.slug}`);
|
|
39
40
|
(0, node_fs_1.mkdirSync)(agentDir, { recursive: true });
|
|
40
41
|
(0, node_fs_1.mkdirSync)(repoThisDir, { recursive: true });
|
|
42
|
+
(0, node_fs_1.mkdirSync)(repoDir, { recursive: true });
|
|
41
43
|
(0, node_fs_1.mkdirSync)(repoRoleDir, { recursive: true });
|
|
42
44
|
// Findsert .agent/readme.md
|
|
43
45
|
(0, findsertFile_1.findsertFile)({
|
|
@@ -49,6 +51,13 @@ const invokeRolesLink = ({ command, registries, }) => {
|
|
|
49
51
|
path: (0, node_path_1.resolve)(repoThisDir, 'readme.md'),
|
|
50
52
|
template: (0, getAgentReadmeTemplates_1.getAgentRepoThisReadmeTemplate)(),
|
|
51
53
|
});
|
|
54
|
+
// Upsert .agent/repo=$repo/readme.md
|
|
55
|
+
if (repo.readme) {
|
|
56
|
+
const repoReadmePath = (0, node_path_1.resolve)(repoDir, 'readme.md');
|
|
57
|
+
const relativeRepoReadmePath = (0, node_path_1.relative)(process.cwd(), repoReadmePath);
|
|
58
|
+
(0, node_fs_1.writeFileSync)(repoReadmePath, repo.readme, 'utf8');
|
|
59
|
+
console.log(` + ${relativeRepoReadmePath} (upserted)`);
|
|
60
|
+
}
|
|
52
61
|
// Upsert .agent/repo=$repo/role=$role/readme.md
|
|
53
62
|
if (role.readme) {
|
|
54
63
|
const roleReadmePath = (0, node_path_1.resolve)(repoRoleDir, 'readme.md');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invokeRolesLink.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeRolesLink.ts"],"names":[],"mappings":";;;AACA,mDAAiD;AAGjD,iFAA8E;AAC9E,mGAG+D;AAC/D,mFAAgF;AAChF,kFAA+E;AAC/E,8GAA2G;AAE3G,qCAAmD;AACnD,yCAA8C;AAE9C;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,EAC9B,OAAO,EACP,UAAU,GAIX,EAAQ,EAAE;IACT,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,sDAAsD,CAAC;SACnE,MAAM,CAAC,eAAe,EAAE,kCAAkC,CAAC;SAC3D,MAAM,CAAC,eAAe,EAAE,gCAAgC,CAAC;SACzD,MAAM,CAAC,CAAC,IAAsC,EAAE,EAAE;QACjD,IAAI,CAAC,IAAI,CAAC,IAAI;YACZ,gCAAe,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAEtE,MAAM,IAAI,GAAG,IAAA,+BAAc,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI;YACpB,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC;YAC9C,CAAC,CAAC,IAAA,iCAAe,EAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI;YACP,gCAAe,CAAC,KAAK,CAAC,4BAA4B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QAElE,OAAO,CAAC,GAAG,CAAC,E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AAY,EAAE,QAAQ;SACvB,CAAC,CAAC;QAEH,2BAA2B;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI;YACjC,CAAC,CAAC,IAAA,uDAA0B,EAAC;gBACzB,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;gBAC3B,SAAS,EAAE,IAAA,mBAAO,EAAC,WAAW,EAAE,OAAO,CAAC;gBACxC,YAAY,EAAE,OAAO;aACtB,CAAC;YACJ,CAAC,CAAC,CAAC,CAAC;QAEN,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,IAAI,gBAAgB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACtE,IAAI,WAAW,GAAG,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,OAAO,WAAW,kBAAkB,CAAC,CAAC;QACvE,IAAI,WAAW,GAAG,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,OAAO,WAAW,kBAAkB,CAAC,CAAC;QACvE,IAAI,UAAU,GAAG,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC;QACpE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AArGW,QAAA,eAAe,mBAqG1B"}
|
|
@@ -25,7 +25,7 @@ const performRunViaActorMode = async (input) => {
|
|
|
25
25
|
const actor = (0, genActor_1.genActor)({ role: input.role, brains: input.brains });
|
|
26
26
|
// log which skill will run
|
|
27
27
|
console.log(``);
|
|
28
|
-
console.log(`🪨 skill
|
|
28
|
+
console.log(`🪨 run solid skill role=${input.opts.role}/skill=${input.opts.skill}`);
|
|
29
29
|
console.log(``);
|
|
30
30
|
// parse skill input from remaining args
|
|
31
31
|
const rawArgs = getRawArgsAfterRun();
|
|
@@ -40,13 +40,13 @@ const performRunViaActorMode = async (input) => {
|
|
|
40
40
|
const performRunViaCommandMode = (input) => {
|
|
41
41
|
// discover skill via .agent/ dirs
|
|
42
42
|
const skill = (0, findUniqueSkillExecutable_1.findUniqueSkillExecutable)({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
slugRepo: input.opts.repo,
|
|
44
|
+
slugRole: input.opts.role,
|
|
45
|
+
slugSkill: input.opts.skill,
|
|
46
46
|
});
|
|
47
47
|
// log which skill will run
|
|
48
48
|
console.log(``);
|
|
49
|
-
console.log(`🪨 skill
|
|
49
|
+
console.log(`🪨 run solid skill repo=${skill.slugRepo}/role=${skill.slugRole}/skill=${skill.slug}`);
|
|
50
50
|
console.log(``);
|
|
51
51
|
// get all args after 'run' for passthrough
|
|
52
52
|
const rawArgs = getRawArgsAfterRun();
|
|
@@ -110,7 +110,7 @@ exports.invokeRun = invokeRun;
|
|
|
110
110
|
* .what = parses raw CLI args into object for skill input
|
|
111
111
|
* .why = converts --key value pairs to { key: value } object
|
|
112
112
|
*/
|
|
113
|
-
const parseArgsToObject = (rawArgs,
|
|
113
|
+
const parseArgsToObject = (rawArgs, slugSkill) => {
|
|
114
114
|
const result = {};
|
|
115
115
|
let i = 0;
|
|
116
116
|
while (i < rawArgs.length) {
|
|
@@ -125,7 +125,7 @@ const parseArgsToObject = (rawArgs, skillSlug) => {
|
|
|
125
125
|
continue;
|
|
126
126
|
}
|
|
127
127
|
// skip the skill slug value if it matches
|
|
128
|
-
if (arg ===
|
|
128
|
+
if (arg === slugSkill) {
|
|
129
129
|
i++;
|
|
130
130
|
continue;
|
|
131
131
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invokeRun.js","sourceRoot":"","sources":["../../../src/contract/cli/invokeRun.ts"],"names":[],"mappings":";;;AACA,mDAA0E;AAK1E,oEAAiE;AACjE,6EAGoD;AACpD,uGAAoG;AAEpG;;;GAGG;AACH,MAAM,kBAAkB,GAAG,GAAa,EAAE;IACxC,MAAM,IAAI,GAAG,OAA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YAClC,SAAS;QACX,CAAC;QAED,0CAA0C;QAC1C,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,CAAC,EAAE,CAAC;YACJ,SAAS;QACX,CAAC;QAED,mCAAmC;QACnC,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBACd,qBAAqB;gBACrB,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;gBAChC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;gBACnC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBACpB,CAAC,EAAE,CAAC;YACN,CAAC;iBAAM,CAAC;gBACN,qBAAqB;gBACrB,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACzB,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;gBACnC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBACpB,CAAC,IAAI,CAAC,CAAC;YACT,CAAC;QACH,CAAC;aAAM,CAAC;YACN,CAAC,EAAE,CAAC;QACN,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -17,13 +17,13 @@ export interface RoleInitExecutable {
|
|
|
17
17
|
* .what = the repo (registry) this init belongs to
|
|
18
18
|
* .example = "ehmpathy", ".this"
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
slugRepo: string;
|
|
21
21
|
/**
|
|
22
22
|
* .what = the role this init belongs to
|
|
23
23
|
* .example = "mechanic", "designer"
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
slugRole: string;
|
|
26
26
|
}
|
|
27
27
|
export declare class RoleInitExecutable extends DomainLiteral<RoleInitExecutable> implements RoleInitExecutable {
|
|
28
|
-
static unique: readonly ["
|
|
28
|
+
static unique: readonly ["slugRepo", "slugRole", "slug"];
|
|
29
29
|
}
|
|
@@ -5,5 +5,5 @@ const domain_objects_1 = require("domain-objects");
|
|
|
5
5
|
class RoleInitExecutable extends domain_objects_1.DomainLiteral {
|
|
6
6
|
}
|
|
7
7
|
exports.RoleInitExecutable = RoleInitExecutable;
|
|
8
|
-
RoleInitExecutable.unique = ['
|
|
8
|
+
RoleInitExecutable.unique = ['slugRepo', 'slugRole', 'slug'];
|
|
9
9
|
//# sourceMappingURL=RoleInitExecutable.js.map
|
|
@@ -120,7 +120,7 @@ export declare class RoleSkillThreadsGetter<TOutput extends Threads<any>, TVaria
|
|
|
120
120
|
export interface RoleSkillContextGetter<TOutput extends GStitcher['context'], TVariables extends Record<string, string>> extends RoleSkillArgGetter<TOutput, TVariables> {
|
|
121
121
|
/**
|
|
122
122
|
* .what = how to lookup the required inputs for context instantiation
|
|
123
|
-
* .example = { openaiApiKey: { envar: "
|
|
123
|
+
* .example = { openaiApiKey: { envar: "OPENAI_API_KEY" } }
|
|
124
124
|
*/
|
|
125
125
|
lookup: {
|
|
126
126
|
[K in keyof TVariables]: {
|
|
@@ -17,13 +17,13 @@ export interface RoleSkillExecutable {
|
|
|
17
17
|
* .what = the repo (registry) this skill belongs to
|
|
18
18
|
* .example = "ehmpathy", ".this"
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
slugRepo: string;
|
|
21
21
|
/**
|
|
22
22
|
* .what = the role this skill belongs to
|
|
23
23
|
* .example = "mechanic", "designer"
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
slugRole: string;
|
|
26
26
|
}
|
|
27
27
|
export declare class RoleSkillExecutable extends DomainLiteral<RoleSkillExecutable> implements RoleSkillExecutable {
|
|
28
|
-
static unique: readonly ["
|
|
28
|
+
static unique: readonly ["slugRepo", "slugRole", "slug"];
|
|
29
29
|
}
|
|
@@ -5,5 +5,5 @@ const domain_objects_1 = require("domain-objects");
|
|
|
5
5
|
class RoleSkillExecutable extends domain_objects_1.DomainLiteral {
|
|
6
6
|
}
|
|
7
7
|
exports.RoleSkillExecutable = RoleSkillExecutable;
|
|
8
|
-
RoleSkillExecutable.unique = ['
|
|
8
|
+
RoleSkillExecutable.unique = ['slugRepo', 'slugRole', 'slug'];
|
|
9
9
|
//# sourceMappingURL=RoleSkillExecutable.js.map
|
|
@@ -18,14 +18,14 @@ const findActorRoleSkillBySlug = (input) => {
|
|
|
18
18
|
if (skillSchema) {
|
|
19
19
|
// find executable from .agent/ dirs (skill schema defines type, but executable runs)
|
|
20
20
|
const executables = (0, discoverSkillExecutables_1.discoverSkillExecutables)({
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
slugRole: input.role.slug,
|
|
22
|
+
slugSkill: input.slug,
|
|
23
23
|
});
|
|
24
24
|
// fail fast if skill is declared but no executable found
|
|
25
25
|
if (executables.length === 0)
|
|
26
26
|
throw new helpful_errors_1.BadRequestError(`skill "${input.slug}" declared in role.skills.${input.route} but no executable found in .agent/`, {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
slugSkill: input.slug,
|
|
28
|
+
slugRole: input.role.slug,
|
|
29
29
|
route: input.route,
|
|
30
30
|
hint: `create .agent/repo=.this/role=${input.role.slug}/skills/${input.slug}.sh`,
|
|
31
31
|
});
|
|
@@ -39,22 +39,22 @@ const findActorRoleSkillBySlug = (input) => {
|
|
|
39
39
|
}
|
|
40
40
|
// fall back to .agent/ discovery (executable exists but no schema)
|
|
41
41
|
const executables = (0, discoverSkillExecutables_1.discoverSkillExecutables)({
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
slugRole: input.role.slug,
|
|
43
|
+
slugSkill: input.slug,
|
|
44
44
|
});
|
|
45
45
|
// executable exists but no schema = not usable via actor contracts
|
|
46
46
|
if (executables.length > 0)
|
|
47
47
|
throw new helpful_errors_1.BadRequestError(`skill "${input.slug}" found in .agent/ but lacks schema in role.skills.${input.route}`, {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
slugSkill: input.slug,
|
|
49
|
+
slugRole: input.role.slug,
|
|
50
50
|
route: input.route,
|
|
51
51
|
hint: `add schema to role.skills.${input.route}.${input.slug} to use via actor contracts`,
|
|
52
52
|
executable: executables[0],
|
|
53
53
|
});
|
|
54
54
|
// skill not found
|
|
55
55
|
throw new helpful_errors_1.BadRequestError(`skill not found: ${input.slug}`, {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
slugSkill: input.slug,
|
|
57
|
+
slugRole: input.role.slug,
|
|
58
58
|
route: input.route,
|
|
59
59
|
availableSolidSkills: input.role.skills.solid
|
|
60
60
|
? Object.keys(input.role.skills.solid)
|
|
@@ -22,7 +22,7 @@ const findActorRoleSkillBySlug_1 = require("./findActorRoleSkillBySlug");
|
|
|
22
22
|
const genActor = (input) => {
|
|
23
23
|
// validate that at least one brain is provided
|
|
24
24
|
if (input.brains.length === 0)
|
|
25
|
-
throw new helpful_errors_1.BadRequestError('genActor requires at least one brain in allowlist', {
|
|
25
|
+
throw new helpful_errors_1.BadRequestError('genActor requires at least one brain in allowlist', { slugRole: input.role.slug });
|
|
26
26
|
// extract default brain (first in list)
|
|
27
27
|
const defaultBrain = input.brains[0];
|
|
28
28
|
// create bound .act() method with strong types
|
|
@@ -40,10 +40,10 @@ const genActor = (input) => {
|
|
|
40
40
|
throw new helpful_errors_1.BadRequestError('actor.act expects exactly one skill entry', {
|
|
41
41
|
entriesCount: entries.length,
|
|
42
42
|
});
|
|
43
|
-
const [
|
|
43
|
+
const [slugSkill, skillArgs] = entries[0];
|
|
44
44
|
// resolve skill from role
|
|
45
45
|
const skillResolved = (0, findActorRoleSkillBySlug_1.findActorRoleSkillBySlug)({
|
|
46
|
-
slug:
|
|
46
|
+
slug: slugSkill,
|
|
47
47
|
role: input.role,
|
|
48
48
|
route: 'rigid',
|
|
49
49
|
});
|
|
@@ -63,10 +63,10 @@ const genActor = (input) => {
|
|
|
63
63
|
throw new helpful_errors_1.BadRequestError('actor.run expects exactly one skill entry', {
|
|
64
64
|
entriesCount: entries.length,
|
|
65
65
|
});
|
|
66
|
-
const [
|
|
66
|
+
const [slugSkill, skillArgs] = entries[0];
|
|
67
67
|
// resolve skill from role
|
|
68
68
|
const skillResolved = (0, findActorRoleSkillBySlug_1.findActorRoleSkillBySlug)({
|
|
69
|
-
slug:
|
|
69
|
+
slug: slugSkill,
|
|
70
70
|
role: input.role,
|
|
71
71
|
route: 'solid',
|
|
72
72
|
});
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* .why = outputs role resources with stats for context loading
|
|
4
4
|
* .how = reads files from .agent/repo=$repo/role=$role and prints them with formatting
|
|
5
5
|
*/
|
|
6
|
-
export declare const bootRoleResources: ({
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export declare const bootRoleResources: ({ slugRepo, slugRole, ifPresent, }: {
|
|
7
|
+
slugRepo: string;
|
|
8
|
+
slugRole: string;
|
|
9
9
|
ifPresent: boolean;
|
|
10
10
|
}) => Promise<void>;
|
|
@@ -27,17 +27,17 @@ const getAllFilesFromDir = (dir) => {
|
|
|
27
27
|
* .why = outputs role resources with stats for context loading
|
|
28
28
|
* .how = reads files from .agent/repo=$repo/role=$role and prints them with formatting
|
|
29
29
|
*/
|
|
30
|
-
const bootRoleResources = async ({
|
|
31
|
-
const isRepoThis =
|
|
32
|
-
const roleDir = (0, node_path_1.resolve)(process.cwd(), '.agent', `repo=${
|
|
30
|
+
const bootRoleResources = async ({ slugRepo, slugRole, ifPresent, }) => {
|
|
31
|
+
const isRepoThis = slugRepo === '.this';
|
|
32
|
+
const roleDir = (0, node_path_1.resolve)(process.cwd(), '.agent', `repo=${slugRepo}`, `role=${slugRole}`);
|
|
33
33
|
// check if role directory exists
|
|
34
34
|
if (!(0, node_fs_1.existsSync)(roleDir)) {
|
|
35
35
|
// if --if-present, exit silently without error
|
|
36
36
|
if (ifPresent)
|
|
37
37
|
return;
|
|
38
38
|
const hint = isRepoThis
|
|
39
|
-
? `Create .agent/repo=.this/role=${
|
|
40
|
-
: `Run "rhachet roles link --repo ${
|
|
39
|
+
? `Create .agent/repo=.this/role=${slugRole}/[briefs,skills] directories`
|
|
40
|
+
: `Run "rhachet roles link --repo ${slugRepo} --role ${slugRole}" first`;
|
|
41
41
|
throw new Error(`Role directory not found: ${roleDir}\n${hint}`);
|
|
42
42
|
}
|
|
43
43
|
// recursively read all files, then filter to readme, briefs, and skills
|
|
@@ -98,7 +98,7 @@ const bootRoleResources = async ({ repoSlug, roleSlug, ifPresent, }) => {
|
|
|
98
98
|
printStats();
|
|
99
99
|
// print each file
|
|
100
100
|
for (const filepath of relevantFiles) {
|
|
101
|
-
const relativePath = `.agent/repo=${
|
|
101
|
+
const relativePath = `.agent/repo=${slugRepo}/role=${slugRole}/${(0, node_path_1.relative)(roleDir, filepath)}`;
|
|
102
102
|
const isSkill = filepath.startsWith(skillsDir);
|
|
103
103
|
const isReadme = filepath === readmePath;
|
|
104
104
|
const tagName = isSkill ? 'skill' : isReadme ? 'readme' : 'brief';
|
|
@@ -4,7 +4,7 @@ import { RoleInitExecutable } from '../../domain.objects/RoleInitExecutable';
|
|
|
4
4
|
* .why = enables `rhachet roles init --command` to find and execute inits
|
|
5
5
|
*/
|
|
6
6
|
export declare const discoverInitExecutables: (input: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
slugRepo?: string;
|
|
8
|
+
slugRole?: string;
|
|
9
|
+
slugInit?: string;
|
|
10
10
|
}) => RoleInitExecutable[];
|
|
@@ -51,31 +51,31 @@ const discoverInitExecutables = (input) => {
|
|
|
51
51
|
const repoEntries = (0, node_fs_1.readdirSync)(agentDir).filter((entry) => entry.startsWith('repo='));
|
|
52
52
|
const inits = [];
|
|
53
53
|
for (const repoEntry of repoEntries) {
|
|
54
|
-
const
|
|
55
|
-
// filter by
|
|
56
|
-
if (input.
|
|
54
|
+
const slugRepo = repoEntry.replace('repo=', '');
|
|
55
|
+
// filter by slugRepo if specified
|
|
56
|
+
if (input.slugRepo && slugRepo !== input.slugRepo)
|
|
57
57
|
continue;
|
|
58
58
|
const repoDir = (0, node_path_1.resolve)(agentDir, repoEntry);
|
|
59
59
|
// discover role directories
|
|
60
60
|
const roleEntries = (0, node_fs_1.readdirSync)(repoDir).filter((entry) => entry.startsWith('role='));
|
|
61
61
|
for (const roleEntry of roleEntries) {
|
|
62
|
-
const
|
|
63
|
-
// filter by
|
|
64
|
-
if (input.
|
|
62
|
+
const slugRole = roleEntry.replace('role=', '');
|
|
63
|
+
// filter by slugRole if specified
|
|
64
|
+
if (input.slugRole && slugRole !== input.slugRole)
|
|
65
65
|
continue;
|
|
66
66
|
const initsDir = (0, node_path_1.resolve)(repoDir, roleEntry, 'inits');
|
|
67
67
|
// get all files from inits directory
|
|
68
68
|
const initFiles = getAllFilesFromDir(initsDir);
|
|
69
69
|
for (const initPath of initFiles) {
|
|
70
70
|
const slug = extractSlugFromPath({ initsDir, filePath: initPath });
|
|
71
|
-
// filter by
|
|
72
|
-
if (input.
|
|
71
|
+
// filter by slugInit if specified
|
|
72
|
+
if (input.slugInit && slug !== input.slugInit)
|
|
73
73
|
continue;
|
|
74
74
|
inits.push(new RoleInitExecutable_1.RoleInitExecutable({
|
|
75
75
|
slug,
|
|
76
76
|
path: initPath,
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
slugRepo,
|
|
78
|
+
slugRole,
|
|
79
79
|
}));
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -4,7 +4,7 @@ import { RoleSkillExecutable } from '../../domain.objects/RoleSkillExecutable';
|
|
|
4
4
|
* .why = enables `rhachet run --skill` to find and execute skills
|
|
5
5
|
*/
|
|
6
6
|
export declare const discoverSkillExecutables: (input: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
slugRepo?: string;
|
|
8
|
+
slugRole?: string;
|
|
9
|
+
slugSkill?: string;
|
|
10
10
|
}) => RoleSkillExecutable[];
|
|
@@ -49,17 +49,17 @@ const discoverSkillExecutables = (input) => {
|
|
|
49
49
|
const repoEntries = (0, node_fs_1.readdirSync)(agentDir).filter((entry) => entry.startsWith('repo='));
|
|
50
50
|
const skills = [];
|
|
51
51
|
for (const repoEntry of repoEntries) {
|
|
52
|
-
const
|
|
53
|
-
// filter by
|
|
54
|
-
if (input.
|
|
52
|
+
const slugRepo = repoEntry.replace('repo=', '');
|
|
53
|
+
// filter by slugRepo if specified
|
|
54
|
+
if (input.slugRepo && slugRepo !== input.slugRepo)
|
|
55
55
|
continue;
|
|
56
56
|
const repoDir = (0, node_path_1.resolve)(agentDir, repoEntry);
|
|
57
57
|
// discover role directories
|
|
58
58
|
const roleEntries = (0, node_fs_1.readdirSync)(repoDir).filter((entry) => entry.startsWith('role='));
|
|
59
59
|
for (const roleEntry of roleEntries) {
|
|
60
|
-
const
|
|
61
|
-
// filter by
|
|
62
|
-
if (input.
|
|
60
|
+
const slugRole = roleEntry.replace('role=', '');
|
|
61
|
+
// filter by slugRole if specified
|
|
62
|
+
if (input.slugRole && slugRole !== input.slugRole)
|
|
63
63
|
continue;
|
|
64
64
|
const skillsDir = (0, node_path_1.resolve)(repoDir, roleEntry, 'skills');
|
|
65
65
|
// get all files from skills directory
|
|
@@ -67,14 +67,14 @@ const discoverSkillExecutables = (input) => {
|
|
|
67
67
|
for (const skillPath of skillFiles) {
|
|
68
68
|
const filename = (0, node_path_1.basename)(skillPath);
|
|
69
69
|
const slug = extractSlugFromFilename(filename);
|
|
70
|
-
// filter by
|
|
71
|
-
if (input.
|
|
70
|
+
// filter by slugSkill if specified
|
|
71
|
+
if (input.slugSkill && slug !== input.slugSkill)
|
|
72
72
|
continue;
|
|
73
73
|
skills.push(new RoleSkillExecutable_1.RoleSkillExecutable({
|
|
74
74
|
slug,
|
|
75
75
|
path: skillPath,
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
slugRepo,
|
|
77
|
+
slugRole,
|
|
78
78
|
}));
|
|
79
79
|
}
|
|
80
80
|
}
|
|
@@ -4,7 +4,7 @@ import type { RoleInitExecutable } from '../../domain.objects/RoleInitExecutable
|
|
|
4
4
|
* .why = ensures unambiguous init resolution before execution
|
|
5
5
|
*/
|
|
6
6
|
export declare const findUniqueInitExecutable: (input: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
slugRepo?: string;
|
|
8
|
+
slugRole?: string;
|
|
9
|
+
slugInit: string;
|
|
10
10
|
}) => RoleInitExecutable;
|
|
@@ -10,30 +10,30 @@ const discoverInitExecutables_1 = require("./discoverInitExecutables");
|
|
|
10
10
|
const findUniqueInitExecutable = (input) => {
|
|
11
11
|
// discover inits with filters
|
|
12
12
|
const matches = (0, discoverInitExecutables_1.discoverInitExecutables)({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
slugRepo: input.slugRepo,
|
|
14
|
+
slugRole: input.slugRole,
|
|
15
|
+
slugInit: input.slugInit,
|
|
16
16
|
});
|
|
17
17
|
// handle no matches
|
|
18
18
|
if (matches.length === 0) {
|
|
19
19
|
const filters = [
|
|
20
|
-
input.
|
|
21
|
-
input.
|
|
20
|
+
input.slugRepo ? `--repo ${input.slugRepo}` : null,
|
|
21
|
+
input.slugRole ? `--role ${input.slugRole}` : null,
|
|
22
22
|
]
|
|
23
23
|
.filter(Boolean)
|
|
24
24
|
.join(' ');
|
|
25
25
|
const hint = filters
|
|
26
|
-
? `no init "${input.
|
|
27
|
-
: `no init "${input.
|
|
26
|
+
? `no init "${input.slugInit}" found with ${filters}`
|
|
27
|
+
: `no init "${input.slugInit}" found in any linked role`;
|
|
28
28
|
// discover all available inits to show suggestions
|
|
29
29
|
const allInits = (0, discoverInitExecutables_1.discoverInitExecutables)({
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
slugRepo: input.slugRepo,
|
|
31
|
+
slugRole: input.slugRole,
|
|
32
32
|
});
|
|
33
33
|
const suggestions = allInits.length > 0
|
|
34
34
|
? `\n\navailable inits:\n${allInits
|
|
35
35
|
.slice(0, 5)
|
|
36
|
-
.map((s) => ` - ${s.slug} (repo=${s.
|
|
36
|
+
.map((s) => ` - ${s.slug} (repo=${s.slugRepo} role=${s.slugRole})`)
|
|
37
37
|
.join('\n')}${allInits.length > 5 ? `\n ... and ${allInits.length - 5} more` : ''}`
|
|
38
38
|
: '';
|
|
39
39
|
const tip = `\n\ntip: did you \`npx rhachet roles link\` the --role this init comes from?`;
|
|
@@ -42,9 +42,9 @@ const findUniqueInitExecutable = (input) => {
|
|
|
42
42
|
// handle multiple matches
|
|
43
43
|
if (matches.length > 1) {
|
|
44
44
|
const matchList = matches
|
|
45
|
-
.map((m) => ` - repo=${m.
|
|
45
|
+
.map((m) => ` - repo=${m.slugRepo} role=${m.slugRole}`)
|
|
46
46
|
.join('\n');
|
|
47
|
-
helpful_errors_1.BadRequestError.throw(`multiple inits found for "${input.
|
|
47
|
+
helpful_errors_1.BadRequestError.throw(`multiple inits found for "${input.slugInit}":\n${matchList}\n\nuse --repo and/or --role to disambiguate`, { input, matches });
|
|
48
48
|
}
|
|
49
49
|
// return unique match
|
|
50
50
|
return matches[0];
|
|
@@ -4,7 +4,7 @@ import type { RoleSkillExecutable } from '../../domain.objects/RoleSkillExecutab
|
|
|
4
4
|
* .why = ensures unambiguous skill resolution before execution
|
|
5
5
|
*/
|
|
6
6
|
export declare const findUniqueSkillExecutable: (input: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
slugRepo?: string;
|
|
8
|
+
slugRole?: string;
|
|
9
|
+
slugSkill: string;
|
|
10
10
|
}) => RoleSkillExecutable;
|
|
@@ -10,30 +10,30 @@ const discoverSkillExecutables_1 = require("./discoverSkillExecutables");
|
|
|
10
10
|
const findUniqueSkillExecutable = (input) => {
|
|
11
11
|
// discover skills with filters
|
|
12
12
|
const matches = (0, discoverSkillExecutables_1.discoverSkillExecutables)({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
slugRepo: input.slugRepo,
|
|
14
|
+
slugRole: input.slugRole,
|
|
15
|
+
slugSkill: input.slugSkill,
|
|
16
16
|
});
|
|
17
17
|
// handle no matches
|
|
18
18
|
if (matches.length === 0) {
|
|
19
19
|
const filters = [
|
|
20
|
-
input.
|
|
21
|
-
input.
|
|
20
|
+
input.slugRepo ? `--repo ${input.slugRepo}` : null,
|
|
21
|
+
input.slugRole ? `--role ${input.slugRole}` : null,
|
|
22
22
|
]
|
|
23
23
|
.filter(Boolean)
|
|
24
24
|
.join(' ');
|
|
25
25
|
const hint = filters
|
|
26
|
-
? `no skill "${input.
|
|
27
|
-
: `no skill "${input.
|
|
26
|
+
? `no skill "${input.slugSkill}" found with ${filters}`
|
|
27
|
+
: `no skill "${input.slugSkill}" found in any linked role`;
|
|
28
28
|
// discover all available skills to show suggestions
|
|
29
29
|
const allSkills = (0, discoverSkillExecutables_1.discoverSkillExecutables)({
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
slugRepo: input.slugRepo,
|
|
31
|
+
slugRole: input.slugRole,
|
|
32
32
|
});
|
|
33
33
|
const suggestions = allSkills.length > 0
|
|
34
34
|
? `\n\navailable skills:\n${allSkills
|
|
35
35
|
.slice(0, 5)
|
|
36
|
-
.map((s) => ` - ${s.slug} (repo=${s.
|
|
36
|
+
.map((s) => ` - ${s.slug} (repo=${s.slugRepo} role=${s.slugRole})`)
|
|
37
37
|
.join('\n')}${allSkills.length > 5 ? `\n ... and ${allSkills.length - 5} more` : ''}`
|
|
38
38
|
: '';
|
|
39
39
|
const tip = `\n\ntip: did you \`npx rhachet roles link\` the --role this skill comes from?`;
|
|
@@ -42,9 +42,9 @@ const findUniqueSkillExecutable = (input) => {
|
|
|
42
42
|
// handle multiple matches
|
|
43
43
|
if (matches.length > 1) {
|
|
44
44
|
const matchList = matches
|
|
45
|
-
.map((m) => ` - repo=${m.
|
|
45
|
+
.map((m) => ` - repo=${m.slugRepo} role=${m.slugRole}`)
|
|
46
46
|
.join('\n');
|
|
47
|
-
helpful_errors_1.BadRequestError.throw(`multiple skills found for "${input.
|
|
47
|
+
helpful_errors_1.BadRequestError.throw(`multiple skills found for "${input.slugSkill}":\n${matchList}\n\nuse --repo and/or --role to disambiguate`, { input, matches });
|
|
48
48
|
}
|
|
49
49
|
// return unique match
|
|
50
50
|
return matches[0];
|
|
@@ -9,17 +9,17 @@ const helpful_errors_1 = require("helpful-errors");
|
|
|
9
9
|
*/
|
|
10
10
|
const inferRepoByRole = (input) => {
|
|
11
11
|
// Find all registries (repos) that have the specified role
|
|
12
|
-
const matchingRepos = input.registries.filter((registry) => registry.roles.some((role) => role.slug === input.
|
|
12
|
+
const matchingRepos = input.registries.filter((registry) => registry.roles.some((role) => role.slug === input.slugRole));
|
|
13
13
|
// Handle unique match
|
|
14
14
|
if (matchingRepos.length === 1)
|
|
15
15
|
return matchingRepos[0];
|
|
16
16
|
// Handle ambiguous case
|
|
17
17
|
if (matchingRepos.length > 1) {
|
|
18
18
|
const repoList = matchingRepos.map((r) => ` - ${r.slug}`).join('\n');
|
|
19
|
-
helpful_errors_1.BadRequestError.throw(`Multiple repos have role "${input.
|
|
19
|
+
helpful_errors_1.BadRequestError.throw(`Multiple repos have role "${input.slugRole}":\n${repoList}\nPlease specify --repo to disambiguate.`);
|
|
20
20
|
}
|
|
21
21
|
// Handle not found case
|
|
22
|
-
helpful_errors_1.BadRequestError.throw(`No repo has role "${input.
|
|
22
|
+
helpful_errors_1.BadRequestError.throw(`No repo has role "${input.slugRole}".\nCheck that the role exists in your registries.`);
|
|
23
23
|
};
|
|
24
24
|
exports.inferRepoByRole = inferRepoByRole;
|
|
25
25
|
//# sourceMappingURL=inferRepoByRole.js.map
|
|
@@ -24,8 +24,8 @@ export declare const getAllFiles: (dir: string) => string[];
|
|
|
24
24
|
*/
|
|
25
25
|
export declare const getRoleFileCosts: (input: {
|
|
26
26
|
roleDir: string;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
slugRepo: string;
|
|
28
|
+
slugRole: string;
|
|
29
29
|
}) => FileCost[];
|
|
30
30
|
/**
|
|
31
31
|
* .what = aggregates file costs into summary statistics
|
|
@@ -31,7 +31,7 @@ exports.getAllFiles = getAllFiles;
|
|
|
31
31
|
* .how = reads files, applies skill doc extraction, computes tokens
|
|
32
32
|
*/
|
|
33
33
|
const getRoleFileCosts = (input) => {
|
|
34
|
-
const { roleDir,
|
|
34
|
+
const { roleDir, slugRepo, slugRole } = input;
|
|
35
35
|
// define directories for type classification
|
|
36
36
|
const briefsDir = (0, node_path_1.resolve)(roleDir, 'briefs');
|
|
37
37
|
const skillsDir = (0, node_path_1.resolve)(roleDir, 'skills');
|
|
@@ -59,7 +59,7 @@ const getRoleFileCosts = (input) => {
|
|
|
59
59
|
: 'other';
|
|
60
60
|
return {
|
|
61
61
|
path: filepath,
|
|
62
|
-
relativePath: `.agent/repo=${
|
|
62
|
+
relativePath: `.agent/repo=${slugRepo}/role=${slugRole}/${(0, node_path_1.relative)(roleDir, filepath)}`,
|
|
63
63
|
chars,
|
|
64
64
|
tokens,
|
|
65
65
|
cost,
|
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.19.
|
|
5
|
+
"version": "1.19.9",
|
|
6
6
|
"repository": "ehmpathy/rhachet",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/rhachet",
|
|
8
8
|
"keywords": [
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"@anthropic-ai/claude-agent-sdk": "0.1.76",
|
|
58
58
|
"@anthropic-ai/sdk": "0.71.2",
|
|
59
59
|
"@ehmpathy/uni-time": "1.9.0",
|
|
60
|
+
"@openai/codex-sdk": "0.77.0",
|
|
60
61
|
"as-procedure": "1.1.6",
|
|
61
62
|
"bottleneck": "2.19.5",
|
|
62
63
|
"chalk": "4.1.2",
|
|
@@ -65,13 +66,13 @@
|
|
|
65
66
|
"fast-glob": "3.3.3",
|
|
66
67
|
"flattie": "1.1.1",
|
|
67
68
|
"helpful-errors": "1.5.3",
|
|
68
|
-
"@openai/codex-sdk": "0.77.0",
|
|
69
69
|
"openai": "5.8.2",
|
|
70
70
|
"rhachet-artifact": "1.0.1",
|
|
71
71
|
"rhachet-artifact-git": "1.1.3",
|
|
72
72
|
"serde-fns": "1.3.1",
|
|
73
73
|
"type-fns": "1.21.0",
|
|
74
74
|
"uuid-fns": "1.0.1",
|
|
75
|
+
"wrapper-fns": "1.1.0",
|
|
75
76
|
"zod": "3.25.76",
|
|
76
77
|
"zod-to-json-schema": "3.25.1"
|
|
77
78
|
},
|