@nt-ai-lab/deterministic-agent-workflow-cli 0.2.0 → 0.2.1
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkflowEngine } from '@nt-ai-lab/deterministic-agent-workflow-engine';
|
|
1
|
+
import { pass, WorkflowEngine } from '@nt-ai-lab/deterministic-agent-workflow-engine';
|
|
2
2
|
import { EXIT_ALLOW, EXIT_BLOCK, EXIT_ERROR } from '../../../shell/exit-codes.js';
|
|
3
3
|
import { formatContextInjection, formatDenyDecision } from '../../../platform/infra/cli/presentation/hook-output.js';
|
|
4
4
|
import { hookCommonInputSchema, preToolUseInputSchema, subagentStartInputSchema, teammateIdleInputSchema, } from '../../../platform/infra/external-clients/claude-hooks/hook-schemas.js';
|
|
@@ -83,7 +83,7 @@ export function createWorkflowRunner(config) {
|
|
|
83
83
|
return (args, engineDeps, workflowDeps, options) => {
|
|
84
84
|
const engine = new WorkflowEngine(config.workflowDefinition, engineDeps, workflowDeps);
|
|
85
85
|
if (args.length > 0) {
|
|
86
|
-
return handleRoute(engine, config, args, args[0], options?.getSessionId, options?.getSessionTranscriptPath, options?.getSessionRepository);
|
|
86
|
+
return handleRoute(engine, engineDeps, config, args, args[0], options?.getSessionId, options?.getSessionTranscriptPath, options?.getSessionRepository);
|
|
87
87
|
}
|
|
88
88
|
if (options?.readStdin === undefined)
|
|
89
89
|
return {
|
|
@@ -93,7 +93,33 @@ export function createWorkflowRunner(config) {
|
|
|
93
93
|
return handleHook(engine, resolvedHandler, options.readStdin);
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function handleWriteJournalRoute(engine, engineDeps, args, getSessionId) {
|
|
97
|
+
const hasExplicitSessionId = getSessionId === undefined;
|
|
98
|
+
const sessionId = hasExplicitSessionId ? args[1] : getSessionId();
|
|
99
|
+
const agentNameIndex = hasExplicitSessionId ? 2 : 1;
|
|
100
|
+
const contentIndex = hasExplicitSessionId ? 3 : 2;
|
|
101
|
+
const agentName = args[agentNameIndex];
|
|
102
|
+
const content = args.slice(contentIndex).join(' ').trim();
|
|
103
|
+
if (typeof sessionId !== 'string' || typeof agentName !== 'string' || content.length === 0) {
|
|
104
|
+
return {
|
|
105
|
+
output: 'write-journal requires <agent-name> and <content> arguments',
|
|
106
|
+
exitCode: EXIT_ERROR,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return engineResultToRunnerResult(engine.transaction(sessionId, 'write-journal', (workflow) => {
|
|
110
|
+
workflow.appendEvent({
|
|
111
|
+
type: 'journal-entry',
|
|
112
|
+
at: engineDeps.now(),
|
|
113
|
+
agentName,
|
|
114
|
+
content,
|
|
115
|
+
});
|
|
116
|
+
return pass();
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
function handleRoute(engine, engineDeps, config, args, routeName, getSessionId, getSessionTranscriptPath, getSessionRepository) {
|
|
120
|
+
if (routeName === 'write-journal') {
|
|
121
|
+
return handleWriteJournalRoute(engine, engineDeps, args, getSessionId);
|
|
122
|
+
}
|
|
97
123
|
const routeDef = Object.hasOwn(config.routes, routeName) ? config.routes[routeName] : undefined;
|
|
98
124
|
if (routeDef === undefined)
|
|
99
125
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nt-ai-lab/deterministic-agent-workflow-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"
|
|
15
|
-
"@nt-ai-lab/deterministic-agent-workflow-dsl": "0.2.
|
|
16
|
-
"@nt-ai-lab/deterministic-agent-workflow-
|
|
17
|
-
"
|
|
14
|
+
"zod": "^3.25.76",
|
|
15
|
+
"@nt-ai-lab/deterministic-agent-workflow-dsl": "0.2.1",
|
|
16
|
+
"@nt-ai-lab/deterministic-agent-workflow-engine": "0.2.1",
|
|
17
|
+
"@nt-ai-lab/deterministic-agent-workflow-event-store": "0.2.1"
|
|
18
18
|
},
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"access": "public"
|