@agentstorm/server 0.2.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.
@@ -0,0 +1,20 @@
1
+ import type { ApprovalRequest, PipelineRun } from "@agentstorm/protocol";
2
+ export type PipelineNextAction = "wait" | "human_approval" | "human_intervention" | "resume_node" | "completed" | "none";
3
+ export interface PipelineStatusNotification {
4
+ kind: "approval_required" | "human_required" | "blocked" | "completed" | "progress";
5
+ message: string;
6
+ at: string;
7
+ }
8
+ /**
9
+ * Translate the durable PipelineRun phase into a small, model-readable
10
+ * notification. This is deliberately derived from persisted state rather
11
+ * than pushed as an unsolicited chat message: a Main Agent can call
12
+ * pipeline_status at any time and will not miss a transition after a restart.
13
+ */
14
+ export declare function buildPipelineStatusSummary(run: PipelineRun, approvals: ApprovalRequest[]): {
15
+ nextAction: PipelineNextAction;
16
+ notifications: PipelineStatusNotification[];
17
+ canRevisePlan: boolean;
18
+ revisionCommand: string | null;
19
+ };
20
+ //# sourceMappingURL=pipeline-status.d.ts.map
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Translate the durable PipelineRun phase into a small, model-readable
3
+ * notification. This is deliberately derived from persisted state rather
4
+ * than pushed as an unsolicited chat message: a Main Agent can call
5
+ * pipeline_status at any time and will not miss a transition after a restart.
6
+ */
7
+ export function buildPipelineStatusSummary(run, approvals) {
8
+ const revisionCapability = {
9
+ canRevisePlan: run.phase !== "cancelled",
10
+ revisionCommand: run.phase === "cancelled"
11
+ ? null
12
+ : 'agentstorm pipeline extend --request "<修改要求>"',
13
+ };
14
+ const pendingApprovals = approvals.filter((approval) => approval.status === "pending");
15
+ if (run.phase === "awaiting_approval" || pendingApprovals.length > 0) {
16
+ return {
17
+ ...revisionCapability,
18
+ nextAction: "human_approval",
19
+ notifications: [{
20
+ kind: "approval_required",
21
+ message: "计划等待用户审批;主 Agent 不得代替用户批准。",
22
+ at: run.updatedAt,
23
+ }],
24
+ };
25
+ }
26
+ if (run.phase === "waiting_human" ||
27
+ (run.phase === "paused" && run.blockReason === "waiting_human")) {
28
+ return {
29
+ ...revisionCapability,
30
+ nextAction: "human_intervention",
31
+ notifications: [
32
+ {
33
+ kind: "human_required",
34
+ message: "当前节点等待用户完成登录、授权或其他外部操作;打开对应节点处理请求。",
35
+ at: run.updatedAt,
36
+ },
37
+ ],
38
+ };
39
+ }
40
+ if (run.phase === "blocked") {
41
+ return {
42
+ ...revisionCapability,
43
+ nextAction: "resume_node",
44
+ notifications: [{
45
+ kind: "blocked",
46
+ message: `流水线已阻塞${run.blockReason ? `:${run.blockReason}` : ""};向阻塞节点发送说明即可在原 ExecuteRun 上恢复。`,
47
+ at: run.updatedAt,
48
+ }],
49
+ };
50
+ }
51
+ if (run.phase === "done" || run.phase === "cancelled") {
52
+ return {
53
+ ...revisionCapability,
54
+ nextAction: "completed",
55
+ notifications: [{
56
+ kind: "completed",
57
+ message: run.phase === "done" ? "流水线已完成。" : "流水线已取消。",
58
+ at: run.updatedAt,
59
+ }],
60
+ };
61
+ }
62
+ if (run.phase === "planning" || run.phase === "ready" || run.phase === "executing" || run.phase === "paused") {
63
+ return {
64
+ ...revisionCapability,
65
+ nextAction: "wait",
66
+ notifications: [{
67
+ kind: "progress",
68
+ message: `流水线当前阶段:${run.phase}。AgentStorm 将继续负责阶段转换。`,
69
+ at: run.updatedAt,
70
+ }],
71
+ };
72
+ }
73
+ return { ...revisionCapability, nextAction: "none", notifications: [] };
74
+ }
75
+ //# sourceMappingURL=pipeline-status.js.map
@@ -0,0 +1,87 @@
1
+ import { type WorkflowSpec } from "@agentstorm/protocol";
2
+ export type TemplateGraph = "plan" | "execute";
3
+ export interface TemplateCanvasLayout {
4
+ plan?: Record<string, {
5
+ x: number;
6
+ y: number;
7
+ }>;
8
+ execute?: Record<string, {
9
+ x: number;
10
+ y: number;
11
+ }>;
12
+ edgeHandles?: Partial<Record<TemplateGraph, Record<string, {
13
+ sourceHandle?: string;
14
+ targetHandle?: string;
15
+ }>>>;
16
+ }
17
+ export interface TemplateAgentConfig {
18
+ backend?: "paseo";
19
+ provider?: string;
20
+ model?: string;
21
+ mode?: string;
22
+ thinking?: string;
23
+ }
24
+ export interface GlobalTemplateManifest {
25
+ schemaVersion: 1;
26
+ id: string;
27
+ name: string;
28
+ description: string;
29
+ version: number;
30
+ seeded: boolean;
31
+ updatedAt: string;
32
+ }
33
+ export interface GlobalTemplateSummary extends GlobalTemplateManifest {
34
+ etag: string;
35
+ }
36
+ export interface GlobalTemplateDocument extends GlobalTemplateSummary {
37
+ spec: WorkflowSpec;
38
+ layout: TemplateCanvasLayout;
39
+ assets: Record<string, string>;
40
+ }
41
+ export interface GlobalTemplateInput {
42
+ id?: string;
43
+ name: string;
44
+ description?: string;
45
+ spec: unknown;
46
+ layout?: unknown;
47
+ assets?: Record<string, unknown>;
48
+ }
49
+ export interface MaterializedWorkflow {
50
+ id: string;
51
+ spec: WorkflowSpec;
52
+ etag: string;
53
+ updatedAt: string;
54
+ version: number;
55
+ templateId: string;
56
+ templateVersion: number;
57
+ }
58
+ export declare function resolveBuiltinTemplateRoot(options?: {
59
+ home?: string;
60
+ moduleUrl?: string;
61
+ resourcesPath?: string;
62
+ }): string;
63
+ export declare function resolveTemplateRoot(options?: {
64
+ home?: string;
65
+ }): string;
66
+ export declare class GlobalTemplateLibrary {
67
+ readonly rootPath: string;
68
+ constructor(options?: {
69
+ home?: string;
70
+ });
71
+ list(): GlobalTemplateSummary[];
72
+ get(id: string): GlobalTemplateDocument;
73
+ create(input: GlobalTemplateInput): GlobalTemplateDocument;
74
+ update(id: string, input: GlobalTemplateInput, expectedEtag?: string): GlobalTemplateDocument;
75
+ delete(id: string): void;
76
+ materialize(id: string, workspaceRoot: string, options?: {
77
+ agentConfig?: TemplateAgentConfig;
78
+ name?: string;
79
+ }): MaterializedWorkflow;
80
+ private ensureSeedTemplates;
81
+ private migrateGeneralWorkflowId;
82
+ private retireLegacySeedTemplates;
83
+ private normalizeLegacyManifest;
84
+ private templateDir;
85
+ private writeDocument;
86
+ }
87
+ //# sourceMappingURL=template-library.d.ts.map