rhachet-roles-ehmpathy 1.4.0 → 1.6.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 (48) hide show
  1. package/dist/contract/sdk/index.d.ts +1 -0
  2. package/dist/contract/sdk/index.js +3 -1
  3. package/dist/contract/sdk/index.js.map +1 -1
  4. package/dist/logic/hooks/decodeDocOutputPath.d.ts +21 -0
  5. package/dist/logic/hooks/decodeDocOutputPath.js +57 -0
  6. package/dist/logic/hooks/decodeDocOutputPath.js.map +1 -0
  7. package/dist/logic/hooks/decodeDocOutputPath.test.d.ts +1 -0
  8. package/dist/logic/hooks/decodeDocOutputPath.test.js +146 -0
  9. package/dist/logic/hooks/decodeDocOutputPath.test.js.map +1 -0
  10. package/dist/logic/hooks/execTranslateDocOutputPath.d.ts +20 -0
  11. package/dist/logic/hooks/execTranslateDocOutputPath.js +80 -0
  12. package/dist/logic/hooks/execTranslateDocOutputPath.js.map +1 -0
  13. package/dist/logic/hooks/execTranslateDocOutputPath.test.d.ts +1 -0
  14. package/dist/logic/hooks/execTranslateDocOutputPath.test.js +409 -0
  15. package/dist/logic/hooks/execTranslateDocOutputPath.test.js.map +1 -0
  16. package/dist/logic/hooks/getInvokeHooks.d.ts +2 -0
  17. package/dist/logic/hooks/getInvokeHooks.js +15 -0
  18. package/dist/logic/hooks/getInvokeHooks.js.map +1 -0
  19. package/dist/logic/hooks/relateDocOutputPath.d.ts +10 -0
  20. package/dist/logic/hooks/relateDocOutputPath.js +45 -0
  21. package/dist/logic/hooks/relateDocOutputPath.js.map +1 -0
  22. package/dist/logic/hooks/relateDocOutputPath.test.d.ts +1 -0
  23. package/dist/logic/hooks/relateDocOutputPath.test.js +111 -0
  24. package/dist/logic/hooks/relateDocOutputPath.test.js.map +1 -0
  25. package/dist/logic/roles/getRoleRegistry.js +2 -0
  26. package/dist/logic/roles/getRoleRegistry.js.map +1 -1
  27. package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.d.ts +42 -0
  28. package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.integration.test.d.ts +1 -0
  29. package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.integration.test.js +76 -0
  30. package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.integration.test.js.map +1 -0
  31. package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.js +126 -0
  32. package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.js.map +1 -0
  33. package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.skill.d.ts +12 -0
  34. package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.skill.js +69 -0
  35. package/dist/logic/roles/terminal.commander/command.exec/stepExecCommand.skill.js.map +1 -0
  36. package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.d.ts +54 -0
  37. package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.integration.test.d.ts +1 -0
  38. package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.integration.test.js +97 -0
  39. package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.integration.test.js.map +1 -0
  40. package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.js +68 -0
  41. package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.js.map +1 -0
  42. package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.skill.d.ts +28 -0
  43. package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.skill.js +124 -0
  44. package/dist/logic/roles/terminal.commander/command.plan/stepPlanCommand.skill.js.map +1 -0
  45. package/dist/logic/roles/terminal.commander/getCommanderRole.d.ts +2 -0
  46. package/dist/logic/roles/terminal.commander/getCommanderRole.js +35 -0
  47. package/dist/logic/roles/terminal.commander/getCommanderRole.js.map +1 -0
  48. package/package.json +2 -2
@@ -6,6 +6,7 @@ const getBhrainRole_1 = require("./bhrain/getBhrainRole");
6
6
  // import { ROLE_ECOLOGIST } from './ecologist/getEcologistRole';
7
7
  const getRoleRegistry_readme_1 = require("./getRoleRegistry.readme");
8
8
  const getMechanicRole_1 = require("./mechanic/getMechanicRole");
9
+ const getCommanderRole_1 = require("./terminal.commander/getCommanderRole");
9
10
  /**
10
11
  * .what = returns the core registry of predefined roles and skills
11
12
  * .why =
@@ -19,6 +20,7 @@ const getRoleRegistry = () => new rhachet_1.RoleRegistry({
19
20
  getBhrainRole_1.ROLE_BHRAIN, // todo: lift bhrain role into own repo
20
21
  // ROLE_ECOLOGIST,
21
22
  getMechanicRole_1.ROLE_MECHANIC,
23
+ getCommanderRole_1.ROLE_COMMANDER,
22
24
  ],
23
25
  });
24
26
  exports.getRoleRegistry = getRoleRegistry;
@@ -1 +1 @@
1
- {"version":3,"file":"getRoleRegistry.js","sourceRoot":"","sources":["../../../src/logic/roles/getRoleRegistry.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,0DAAqD;AACrD,iEAAiE;AACjE,qEAAoE;AACpE,gEAA2D;AAE3D;;;;;GAKG;AACI,MAAM,eAAe,GAAG,GAAiB,EAAE,CAChD,IAAI,sBAAY,CAAC;IACf,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,iDAAwB;IAChC,KAAK,EAAE;QACL,2BAAW,EAAE,uCAAuC;QACpD,kBAAkB;QAClB,+BAAa;KACd;CACF,CAAC,CAAC;AATQ,QAAA,eAAe,mBASvB"}
1
+ {"version":3,"file":"getRoleRegistry.js","sourceRoot":"","sources":["../../../src/logic/roles/getRoleRegistry.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC,0DAAqD;AACrD,iEAAiE;AACjE,qEAAoE;AACpE,gEAA2D;AAC3D,4EAAuE;AAEvE;;;;;GAKG;AACI,MAAM,eAAe,GAAG,GAAiB,EAAE,CAChD,IAAI,sBAAY,CAAC;IACf,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,iDAAwB;IAChC,KAAK,EAAE;QACL,2BAAW,EAAE,uCAAuC;QACpD,kBAAkB;QAClB,+BAAa;QAEb,iCAAc;KACf;CACF,CAAC,CAAC;AAXQ,QAAA,eAAe,mBAWvB"}
@@ -0,0 +1,42 @@
1
+ import { UniDateTime, UniDuration } from '@ehmpathy/uni-time';
2
+ import { GStitcher, RoleContext, StitchStepCompute, Threads } from 'rhachet';
3
+ import { Focus } from '../../../../_topublish/rhachet-roles-bhrain/src/domain/objects/Focus';
4
+ export declare const stepCommandExec: StitchStepCompute<GStitcher<Threads<{
5
+ commander: RoleContext<'commander', {
6
+ art: {
7
+ /**
8
+ * the command to execute
9
+ */
10
+ input: Focus['concept'];
11
+ /**
12
+ * the output that was produced
13
+ */
14
+ output: Focus['concept'];
15
+ };
16
+ }>;
17
+ }>, import("simple-log-methods").ContextLogTrail & import("rhachet").ContextStitchTrail, {
18
+ code: number | null;
19
+ stdout: string;
20
+ stderr: string;
21
+ }>>;
22
+ type Clock = {
23
+ range: {
24
+ since: UniDateTime;
25
+ until: UniDateTime;
26
+ };
27
+ duration: UniDuration;
28
+ };
29
+ /**
30
+ * spawns a login-capable subshell and runs the provided command.
31
+ * chooses a single shell (no fallback). defaults to bash if $SHELL contains "bash", otherwise "sh".
32
+ */
33
+ export declare const runInSubshell: (command: string, opts?: {
34
+ shell?: 'bash' | 'sh';
35
+ logPrefix?: string;
36
+ }) => Promise<{
37
+ code: number | null;
38
+ stdout: string;
39
+ stderr: string;
40
+ clock: Clock;
41
+ }>;
42
+ export {};
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const uni_time_1 = require("@ehmpathy/uni-time");
4
+ const rhachet_1 = require("rhachet");
5
+ const rhachet_artifact_git_1 = require("rhachet-artifact-git");
6
+ const test_fns_1 = require("test-fns");
7
+ const genContextLogTrail_1 = require("../../../../.test/genContextLogTrail");
8
+ const genContextStitchTrail_1 = require("../../../../.test/genContextStitchTrail");
9
+ const getContextOpenAI_1 = require("../../../../.test/getContextOpenAI");
10
+ const stepExecCommand_1 = require("./stepExecCommand");
11
+ jest.setTimeout((0, uni_time_1.toMilliseconds)({ minutes: 5 }));
12
+ const artifacts = {
13
+ commander: {
14
+ input: (0, rhachet_artifact_git_1.genArtifactGitFile)({ uri: __dirname + '/.temp/stepCommandExec/commander.input.sh' }, { versions: true }),
15
+ output: (0, rhachet_artifact_git_1.genArtifactGitFile)({ uri: __dirname + '/.temp/stepCommandExec/commander.output.md' }, { versions: true }),
16
+ },
17
+ };
18
+ const enthread = () => (0, test_fns_1.usePrep)(async () => ({
19
+ commander: await (0, rhachet_1.enrollThread)({
20
+ role: 'commander',
21
+ stash: {
22
+ art: {
23
+ input: artifacts.commander.input,
24
+ output: artifacts.commander.output,
25
+ },
26
+ refs: [],
27
+ },
28
+ inherit: {},
29
+ }),
30
+ }));
31
+ describe('stepCommandExec', () => {
32
+ const context = {
33
+ ...(0, genContextLogTrail_1.genContextLogTrail)(),
34
+ ...(0, genContextStitchTrail_1.genContextStitchTrail)(),
35
+ ...(0, getContextOpenAI_1.getContextOpenAI)(),
36
+ };
37
+ const route = stepExecCommand_1.stepCommandExec;
38
+ (0, test_fns_1.given)('a simple shell pipeline that writes to stdout and stderr', () => {
39
+ // prints 'hi' and 'done' to stdout, and 'oops' to stderr
40
+ const command = `printf "hi\\n"; echo "oops" 1>&2; printf "done\\n"`;
41
+ beforeEach(async () => {
42
+ await artifacts.commander.input.set({ content: command });
43
+ await artifacts.commander.output.set({ content: '' });
44
+ });
45
+ (0, test_fns_1.when)('invoked', () => {
46
+ const threads = enthread();
47
+ (0, test_fns_1.then)('runs the command in a subshell and writes a markdown report', async () => {
48
+ const result = await (0, rhachet_1.enweaveOneStitcher)({ stitcher: route, threads }, context);
49
+ console.log(JSON.stringify(result.stitch, null, 2));
50
+ console.log(artifacts.commander.output);
51
+ const { content: md } = await artifacts.commander.output
52
+ .get()
53
+ .expect('isPresent');
54
+ // command section
55
+ expect(md).toContain('### 🐚 command');
56
+ expect(md).toContain('```sh');
57
+ expect(md).toContain(command);
58
+ // exit code section
59
+ expect(md).toContain('### 🏁 exit code');
60
+ expect(md).toMatch(/\n0\s*\n/);
61
+ // stdout section
62
+ expect(md).toContain('### 📦 stdout');
63
+ expect(md).toContain('```');
64
+ expect(md).toMatch(/hi/i);
65
+ expect(md).toMatch(/done/i);
66
+ // stderr section
67
+ expect(md).toContain('### 🚧 stderr');
68
+ expect(md).toContain('```');
69
+ expect(md).toMatch(/oops/i);
70
+ // sanity: artifact path ends with .md (we chose a .md uri above)
71
+ expect(artifacts.commander.output.ref.uri).toMatch(/\.md$/);
72
+ });
73
+ });
74
+ });
75
+ });
76
+ //# sourceMappingURL=stepExecCommand.integration.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepExecCommand.integration.test.js","sourceRoot":"","sources":["../../../../../src/logic/roles/terminal.commander/command.exec/stepExecCommand.integration.test.ts"],"names":[],"mappings":";;AAAA,iDAAoD;AACpD,qCAA2D;AAC3D,+DAA0D;AAC1D,uCAAsD;AAEtD,6EAA0E;AAC1E,mFAAgF;AAChF,yEAAsE;AACtE,uDAAoD;AAEpD,IAAI,CAAC,UAAU,CAAC,IAAA,yBAAc,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEhD,MAAM,SAAS,GAAG;IAChB,SAAS,EAAE;QACT,KAAK,EAAE,IAAA,yCAAkB,EACvB,EAAE,GAAG,EAAE,SAAS,GAAG,2CAA2C,EAAE,EAChE,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB;QACD,MAAM,EAAE,IAAA,yCAAkB,EACxB,EAAE,GAAG,EAAE,SAAS,GAAG,4CAA4C,EAAE,EACjE,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB;KACF;CACF,CAAC;AAEF,MAAM,QAAQ,GAAG,GAAG,EAAE,CACpB,IAAA,kBAAO,EAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACnB,SAAS,EAAE,MAAM,IAAA,sBAAY,EAAC;QAC5B,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE;YACL,GAAG,EAAE;g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L,CAAC,CAAC,CAAC"}
@@ -0,0 +1,126 @@
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
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.runInSubshell = exports.stepCommandExec = void 0;
27
+ const uni_time_1 = require("@ehmpathy/uni-time");
28
+ const child_process_1 = require("child_process");
29
+ const helpful_errors_1 = require("helpful-errors");
30
+ const readline = __importStar(require("readline"));
31
+ const rhachet_1 = require("rhachet");
32
+ exports.stepCommandExec = new rhachet_1.StitchStepCompute({
33
+ slug: '@[commander][command]<exec>',
34
+ readme: 'executes a terminal command',
35
+ form: 'COMPUTE',
36
+ stitchee: 'commander',
37
+ invoke: async ({ threads }) => {
38
+ // grab the command from the input artifact
39
+ const command = (await threads.commander.context.stash.art.input.get())?.content ??
40
+ helpful_errors_1.UnexpectedCodePathError.throw('no command found in the commander art.input artifact', {
41
+ artifact: threads.commander.context.stash.art.input,
42
+ });
43
+ // spawn a subshell and execute it
44
+ const { code, stdout, stderr } = await (0, exports.runInSubshell)(command);
45
+ // save the outputs
46
+ await threads.commander.context.stash.art.output.set({
47
+ content: [
48
+ '# command execution',
49
+ '',
50
+ '### 🐚 command',
51
+ '',
52
+ '```sh',
53
+ command,
54
+ '```',
55
+ '',
56
+ '',
57
+ '### 🏁 exit code',
58
+ '',
59
+ `${code ?? '(null)'}`,
60
+ '',
61
+ '',
62
+ '### 📦 stdout',
63
+ '',
64
+ '```',
65
+ stdout?.trim()?.length ? stdout : '(empty)',
66
+ '```',
67
+ '',
68
+ '',
69
+ '### 🚧 stderr',
70
+ '',
71
+ '```',
72
+ stderr?.trim()?.length ? stderr : '(empty)',
73
+ '```',
74
+ '',
75
+ ].join('\n'),
76
+ });
77
+ return {
78
+ input: { command },
79
+ output: { code, stdout, stderr },
80
+ };
81
+ },
82
+ });
83
+ /**
84
+ * spawns a login-capable subshell and runs the provided command.
85
+ * chooses a single shell (no fallback). defaults to bash if $SHELL contains "bash", otherwise "sh".
86
+ */
87
+ const runInSubshell = async (command, opts) => {
88
+ // capture start time as early as possible
89
+ const beganAt = (0, uni_time_1.asUniDateTime)(new Date());
90
+ return await new Promise((resolve, reject) => {
91
+ const shell = opts?.shell ?? (process.env.SHELL?.includes('bash') ? 'bash' : 'sh');
92
+ const child = (0, child_process_1.spawn)(shell, ['-lc', command], {
93
+ stdio: ['ignore', 'pipe', 'pipe'],
94
+ });
95
+ const bufsOut = [];
96
+ const bufsErr = [];
97
+ // stream lines to parent with optional prefix (observability)
98
+ // while also buffering raw bytes for return payload
99
+ const wire = (stream, onChunk, write) => {
100
+ if (!stream)
101
+ return;
102
+ const rl = readline.createInterface({ input: stream });
103
+ rl.on('line', (line) => write((opts?.logPrefix ?? '') + line + '\n'));
104
+ stream.on('data', (d) => onChunk(Buffer.isBuffer(d) ? d : Buffer.from(d)));
105
+ };
106
+ wire(child.stdout, (b) => bufsOut.push(b), (s) => process.stdout.write(s));
107
+ wire(child.stderr, (b) => bufsErr.push(b), (s) => process.stderr.write(s));
108
+ child.once('error', reject);
109
+ child.once('exit', (code) => {
110
+ const until = (0, uni_time_1.asUniDateTime)(new Date());
111
+ const range = { since: beganAt, until };
112
+ const clock = {
113
+ range,
114
+ duration: (0, uni_time_1.getDuration)({ of: { range } }),
115
+ };
116
+ resolve({
117
+ code,
118
+ stdout: Buffer.concat(bufsOut).toString('utf8'),
119
+ stderr: Buffer.concat(bufsErr).toString('utf8'),
120
+ clock,
121
+ });
122
+ });
123
+ });
124
+ };
125
+ exports.runInSubshell = runInSubshell;
126
+ //# sourceMappingURL=stepExecCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepExecCommand.js","sourceRoot":"","sources":["../../../../../src/logic/roles/terminal.commander/command.exec/stepExecCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAK4B;AAC5B,iDAAsC;AACtC,mDAAyD;AACzD,mDAAqC;AACrC,qCAA6E;AA4BhE,QAAA,eAAe,GAAG,IAAI,2BAAiB,CAMlD;IACA,IAAI,EAAE,6BAA6B;IACnC,MAAM,EAAE,6BAA6B;IACrC,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,WAAW;IACrB,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAC5B,2CAA2C;QAC3C,MAAM,OAAO,GACX,CAAC,MAAM,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,OAAO;YAChE,wCAAuB,CAAC,KAAK,CAC3B,sDAAsD,EACtD;gBACE,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK;aACpD,CACF,CAAC;QAEJ,kCAAkC;QAClC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,qBAAa,EAAC,OAAO,CAAC,CAAC;QAE9D,mBAAmB;QACnB,MAAM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AAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAC/B,CAAC;QAEF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5B,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YAC1B,MAAM,KAAK,GAAG,IAAA,wBAAa,EAAC,IAAI,IAAI,EAAE,CAAC,CAAC;YACxC,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;YACxC,MAAM,KAAK,GAAU;gBACnB,KAAK;gBACL,QAAQ,EAAE,IAAA,sBAAW,EAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;aACzC,CAAC;YACF,OAAO,CAAC;gBACN,IAAI;gBACJ,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAC/C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAC/C,KAAK;aACN,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AApEW,QAAA,aAAa,iBAoExB"}
@@ -0,0 +1,12 @@
1
+ export declare const SKILL_COMMAND_EXEC: import("rhachet").RoleSkill<import("rhachet").GStitcher<import("rhachet").Threads<{
2
+ commander: import("rhachet").RoleContext<"commander", {
3
+ art: {
4
+ input: import("rhachet-artifact").Artifact<typeof import("rhachet-artifact-git").GitFile, string>;
5
+ output: import("rhachet-artifact").Artifact<typeof import("rhachet-artifact-git").GitFile, string>;
6
+ };
7
+ }>;
8
+ }>, import("simple-log-methods").ContextLogTrail & import("rhachet").ContextStitchTrail, {
9
+ code: number | null;
10
+ stdout: string;
11
+ stderr: string;
12
+ }>>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SKILL_COMMAND_EXEC = void 0;
4
+ const rhachet_1 = require("rhachet");
5
+ const rhachet_artifact_git_1 = require("rhachet-artifact-git");
6
+ const genContextLogTrail_1 = require("../../../../.test/genContextLogTrail");
7
+ const setSkillOutputSrc_1 = require("../../../artifact/setSkillOutputSrc");
8
+ const genStitchStreamToDisk_1 = require("../../../context/genStitchStreamToDisk");
9
+ const stepExecCommand_1 = require("./stepExecCommand");
10
+ exports.SKILL_COMMAND_EXEC = (0, rhachet_1.genRoleSkill)({
11
+ slug: 'exec',
12
+ route: stepExecCommand_1.stepCommandExec,
13
+ threads: {
14
+ lookup: {
15
+ input: {
16
+ source: 'process.argv',
17
+ char: 'i',
18
+ desc: 'path to the input artifact containing the command text',
19
+ type: 'string',
20
+ },
21
+ output: {
22
+ source: 'process.argv',
23
+ char: 'o',
24
+ desc: 'path to the output artifact (markdown report)',
25
+ type: 'string',
26
+ },
27
+ },
28
+ assess: (input) => typeof input.input === 'string' &&
29
+ typeof input.output === 'string',
30
+ instantiate: async (input) => {
31
+ // declare where all the artifacts will be found
32
+ // const obsDir = getArtifactObsDir({ uri: input.output });
33
+ const artifacts = {
34
+ input: (0, rhachet_artifact_git_1.genArtifactGitFile)({ uri: input.input }, { access: 'readonly' }),
35
+ output: (0, rhachet_artifact_git_1.genArtifactGitFile)({ uri: input.output }, { versions: true }),
36
+ };
37
+ // add an src file for historic record
38
+ await (0, setSkillOutputSrc_1.setSkillOutputSrc)({
39
+ skillUri: 'commander.exec',
40
+ opts: input,
41
+ }).catch(() => { });
42
+ // enroll the threads
43
+ return {
44
+ commander: await (0, rhachet_1.enrollThread)({
45
+ role: 'commander',
46
+ stash: {
47
+ art: {
48
+ input: artifacts.input,
49
+ output: artifacts.output,
50
+ },
51
+ },
52
+ }),
53
+ };
54
+ },
55
+ },
56
+ // no OpenAI needed for pure command execution
57
+ context: {
58
+ lookup: {},
59
+ assess: (_) => true,
60
+ instantiate: () => ({
61
+ ...(0, genContextLogTrail_1.genContextLogTrail)(),
62
+ ...(0, rhachet_1.genContextStitchTrail)({
63
+ stream: (0, genStitchStreamToDisk_1.genStitchStreamToDisk)({ dir: process.cwd() }), // stream events to disk
64
+ }),
65
+ }),
66
+ },
67
+ readme: '',
68
+ });
69
+ //# sourceMappingURL=stepExecCommand.skill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepExecCommand.skill.js","sourceRoot":"","sources":["../../../../../src/logic/roles/terminal.commander/command.exec/stepExecCommand.skill.ts"],"names":[],"mappings":";;;AAAA,qCAA4E;AAC5E,+DAA0D;AAE1D,6EAA0E;AAC1E,2EAAwE;AACxE,kFAA+E;AAC/E,uDAAoD;AAEvC,QAAA,kBAAkB,GAAG,IAAA,sBAAY,EAAC;IAC7C,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,iCAAe;IACtB,OAAO,EAAE;QACP,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,MAAM,EAAE,cAAc;gBACtB,IAAI,EAAE,GAAG;gBACT,IAAI,EAAE,wDAAwD;gBAC9D,IAAI,EAAE,QAAQ;aACf;YACD,MAAM,EAAE;gBACN,MAAM,EAAE,cAAc;gBACtB,IAAI,EAAE,GAAG;gBACT,IAAI,EAAE,+CAA+C;gBACrD,IAAI,EAAE,QAAQ;aACf;SACF;QACD,MAAM,EAAE,CACN,KAAK,EAKL,EAAE,CACF,OAAQ,KAAa,CAAC,KAAK,KAAK,QAAQ;YACxC,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ;QAElC,WAAW,EAAE,KAAK,EAAE,KAInB,EAAE,EAAE;YACH,gDAAgD;YAChD,2DAA2D;YAC3D,MAAM,SAAS,GAAG;gBAChB,KAAK,EAAE,IAAA,yCAAkB,EAAC,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;gBACvE,MAAM,EAAE,IAAA,yCAAkB,EAAC,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;aACtE,CAAC;YAEF,sCAAsC;YACtC,MAAM,IAAA,qCAAiB,EAAC;gBACtB,QAAQ,EAAE,gBAAgB;gBAC1B,IAAI,EAAE,KAAK;aACZ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAEnB,qBAAqB;YACrB,OAAO;gBACL,SAAS,EAAE,MAAM,IAAA,sBAAY,EAAC;oBAC5B,IAAI,EAAE,WAAW;oBACjB,KAAK,EAAE;wBACL,GAAG,EAAE;4BACH,KAAK,EAAE,SAAS,CAAC,KAAK;4BACtB,MAAM,EAAE,SAAS,CAAC,MAAM;yBACzB;qBACF;iBACF,CAAC;aACH,CAAC;QACJ,CAAC;KACF;IAED,8CAA8C;IAC9C,OAAO,EAAE;QACP,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,CAAC,CAAC,EAA8B,EAAE,CAAC,IAAI;QAC/C,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;YAClB,GAAG,IAAA,uCAAkB,GAAE;YACvB,GAAG,IAAA,+BAAqB,EAAC;gBACvB,MAAM,EAAE,IAAA,6CAAqB,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,wBAAwB;aAChF,CAAC;SACH,CAAC;KACH;IACD,MAAM,EAAE,EAAE;CACX,CAAC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { GStitcher, RoleContext, Threads } from 'rhachet';
2
+ import { Artifact } from 'rhachet-artifact';
3
+ import { GitFile } from 'rhachet-artifact-git';
4
+ import { Focus } from '../../../../_topublish/rhachet-roles-bhrain/src/domain/objects/Focus';
5
+ import { ContextOpenAI } from '../../../../data/sdk/sdkOpenAi';
6
+ type StitcherDesired = GStitcher<Threads<{
7
+ caller: RoleContext<'caller', {
8
+ art: {
9
+ feedback: Artifact<typeof GitFile>;
10
+ 'foci.goal.concept': Focus['concept'];
11
+ 'foci.goal.context': Focus['context'];
12
+ };
13
+ refs: Artifact<typeof GitFile>[];
14
+ }>;
15
+ thinker: RoleContext<'thinker', {
16
+ art: {
17
+ 'focus.concept': Focus['concept'];
18
+ 'focus.context': Focus['context'];
19
+ };
20
+ briefs: Artifact<typeof GitFile>[];
21
+ }>;
22
+ }>, ContextOpenAI & GStitcher['context'], {
23
+ content: string;
24
+ }>;
25
+ export declare const stepCommandPlan: import("rhachet").Stitcher<StitcherDesired>;
26
+ export declare const loopCommandPlan: import("rhachet").Stitcher<GStitcher<Threads<{
27
+ caller: RoleContext<"caller", {
28
+ art: {
29
+ feedback: Artifact<typeof GitFile>;
30
+ 'foci.goal.concept': Focus['concept'];
31
+ 'foci.goal.context': Focus['context'];
32
+ };
33
+ refs: Artifact<typeof GitFile>[];
34
+ } & {
35
+ ask: string;
36
+ art: {
37
+ feedback: Artifact<typeof GitFile, string>;
38
+ };
39
+ }>;
40
+ thinker: RoleContext<"thinker", {
41
+ art: {
42
+ 'focus.concept': Focus['concept'];
43
+ 'focus.context': Focus['context'];
44
+ };
45
+ briefs: Artifact<typeof GitFile>[];
46
+ } & {
47
+ art: {
48
+ "focus.concept": Artifact<typeof GitFile, string>;
49
+ };
50
+ }>;
51
+ }>, ContextOpenAI & import("simple-log-methods").ContextLogTrail & import("rhachet").ContextStitchTrail, {
52
+ feedback: GitFile | null;
53
+ }>>;
54
+ export {};
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const uni_time_1 = require("@ehmpathy/uni-time");
4
+ const rhachet_1 = require("rhachet");
5
+ const rhachet_artifact_git_1 = require("rhachet-artifact-git");
6
+ const test_fns_1 = require("test-fns");
7
+ const genContextLogTrail_1 = require("../../../../.test/genContextLogTrail");
8
+ const genContextStitchTrail_1 = require("../../../../.test/genContextStitchTrail");
9
+ const getContextOpenAI_1 = require("../../../../.test/getContextOpenAI");
10
+ const stepPlanCommand_1 = require("./stepPlanCommand");
11
+ jest.setTimeout((0, uni_time_1.toMilliseconds)({ minutes: 5 }));
12
+ const artifacts = {
13
+ caller: {
14
+ feedback: (0, rhachet_artifact_git_1.genArtifactGitFile)({ uri: __dirname + '/.temp/stepCommandPlan/caller.feedback.md' }, { versions: true }),
15
+ 'foci.goal.concept': (0, rhachet_artifact_git_1.genArtifactGitFile)({
16
+ uri: __dirname + '/.temp/stepCommandPlan/caller.foci.goal.concept.md',
17
+ }, { versions: true }),
18
+ 'foci.goal.context': (0, rhachet_artifact_git_1.genArtifactGitFile)({
19
+ uri: __dirname + '/.temp/stepCommandPlan/caller.foci.goal.context.md',
20
+ }, { versions: true }),
21
+ },
22
+ thinker: {
23
+ 'focus.concept': (0, rhachet_artifact_git_1.genArtifactGitFile)({ uri: __dirname + '/.temp/stepCommandPlan/thinker.focus.concept.md' }, { versions: true }),
24
+ 'focus.context': (0, rhachet_artifact_git_1.genArtifactGitFile)({ uri: __dirname + '/.temp/stepCommandPlan/thinker.focus.context.md' }, { versions: true }),
25
+ },
26
+ };
27
+ const enthread = () => (0, test_fns_1.usePrep)(async () => ({
28
+ caller: await (0, rhachet_1.enrollThread)({
29
+ role: 'caller',
30
+ stash: {
31
+ art: {
32
+ 'foci.goal.concept': artifacts.caller['foci.goal.concept'],
33
+ 'foci.goal.context': artifacts.caller['foci.goal.context'],
34
+ feedback: artifacts.caller.feedback,
35
+ },
36
+ refs: [],
37
+ },
38
+ }),
39
+ thinker: await (0, rhachet_1.enrollThread)({
40
+ role: 'thinker',
41
+ stash: {
42
+ art: {
43
+ 'focus.context': artifacts.thinker['focus.context'],
44
+ 'focus.concept': artifacts.thinker['focus.concept'],
45
+ },
46
+ briefs: [],
47
+ },
48
+ inherit: {},
49
+ }),
50
+ }));
51
+ describe('stepCommandPlan', () => {
52
+ const context = {
53
+ ...(0, genContextLogTrail_1.genContextLogTrail)(),
54
+ ...(0, genContextStitchTrail_1.genContextStitchTrail)(),
55
+ ...(0, getContextOpenAI_1.getContextOpenAI)(),
56
+ };
57
+ const route = stepPlanCommand_1.stepCommandPlan;
58
+ (0, test_fns_1.given)('we want to commandPlan a file move', () => {
59
+ const ask = `
60
+ given
61
+
62
+ ➜ tree src/logic/roles/terminal.commander
63
+ src/logic/roles/terminal.commander
64
+ └── commandPlan
65
+ ├── stepCommandPlan.integration.test.ts
66
+ ├── stepCommandPlan.skill.ts
67
+ └── stepCommandPlan.ts
68
+
69
+ rename from stepCommandPlan to just stepPlan.ts
70
+ `;
71
+ beforeEach(async () => {
72
+ await artifacts.caller.feedback.set({ content: '' });
73
+ await artifacts.thinker['focus.context'].set({
74
+ content: [].join('\n'),
75
+ });
76
+ await artifacts.thinker['focus.concept'].set({
77
+ content: [].join('\n'),
78
+ });
79
+ await artifacts.caller['foci.goal.concept'].set({
80
+ content: ask,
81
+ });
82
+ });
83
+ (0, test_fns_1.when)('invoked', () => {
84
+ const goalThreads = enthread();
85
+ (0, test_fns_1.then)('outputs an instance', async () => {
86
+ const result = await (0, rhachet_1.enweaveOneStitcher)({ stitcher: route, threads: goalThreads }, context);
87
+ console.log(JSON.stringify(result.stitch, null, 2));
88
+ console.log(artifacts.thinker['focus.concept']);
89
+ const { content } = await artifacts.thinker['focus.concept']
90
+ .get()
91
+ .expect('isPresent');
92
+ expect(content.toLowerCase()).toMatch(/pun|knock/i);
93
+ });
94
+ });
95
+ });
96
+ });
97
+ //# sourceMappingURL=stepPlanCommand.integration.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepPlanCommand.integration.test.js","sourceRoot":"","sources":["../../../../../src/logic/roles/terminal.commander/command.plan/stepPlanCommand.integration.test.ts"],"names":[],"mappings":";;AAAA,iDAAoD;AACpD,qCAA2D;AAC3D,+DAA0D;AAC1D,uCAAsD;AAEtD,6EAA0E;AAC1E,mFAAgF;AAChF,yEAAsE;AACtE,uDAAoD;AAEpD,IAAI,CAAC,UAAU,CAAC,IAAA,yBAAc,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,C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MAAM,GAAG,MAAM,IAAA,4BAAkB,EACrC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,EACzC,OAAO,CACR,CAAC;gBACF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBACpD,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC;gBAEhD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,eAAe,CAAC;qBACzD,GAAG,EAAE;qBACL,MAAM,CAAC,WAAW,CAAC,CAAC;gBAEvB,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACtD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loopCommandPlan = exports.stepCommandPlan = void 0;
4
+ const rhachet_1 = require("rhachet");
5
+ const genLoopFeedback_1 = require("../../../artifact/genLoopFeedback");
6
+ const stepInstantiate_1 = require("../../bhrain/khue.instantiate/stepInstantiate");
7
+ const BRIEFS_FOR_CLIPLAN = [];
8
+ const stepAddBriefs = new rhachet_1.StitchStepCompute({
9
+ slug: '@[thinker]<getBriefs>',
10
+ readme: "adds a set of briefs to the @[thinker]'s context",
11
+ form: 'COMPUTE',
12
+ stitchee: 'thinker',
13
+ invoke: async ({ threads }) => {
14
+ // identify the prior briefs
15
+ const briefsBeforeUnsanitized = threads.thinker.context.stash.briefs;
16
+ // drop the briefs if they were already included (we'll put them at the end again, so they're the last thought)
17
+ const briefsBefore = briefsBeforeUnsanitized.filter((b) => !BRIEFS_FOR_CLIPLAN.includes(b));
18
+ // append these briefs
19
+ const briefsAfter = [...briefsBefore, ...BRIEFS_FOR_CLIPLAN];
20
+ // add the briefs to the thinker's context
21
+ threads.thinker.context.stash.briefs = briefsAfter;
22
+ // extend the focus context to explicitly know to use these briefs; // todo: put this into its own step for observability in stitch trail
23
+ const focusContextBefore = (await threads.thinker.context.stash.art['focus.context'].get())?.content;
24
+ const focusContextToAdd = `
25
+ instantiate a shell terminal command which will achieve the ask
26
+
27
+ objectives
28
+ - maximize readability
29
+ - maximize maintainability
30
+
31
+ tactics
32
+ - comments and newlines -> maximize readability
33
+ - simplify => maximize maintainability
34
+ - yagni => maximize maintainability
35
+ `.trim();
36
+ const focusContextAfter = [
37
+ focusContextBefore,
38
+ '',
39
+ '---',
40
+ '',
41
+ focusContextToAdd,
42
+ ].join('\n');
43
+ await threads.thinker.context.stash.art['focus.context'].set({
44
+ content: focusContextAfter,
45
+ });
46
+ // and then report that we did so
47
+ return {
48
+ input: null,
49
+ output: {
50
+ briefs: {
51
+ before: briefsBefore.map((artifact) => artifact.ref.uri),
52
+ after: briefsAfter.map((artifact) => artifact.ref.uri),
53
+ },
54
+ },
55
+ };
56
+ },
57
+ });
58
+ exports.stepCommandPlan = (0, rhachet_1.asStitcherFlat)((0, rhachet_1.genStitchRoute)({
59
+ slug: '@[thinker]<commandPlan>',
60
+ readme: '@[thinker]<getBriefs> -> @[thinker]<instantiate>[command][plan] -> [instance][command][plan]',
61
+ sequence: [stepAddBriefs, stepInstantiate_1.stepInstantiate],
62
+ }));
63
+ exports.loopCommandPlan = (0, genLoopFeedback_1.genLoopFeedback)({
64
+ stitchee: 'thinker',
65
+ artee: 'focus.concept',
66
+ repeatee: exports.stepCommandPlan,
67
+ });
68
+ //# sourceMappingURL=stepPlanCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stepPlanCommand.js","sourceRoot":"","sources":["../../../../../src/logic/roles/terminal.commander/command.plan/stepPlanCommand.ts"],"names":[],"mappings":";;;AAAA,qCAOiB;AAMjB,uEAAoE;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AiC;QACjC,OAAO;YACL,KAAK,EAAE,IAAI;YACX,MAAM,EAAE;gBACN,MAAM,EAAE;oBACN,MAAM,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;oBACxD,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;iBACvD;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,IAAA,wBAAc,EAC3C,IAAA,wBAAc,EAAC;IACb,IAAI,EAAE,yBAAyB;IAC/B,MAAM,EACJ,8FAA8F;IAChG,QAAQ,EAAE,CAAC,aAAa,EAAE,iCAAe,CAAC;CAC3C,CAAC,CACH,CAAC;AAEW,QAAA,eAAe,GAAG,IAAA,iCAAe,EAAC;IAC7C,QAAQ,EAAE,SAAS;IACnB,KAAK,EAAE,eAAe;IACtB,QAAQ,EAAE,uBAAe;CAC1B,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ export declare const SKILL_COMMAND_PLAN: import("rhachet").RoleSkill<import("rhachet").GStitcher<import("rhachet").Threads<{
2
+ caller: import("rhachet").RoleContext<"caller", {
3
+ art: {
4
+ feedback: import("rhachet-artifact").Artifact<typeof import("rhachet-artifact-git").GitFile, string>;
5
+ 'foci.goal.concept': import("rhachet-artifact").Artifact<typeof import("rhachet-artifact-git").GitFile, string>;
6
+ 'foci.goal.context': import("rhachet-artifact").Artifact<typeof import("rhachet-artifact-git").GitFile, string>;
7
+ };
8
+ refs: import("rhachet-artifact").Artifact<typeof import("rhachet-artifact-git").GitFile, string>[];
9
+ } & {
10
+ ask: string;
11
+ art: {
12
+ feedback: import("rhachet-artifact").Artifact<typeof import("rhachet-artifact-git").GitFile, string>;
13
+ };
14
+ }>;
15
+ thinker: import("rhachet").RoleContext<"thinker", {
16
+ art: {
17
+ 'focus.concept': import("rhachet-artifact").Artifact<typeof import("rhachet-artifact-git").GitFile, string>;
18
+ 'focus.context': import("rhachet-artifact").Artifact<typeof import("rhachet-artifact-git").GitFile, string>;
19
+ };
20
+ briefs: import("rhachet-artifact").Artifact<typeof import("rhachet-artifact-git").GitFile, string>[];
21
+ } & {
22
+ art: {
23
+ "focus.concept": import("rhachet-artifact").Artifact<typeof import("rhachet-artifact-git").GitFile, string>;
24
+ };
25
+ }>;
26
+ }>, import("../../../../data/sdk/sdkOpenAi").ContextOpenAI & import("simple-log-methods").ContextLogTrail & import("rhachet").ContextStitchTrail, {
27
+ feedback: import("rhachet-artifact-git").GitFile | null;
28
+ }>>;