@nt-ai-lab/deterministic-agent-workflow-pi 0.5.3 → 0.5.5
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,6 +1,6 @@
|
|
|
1
1
|
import type { BaseWorkflowState, RehydratableWorkflow, TransitionContext } from '@nt-ai-lab/deterministic-agent-workflow-engine';
|
|
2
2
|
import type { PiWorkflowExtension, PiWorkflowExtensionConfig } from '../../../platform/domain/pi-workflow-extension-types';
|
|
3
|
-
export declare const PI_IDLE_RECOVERY_MESSAGE
|
|
3
|
+
export declare const PI_IDLE_RECOVERY_MESSAGE: string;
|
|
4
4
|
export declare const PI_SESSION_BRANCH_BLOCK_MESSAGE = "Pi session tree navigation and forks are disabled while a workflow is active.";
|
|
5
5
|
/** @riviere-role cli-entrypoint */
|
|
6
6
|
export declare function createPiWorkflowExtension<TWorkflow extends RehydratableWorkflow<TState>, TState extends BaseWorkflowState<TStateName>, TDeps, TStateName extends string = string, TOperation extends string = string, TTransitionContext extends TransitionContext<TState, TStateName> = TransitionContext<TState, TStateName>>(config: PiWorkflowExtensionConfig<TWorkflow, TState, TDeps, TStateName, TOperation, TTransitionContext>): PiWorkflowExtension;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { WorkflowEngine } from '@nt-ai-lab/deterministic-agent-workflow-engine';
|
|
3
|
-
import { createPreToolUseHandler, createWorkflowRunner, getRepositoryName, } from '@nt-ai-lab/deterministic-agent-workflow-cli';
|
|
3
|
+
import { createPreToolUseHandler, createWorkflowRunner, formatStopPreventionMessage, getRepositoryName, } from '@nt-ai-lab/deterministic-agent-workflow-cli';
|
|
4
4
|
import { createStore } from '@nt-ai-lab/deterministic-agent-workflow-event-store';
|
|
5
5
|
import { Type } from 'typebox';
|
|
6
6
|
import { parsePiCommandArguments } from '../../../platform/domain/pi-command-arguments.js';
|
|
@@ -12,7 +12,7 @@ const DEFAULT_COMMAND_NAME = 'workflow';
|
|
|
12
12
|
const DEFAULT_TOOL_NAME = 'workflow';
|
|
13
13
|
const INITIALIZATION_PENDING_REASON = 'Pi workflow initialization has not completed safely. Tool execution is blocked.';
|
|
14
14
|
const INACTIVE_WORKFLOW_REASON = 'Pi workflow is inactive. Run the workflow init command before using workflow operations.';
|
|
15
|
-
export const PI_IDLE_RECOVERY_MESSAGE =
|
|
15
|
+
export const PI_IDLE_RECOVERY_MESSAGE = formatStopPreventionMessage();
|
|
16
16
|
export const PI_SESSION_BRANCH_BLOCK_MESSAGE = 'Pi session tree navigation and forks are disabled while a workflow is active.';
|
|
17
17
|
const workflowToolParameters = Type.Object({
|
|
18
18
|
operation: Type.String({ description: 'Workflow operation, for example init or transition' }),
|
|
@@ -35,6 +35,7 @@ export function createPiWorkflowExtension(config) {
|
|
|
35
35
|
const runner = createWorkflowRunner({
|
|
36
36
|
workflowDefinition: config.workflowDefinition,
|
|
37
37
|
routes: config.routes,
|
|
38
|
+
unknownCommandMessage: config.unknownCommandMessage,
|
|
38
39
|
bashForbidden: config.bashForbidden,
|
|
39
40
|
isWriteAllowed: config.isWriteAllowed,
|
|
40
41
|
questionToolName: PI_QUESTION_TOOL,
|
|
@@ -317,7 +318,7 @@ export function createPiWorkflowExtension(config) {
|
|
|
317
318
|
const result = useEngine(ctx, (engine) => engine.checkStopping(session.sessionId, 'stop'));
|
|
318
319
|
if (result.type === 'blocked' && ctx.isIdle() && !ctx.hasPendingMessages()) {
|
|
319
320
|
recoveredAssistantBySession.set(session.sessionId, settlement.id);
|
|
320
|
-
pi.sendUserMessage(
|
|
321
|
+
pi.sendUserMessage(formatStopPreventionMessage(result.output, config.stopPreventionMessage));
|
|
321
322
|
}
|
|
322
323
|
}
|
|
323
324
|
catch (error) {
|
|
@@ -26,9 +26,11 @@ export type PiSessionIdResult = {
|
|
|
26
26
|
export type PiWorkflowExtensionConfig<TWorkflow extends RehydratableWorkflow<TState>, TState extends BaseWorkflowState<TStateName>, TDeps, TStateName extends string = string, TOperation extends string = string, TTransitionContext extends TransitionContext<TState, TStateName> = TransitionContext<TState, TStateName>> = Omit<PreToolUseHandlerConfig<TWorkflow, TState, TStateName>, 'questionToolName'> & {
|
|
27
27
|
readonly workflowDefinition: WorkflowDefinition<TWorkflow, TState, TDeps, TStateName, TOperation, TTransitionContext>;
|
|
28
28
|
readonly routes: RouteMap<TWorkflow, TState>;
|
|
29
|
+
readonly unknownCommandMessage: string;
|
|
29
30
|
readonly buildWorkflowDeps: (platform: PlatformContext) => TDeps;
|
|
30
31
|
readonly pluginRoot: string;
|
|
31
32
|
readonly databasePath?: string;
|
|
32
33
|
readonly commandName?: string;
|
|
33
34
|
readonly toolName?: string;
|
|
35
|
+
readonly stopPreventionMessage?: string;
|
|
34
36
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nt-ai-lab/deterministic-agent-workflow-pi",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"typebox": "^1.3.7",
|
|
26
|
-
"@nt-ai-lab/deterministic-agent-workflow-cli": "0.4.
|
|
27
|
-
"@nt-ai-lab/deterministic-agent-workflow-
|
|
28
|
-
"@nt-ai-lab/deterministic-agent-workflow-
|
|
26
|
+
"@nt-ai-lab/deterministic-agent-workflow-cli": "0.4.8",
|
|
27
|
+
"@nt-ai-lab/deterministic-agent-workflow-engine": "0.4.7",
|
|
28
|
+
"@nt-ai-lab/deterministic-agent-workflow-event-store": "0.4.7"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@earendil-works/pi-coding-agent": "^0.84.4",
|