@ownclaw/own-prose 0.1.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.
- package/README.md +90 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +1 -0
- package/dist/openclaw.plugin.json +28 -0
- package/dist/runtime-api.d.ts +2 -0
- package/dist/runtime-api.js +1 -0
- package/dist/src/agent-notify.d.ts +39 -0
- package/dist/src/agent-notify.js +1 -0
- package/dist/src/agent-parser.d.ts +4 -0
- package/dist/src/agent-parser.js +1 -0
- package/dist/src/cli.d.ts +3 -0
- package/dist/src/cli.js +1 -0
- package/dist/src/config.d.ts +8 -0
- package/dist/src/config.js +1 -0
- package/dist/src/execution.d.ts +47 -0
- package/dist/src/execution.js +1 -0
- package/dist/src/plan-compiler.d.ts +12 -0
- package/dist/src/plan-compiler.js +1 -0
- package/dist/src/plan-validator.d.ts +2 -0
- package/dist/src/plan-validator.js +1 -0
- package/dist/src/program-parser.d.ts +3 -0
- package/dist/src/program-parser.js +1 -0
- package/dist/src/state-store.d.ts +20 -0
- package/dist/src/state-store.js +1 -0
- package/dist/src/tool.d.ts +133 -0
- package/dist/src/tool.js +1 -0
- package/dist/src/types.d.ts +233 -0
- package/dist/src/types.js +1 -0
- package/openclaw.plugin.json +28 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# @ownclaw/own-prose
|
|
2
|
+
|
|
3
|
+
`@ownclaw/own-prose` is a natural-language workflow compiler and executor for
|
|
4
|
+
OpenClaw.
|
|
5
|
+
|
|
6
|
+
It lets you describe a workflow in Markdown, compile that workflow into a
|
|
7
|
+
strict execution plan, then run it through OpenClaw tools and agent sessions.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @ownclaw/own-prose
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## What it provides
|
|
16
|
+
|
|
17
|
+
- Natural-language `program.md` workflow definitions
|
|
18
|
+
- Workflow compilation into explicit `task`, `judge`, and `finish` nodes
|
|
19
|
+
- Blocking execution with `own_prose_drive`
|
|
20
|
+
- Background execution with `own_prose_start`
|
|
21
|
+
- Run inspection with `own_prose_status`
|
|
22
|
+
- OpenClaw session notification support for background runs
|
|
23
|
+
|
|
24
|
+
## Typical workflow layout
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
my-workflow/
|
|
28
|
+
├── program.md
|
|
29
|
+
└── agents/
|
|
30
|
+
├── researcher.md
|
|
31
|
+
├── writer.md
|
|
32
|
+
├── reviewer.md
|
|
33
|
+
└── finalizer.md
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Example `program.md`
|
|
37
|
+
|
|
38
|
+
```md
|
|
39
|
+
---
|
|
40
|
+
name: article-workflow
|
|
41
|
+
version: 1
|
|
42
|
+
description: Draft, review, and finalize an article.
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Goal
|
|
46
|
+
|
|
47
|
+
Produce a final article from a topic input.
|
|
48
|
+
|
|
49
|
+
## Inputs
|
|
50
|
+
|
|
51
|
+
- topic: article topic
|
|
52
|
+
|
|
53
|
+
## Agents
|
|
54
|
+
|
|
55
|
+
- writer
|
|
56
|
+
- reviewer
|
|
57
|
+
- finalizer
|
|
58
|
+
|
|
59
|
+
## Workflow
|
|
60
|
+
|
|
61
|
+
Write a draft for the topic, review whether it is ready, and if approved,
|
|
62
|
+
return the final article text.
|
|
63
|
+
|
|
64
|
+
## Constraints
|
|
65
|
+
|
|
66
|
+
- maxSteps: 6
|
|
67
|
+
- allowLoops: false
|
|
68
|
+
|
|
69
|
+
## Output Contract
|
|
70
|
+
|
|
71
|
+
- Return only the final article
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## OpenClaw tool surface
|
|
75
|
+
|
|
76
|
+
This package registers these runtime tools:
|
|
77
|
+
|
|
78
|
+
- `own_prose_start`
|
|
79
|
+
- `own_prose_drive`
|
|
80
|
+
- `own_prose_status`
|
|
81
|
+
- `own_prose_background_run`
|
|
82
|
+
|
|
83
|
+
## Notes
|
|
84
|
+
|
|
85
|
+
- The package is intended for OpenClaw environments.
|
|
86
|
+
- Background runs can notify the originating agent session when they finish.
|
|
87
|
+
- Skill-driven workflows can be implemented by putting preferred skill usage in
|
|
88
|
+
agent instructions and letting `judge` nodes branch on explicit signal fields.
|
|
89
|
+
|
|
90
|
+
Project repository documentation may be more detailed than this npm page.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
configSchema: {
|
|
7
|
+
type: string;
|
|
8
|
+
additionalProperties: boolean;
|
|
9
|
+
properties: {
|
|
10
|
+
stateRoot: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
defaultProvider: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
defaultModel: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
timeoutMs: {
|
|
23
|
+
type: string;
|
|
24
|
+
minimum: number;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
register(api: OpenClawPluginApi): void;
|
|
30
|
+
};
|
|
31
|
+
export default _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _0x4ccc(){var _0x168da6=['configSchema','6xSnQyV','8700273HiRWBS','registerTool','603192CTaxVi','6189984jkzXzr','Compile\x20and\x20execute\x20natural-language\x20workflows','OwnProse','10VIeSbs','own-prose','341795bfxskY','21kiRSPb','70734hYehkq','650696wbZQoL','5519640XzYXMS'];_0x4ccc=function(){return _0x168da6;};return _0x4ccc();}var _0x2e1f1b=_0x392b;(function(_0x2a6206,_0x4d8e59){var _0x124605=_0x392b,_0x414f0=_0x2a6206();while(!![]){try{var _0x3a4668=parseInt(_0x124605(0x1e7))/0x1*(-parseInt(_0x124605(0x1e8))/0x2)+-parseInt(_0x124605(0x1e0))/0x3+parseInt(_0x124605(0x1e1))/0x4+-parseInt(_0x124605(0x1e6))/0x5*(-parseInt(_0x124605(0x1dd))/0x6)+-parseInt(_0x124605(0x1db))/0x7+parseInt(_0x124605(0x1e9))/0x8+parseInt(_0x124605(0x1de))/0x9*(parseInt(_0x124605(0x1e4))/0xa);if(_0x3a4668===_0x4d8e59)break;else _0x414f0['push'](_0x414f0['shift']());}catch(_0x1f90ba){_0x414f0['push'](_0x414f0['shift']());}}}(_0x4ccc,0xe370e));function _0x392b(_0x16cfc9,_0xec8f52){_0x16cfc9=_0x16cfc9-0x1db;var _0x4cccf9=_0x4ccc();var _0x392b6f=_0x4cccf9[_0x16cfc9];return _0x392b6f;}import _0x15def0 from'./openclaw.plugin.json'with{type:'json'};import{registerOwnProseCli}from'./src/cli.js';import{createOwnProseBackgroundRunTool,createOwnProseDriveTool,createOwnProseStartTool,createOwnProseStatusTool}from'./src/tool.js';export default{'id':'own-prose','name':_0x2e1f1b(0x1e3),'description':'Natural-language\x20workflow\x20compiler\x20and\x20executor\x20for\x20OpenClaw.','configSchema':_0x15def0[_0x2e1f1b(0x1dc)],'register'(_0x15fd64){var _0x365f45=_0x2e1f1b;_0x15fd64[_0x365f45(0x1df)](_0x19dae9=>createOwnProseStartTool(_0x15fd64,_0x19dae9),{'optional':!![]}),_0x15fd64['registerTool'](_0x491700=>createOwnProseDriveTool(_0x15fd64,_0x491700),{'optional':!![]}),_0x15fd64[_0x365f45(0x1df)](_0x2c3549=>createOwnProseStatusTool(_0x15fd64,_0x2c3549),{'optional':!![]}),_0x15fd64[_0x365f45(0x1df)](_0x1a05be=>createOwnProseBackgroundRunTool(_0x15fd64,_0x1a05be)),_0x15fd64['registerCli'](({program:_0x42db09})=>{registerOwnProseCli(_0x42db09,_0x15fd64);},{'descriptors':[{'name':_0x365f45(0x1e5),'description':_0x365f45(0x1e2),'hasSubcommands':!![]}]});}};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "own-prose",
|
|
3
|
+
"name": "OwnProse",
|
|
4
|
+
"description": "Natural-language workflow compiler and executor for OpenClaw.",
|
|
5
|
+
"configSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"stateRoot": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Optional workspace-relative directory used for own-prose state."
|
|
12
|
+
},
|
|
13
|
+
"defaultProvider": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Optional provider override used for workflow compilation and node execution."
|
|
16
|
+
},
|
|
17
|
+
"defaultModel": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Optional model override used for workflow compilation and node execution."
|
|
20
|
+
},
|
|
21
|
+
"timeoutMs": {
|
|
22
|
+
"type": "number",
|
|
23
|
+
"minimum": 1000,
|
|
24
|
+
"description": "Optional timeout override for each compiler or node run."
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _0x451f(){var _0x3822ed=['65158XFrpcs','57957640cBXftP','4625825VNzdAZ','9DegEZg','20151vvcAxA','6gAlzDW','5410bTateR','45oKvalI','22QDZKYR','4308828hmchDD','361252xwjZrV','8KZtpkU','10103786tyXTjP'];_0x451f=function(){return _0x3822ed;};return _0x451f();}(function(_0x43e6c5,_0x19db57){var _0x3efd5d=_0xbeb4,_0x5c7dd2=_0x43e6c5();while(!![]){try{var _0x3f3a03=-parseInt(_0x3efd5d(0x1ca))/0x1*(parseInt(_0x3efd5d(0x1d0))/0x2)+-parseInt(_0x3efd5d(0x1c6))/0x3*(parseInt(_0x3efd5d(0x1cd))/0x4)+-parseInt(_0x3efd5d(0x1c5))/0x5*(parseInt(_0x3efd5d(0x1c8))/0x6)+-parseInt(_0x3efd5d(0x1cf))/0x7*(parseInt(_0x3efd5d(0x1ce))/0x8)+parseInt(_0x3efd5d(0x1c7))/0x9*(parseInt(_0x3efd5d(0x1c9))/0xa)+-parseInt(_0x3efd5d(0x1cb))/0xb*(parseInt(_0x3efd5d(0x1cc))/0xc)+parseInt(_0x3efd5d(0x1c4))/0xd;if(_0x3f3a03===_0x19db57)break;else _0x5c7dd2['push'](_0x5c7dd2['shift']());}catch(_0x59882e){_0x5c7dd2['push'](_0x5c7dd2['shift']());}}}(_0x451f,0xce83c));function _0xbeb4(_0x1b1539,_0x1a1512){_0x1b1539=_0x1b1539-0x1c4;var _0x451f5e=_0x451f();var _0xbeb4c8=_0x451f5e[_0x1b1539];return _0xbeb4c8;}export{definePluginEntry}from'openclaw/plugin-sdk/core';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type AgentSessionNotificationResult = {
|
|
2
|
+
runId: string;
|
|
3
|
+
};
|
|
4
|
+
export type AgentSessionWaitResult = {
|
|
5
|
+
status?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
};
|
|
8
|
+
export type AgentSessionMessagesResult = {
|
|
9
|
+
messages: unknown[];
|
|
10
|
+
};
|
|
11
|
+
export declare function queueAgentSessionRun(params: {
|
|
12
|
+
sessionKey: string;
|
|
13
|
+
message: string;
|
|
14
|
+
agentId?: string;
|
|
15
|
+
extraSystemPrompt?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
idempotencyKey?: string;
|
|
19
|
+
}): Promise<AgentSessionNotificationResult>;
|
|
20
|
+
export declare function waitForAgentSessionRun(params: {
|
|
21
|
+
runId: string;
|
|
22
|
+
timeoutMs: number;
|
|
23
|
+
}): Promise<AgentSessionWaitResult>;
|
|
24
|
+
export declare function getAgentSessionMessages(params: {
|
|
25
|
+
sessionKey: string;
|
|
26
|
+
limit?: number;
|
|
27
|
+
}): Promise<AgentSessionMessagesResult>;
|
|
28
|
+
/**
|
|
29
|
+
* Queue a message back into an existing OpenClaw agent session.
|
|
30
|
+
*/
|
|
31
|
+
export declare function notifyAgentSession(params: {
|
|
32
|
+
sessionKey: string;
|
|
33
|
+
message: string;
|
|
34
|
+
agentId?: string;
|
|
35
|
+
extraSystemPrompt?: string;
|
|
36
|
+
label?: string;
|
|
37
|
+
timeoutMs?: number;
|
|
38
|
+
idempotencyKey?: string;
|
|
39
|
+
}): Promise<AgentSessionNotificationResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _0x3884(_0x133b38,_0x36cce7){_0x133b38=_0x133b38-0x1de;const _0x524285=_0x5242();let _0x3884a7=_0x524285[_0x133b38];return _0x3884a7;}(function(_0x49e8e5,_0xd27091){const _0x50fed7=_0x3884,_0x4562e9=_0x49e8e5();while(!![]){try{const _0x481bc5=-parseInt(_0x50fed7(0x1e2))/0x1+parseInt(_0x50fed7(0x1e4))/0x2*(parseInt(_0x50fed7(0x1f3))/0x3)+-parseInt(_0x50fed7(0x1de))/0x4*(parseInt(_0x50fed7(0x1ee))/0x5)+parseInt(_0x50fed7(0x1df))/0x6*(parseInt(_0x50fed7(0x1f1))/0x7)+-parseInt(_0x50fed7(0x1f4))/0x8+parseInt(_0x50fed7(0x1e0))/0x9*(parseInt(_0x50fed7(0x1e5))/0xa)+parseInt(_0x50fed7(0x1e7))/0xb*(parseInt(_0x50fed7(0x1f5))/0xc);if(_0x481bc5===_0xd27091)break;else _0x4562e9['push'](_0x4562e9['shift']());}catch(_0x315f68){_0x4562e9['push'](_0x4562e9['shift']());}}}(_0x5242,0x32247));import{randomUUID}from'node:crypto';function _0x5242(){const _0x7585cc=['agentId','236sjIhuk','10BXDWLp','agent.wait','11lxNltC','agent','trim','Agent\x20session\x20notification\x20did\x20not\x20return\x20a\x20runId','timeoutMs','runId','extraSystemPrompt','5iMvKmt','idempotencyKey','sessionKey','63lSsJiV','chat.history','8949MWBhPq','3249232vTxzbZ','6623772FizUzV','1411708WVDoBG','180366YtuOCN','1694457Qpsgjv','label','398333VoxhCd'];_0x5242=function(){return _0x7585cc;};return _0x5242();}import{callGatewayTool}from'openclaw/plugin-sdk/browser-support';export async function queueAgentSessionRun(_0x2bf91b){const _0x598ab9=_0x3884,_0x3731c5=await callGatewayTool(_0x598ab9(0x1e8),{'timeoutMs':_0x2bf91b['timeoutMs']??0x2710},{'message':_0x2bf91b['message'],'sessionKey':_0x2bf91b[_0x598ab9(0x1f0)],..._0x2bf91b[_0x598ab9(0x1e3)]?{'agentId':_0x2bf91b[_0x598ab9(0x1e3)]}:{},..._0x2bf91b['extraSystemPrompt']?{'extraSystemPrompt':_0x2bf91b[_0x598ab9(0x1ed)]}:{},..._0x2bf91b[_0x598ab9(0x1e1)]?{'label':_0x2bf91b['label']}:{},'idempotencyKey':_0x2bf91b[_0x598ab9(0x1ef)]??randomUUID(),'deliver':![]}),_0x5e8ed8=_0x3731c5?.[_0x598ab9(0x1ec)]?.[_0x598ab9(0x1e9)]();if(!_0x5e8ed8)throw new Error(_0x598ab9(0x1ea));return{'runId':_0x5e8ed8};}export async function waitForAgentSessionRun(_0x3ddee4){const _0x5b124b=_0x3884;return await callGatewayTool(_0x5b124b(0x1e6),{'timeoutMs':_0x3ddee4[_0x5b124b(0x1eb)]+0x7d0},{'runId':_0x3ddee4[_0x5b124b(0x1ec)],'timeoutMs':_0x3ddee4[_0x5b124b(0x1eb)]});}export async function getAgentSessionMessages(_0xcb76d){const _0x358573=_0x3884;return await callGatewayTool(_0x358573(0x1f2),{'timeoutMs':0x2710},{'sessionKey':_0xcb76d['sessionKey'],'limit':_0xcb76d['limit']??0xc8});}export async function notifyAgentSession(_0x50f4dc){return queueAgentSessionRun(_0x50f4dc);}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgentSpec } from "./types.js";
|
|
2
|
+
export declare function parseAgentFile(agentPath: string): Promise<AgentSpec>;
|
|
3
|
+
export declare function loadAgents(agentIds: string[], baseDir: string): Promise<Record<string, AgentSpec>>;
|
|
4
|
+
export declare function parseAgentMarkdown(source: string, sourcePath: string): AgentSpec;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x3d7bc1,_0x366ee9){const _0x28ec3c=_0x2b00,_0x4a7e01=_0x3d7bc1();while(!![]){try{const _0x1e69a3=parseInt(_0x28ec3c(0x147))/0x1*(parseInt(_0x28ec3c(0x16b))/0x2)+parseInt(_0x28ec3c(0x15e))/0x3+parseInt(_0x28ec3c(0x155))/0x4*(-parseInt(_0x28ec3c(0x157))/0x5)+-parseInt(_0x28ec3c(0x159))/0x6+-parseInt(_0x28ec3c(0x14a))/0x7+parseInt(_0x28ec3c(0x144))/0x8*(-parseInt(_0x28ec3c(0x165))/0x9)+parseInt(_0x28ec3c(0x141))/0xa;if(_0x1e69a3===_0x366ee9)break;else _0x4a7e01['push'](_0x4a7e01['shift']());}catch(_0x5f1339){_0x4a7e01['push'](_0x4a7e01['shift']());}}}(_0x31bb,0x8ddee));import _0x11f209 from'node:fs/promises';import _0x870d4f from'node:path';import{parse as _0x5bc759}from'yaml';export async function parseAgentFile(_0xdb101f){const _0x50ed52=_0x2b00,_0x2472e9=_0x870d4f[_0x50ed52(0x13c)](_0xdb101f),_0x1f5372=await _0x11f209[_0x50ed52(0x154)](_0x2472e9,_0x50ed52(0x169));return parseAgentMarkdown(_0x1f5372,_0x2472e9);}export async function loadAgents(_0x538b65,_0x3a93e8){const _0x4b2b6a=_0x2b00,_0x1072b4=await Promise['all'](_0x538b65[_0x4b2b6a(0x14d)](async _0x21fad0=>[_0x21fad0,await parseAgentFile(_0x870d4f['join'](_0x3a93e8,_0x4b2b6a(0x162),_0x21fad0+_0x4b2b6a(0x163)))]));return Object[_0x4b2b6a(0x145)](_0x1072b4);}function _0x31bb(){const _0xd390ed=['trim','subagent','41106uJYAJH','---\x0a','provider','join','agents','.md','toUpperCase','19827MZrvvH','description','split','own-prose\x20agent\x20frontmatter\x20must\x20be\x20a\x20YAML\x20object','utf8','own-prose\x20agent\x20must\x20start\x20with\x20YAML\x20frontmatter','4934bXPBIl','push','resolve','isFinite','self','own-prose\x20agent\x20must\x20include\x20a\x20\x22##\x20','string','33745800liDrFN','slice','executionTarget','2664RQIFUx','fromEntries','number','242RWZEwk','replace','exec','8073618uAaQnx','filter','timeoutMs','map','instructions','name','model','role','overview','\x22\x20section','readFile','646856IjVVuS','basename','25XKmdAm','\x0a---\x0a','4251906IbvPwC','done_when','allowMutatingTools'];_0x31bb=function(){return _0xd390ed;};return _0x31bb();}export function parseAgentMarkdown(_0x1faa13,_0x4eef13){const _0xcddf58=_0x2b00,{frontmatter:_0x4014a3,body:_0xb26761}=splitFrontmatter(_0x1faa13),_0x3579fe=normalizeFrontmatter(_0x4014a3),_0x40fff1=parseSections(_0xb26761),_0xf22d8d=_0x870d4f[_0xcddf58(0x156)](_0x4eef13,_0x870d4f['extname'](_0x4eef13)),_0x41bb68=optionalString(_0x3579fe[_0xcddf58(0x14f)])??_0xf22d8d;return{'id':_0xf22d8d,'name':_0x41bb68,'description':optionalString(_0x3579fe[_0xcddf58(0x166)]),'sourcePath':_0x4eef13,'provider':optionalString(_0x3579fe[_0xcddf58(0x160)]),'model':optionalString(_0x3579fe[_0xcddf58(0x150)]),'timeoutMs':normalizeTimeoutMs(_0x3579fe[_0xcddf58(0x14c)]),'permissions':normalizePermissions({'allowMutatingTools':_0x3579fe[_0xcddf58(0x15b)],'executionTarget':_0x3579fe[_0xcddf58(0x143)]}),'role':requireSection(_0x40fff1,_0xcddf58(0x151)),'instructions':requireSection(_0x40fff1,_0xcddf58(0x14e)),'doneWhen':parseDoneWhen(_0x40fff1[_0xcddf58(0x15a)])};}function splitFrontmatter(_0x46d1f2){const _0xe9f8ff=_0x2b00,_0x1654e0=_0x46d1f2[_0xe9f8ff(0x148)](/\r\n/g,'\x0a');if(!_0x1654e0['startsWith'](_0xe9f8ff(0x15f)))throw new Error(_0xe9f8ff(0x16a));const _0x12ef98=_0x1654e0['indexOf'](_0xe9f8ff(0x158),0x4);if(_0x12ef98<0x0)throw new Error('own-prose\x20agent\x20frontmatter\x20is\x20missing\x20a\x20closing\x20---\x20line');return{'frontmatter':_0x5bc759(_0x1654e0[_0xe9f8ff(0x142)](0x4,_0x12ef98)),'body':_0x1654e0[_0xe9f8ff(0x142)](_0x12ef98+0x5)[_0xe9f8ff(0x15c)]()};}function normalizeFrontmatter(_0xbd44f1){const _0x1acd6c=_0x2b00;if(!_0xbd44f1||typeof _0xbd44f1!=='object'||Array['isArray'](_0xbd44f1))throw new Error(_0x1acd6c(0x168));return _0xbd44f1;}function parseSections(_0xe3bdbf){const _0x5e910a=_0x2b00,_0x4dc642={},_0x52a056=_0xe3bdbf[_0x5e910a(0x167)]('\x0a');let _0x72c62d=_0x5e910a(0x152),_0x5f4203=[];for(const _0x7dd404 of _0x52a056){const _0x2d4413=/^##\s+(.+?)\s*$/['exec'](_0x7dd404);if(_0x2d4413){_0x4dc642[_0x72c62d]=_0x5f4203[_0x5e910a(0x161)]('\x0a')['trim'](),_0x72c62d=_0x2d4413[0x1][_0x5e910a(0x15c)]()['toLowerCase']()['replace'](/[^a-z0-9]+/g,'_')['replace'](/^_+|_+$/g,''),_0x5f4203=[];continue;}_0x5f4203[_0x5e910a(0x16c)](_0x7dd404);}return _0x4dc642[_0x72c62d]=_0x5f4203[_0x5e910a(0x161)]('\x0a')['trim'](),_0x4dc642;}function normalizePermissions(_0x1374fe){const _0xd849a7=_0x2b00,_0x4572f3=_0x1374fe[_0xd849a7(0x143)]===_0xd849a7(0x13e)||_0x1374fe[_0xd849a7(0x143)]===_0xd849a7(0x15d)?_0x1374fe[_0xd849a7(0x143)]:_0xd849a7(0x15d);return{'allowMutatingTools':_0x1374fe[_0xd849a7(0x15b)]===!![],'executionTarget':_0x4572f3};}function normalizeTimeoutMs(_0x15784d){const _0x409cb5=_0x2b00;return typeof _0x15784d===_0x409cb5(0x146)&&Number[_0x409cb5(0x13d)](_0x15784d)&&_0x15784d>=0x1?_0x15784d:undefined;}function parseDoneWhen(_0x57f966){const _0x235b57=_0x2b00;if(!_0x57f966?.[_0x235b57(0x15c)]())return[];return _0x57f966['split']('\x0a')[_0x235b57(0x14d)](_0x37114c=>/^\s*-\s+(.*\S)\s*$/[_0x235b57(0x149)](_0x37114c)?.[0x1]?.[_0x235b57(0x15c)]())[_0x235b57(0x14b)](_0x235c4e=>Boolean(_0x235c4e));}function _0x2b00(_0x2fd9e3,_0x3dd660){_0x2fd9e3=_0x2fd9e3-0x13c;const _0x31bbb1=_0x31bb();let _0x2b00f5=_0x31bbb1[_0x2fd9e3];return _0x2b00f5;}function requireSection(_0x4ef598,_0x3c37a7){const _0x5823cd=_0x2b00,_0x2928e5=_0x4ef598[_0x3c37a7];if(!_0x2928e5?.[_0x5823cd(0x15c)]())throw new Error(_0x5823cd(0x13f)+humanizeSectionId(_0x3c37a7)+_0x5823cd(0x153));return _0x2928e5[_0x5823cd(0x15c)]();}function humanizeSectionId(_0x8269c6){const _0x48e06a=_0x2b00;return _0x8269c6[_0x48e06a(0x167)]('_')[_0x48e06a(0x14d)](_0x3d7ab=>_0x3d7ab[_0x48e06a(0x142)](0x0,0x1)[_0x48e06a(0x164)]()+_0x3d7ab[_0x48e06a(0x142)](0x1))['join']('\x20');}function optionalString(_0x1025ce){const _0x563cfd=_0x2b00;return typeof _0x1025ce===_0x563cfd(0x140)&&_0x1025ce[_0x563cfd(0x15c)]()?_0x1025ce[_0x563cfd(0x15c)]():undefined;}
|
package/dist/src/cli.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x47af19,_0x496239){const _0x159caa=_0x44e1,_0x13e64e=_0x47af19();while(!![]){try{const _0x3db4d1=parseInt(_0x159caa(0xbe))/0x1*(-parseInt(_0x159caa(0x9f))/0x2)+-parseInt(_0x159caa(0xc9))/0x3+parseInt(_0x159caa(0xc0))/0x4*(parseInt(_0x159caa(0xb2))/0x5)+-parseInt(_0x159caa(0xc4))/0x6*(parseInt(_0x159caa(0xa6))/0x7)+parseInt(_0x159caa(0xc3))/0x8+-parseInt(_0x159caa(0xd0))/0x9*(-parseInt(_0x159caa(0x99))/0xa)+parseInt(_0x159caa(0xcf))/0xb;if(_0x3db4d1===_0x496239)break;else _0x13e64e['push'](_0x13e64e['shift']());}catch(_0x525545){_0x13e64e['push'](_0x13e64e['shift']());}}}(_0x12a0,0xdfe66));import{compileOwnProseProgram,driveOwnProseProgram,inspectOwnProseProgramFile,loadOwnProseRunState,renderOwnProseStatus,startOwnProseProgram}from'./execution.js';export function registerOwnProseCli(_0x4f57ad,_0x43326b){const _0x46c40d=_0x44e1,_0x89fa8b=_0x4f57ad[_0x46c40d(0xa1)](_0x46c40d(0xc6))[_0x46c40d(0xa4)](_0x46c40d(0xa3));_0x89fa8b[_0x46c40d(0xa1)](_0x46c40d(0xa2))[_0x46c40d(0xa4)](_0x46c40d(0x96))['argument']('<program>',_0x46c40d(0xb0))[_0x46c40d(0xae)]('--input\x20<key=value>','Repeatable\x20input\x20value',collectOption,[])[_0x46c40d(0xae)]('--json-input\x20<json>',_0x46c40d(0x9e))['option'](_0x46c40d(0xac),_0x46c40d(0xbc),![])[_0x46c40d(0xa5)](async(_0x4c0422,_0x2c5afe)=>{const _0x20881f=_0x46c40d,_0x2e5a7d=resolveInputOptions(_0x2c5afe),_0x4df7ad=await startOwnProseProgram({'api':_0x43326b,'workspaceDir':process['cwd'](),'programPath':_0x4c0422,'inputs':_0x2e5a7d});if(_0x2c5afe[_0x20881f(0xbf)]){process['stdout'][_0x20881f(0xaa)](JSON[_0x20881f(0xb3)](_0x4df7ad,null,0x2)+'\x0a');return;}process[_0x20881f(0xba)][_0x20881f(0xaa)](renderOwnProseStatus(_0x4df7ad['state'])+'\x0a');}),_0x89fa8b[_0x46c40d(0xa1)]('drive')[_0x46c40d(0xa4)](_0x46c40d(0xc7))['argument'](_0x46c40d(0xb4),_0x46c40d(0xb0))[_0x46c40d(0xae)](_0x46c40d(0xaf),_0x46c40d(0xad),collectOption,[])[_0x46c40d(0xae)]('--json-input\x20<json>',_0x46c40d(0x9e))[_0x46c40d(0xae)](_0x46c40d(0xac),_0x46c40d(0xbc),![])['action'](async(_0x5038bb,_0x21e5c1)=>{const _0x1092ab=_0x46c40d,_0x54beb9=resolveInputOptions(_0x21e5c1),_0x3a7ce2=await driveOwnProseProgram({'api':_0x43326b,'workspaceDir':process[_0x1092ab(0xce)](),'programPath':_0x5038bb,'inputs':_0x54beb9});if(_0x21e5c1[_0x1092ab(0xbf)]){process[_0x1092ab(0xba)][_0x1092ab(0xaa)](JSON[_0x1092ab(0xb3)](_0x3a7ce2,null,0x2)+'\x0a');return;}process[_0x1092ab(0xba)][_0x1092ab(0xaa)](renderOwnProseStatus(_0x3a7ce2['state'])+'\x0a');}),_0x89fa8b[_0x46c40d(0xa1)](_0x46c40d(0xcb))[_0x46c40d(0xa4)]('Compile\x20a\x20workflow\x20into\x20a\x20structured\x20execution\x20plan')[_0x46c40d(0xcc)](_0x46c40d(0xb4),_0x46c40d(0xb0))[_0x46c40d(0xae)]('--json',_0x46c40d(0xbc),![])['action'](async(_0x5acf04,_0x45cf16)=>{const _0x55fe54=_0x46c40d,_0x3ca71c=await compileOwnProseProgram({'api':_0x43326b,'workspaceDir':process[_0x55fe54(0xce)](),'programPath':_0x5acf04});if(_0x45cf16[_0x55fe54(0xbf)]){process[_0x55fe54(0xba)]['write'](JSON[_0x55fe54(0xb3)](_0x3ca71c,null,0x2)+'\x0a');return;}process[_0x55fe54(0xba)][_0x55fe54(0xaa)](JSON['stringify'](_0x3ca71c[_0x55fe54(0xc1)],null,0x2)+'\x0a');}),_0x89fa8b[_0x46c40d(0xa1)]('status')['description'](_0x46c40d(0x97))[_0x46c40d(0xcc)](_0x46c40d(0x98),'Run\x20id')[_0x46c40d(0xae)]('--json',_0x46c40d(0xbc),![])['action'](async(_0x1976d5,_0xab235e)=>{const _0x250ce5=_0x46c40d,{state:_0x53be09,plan:_0x4135fe}=await loadOwnProseRunState(process[_0x250ce5(0xce)](),_0x43326b['pluginConfig'],_0x1976d5);if(_0xab235e[_0x250ce5(0xbf)]){process[_0x250ce5(0xba)][_0x250ce5(0xaa)](JSON[_0x250ce5(0xb3)]({'state':_0x53be09,'plan':_0x4135fe},null,0x2)+'\x0a');return;}process['stdout']['write'](renderOwnProseStatus(_0x53be09)+'\x0a');}),_0x89fa8b[_0x46c40d(0xa1)](_0x46c40d(0xb8))[_0x46c40d(0xa4)](_0x46c40d(0xb5))[_0x46c40d(0xcc)](_0x46c40d(0xb4),_0x46c40d(0xb0))[_0x46c40d(0xae)]('--json',_0x46c40d(0xbc),![])[_0x46c40d(0xa5)](async(_0x5af436,_0x4b39d9)=>{const _0x54bb80=_0x46c40d,_0x3a7507=_0x5af436,_0x57de21=await inspectOwnProseProgramFile(_0x3a7507);if(_0x4b39d9[_0x54bb80(0xbf)]){process[_0x54bb80(0xba)][_0x54bb80(0xaa)](JSON[_0x54bb80(0xb3)](_0x57de21,null,0x2)+'\x0a');return;}process[_0x54bb80(0xba)][_0x54bb80(0xaa)](['Program:\x20'+_0x57de21[_0x54bb80(0x9a)][_0x54bb80(0xc8)],_0x54bb80(0xa7)+(_0x57de21[_0x54bb80(0x9a)][_0x54bb80(0x9c)]['join'](',\x20')||'none'),_0x54bb80(0xb6)+_0x57de21[_0x54bb80(0x9a)][_0x54bb80(0xc5)],_0x54bb80(0xb7)+_0x57de21[_0x54bb80(0x9a)][_0x54bb80(0xc2)]][_0x54bb80(0xa8)]('\x0a')+'\x0a');});}function collectOption(_0x69e693,_0x3578eb){const _0x5b5806=_0x44e1;return _0x3578eb[_0x5b5806(0x9b)](_0x69e693),_0x3578eb;}function _0x44e1(_0x1aa46d,_0x154aa0){_0x1aa46d=_0x1aa46d-0x96;const _0x12a0f1=_0x12a0();let _0x44e12f=_0x12a0f1[_0x1aa46d];return _0x44e12f;}function _0x12a0(){const _0x40d3c5=['Compile\x20and\x20start\x20a\x20workflow\x20in\x20the\x20background','Show\x20the\x20current\x20state\x20of\x20an\x20own-prose\x20run','<runId>','470JeXxlu','program','push','agentIds','jsonInput','Full\x20input\x20object\x20as\x20JSON','4jevLRw','map','command','start','Compile\x20and\x20execute\x20natural-language\x20own-prose\x20workflows','description','action','696073bxfIZt','Agents:\x20','join','parse','write','slice','--json','Repeatable\x20input\x20value','option','--input\x20<key=value>','Path\x20to\x20the\x20Markdown\x20program','fromEntries','5bAUzcz','stringify','<program>','Parse\x20a\x20workflow\x20definition\x20without\x20compiling\x20or\x20running\x20it','Goal:\x20','Workflow:\x20','inspect','isArray','stdout','\x22.\x20Expected\x20key=value','Print\x20raw\x20JSON','input','78705sMCiVp','json','2938484ORKSaQ','plan','workflow','11495688nirszE','6GaoQMB','goal','own-prose','Compile\x20and\x20execute\x20a\x20workflow\x20end-to-end','name','5131515UpNkAO','Invalid\x20--input\x20value\x20\x22','compile','argument','object','cwd','5911565cFdDFc','33597xkrshu'];_0x12a0=function(){return _0x40d3c5;};return _0x12a0();}function resolveInputOptions(_0x51fe3d){const _0x333698=_0x44e1,_0x363c11=Object[_0x333698(0xb1)]((_0x51fe3d[_0x333698(0xbd)]??[])[_0x333698(0xa0)](_0x5789f1=>{const _0x2d873e=_0x333698,_0x222f1e=_0x5789f1['indexOf']('=');if(_0x222f1e<=0x0)throw new Error(_0x2d873e(0xca)+_0x5789f1+_0x2d873e(0xbb));return[_0x5789f1[_0x2d873e(0xab)](0x0,_0x222f1e),_0x5789f1[_0x2d873e(0xab)](_0x222f1e+0x1)];}));if(!_0x51fe3d[_0x333698(0x9d)])return _0x363c11;const _0x1900fe=JSON[_0x333698(0xa9)](_0x51fe3d[_0x333698(0x9d)]);if(!_0x1900fe||typeof _0x1900fe!==_0x333698(0xcd)||Array[_0x333698(0xb9)](_0x1900fe))throw new Error('--json-input\x20must\x20decode\x20to\x20an\x20object');return{..._0x363c11,..._0x1900fe};}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const OWN_PROSE_DEFAULT_TIMEOUT_MS = 600000;
|
|
2
|
+
export type OwnProseResolvedConfig = {
|
|
3
|
+
stateRoot: string;
|
|
4
|
+
defaultProvider?: string;
|
|
5
|
+
defaultModel?: string;
|
|
6
|
+
timeoutMs: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function resolveOwnProseConfig(workspaceDir: string, pluginConfig?: Record<string, unknown>): OwnProseResolvedConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x51dec7,_0x2f415f){const _0x204b73=_0x4bbf,_0x1fa139=_0x51dec7();while(!![]){try{const _0xe7149e=-parseInt(_0x204b73(0x1bf))/0x1+-parseInt(_0x204b73(0x1b9))/0x2+parseInt(_0x204b73(0x1c2))/0x3+parseInt(_0x204b73(0x1c5))/0x4+parseInt(_0x204b73(0x1c6))/0x5+-parseInt(_0x204b73(0x1b8))/0x6+parseInt(_0x204b73(0x1bd))/0x7;if(_0xe7149e===_0x2f415f)break;else _0x1fa139['push'](_0x1fa139['shift']());}catch(_0x37eda6){_0x1fa139['push'](_0x1fa139['shift']());}}}(_0xe1e0,0x32c6b));import _0x340c85 from'node:path';export const OWN_PROSE_DEFAULT_TIMEOUT_MS=0x927c0;function _0x4bbf(_0x5bd0f8,_0x3969f0){_0x5bd0f8=_0x5bd0f8-0x1b7;const _0xe1e014=_0xe1e0();let _0x4bbf78=_0xe1e014[_0x5bd0f8];return _0x4bbf78;}function _0xe1e0(){const _0x177ea2=['defaultProvider','defaultModel','1521310LjMmoJ','timeoutMs','37459UgJVLb','isFinite','trim','501975lbykFK','string','stateRoot','1236968Vibsas','954190THpZwc','.own-prose','2429226LOkJFF','468852loLukp','resolve'];_0xe1e0=function(){return _0x177ea2;};return _0xe1e0();}export function resolveOwnProseConfig(_0x553dc4,_0x393a08){const _0x1a2da4=_0x4bbf,_0x22ca48=_0x393a08??{},_0xdfce98=typeof _0x22ca48['stateRoot']===_0x1a2da4(0x1c3)&&_0x22ca48[_0x1a2da4(0x1c4)]['trim']()?_0x22ca48[_0x1a2da4(0x1c4)][_0x1a2da4(0x1c1)]():_0x1a2da4(0x1b7),_0x475d48=typeof _0x22ca48[_0x1a2da4(0x1bb)]===_0x1a2da4(0x1c3)&&_0x22ca48[_0x1a2da4(0x1bb)][_0x1a2da4(0x1c1)]()?_0x22ca48[_0x1a2da4(0x1bb)][_0x1a2da4(0x1c1)]():undefined,_0x1fc3dc=typeof _0x22ca48[_0x1a2da4(0x1bc)]==='string'&&_0x22ca48[_0x1a2da4(0x1bc)]['trim']()?_0x22ca48[_0x1a2da4(0x1bc)][_0x1a2da4(0x1c1)]():undefined,_0x40c59b=typeof _0x22ca48[_0x1a2da4(0x1be)]==='number'&&Number[_0x1a2da4(0x1c0)](_0x22ca48[_0x1a2da4(0x1be)])&&_0x22ca48[_0x1a2da4(0x1be)]>=0x3e8?_0x22ca48[_0x1a2da4(0x1be)]:OWN_PROSE_DEFAULT_TIMEOUT_MS;return{'stateRoot':_0x340c85[_0x1a2da4(0x1ba)](_0x553dc4,_0xdfce98),'defaultProvider':_0x475d48,'defaultModel':_0x1fc3dc,'timeoutMs':_0x40c59b};}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
|
2
|
+
import type { CompiledPlan, OwnProseBackgroundStartResult, OwnProseRunResult, ProgramBundle, RunState } from "./types.js";
|
|
3
|
+
type DriveParams = {
|
|
4
|
+
api: OpenClawPluginApi;
|
|
5
|
+
workspaceDir: string;
|
|
6
|
+
programPath: string;
|
|
7
|
+
inputs?: Record<string, unknown>;
|
|
8
|
+
sessionKey?: string;
|
|
9
|
+
agentId?: string;
|
|
10
|
+
};
|
|
11
|
+
type StartParams = DriveParams & {
|
|
12
|
+
sessionKey?: string;
|
|
13
|
+
agentId?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function driveOwnProseProgram(params: DriveParams): Promise<OwnProseRunResult>;
|
|
16
|
+
export declare function startOwnProseProgram(params: StartParams): Promise<OwnProseBackgroundStartResult>;
|
|
17
|
+
export declare function resumeOwnProseBackgroundRun(params: {
|
|
18
|
+
api: OpenClawPluginApi;
|
|
19
|
+
workspaceDir: string;
|
|
20
|
+
runId: string;
|
|
21
|
+
}): Promise<OwnProseRunResult>;
|
|
22
|
+
export declare function waitForOwnProseBackgroundRun(runId: string, options: {
|
|
23
|
+
workspaceDir: string;
|
|
24
|
+
pluginConfig?: Record<string, unknown>;
|
|
25
|
+
}): Promise<{
|
|
26
|
+
runDir: string;
|
|
27
|
+
state: RunState;
|
|
28
|
+
plan: CompiledPlan;
|
|
29
|
+
}>;
|
|
30
|
+
export declare function compileOwnProseProgram(params: {
|
|
31
|
+
api: OpenClawPluginApi;
|
|
32
|
+
workspaceDir: string;
|
|
33
|
+
programPath: string;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
program: ProgramBundle["program"];
|
|
36
|
+
agents: ProgramBundle["agents"];
|
|
37
|
+
plan: CompiledPlan;
|
|
38
|
+
}>;
|
|
39
|
+
export declare function inspectOwnProseProgramFile(programPath: string): Promise<ProgramBundle>;
|
|
40
|
+
export declare function loadOwnProseRunState(workspaceDir: string, pluginConfig: Record<string, unknown> | undefined, runId: string): Promise<{
|
|
41
|
+
runDir: string;
|
|
42
|
+
state: RunState;
|
|
43
|
+
plan: CompiledPlan;
|
|
44
|
+
}>;
|
|
45
|
+
export declare function resolveOwnProseProgramPath(workspaceDir: string, programPath?: string): string | undefined;
|
|
46
|
+
export declare function renderOwnProseStatus(state: RunState): string;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x3d1e95=_0x3444;(function(_0x23b617,_0x39d748){const _0x45a7a8=_0x3444,_0x590fbe=_0x23b617();while(!![]){try{const _0x8d6656=parseInt(_0x45a7a8(0x1b3))/0x1+parseInt(_0x45a7a8(0xfe))/0x2+-parseInt(_0x45a7a8(0x183))/0x3*(-parseInt(_0x45a7a8(0xfb))/0x4)+parseInt(_0x45a7a8(0x154))/0x5*(-parseInt(_0x45a7a8(0x140))/0x6)+parseInt(_0x45a7a8(0x142))/0x7*(parseInt(_0x45a7a8(0x1a6))/0x8)+parseInt(_0x45a7a8(0xff))/0x9+parseInt(_0x45a7a8(0x199))/0xa*(-parseInt(_0x45a7a8(0x17f))/0xb);if(_0x8d6656===_0x39d748)break;else _0x590fbe['push'](_0x590fbe['shift']());}catch(_0x593d6f){_0x590fbe['push'](_0x590fbe['shift']());}}}(_0x1f8b,0x53f5d));import _0x2cb537 from'node:fs/promises';import _0x52d1d9 from'node:path';import{getAgentSessionMessages,notifyAgentSession,queueAgentSessionRun,waitForAgentSessionRun}from'./agent-notify.js';import{loadAgents}from'./agent-parser.js';import{resolveOwnProseConfig}from'./config.js';import{compilePlan}from'./plan-compiler.js';import{validateCompiledPlan}from'./plan-validator.js';import{parseProgramFile}from'./program-parser.js';function _0x3444(_0x484e17,_0x138bdb){_0x484e17=_0x484e17-0xf7;const _0x1f8b66=_0x1f8b();let _0x3444e9=_0x1f8b66[_0x484e17];return _0x3444e9;}import{appendTimeline,createRunId,ensureRunDirectories,getRunDir,initializeRunState,readCompiledPlan,readRunState,writeArtifact,writeProgramSource,writeResumeFile,writeRunState}from'./state-store.js';const activeBackgroundRuns=new Map(),NO_REPLY_TOKEN=_0x3d1e95(0x11e);export async function driveOwnProseProgram(_0x245251){const _0xe1a51f=_0x3d1e95,_0x327d77=await loadProgramBundle(_0x245251['programPath']),_0x1b4409=resolveOwnProseConfig(_0x245251[_0xe1a51f(0x128)],_0x245251[_0xe1a51f(0x195)][_0xe1a51f(0x145)]);await _0x2cb537[_0xe1a51f(0x116)](_0x52d1d9[_0xe1a51f(0x1a0)](_0x1b4409[_0xe1a51f(0x113)],_0xe1a51f(0x1b0)),{'recursive':!![]});const _0x553c51=createRunId(),_0x18f2f1=getRunDir(_0x1b4409[_0xe1a51f(0x113)],_0x553c51);await ensureRunDirectories(_0x18f2f1);const _0x2d5dd0=await _0x2cb537[_0xe1a51f(0x14c)](_0x327d77[_0xe1a51f(0x168)][_0xe1a51f(0x186)],_0xe1a51f(0x15d));await writeProgramSource(_0x18f2f1,_0x2d5dd0);const _0x196f2b=await compilePlan({'api':_0x245251[_0xe1a51f(0x195)],'workspaceDir':_0x245251['workspaceDir'],'runDir':_0x18f2f1,'program':_0x327d77[_0xe1a51f(0x168)],'agents':_0x327d77[_0xe1a51f(0x1b5)],'provider':_0x1b4409[_0xe1a51f(0x193)],'model':_0x1b4409[_0xe1a51f(0x118)],'timeoutMs':_0x1b4409[_0xe1a51f(0x123)]});validateCompiledPlan(_0x196f2b,_0x327d77[_0xe1a51f(0x168)],_0x327d77['agents']);const _0x7c2c6c=resolveProgramInputs(_0x327d77['program'],_0x245251[_0xe1a51f(0x178)]??{}),_0x3756b8=await initializeRunState({'runDir':_0x18f2f1,'runId':_0x553c51,'program':_0x327d77[_0xe1a51f(0x168)],'inputs':_0x7c2c6c,'plan':_0x196f2b,'runtime':{'cwd':_0x245251[_0xe1a51f(0x128)],'provider':_0x1b4409[_0xe1a51f(0x193)],'model':_0x1b4409[_0xe1a51f(0x118)],'sessionKey':_0x245251[_0xe1a51f(0x198)],'agentId':_0x245251[_0xe1a51f(0xf9)]}}),_0x48bdc1=await executePlan({'api':_0x245251['api'],'workspaceDir':_0x245251['workspaceDir'],'runDir':_0x18f2f1,'state':_0x3756b8,'program':_0x327d77[_0xe1a51f(0x168)],'plan':_0x196f2b,'agents':_0x327d77[_0xe1a51f(0x1b5)],'inputs':_0x7c2c6c,'defaultProvider':_0x1b4409[_0xe1a51f(0x193)],'defaultModel':_0x1b4409[_0xe1a51f(0x118)],'defaultTimeoutMs':_0x1b4409['timeoutMs'],'background':![]});return{'runId':_0x553c51,'runDir':_0x18f2f1,'state':_0x48bdc1,'plan':_0x196f2b};}export async function startOwnProseProgram(_0x24429a){const _0x3ec65e=_0x3d1e95,_0xc20262=await loadProgramBundle(_0x24429a[_0x3ec65e(0x184)]),_0x42cbe5=resolveOwnProseConfig(_0x24429a[_0x3ec65e(0x128)],_0x24429a[_0x3ec65e(0x195)][_0x3ec65e(0x145)]);await _0x2cb537[_0x3ec65e(0x116)](_0x52d1d9[_0x3ec65e(0x1a0)](_0x42cbe5[_0x3ec65e(0x113)],_0x3ec65e(0x1b0)),{'recursive':!![]});const _0x1799cf=createRunId(),_0x17a863=getRunDir(_0x42cbe5[_0x3ec65e(0x113)],_0x1799cf);await ensureRunDirectories(_0x17a863);const _0x173ed6=await _0x2cb537[_0x3ec65e(0x14c)](_0xc20262['program'][_0x3ec65e(0x186)],_0x3ec65e(0x15d));await writeProgramSource(_0x17a863,_0x173ed6);const _0x3706e3=await compilePlan({'api':_0x24429a[_0x3ec65e(0x195)],'workspaceDir':_0x24429a[_0x3ec65e(0x128)],'runDir':_0x17a863,'program':_0xc20262['program'],'agents':_0xc20262[_0x3ec65e(0x1b5)],'provider':_0x42cbe5[_0x3ec65e(0x193)],'model':_0x42cbe5['defaultModel'],'timeoutMs':_0x42cbe5[_0x3ec65e(0x123)]});validateCompiledPlan(_0x3706e3,_0xc20262[_0x3ec65e(0x168)],_0xc20262[_0x3ec65e(0x1b5)]);const _0x22dae0=resolveProgramInputs(_0xc20262['program'],_0x24429a[_0x3ec65e(0x178)]??{}),_0x260856=await initializeRunState({'runDir':_0x17a863,'runId':_0x1799cf,'program':_0xc20262[_0x3ec65e(0x168)],'inputs':_0x22dae0,'plan':_0x3706e3,'runtime':{'cwd':_0x24429a['workspaceDir'],'provider':_0x42cbe5[_0x3ec65e(0x193)],'model':_0x42cbe5['defaultModel'],'sessionKey':_0x24429a[_0x3ec65e(0x198)],'agentId':_0x24429a[_0x3ec65e(0xf9)]}});_0x260856[_0x3ec65e(0x16f)]={'mode':_0x3ec65e(0x16f),'status':_0x3ec65e(0x164),'startedAt':new Date()[_0x3ec65e(0x163)](),'originSessionKey':_0x24429a['sessionKey'],'originAgentId':_0x24429a['agentId']},await writeRunState(_0x17a863,_0x260856),await writeResumeFile(_0x17a863,_0x260856,_0x3706e3);if(_0x24429a['sessionKey']?.[_0x3ec65e(0x17e)]()){const _0x434598=await queueBackgroundWorkerRun({'sessionKey':_0x24429a[_0x3ec65e(0x198)],'agentId':_0x24429a[_0x3ec65e(0xf9)],'runId':_0x1799cf});_0x260856[_0x3ec65e(0x16f)][_0x3ec65e(0x114)]={'status':_0x3ec65e(0x164),'queuedAt':new Date()[_0x3ec65e(0x163)](),'sessionKey':_0x434598[_0x3ec65e(0x198)],'runId':_0x434598['runId']},await writeRunState(_0x17a863,_0x260856),await writeResumeFile(_0x17a863,_0x260856,_0x3706e3);}else{const _0x2f38f2=runInBackground({'api':_0x24429a[_0x3ec65e(0x195)],'workspaceDir':_0x24429a['workspaceDir'],'runDir':_0x17a863,'state':_0x260856,'program':_0xc20262[_0x3ec65e(0x168)],'plan':_0x3706e3,'agents':_0xc20262[_0x3ec65e(0x1b5)],'inputs':_0x22dae0,'defaultProvider':_0x42cbe5['defaultProvider'],'defaultModel':_0x42cbe5[_0x3ec65e(0x118)],'defaultTimeoutMs':_0x42cbe5[_0x3ec65e(0x123)]});activeBackgroundRuns[_0x3ec65e(0x134)](_0x1799cf,_0x2f38f2),void _0x2f38f2['finally'](()=>{activeBackgroundRuns['delete'](_0x1799cf);});}return{'runId':_0x1799cf,'runDir':_0x17a863,'state':_0x260856,'plan':_0x3706e3,'alreadyRunning':![]};}export async function resumeOwnProseBackgroundRun(_0x40ed72){const _0x4a13d3=_0x3d1e95,{runDir:_0x4ea656,state:_0x2ab63d,plan:_0x2a0749}=await loadOwnProseRunState(_0x40ed72[_0x4a13d3(0x128)],_0x40ed72[_0x4a13d3(0x195)][_0x4a13d3(0x145)],_0x40ed72['runId']);if(_0x2ab63d[_0x4a13d3(0x10c)]!=='running')return{'runId':_0x2ab63d['runId'],'runDir':_0x4ea656,'state':_0x2ab63d,'plan':_0x2a0749};const _0x5a780f=await loadProgramBundle(_0x2ab63d[_0x4a13d3(0x184)]),_0x49d1f9=resolveOwnProseConfig(_0x40ed72[_0x4a13d3(0x128)],_0x40ed72[_0x4a13d3(0x195)][_0x4a13d3(0x145)]),_0x126e6f=await runInBackground({'api':_0x40ed72[_0x4a13d3(0x195)],'workspaceDir':_0x40ed72['workspaceDir'],'runDir':_0x4ea656,'state':_0x2ab63d,'program':_0x5a780f[_0x4a13d3(0x168)],'plan':_0x2a0749,'agents':_0x5a780f[_0x4a13d3(0x1b5)],'inputs':_0x2ab63d[_0x4a13d3(0x178)],'defaultProvider':_0x49d1f9[_0x4a13d3(0x193)],'defaultModel':_0x49d1f9[_0x4a13d3(0x118)],'defaultTimeoutMs':_0x49d1f9[_0x4a13d3(0x123)]});return{'runId':_0x2ab63d['runId'],'runDir':_0x4ea656,'state':_0x126e6f,'plan':_0x2a0749};}export async function waitForOwnProseBackgroundRun(_0x2b7971,_0x143a37){const _0x515c83=_0x3d1e95,_0x508954=activeBackgroundRuns['get'](_0x2b7971);return _0x508954&&await _0x508954,loadOwnProseRunState(_0x143a37[_0x515c83(0x128)],_0x143a37[_0x515c83(0x145)],_0x2b7971);}export async function compileOwnProseProgram(_0x505c3f){const _0x1a9e25=_0x3d1e95,_0x1acea3=await loadProgramBundle(_0x505c3f[_0x1a9e25(0x184)]),_0x35db1a=resolveOwnProseConfig(_0x505c3f[_0x1a9e25(0x128)],_0x505c3f['api'][_0x1a9e25(0x145)]),_0x290fc6=_0x52d1d9[_0x1a9e25(0x1a0)](_0x35db1a['stateRoot'],'compile-preview');await ensureRunDirectories(_0x290fc6);const _0x90c25c=await compilePlan({'api':_0x505c3f[_0x1a9e25(0x195)],'workspaceDir':_0x505c3f[_0x1a9e25(0x128)],'runDir':_0x290fc6,'program':_0x1acea3[_0x1a9e25(0x168)],'agents':_0x1acea3['agents'],'provider':_0x35db1a[_0x1a9e25(0x193)],'model':_0x35db1a[_0x1a9e25(0x118)],'timeoutMs':_0x35db1a[_0x1a9e25(0x123)]});return validateCompiledPlan(_0x90c25c,_0x1acea3[_0x1a9e25(0x168)],_0x1acea3['agents']),{'program':_0x1acea3[_0x1a9e25(0x168)],'agents':_0x1acea3['agents'],'plan':_0x90c25c};}export async function inspectOwnProseProgramFile(_0x32f742){return loadProgramBundle(_0x32f742);}function _0x1f8b(){const _0x3e9892=['2406RihAFC','run_failed','74893KNzjtb','nodeId','defaultTimeoutMs','pluginConfig','skipped','You\x20are\x20executing\x20one\x20own-prose\x20judge\x20node.','isError','catch','model','currentNodeId','readFile','slice','timeout','own-prose\x20background\x20','Run\x20the\x20`own_prose_background_run`\x20tool\x20with\x20runId\x20\x22','Run\x20ID:\x20','map','failure','985JZbqmd','\x20-\x20','exec','Started\x20','visitCount','Do\x20not\x20call\x20own_prose_start,\x20own_prose_drive,\x20or\x20own_prose_status.','stringify','notification','Program\x20goal:\x20','utf8','messages','Subagent\x20runtime\x20unavailable\x20and\x20no\x20OpenClaw\x20agent\x20context\x20was\x20recorded\x20for\x20gateway\x20fallback.','Program:\x20','\x20node\x20','Agent\x20instructions:','toISOString','queued','goal','own-prose:','defaultValue','program','runEmbeddedPiAgent','\x22\x20does\x20not\x20exist','Inputs\x20JSON:','Internal\x20own-prose\x20background\x20continuation\x20request.','state','run','background','Node\x20goal:\x20','summary','Agent\x20role:','Queued\x20background\x20notification\x20to\x20','Do\x20not\x20ask\x20follow-up\x20questions.','Notification:\x20','This\x20is\x20an\x20internal\x20own-prose\x20background\x20worker\x20request.','Final\x20output:\x20','inputs','all','content','prompt','node','length','trim','22nbCFvO','completed','type','indexOf','3duKsSb','programPath','task','sourcePath','notification_sent','Run\x20exceeded\x20max\x20steps\x20(','plan','replace','run_completed','allowedBranches','decision','doneWhen','\x20as\x20agent\x20run\x20','###\x20','push','startsWith','defaultProvider','key','api','notification_failed','Allowed\x20branches:\x20','sessionKey','5448430ayvYYy','role','Failure:\x20','question','agentIds','string','finished','join','filter','provider','sessions','title','Judge\x20instructions:','184XmiRsC','failed','Subagent\x20run\x20returned\x20no\x20assistant\x20output','payloads','Node\x20title:\x20','maxSteps','permissions','subagent','Embedded\x20node\x20run\x20returned\x20no\x20output','requirements','runs','Status:\x20','next','321595gpqvqv','includes','agents','runtime','runDir','agentId','own-prose\x20background\x20run\x20finished.','1649356BjeZGo','Judge\x20title:\x20','agent','517866aLIkfg','2462760OLBAeq','node_completed','subagentRunId','\x22\x20returned\x20invalid\x20branch\x20\x22','Current\x20node\x20\x22','isArray','text','Final\x20output:','...','object','Question:\x20','entries','Subagent\x20task\x20timed\x20out:\x20','status','Node\x20instructions:','nodeStates','Previous\x20completed\x20node\x20outputs:','Worker:\x20','Steps\x20executed:\x20','resolve','stateRoot','worker','waitForRun','mkdir','Current\x20node:\x20','defaultModel','Node\x20states:','running','finish','You\x20are\x20executing\x20one\x20own-prose\x20task\x20node.','parse','NO_REPLY','Background:\x20','queuedAt','completedAt','Workflow\x20complete','timeoutMs','notification_skipped','node_started','branch_decided','Skipped\x20background\x20notification\x20because\x20no\x20origin\x20session\x20was\x20recorded','workspaceDir','reason','stepsExecuted','After\x20the\x20tool\x20succeeds\x20or\x20fails,\x20respond\x20with\x20exactly\x20','Judge\x20output\x20is\x20missing\x20decision','Return\x20only\x20the\x20deliverable\x20for\x20this\x20node.\x20Do\x20not\x20explain\x20your\x20process.','Subagent\x20task\x20failed:\x20','get','Done\x20when:','instructions','None','Judge\x20output\x20must\x20be\x20JSON\x20or\x20a\x20single\x20branch\x20token','set','error','Do\x20not\x20call\x20any\x20other\x20own-prose\x20tool.','branchDecisions','Do\x20not\x20include\x20markdown\x20fences.','artifactPath','startedAt','message','finalOutputPath','own-prose:bg:','runId','config'];_0x1f8b=function(){return _0x3e9892;};return _0x1f8b();}export async function loadOwnProseRunState(_0x5fed5f,_0x52066a,_0x403ffc){const _0x3620b6=_0x3d1e95,_0x4e69cc=resolveOwnProseConfig(_0x5fed5f,_0x52066a),_0x6af8c6=getRunDir(_0x4e69cc[_0x3620b6(0x113)],_0x403ffc),_0x3852d1=await readRunState(_0x6af8c6),_0x5acb30=await readCompiledPlan(_0x6af8c6);return{'runDir':_0x6af8c6,'state':_0x3852d1,'plan':_0x5acb30};}export function resolveOwnProseProgramPath(_0x27c6de,_0x5ed8eb){const _0x248715=_0x3d1e95;if(!_0x5ed8eb?.['trim']())return undefined;const _0x4b977a=_0x5ed8eb[_0x248715(0x17e)]();if(_0x4b977a[_0x248715(0x192)]('~/'))return _0x52d1d9['join'](process.env.HOME??'',_0x4b977a['slice'](0x2));return _0x52d1d9[_0x248715(0x112)](_0x27c6de,_0x4b977a);}export function renderOwnProseStatus(_0x1940c9){const _0x1605fc=_0x3d1e95,_0x36231a=['Run:\x20'+_0x1940c9[_0x1605fc(0x13e)],_0x1605fc(0x1b1)+_0x1940c9[_0x1605fc(0x10c)],_0x1940c9[_0x1605fc(0x16f)]?_0x1605fc(0x11f)+_0x1940c9[_0x1605fc(0x16f)]['status']:undefined,_0x1940c9['background']?.[_0x1605fc(0x114)]?_0x1605fc(0x110)+_0x1940c9['background'][_0x1605fc(0x114)][_0x1605fc(0x10c)]+(_0x1940c9[_0x1605fc(0x16f)][_0x1605fc(0x114)]['sessionKey']?'\x20('+_0x1940c9['background']['worker'][_0x1605fc(0x198)]+')':''):undefined,_0x1940c9['background']?.['notification']?_0x1605fc(0x175)+_0x1940c9[_0x1605fc(0x16f)][_0x1605fc(0x15b)][_0x1605fc(0x10c)]:undefined,_0x1605fc(0x117)+(_0x1940c9['currentNodeId']??'none'),_0x1605fc(0x111)+_0x1940c9[_0x1605fc(0x12a)]+'/'+_0x1940c9['maxSteps'],_0x1940c9[_0x1605fc(0x13c)]?_0x1605fc(0x177)+_0x1940c9[_0x1605fc(0x13c)]:undefined,_0x1940c9[_0x1605fc(0x153)]?_0x1605fc(0x19b)+_0x1940c9['failure'][_0x1605fc(0x129)]:undefined,'',_0x1605fc(0x119),...Object['values'](_0x1940c9['nodeStates'])[_0x1605fc(0x152)](_0x35210f=>'-\x20'+_0x35210f[_0x1605fc(0x143)]+':\x20'+_0x35210f['status']+(_0x35210f[_0x1605fc(0x171)]?_0x1605fc(0x155)+_0x35210f[_0x1605fc(0x171)]:''))];return _0x36231a[_0x1605fc(0x1a1)](_0xa3c5bf=>Boolean(_0xa3c5bf))['join']('\x0a');}async function loadProgramBundle(_0x1b1962){const _0x58e810=_0x3d1e95,_0x4a9064=_0x52d1d9['resolve'](_0x1b1962),_0x5aa413=await parseProgramFile(_0x4a9064),_0x496910=await loadAgents(_0x5aa413[_0x58e810(0x19d)],_0x52d1d9['dirname'](_0x4a9064));return{'program':_0x5aa413,'agents':_0x496910};}function resolveProgramInputs(_0x1961ae,_0x201c06){const _0xe05149=_0x3d1e95,_0x1702ce={..._0x201c06};for(const _0x401db5 of _0x1961ae[_0xe05149(0x178)]){_0x1702ce[_0x401db5['key']]==null&&_0x401db5[_0xe05149(0x167)]!=null&&(_0x1702ce[_0x401db5['key']]=_0x401db5['defaultValue']);if(_0x401db5['required']&&_0x1702ce[_0x401db5[_0xe05149(0x194)]]==null)throw new Error('Missing\x20required\x20input\x20\x22'+_0x401db5[_0xe05149(0x194)]+'\x22');}return _0x1702ce;}async function executePlan(_0x234e95){const _0x4cf8c2=_0x3d1e95,_0x398b6d=new Map(_0x234e95[_0x4cf8c2(0x189)]['nodes'][_0x4cf8c2(0x152)](_0x3f2c6e=>[_0x3f2c6e['id'],_0x3f2c6e]));while(_0x234e95[_0x4cf8c2(0x16d)][_0x4cf8c2(0x10c)]===_0x4cf8c2(0x11a)&&_0x234e95[_0x4cf8c2(0x16d)]['currentNodeId']){if(_0x234e95[_0x4cf8c2(0x16d)]['stepsExecuted']>=_0x234e95['state'][_0x4cf8c2(0x1ab)]){await failRun(_0x234e95[_0x4cf8c2(0xf8)],_0x234e95[_0x4cf8c2(0x16d)],_0x234e95['plan'],{'reason':_0x4cf8c2(0x188)+_0x234e95[_0x4cf8c2(0x16d)][_0x4cf8c2(0x1ab)]+')'});break;}const _0x421fbf=_0x398b6d[_0x4cf8c2(0x12f)](_0x234e95[_0x4cf8c2(0x16d)]['currentNodeId']);if(!_0x421fbf){await failRun(_0x234e95['runDir'],_0x234e95[_0x4cf8c2(0x16d)],_0x234e95['plan'],{'nodeId':_0x234e95['state'][_0x4cf8c2(0x14b)],'reason':_0x4cf8c2(0x103)+_0x234e95['state'][_0x4cf8c2(0x14b)]+_0x4cf8c2(0x16a)});break;}if(_0x421fbf[_0x4cf8c2(0x181)]===_0x4cf8c2(0x11b)){_0x234e95['state']['status']='completed',_0x234e95[_0x4cf8c2(0x16d)]['currentNodeId']=null,await appendTimeline(_0x234e95[_0x4cf8c2(0xf8)],{'at':new Date()[_0x4cf8c2(0x163)](),'type':_0x4cf8c2(0x18b),'runId':_0x234e95[_0x4cf8c2(0x16d)][_0x4cf8c2(0x13e)],'message':_0x4cf8c2(0x122)}),await writeRunState(_0x234e95['runDir'],_0x234e95[_0x4cf8c2(0x16d)]),await writeResumeFile(_0x234e95[_0x4cf8c2(0xf8)],_0x234e95['state'],_0x234e95[_0x4cf8c2(0x189)]);break;}const _0x260e88=startNodeRecord(_0x234e95[_0x4cf8c2(0x16d)],_0x421fbf['id'],_0x421fbf[_0x4cf8c2(0xf9)],_0x421fbf['permissions']['executionTarget']);await appendTimeline(_0x234e95[_0x4cf8c2(0xf8)],{'at':_0x260e88[_0x4cf8c2(0x13a)],'type':_0x4cf8c2(0x125),'runId':_0x234e95['state']['runId'],'nodeId':_0x421fbf['id'],'message':_0x4cf8c2(0x157)+_0x421fbf[_0x4cf8c2(0x181)]+_0x4cf8c2(0x161)+_0x421fbf['id']}),await writeRunState(_0x234e95[_0x4cf8c2(0xf8)],_0x234e95[_0x4cf8c2(0x16d)]);try{if(_0x421fbf[_0x4cf8c2(0x181)]===_0x4cf8c2(0x185)){const _0x127fa7=await executeTaskNode({'api':_0x234e95[_0x4cf8c2(0x195)],'workspaceDir':_0x234e95['workspaceDir'],'runDir':_0x234e95[_0x4cf8c2(0xf8)],'state':_0x234e95[_0x4cf8c2(0x16d)],'program':_0x234e95[_0x4cf8c2(0x168)],'plan':_0x234e95[_0x4cf8c2(0x189)],'node':_0x421fbf,'agent':_0x234e95['agents'][_0x421fbf[_0x4cf8c2(0xf9)]],'inputs':_0x234e95[_0x4cf8c2(0x178)],'defaultProvider':_0x234e95[_0x4cf8c2(0x193)],'defaultModel':_0x234e95[_0x4cf8c2(0x118)],'defaultTimeoutMs':_0x234e95[_0x4cf8c2(0x144)],'background':_0x234e95[_0x4cf8c2(0x16f)]}),_0x359e8c=await writeArtifact(_0x234e95['runDir'],_0x421fbf['id'],_0x127fa7);_0x260e88['status']=_0x4cf8c2(0x180),_0x260e88[_0x4cf8c2(0x121)]=new Date()[_0x4cf8c2(0x163)](),_0x260e88[_0x4cf8c2(0x139)]=_0x359e8c,_0x260e88['summary']=summarizeText(_0x127fa7),_0x234e95['state']['artifacts'][_0x421fbf['id']]=_0x359e8c,_0x234e95['state'][_0x4cf8c2(0x12a)]+=0x1;const _0x230b69=_0x421fbf['next']?_0x398b6d[_0x4cf8c2(0x12f)](_0x421fbf['next']):undefined;(_0x230b69?.[_0x4cf8c2(0x181)]===_0x4cf8c2(0x11b)||_0x421fbf[_0x4cf8c2(0x1b2)]==null)&&(_0x234e95[_0x4cf8c2(0x16d)]['finalOutputPath']=_0x359e8c),_0x234e95[_0x4cf8c2(0x16d)][_0x4cf8c2(0x14b)]=_0x421fbf[_0x4cf8c2(0x1b2)],await appendTimeline(_0x234e95[_0x4cf8c2(0xf8)],{'at':_0x260e88[_0x4cf8c2(0x121)],'type':_0x4cf8c2(0x100),'runId':_0x234e95[_0x4cf8c2(0x16d)][_0x4cf8c2(0x13e)],'nodeId':_0x421fbf['id'],'message':_0x260e88[_0x4cf8c2(0x171)]});}else{const _0x4ee256=await executeJudgeNode({'api':_0x234e95[_0x4cf8c2(0x195)],'workspaceDir':_0x234e95[_0x4cf8c2(0x128)],'runDir':_0x234e95['runDir'],'state':_0x234e95[_0x4cf8c2(0x16d)],'program':_0x234e95['program'],'plan':_0x234e95[_0x4cf8c2(0x189)],'node':_0x421fbf,'agent':_0x234e95[_0x4cf8c2(0x1b5)][_0x421fbf['agentId']],'inputs':_0x234e95[_0x4cf8c2(0x178)],'defaultProvider':_0x234e95[_0x4cf8c2(0x193)],'defaultModel':_0x234e95[_0x4cf8c2(0x118)],'defaultTimeoutMs':_0x234e95['defaultTimeoutMs']});if(!_0x421fbf[_0x4cf8c2(0x18c)][_0x4cf8c2(0x1b4)](_0x4ee256[_0x4cf8c2(0x18d)]))throw new Error('Judge\x20node\x20\x22'+_0x421fbf['id']+_0x4cf8c2(0x102)+_0x4ee256[_0x4cf8c2(0x18d)]+'\x22');const _0x3e3582=_0x421fbf['branches'][_0x4ee256[_0x4cf8c2(0x18d)]];_0x260e88['status']=_0x4cf8c2(0x180),_0x260e88[_0x4cf8c2(0x121)]=new Date()['toISOString'](),_0x260e88[_0x4cf8c2(0x171)]=''+_0x4ee256['decision']+(_0x4ee256[_0x4cf8c2(0x129)]?'\x20-\x20'+_0x4ee256[_0x4cf8c2(0x129)]:''),_0x234e95[_0x4cf8c2(0x16d)][_0x4cf8c2(0x137)][_0x4cf8c2(0x191)]({'nodeId':_0x421fbf['id'],'agentId':_0x421fbf[_0x4cf8c2(0xf9)],'decision':_0x4ee256[_0x4cf8c2(0x18d)],'reason':_0x4ee256[_0x4cf8c2(0x129)],'decidedAt':_0x260e88[_0x4cf8c2(0x121)]}),_0x234e95[_0x4cf8c2(0x16d)][_0x4cf8c2(0x12a)]+=0x1,_0x234e95[_0x4cf8c2(0x16d)][_0x4cf8c2(0x14b)]=_0x3e3582,await appendTimeline(_0x234e95['runDir'],{'at':_0x260e88[_0x4cf8c2(0x121)],'type':_0x4cf8c2(0x126),'runId':_0x234e95[_0x4cf8c2(0x16d)][_0x4cf8c2(0x13e)],'nodeId':_0x421fbf['id'],'branch':_0x4ee256[_0x4cf8c2(0x18d)],'message':_0x260e88[_0x4cf8c2(0x171)]});}await writeRunState(_0x234e95[_0x4cf8c2(0xf8)],_0x234e95[_0x4cf8c2(0x16d)]),await writeResumeFile(_0x234e95['runDir'],_0x234e95[_0x4cf8c2(0x16d)],_0x234e95[_0x4cf8c2(0x189)]);}catch(_0x2084cd){_0x260e88[_0x4cf8c2(0x10c)]='failed',_0x260e88[_0x4cf8c2(0x121)]=new Date()[_0x4cf8c2(0x163)](),_0x260e88[_0x4cf8c2(0x135)]=_0x2084cd instanceof Error?_0x2084cd[_0x4cf8c2(0x13b)]:String(_0x2084cd),await failRun(_0x234e95[_0x4cf8c2(0xf8)],_0x234e95[_0x4cf8c2(0x16d)],_0x234e95[_0x4cf8c2(0x189)],{'nodeId':_0x421fbf['id'],'reason':_0x260e88[_0x4cf8c2(0x135)]});break;}}return _0x234e95[_0x4cf8c2(0x16d)];}function startNodeRecord(_0x65b91d,_0x177908,_0x3011fb,_0x1f5abe){const _0x52f9e9=_0x3d1e95,_0x26953d=_0x65b91d['nodeStates'][_0x177908],_0x3849b2=(_0x26953d?.[_0x52f9e9(0x158)]??0x0)+0x1,_0x56af19={'nodeId':_0x177908,'status':_0x52f9e9(0x11a),'startedAt':new Date()[_0x52f9e9(0x163)](),'agentId':_0x3011fb,'executionTarget':_0x1f5abe,'visitCount':_0x3849b2};return _0x65b91d[_0x52f9e9(0x10e)][_0x177908]=_0x56af19,_0x56af19;}async function executeTaskNode(_0x2e82db){const _0x4b4030=_0x3d1e95,_0x4d66af=[_0x4b4030(0x11c),_0x4b4030(0x12d),'',_0x4b4030(0x15c)+_0x2e82db['program'][_0x4b4030(0x165)],_0x4b4030(0x1aa)+_0x2e82db['node'][_0x4b4030(0x1a4)],_0x4b4030(0x170)+_0x2e82db[_0x4b4030(0x17c)][_0x4b4030(0x165)],'',_0x4b4030(0x172),_0x2e82db[_0x4b4030(0xfd)][_0x4b4030(0x19a)],'',_0x4b4030(0x162),_0x2e82db[_0x4b4030(0xfd)][_0x4b4030(0x131)],'',_0x4b4030(0x10d),_0x2e82db[_0x4b4030(0x17c)]['instructions'],'',_0x4b4030(0x130),..._0x2e82db[_0x4b4030(0x17c)][_0x4b4030(0x18e)][_0x4b4030(0x152)](_0x37d3ef=>'-\x20'+_0x37d3ef),'',_0x4b4030(0x16b),JSON['stringify'](_0x2e82db[_0x4b4030(0x178)],null,0x2),'',_0x4b4030(0x10f),await buildPriorNodeContext(_0x2e82db[_0x4b4030(0xf8)],_0x2e82db[_0x4b4030(0x16d)]),'','Final\x20output\x20contract:',..._0x2e82db[_0x4b4030(0x168)]['outputContract'][_0x4b4030(0x1af)][_0x4b4030(0x152)](_0x1054ca=>'-\x20'+_0x1054ca)][_0x4b4030(0x1a0)]('\x0a');if(_0x2e82db[_0x4b4030(0x17c)][_0x4b4030(0x1ac)]['executionTarget']===_0x4b4030(0x1ad))return executeSubagentTaskNode({'api':_0x2e82db['api'],'runDir':_0x2e82db[_0x4b4030(0xf8)],'state':_0x2e82db[_0x4b4030(0x16d)],'node':_0x2e82db[_0x4b4030(0x17c)],'agent':_0x2e82db[_0x4b4030(0xfd)],'prompt':_0x4d66af,'timeoutMs':_0x2e82db[_0x4b4030(0xfd)]['timeoutMs']??_0x2e82db['defaultTimeoutMs'],'provider':_0x2e82db[_0x4b4030(0xfd)][_0x4b4030(0x1a2)]??_0x2e82db[_0x4b4030(0x193)],'model':_0x2e82db[_0x4b4030(0xfd)][_0x4b4030(0x14a)]??_0x2e82db[_0x4b4030(0x118)]});return executeEmbeddedPrompt({'api':_0x2e82db['api'],'workspaceDir':_0x2e82db[_0x4b4030(0x128)],'runDir':_0x2e82db[_0x4b4030(0xf8)],'sessionId':_0x2e82db['state'][_0x4b4030(0x13e)]+':'+_0x2e82db[_0x4b4030(0x17c)]['id'],'runId':_0x2e82db[_0x4b4030(0x16d)][_0x4b4030(0x13e)]+':'+_0x2e82db[_0x4b4030(0x17c)]['id'],'prompt':_0x4d66af,'provider':_0x2e82db[_0x4b4030(0xfd)][_0x4b4030(0x1a2)]??_0x2e82db[_0x4b4030(0x193)],'model':_0x2e82db[_0x4b4030(0xfd)][_0x4b4030(0x14a)]??_0x2e82db[_0x4b4030(0x118)],'timeoutMs':_0x2e82db[_0x4b4030(0xfd)][_0x4b4030(0x123)]??_0x2e82db['defaultTimeoutMs']});}async function executeJudgeNode(_0x46baf7){const _0x3b976e=_0x3d1e95,_0x35d41f=[_0x3b976e(0x147),'Return\x20JSON\x20only\x20with\x20shape\x20{\x22decision\x22:\x22branch_key\x22,\x22reason\x22:\x22optional\x20short\x20reason\x22}.',_0x3b976e(0x138),'','Program\x20goal:\x20'+_0x46baf7['program']['goal'],_0x3b976e(0xfc)+_0x46baf7[_0x3b976e(0x17c)][_0x3b976e(0x1a4)],_0x3b976e(0x109)+_0x46baf7['node'][_0x3b976e(0x19c)],'',_0x3b976e(0x172),_0x46baf7[_0x3b976e(0xfd)]['role'],'',_0x3b976e(0x162),_0x46baf7[_0x3b976e(0xfd)][_0x3b976e(0x131)],'',_0x3b976e(0x1a5),_0x46baf7[_0x3b976e(0x17c)][_0x3b976e(0x131)],'',_0x3b976e(0x197)+_0x46baf7[_0x3b976e(0x17c)][_0x3b976e(0x18c)][_0x3b976e(0x1a0)](',\x20'),'',_0x3b976e(0x16b),JSON[_0x3b976e(0x15a)](_0x46baf7[_0x3b976e(0x178)],null,0x2),'',_0x3b976e(0x10f),await buildPriorNodeContext(_0x46baf7[_0x3b976e(0xf8)],_0x46baf7['state'])][_0x3b976e(0x1a0)]('\x0a'),_0x52eea9=await executeEmbeddedPrompt({'api':_0x46baf7[_0x3b976e(0x195)],'workspaceDir':_0x46baf7['workspaceDir'],'runDir':_0x46baf7[_0x3b976e(0xf8)],'sessionId':_0x46baf7[_0x3b976e(0x16d)][_0x3b976e(0x13e)]+':'+_0x46baf7[_0x3b976e(0x17c)]['id'],'runId':_0x46baf7['state']['runId']+':'+_0x46baf7[_0x3b976e(0x17c)]['id'],'prompt':_0x35d41f,'provider':_0x46baf7[_0x3b976e(0xfd)][_0x3b976e(0x1a2)]??_0x46baf7[_0x3b976e(0x193)],'model':_0x46baf7[_0x3b976e(0xfd)][_0x3b976e(0x14a)]??_0x46baf7[_0x3b976e(0x118)],'timeoutMs':_0x46baf7[_0x3b976e(0xfd)][_0x3b976e(0x123)]??_0x46baf7[_0x3b976e(0x144)]});return parseJudgeDecision(_0x52eea9);}async function executeSubagentTaskNode(_0x357d71){const _0x36fdd9=_0x3d1e95,_0x4553a0=_0x357d71[_0x36fdd9(0x16d)][_0x36fdd9(0x10e)][_0x357d71[_0x36fdd9(0x17c)]['id']],_0x1046d9=_0x36fdd9(0x166)+_0x357d71[_0x36fdd9(0x16d)]['runId']+':'+_0x357d71[_0x36fdd9(0x17c)]['id']+':v'+(_0x4553a0?.['visitCount']??0x1);try{const _0x50926c=await _0x357d71['api']['runtime']['subagent'][_0x36fdd9(0x16e)]({'sessionKey':_0x1046d9,'message':_0x357d71[_0x36fdd9(0x17b)],'deliver':![],..._0x357d71[_0x36fdd9(0x1a2)]?{'provider':_0x357d71[_0x36fdd9(0x1a2)]}:{},..._0x357d71[_0x36fdd9(0x14a)]?{'model':_0x357d71[_0x36fdd9(0x14a)]}:{}});_0x4553a0&&(_0x4553a0[_0x36fdd9(0x198)]=_0x1046d9,_0x4553a0[_0x36fdd9(0x101)]=_0x50926c[_0x36fdd9(0x13e)],await writeRunState(_0x357d71[_0x36fdd9(0xf8)],_0x357d71[_0x36fdd9(0x16d)]));const _0x596b6b=await _0x357d71[_0x36fdd9(0x195)][_0x36fdd9(0xf7)][_0x36fdd9(0x1ad)][_0x36fdd9(0x115)]({'runId':_0x50926c[_0x36fdd9(0x13e)],'timeoutMs':_0x357d71[_0x36fdd9(0x123)]});if(_0x596b6b[_0x36fdd9(0x10c)]!=='ok')throw new Error(_0x596b6b[_0x36fdd9(0x10c)]===_0x36fdd9(0x14e)?_0x36fdd9(0x10b)+_0x357d71['node']['id']:_0x36fdd9(0x12e)+(_0x596b6b[_0x36fdd9(0x135)]??_0x357d71[_0x36fdd9(0x17c)]['id']));const _0x824926=await _0x357d71['api'][_0x36fdd9(0xf7)][_0x36fdd9(0x1ad)]['getSessionMessages']({'sessionKey':_0x1046d9,'limit':0xc8});return extractSubagentOutputText(_0x824926[_0x36fdd9(0x15e)]);}catch(_0x4cfc88){if(!isUnavailablePluginSubagentRuntimeError(_0x4cfc88))throw _0x4cfc88;}const _0x6ca630=_0x357d71[_0x36fdd9(0x16d)][_0x36fdd9(0xf7)][_0x36fdd9(0xf9)]??_0x357d71[_0x36fdd9(0x16d)]['background']?.['originAgentId'];if(!_0x6ca630)throw new Error(_0x36fdd9(0x15f));const _0x4c48fe=await queueAgentSessionRun({'sessionKey':_0x1046d9,'agentId':_0x6ca630,'label':'own-prose\x20task\x20'+_0x357d71['state']['runId']+':'+_0x357d71['node']['id'],'message':_0x357d71[_0x36fdd9(0x17b)]});_0x4553a0&&(_0x4553a0[_0x36fdd9(0x198)]=_0x1046d9,_0x4553a0[_0x36fdd9(0x101)]=_0x4c48fe[_0x36fdd9(0x13e)],await writeRunState(_0x357d71['runDir'],_0x357d71[_0x36fdd9(0x16d)]));const _0x1bb65f=await waitForAgentSessionRun({'runId':_0x4c48fe[_0x36fdd9(0x13e)],'timeoutMs':_0x357d71[_0x36fdd9(0x123)]});if(_0x1bb65f['status']!=='ok')throw new Error(_0x1bb65f[_0x36fdd9(0x10c)]===_0x36fdd9(0x14e)?_0x36fdd9(0x10b)+_0x357d71[_0x36fdd9(0x17c)]['id']:_0x36fdd9(0x12e)+(_0x1bb65f[_0x36fdd9(0x135)]??_0x357d71[_0x36fdd9(0x17c)]['id']));const _0x28f3af=await getAgentSessionMessages({'sessionKey':_0x1046d9,'limit':0xc8});return extractSubagentOutputText(_0x28f3af[_0x36fdd9(0x15e)]);}async function executeEmbeddedPrompt(_0x14830c){const _0x5c5e87=_0x3d1e95,_0x3e88d=await _0x14830c['api']['runtime'][_0x5c5e87(0xfd)][_0x5c5e87(0x169)]({'sessionId':_0x14830c['sessionId'],'runId':_0x14830c[_0x5c5e87(0x13e)],'sessionFile':_0x52d1d9[_0x5c5e87(0x1a0)](_0x14830c['runDir'],_0x5c5e87(0x1a3),sanitizeId(_0x14830c['sessionId'])+'.jsonl'),'workspaceDir':_0x14830c[_0x5c5e87(0x128)],'config':_0x14830c[_0x5c5e87(0x195)][_0x5c5e87(0x13f)],'prompt':_0x14830c['prompt'],'timeoutMs':_0x14830c['timeoutMs'],..._0x14830c['provider']?{'provider':_0x14830c['provider']}:{},..._0x14830c[_0x5c5e87(0x14a)]?{'model':_0x14830c[_0x5c5e87(0x14a)]}:{}}),_0xd2812a=extractEmbeddedRunOutputText(_0x3e88d[_0x5c5e87(0x1a9)]);if(_0xd2812a)return _0xd2812a;const _0x1d82bb=_0x3e88d['meta']?.['error']?.[_0x5c5e87(0x13b)]?.[_0x5c5e87(0x17e)]();throw new Error(_0x1d82bb||_0x5c5e87(0x1ae));}async function buildPriorNodeContext(_0x5a8214,_0x334a72){const _0x4a7d85=_0x3d1e95,_0xd27629=await Promise[_0x4a7d85(0x179)](Object[_0x4a7d85(0x10a)](_0x334a72['artifacts'])[_0x4a7d85(0x152)](async([_0x284405,_0x454956])=>{const _0x1800a5=_0x4a7d85,_0x39ecb7=await _0x2cb537[_0x1800a5(0x14c)](_0x52d1d9[_0x1800a5(0x112)](_0x5a8214,_0x454956),'utf8')['catch'](()=>'');return _0x1800a5(0x190)+_0x284405+'\x0a'+truncateText(_0x39ecb7,0x5dc);}));return _0xd27629[_0x4a7d85(0x17d)]>0x0?_0xd27629[_0x4a7d85(0x1a0)]('\x0a\x0a'):_0x4a7d85(0x132);}function parseJudgeDecision(_0x3ad1c8){const _0x1657fa=_0x3d1e95,_0x47d26b=_0x3ad1c8['trim']();try{const _0x3954d3=extractJsonObject(_0x47d26b),_0x4c8d8f=JSON[_0x1657fa(0x11d)](_0x3954d3),_0x2a83b2=typeof _0x4c8d8f[_0x1657fa(0x18d)]===_0x1657fa(0x19e)?_0x4c8d8f[_0x1657fa(0x18d)][_0x1657fa(0x17e)]():'';if(!_0x2a83b2)throw new Error(_0x1657fa(0x12c));const _0x1ac51f=typeof _0x4c8d8f['reason']===_0x1657fa(0x19e)&&_0x4c8d8f[_0x1657fa(0x129)][_0x1657fa(0x17e)]()?_0x4c8d8f[_0x1657fa(0x129)]['trim']():undefined;return{'decision':_0x2a83b2,'reason':_0x1ac51f};}catch{if(_0x47d26b&&!_0x47d26b['includes']('\x0a'))return{'decision':_0x47d26b};throw new Error(_0x1657fa(0x133));}}async function failRun(_0x393341,_0x5b9e82,_0x2069e0,_0x541e04){const _0x4620f1=_0x3d1e95;_0x5b9e82[_0x4620f1(0x10c)]=_0x4620f1(0x1a7),_0x5b9e82['failure']=_0x541e04,await appendTimeline(_0x393341,{'at':new Date()[_0x4620f1(0x163)](),'type':_0x4620f1(0x141),'runId':_0x5b9e82[_0x4620f1(0x13e)],'nodeId':_0x541e04['nodeId'],'message':_0x541e04[_0x4620f1(0x129)]}),await writeRunState(_0x393341,_0x5b9e82),await writeResumeFile(_0x393341,_0x5b9e82,_0x2069e0);}async function runInBackground(_0x348ef9){const _0x2f2970=_0x3d1e95;_0x348ef9['state'][_0x2f2970(0x16f)]={..._0x348ef9['state']['background']??{'mode':'background','startedAt':new Date()[_0x2f2970(0x163)]()},'mode':_0x2f2970(0x16f),'status':'running'};_0x348ef9[_0x2f2970(0x16d)]['background'][_0x2f2970(0x114)]&&(_0x348ef9['state']['background']['worker']={..._0x348ef9[_0x2f2970(0x16d)][_0x2f2970(0x16f)]['worker'],'status':_0x2f2970(0x11a),'startedAt':new Date()[_0x2f2970(0x163)](),'error':undefined});await writeRunState(_0x348ef9[_0x2f2970(0xf8)],_0x348ef9[_0x2f2970(0x16d)]),await writeResumeFile(_0x348ef9['runDir'],_0x348ef9[_0x2f2970(0x16d)],_0x348ef9[_0x2f2970(0x189)]);const _0x2f1fc2=await executePlan({..._0x348ef9,'background':!![]});return _0x2f1fc2[_0x2f2970(0x16f)]={..._0x2f1fc2[_0x2f2970(0x16f)]??{'mode':_0x2f2970(0x16f),'startedAt':new Date()[_0x2f2970(0x163)]()},'mode':'background','status':_0x2f1fc2[_0x2f2970(0x10c)]==='completed'?_0x2f2970(0x19f):_0x2f2970(0x1a7),'finishedAt':new Date()['toISOString']()},_0x2f1fc2[_0x2f2970(0x16f)][_0x2f2970(0x114)]&&(_0x2f1fc2[_0x2f2970(0x16f)]['worker']={..._0x2f1fc2[_0x2f2970(0x16f)][_0x2f2970(0x114)],'status':_0x2f1fc2[_0x2f2970(0x10c)]==='completed'?_0x2f2970(0x19f):_0x2f2970(0x1a7),'finishedAt':new Date()[_0x2f2970(0x163)](),'error':_0x2f1fc2[_0x2f2970(0x153)]?.[_0x2f2970(0x129)]}),await writeRunState(_0x348ef9['runDir'],_0x2f1fc2),await writeResumeFile(_0x348ef9[_0x2f2970(0xf8)],_0x2f1fc2,_0x348ef9[_0x2f2970(0x189)]),await notifyBackgroundRunFinished({'runDir':_0x348ef9['runDir'],'state':_0x2f1fc2,'plan':_0x348ef9[_0x2f2970(0x189)]}),_0x2f1fc2;}async function notifyBackgroundRunFinished(_0x5cf994){const _0x2facb4=_0x3d1e95,_0x30222d=_0x5cf994[_0x2facb4(0x16d)][_0x2facb4(0x16f)];if(!_0x30222d)return;const _0x3e9b7a=new Date()['toISOString'](),_0x51544d=_0x30222d['originSessionKey']?.[_0x2facb4(0x17e)]();if(!_0x51544d){_0x30222d[_0x2facb4(0x15b)]={'status':_0x2facb4(0x146),'attemptedAt':_0x3e9b7a},await writeRunState(_0x5cf994[_0x2facb4(0xf8)],_0x5cf994[_0x2facb4(0x16d)]),await writeResumeFile(_0x5cf994[_0x2facb4(0xf8)],_0x5cf994[_0x2facb4(0x16d)],_0x5cf994[_0x2facb4(0x189)]),await appendTimeline(_0x5cf994[_0x2facb4(0xf8)],{'at':_0x3e9b7a,'type':_0x2facb4(0x124),'runId':_0x5cf994[_0x2facb4(0x16d)][_0x2facb4(0x13e)],'message':_0x2facb4(0x127)});return;}_0x30222d['notification']={'status':'pending','attemptedAt':_0x3e9b7a},await writeRunState(_0x5cf994[_0x2facb4(0xf8)],_0x5cf994[_0x2facb4(0x16d)]),await writeResumeFile(_0x5cf994[_0x2facb4(0xf8)],_0x5cf994[_0x2facb4(0x16d)],_0x5cf994[_0x2facb4(0x189)]);try{const _0x3a4da1=await notifyAgentSession({'sessionKey':_0x51544d,'message':await buildOwnProseNotificationMessage(_0x5cf994[_0x2facb4(0xf8)],_0x5cf994[_0x2facb4(0x16d)],_0x5cf994[_0x2facb4(0x189)])});_0x30222d['notification']={'status':_0x2facb4(0x164),'attemptedAt':_0x3e9b7a,'queuedAt':new Date()[_0x2facb4(0x163)](),'runId':_0x3a4da1[_0x2facb4(0x13e)]};const _0x4134de=_0x30222d['notification'][_0x2facb4(0x120)]??new Date()[_0x2facb4(0x163)]();await appendTimeline(_0x5cf994[_0x2facb4(0xf8)],{'at':_0x4134de,'type':_0x2facb4(0x187),'runId':_0x5cf994[_0x2facb4(0x16d)][_0x2facb4(0x13e)],'message':_0x2facb4(0x173)+_0x51544d+_0x2facb4(0x18f)+_0x3a4da1['runId']});}catch(_0x2ce33d){const _0xbac63d=_0x2ce33d instanceof Error?_0x2ce33d[_0x2facb4(0x13b)]:String(_0x2ce33d);_0x30222d[_0x2facb4(0x15b)]={'status':'failed','attemptedAt':_0x3e9b7a,'error':_0xbac63d},await appendTimeline(_0x5cf994['runDir'],{'at':new Date()[_0x2facb4(0x163)](),'type':_0x2facb4(0x196),'runId':_0x5cf994[_0x2facb4(0x16d)]['runId'],'message':_0xbac63d});}await writeRunState(_0x5cf994[_0x2facb4(0xf8)],_0x5cf994[_0x2facb4(0x16d)]),await writeResumeFile(_0x5cf994[_0x2facb4(0xf8)],_0x5cf994[_0x2facb4(0x16d)],_0x5cf994[_0x2facb4(0x189)]);}async function queueBackgroundWorkerRun(_0x307f2c){const _0x12ee86=_0x3d1e95,_0x20aeac=_0x307f2c[_0x12ee86(0xf9)]?.[_0x12ee86(0x17e)]()?_0x12ee86(0x13d)+_0x307f2c[_0x12ee86(0xf9)][_0x12ee86(0x17e)]()+':'+_0x307f2c[_0x12ee86(0x13e)]:_0x307f2c['sessionKey'][_0x12ee86(0x17e)](),_0xddf3d7=await queueAgentSessionRun({'sessionKey':_0x20aeac,'agentId':_0x307f2c[_0x12ee86(0xf9)]?.[_0x12ee86(0x17e)]()||undefined,'label':_0x12ee86(0x14f)+_0x307f2c[_0x12ee86(0x13e)],'message':[_0x12ee86(0x16c),_0x12ee86(0x150)+_0x307f2c['runId']+'\x22.',_0x12ee86(0x159),'After\x20the\x20tool\x20finishes,\x20reply\x20only\x20with\x20'+NO_REPLY_TOKEN+'.'][_0x12ee86(0x1a0)]('\x0a'),'extraSystemPrompt':[_0x12ee86(0x176),'You\x20must\x20call\x20the\x20own_prose_background_run\x20tool\x20exactly\x20once\x20with\x20the\x20provided\x20runId.',_0x12ee86(0x174),_0x12ee86(0x136),_0x12ee86(0x12b)+NO_REPLY_TOKEN+'.'][_0x12ee86(0x1a0)]('\x0a')});return{'runId':_0xddf3d7[_0x12ee86(0x13e)],'sessionKey':_0x20aeac};}async function buildOwnProseNotificationMessage(_0x3141b7,_0x4e735c,_0x23d690){const _0x53deef=_0x3d1e95,_0x2825d5=await readFinalOutputMaybe(_0x4e735c[_0x53deef(0x13c)]);return[_0x53deef(0xfa),_0x53deef(0x151)+_0x4e735c['runId'],_0x53deef(0x160)+_0x23d690['programName'],'Status:\x20'+_0x4e735c['status'],_0x4e735c['currentNodeId']?_0x53deef(0x117)+_0x4e735c[_0x53deef(0x14b)]:undefined,_0x4e735c[_0x53deef(0x153)]?_0x53deef(0x19b)+_0x4e735c['failure'][_0x53deef(0x129)]:undefined,_0x2825d5?'':undefined,_0x2825d5?_0x53deef(0x106):undefined,_0x2825d5]['filter'](_0xe8c591=>Boolean(_0xe8c591))[_0x53deef(0x1a0)]('\x0a');}async function readFinalOutputMaybe(_0x2d3756){const _0x1eca99=_0x3d1e95;if(!_0x2d3756)return undefined;const _0x2a5b83=await _0x2cb537['readFile'](_0x2d3756,_0x1eca99(0x15d))[_0x1eca99(0x149)](()=>''),_0x18e071=_0x2a5b83['trim']();return _0x18e071||undefined;}function summarizeText(_0x2e1857,_0x2d06f2=0xa0){const _0x3503b6=_0x3d1e95;return truncateText(_0x2e1857[_0x3503b6(0x18a)](/\s+/g,'\x20')['trim'](),_0x2d06f2);}function truncateText(_0xa14dc8,_0x2e5496){const _0x53f012=_0x3d1e95;if(_0xa14dc8[_0x53f012(0x17d)]<=_0x2e5496)return _0xa14dc8;return _0xa14dc8[_0x53f012(0x14d)](0x0,_0x2e5496-0x1)+_0x53f012(0x107);}function sanitizeId(_0x3facf4){return _0x3facf4['replace'](/[^a-zA-Z0-9._-]+/g,'_');}function extractEmbeddedRunOutputText(_0x1ddef3){const _0x461634=_0x3d1e95;if(!Array[_0x461634(0x104)](_0x1ddef3))return undefined;for(let _0x4f3c99=_0x1ddef3[_0x461634(0x17d)]-0x1;_0x4f3c99>=0x0;_0x4f3c99-=0x1){const _0x432ff3=_0x1ddef3[_0x4f3c99];if(_0x432ff3?.[_0x461634(0x148)])continue;const _0x52df3a=_0x432ff3?.[_0x461634(0x105)]?.[_0x461634(0x17e)]();if(_0x52df3a)return _0x52df3a;}return undefined;}function extractSubagentOutputText(_0x71975c){const _0x11e7eb=_0x3d1e95;for(let _0x36a1c9=_0x71975c[_0x11e7eb(0x17d)]-0x1;_0x36a1c9>=0x0;_0x36a1c9-=0x1){const _0x36ad2e=extractAssistantText(_0x71975c[_0x36a1c9]);if(_0x36ad2e)return _0x36ad2e;}throw new Error(_0x11e7eb(0x1a8));}function extractAssistantText(_0x4cc9ec){const _0x28bc3a=_0x3d1e95,_0x325947=readRecordMaybe(_0x4cc9ec),_0x4013fe=readRecordMaybe(_0x325947?.['message'])??_0x325947;if(readStringMaybe(_0x4013fe?.[_0x28bc3a(0x19a)])!=='assistant')return undefined;const _0x3413f8=_0x4013fe?.[_0x28bc3a(0x17a)];if(typeof _0x3413f8===_0x28bc3a(0x19e)&&_0x3413f8[_0x28bc3a(0x17e)]())return _0x3413f8[_0x28bc3a(0x17e)]();if(!Array[_0x28bc3a(0x104)](_0x3413f8))return undefined;const _0x25847c=_0x3413f8['map'](_0x2b5cc8=>{const _0x46683b=_0x28bc3a,_0x969e33=readRecordMaybe(_0x2b5cc8);if(typeof _0x969e33?.[_0x46683b(0x105)]===_0x46683b(0x19e)&&_0x969e33[_0x46683b(0x105)][_0x46683b(0x17e)]())return _0x969e33['text'][_0x46683b(0x17e)]();return undefined;})[_0x28bc3a(0x1a1)](_0x14e80c=>Boolean(_0x14e80c));return _0x25847c[_0x28bc3a(0x17d)]>0x0?_0x25847c[_0x28bc3a(0x1a0)]('\x0a')[_0x28bc3a(0x17e)]():undefined;}function extractJsonObject(_0x45121c){const _0xfbf5e1=_0x3d1e95,_0x154daa=_0x45121c[_0xfbf5e1(0x17e)]();if(_0x154daa[_0xfbf5e1(0x192)]('{')&&_0x154daa['endsWith']('}'))return _0x154daa;const _0x2b7ceb=/```(?:json)?\s*([\s\S]*?)```/i[_0xfbf5e1(0x156)](_0x154daa);if(_0x2b7ceb?.[0x1]?.[_0xfbf5e1(0x17e)]())return _0x2b7ceb[0x1][_0xfbf5e1(0x17e)]();const _0x24eced=_0x154daa[_0xfbf5e1(0x182)]('{'),_0x27a308=_0x154daa['lastIndexOf']('}');if(_0x24eced>=0x0&&_0x27a308>_0x24eced)return _0x154daa[_0xfbf5e1(0x14d)](_0x24eced,_0x27a308+0x1);throw new Error('Unable\x20to\x20locate\x20JSON\x20object\x20in\x20output');}function readRecordMaybe(_0x1f294a){const _0x1b49cc=_0x3d1e95;return _0x1f294a&&typeof _0x1f294a===_0x1b49cc(0x108)&&!Array[_0x1b49cc(0x104)](_0x1f294a)?_0x1f294a:undefined;}function readStringMaybe(_0x34a6ac){const _0x1535c8=_0x3d1e95;return typeof _0x34a6ac===_0x1535c8(0x19e)&&_0x34a6ac[_0x1535c8(0x17e)]()?_0x34a6ac[_0x1535c8(0x17e)]():undefined;}function isUnavailablePluginSubagentRuntimeError(_0x3852d7){const _0x4160c4=_0x3d1e95;return _0x3852d7 instanceof Error&&_0x3852d7['message'][_0x4160c4(0x1b4)]('Plugin\x20runtime\x20subagent\x20methods\x20are\x20only\x20available\x20during\x20a\x20gateway\x20request.');}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
|
2
|
+
import type { AgentSpec, CompiledPlan, ProgramSpec } from "./types.js";
|
|
3
|
+
export declare function compilePlan(params: {
|
|
4
|
+
api: OpenClawPluginApi;
|
|
5
|
+
workspaceDir: string;
|
|
6
|
+
runDir: string;
|
|
7
|
+
program: ProgramSpec;
|
|
8
|
+
agents: Record<string, AgentSpec>;
|
|
9
|
+
provider?: string;
|
|
10
|
+
model?: string;
|
|
11
|
+
timeoutMs: number;
|
|
12
|
+
}): Promise<CompiledPlan>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x4fd704,_0x532eff){const _0x152a2a=_0x5236,_0x2bbe1a=_0x4fd704();while(!![]){try{const _0x2acb1b=parseInt(_0x152a2a(0x194))/0x1+-parseInt(_0x152a2a(0x1b0))/0x2+-parseInt(_0x152a2a(0x18e))/0x3*(parseInt(_0x152a2a(0x17f))/0x4)+parseInt(_0x152a2a(0x18c))/0x5*(-parseInt(_0x152a2a(0x184))/0x6)+parseInt(_0x152a2a(0x161))/0x7+parseInt(_0x152a2a(0x15b))/0x8+-parseInt(_0x152a2a(0x166))/0x9*(-parseInt(_0x152a2a(0x198))/0xa);if(_0x2acb1b===_0x532eff)break;else _0x2bbe1a['push'](_0x2bbe1a['shift']());}catch(_0x2450b2){_0x2bbe1a['push'](_0x2bbe1a['shift']());}}}(_0x1f93,0x49446));import _0x3cc90f from'node:path';export async function compilePlan(_0x3abc74){const _0x2da996=_0x5236,_0x3ed96e=buildCompilePrompt(_0x3abc74['program'],_0x3abc74[_0x2da996(0x196)]),_0xef6914=await runEmbeddedPrompt({'api':_0x3abc74[_0x2da996(0x18a)],'workspaceDir':_0x3abc74[_0x2da996(0x192)],'runDir':_0x3abc74[_0x2da996(0x1b9)],'sessionId':'own-prose:compile:'+_0x3abc74[_0x2da996(0x15c)][_0x2da996(0x1b8)],'runId':_0x2da996(0x197)+_0x3abc74[_0x2da996(0x15c)]['name'],'prompt':_0x3ed96e,'provider':_0x3abc74[_0x2da996(0x18b)],'model':_0x3abc74[_0x2da996(0x1ba)],'timeoutMs':_0x3abc74[_0x2da996(0x1ad)]});return parseCompiledPlan(_0xef6914,_0x3abc74[_0x2da996(0x15c)],_0x3abc74[_0x2da996(0x196)]);}function buildCompilePrompt(_0x54cab1,_0x34b130){const _0x5cfaa8=_0x5236,_0x7c3336=JSON['stringify'](Object[_0x5cfaa8(0x19c)](_0x34b130)['map'](_0x213e2e=>({'id':_0x213e2e['id'],'role':_0x213e2e['role'],'instructions':_0x213e2e[_0x5cfaa8(0x195)],'doneWhen':_0x213e2e[_0x5cfaa8(0x17b)],'permissions':_0x213e2e[_0x5cfaa8(0x168)]})),null,0x2);return[_0x5cfaa8(0x174),_0x5cfaa8(0x1a0),'Return\x20JSON\x20only.\x20Do\x20not\x20wrap\x20it\x20in\x20markdown\x20fences.','',_0x5cfaa8(0x186),'-\x20Use\x20only\x20agents\x20listed\x20below.',_0x5cfaa8(0x15a),_0x5cfaa8(0x1b1),_0x5cfaa8(0x187),_0x5cfaa8(0x1a8),_0x5cfaa8(0x16e),_0x5cfaa8(0x1b6),_0x5cfaa8(0x1b7),'-\x20If\x20allowLoops\x20is\x20false,\x20do\x20not\x20create\x20loops.','',_0x5cfaa8(0x188),JSON[_0x5cfaa8(0x190)]({'name':_0x54cab1[_0x5cfaa8(0x1b8)],'goal':_0x54cab1[_0x5cfaa8(0x18f)],'workflow':_0x54cab1[_0x5cfaa8(0x173)],'constraints':_0x54cab1['constraints'],'outputContract':_0x54cab1[_0x5cfaa8(0x189)]},null,0x2),'','Available\x20agents:',_0x7c3336,'',_0x5cfaa8(0x16d),_0x5cfaa8(0x171)]['join']('\x0a');}function parseCompiledPlan(_0x2ef9dd,_0x755e01,_0x3c7a35){const _0x2d8d96=_0x5236,_0x49644e=extractJsonObject(_0x2ef9dd),_0xa2c6c6=JSON['parse'](_0x49644e),_0x4a4933=Array['isArray'](_0xa2c6c6['nodes'])?_0xa2c6c6[_0x2d8d96(0x16a)]:undefined;if(!_0x4a4933||_0x4a4933['length']===0x0)throw new Error(_0x2d8d96(0x19b));const _0x4abccd=_0x4a4933[_0x2d8d96(0x182)]((_0x5931b3,_0x7b77fe)=>normalizeNode(_0x5931b3,_0x7b77fe,_0x3c7a35)),_0x4f560f=requireString(_0xa2c6c6[_0x2d8d96(0x172)],'entryNodeId'),_0x50c278=normalizeMaxSteps(_0xa2c6c6[_0x2d8d96(0x15e)],_0x755e01[_0x2d8d96(0x1a1)][_0x2d8d96(0x15e)]),_0x1ab72f=normalizeStringArray(_0xa2c6c6['branchVocabulary']);return{'version':0x1,'planId':_0x755e01[_0x2d8d96(0x1b8)]+':'+Date['now'](),'programName':_0x755e01['name'],'summary':requireString(_0xa2c6c6['summary'],_0x2d8d96(0x1a5)),'entryNodeId':_0x4f560f,'maxSteps':_0x50c278,'branchVocabulary':_0x1ab72f,'nodes':_0x4abccd};}function normalizeNode(_0x271408,_0x24c347,_0x421473){const _0x4a7481=_0x5236;if(!_0x271408||typeof _0x271408!=='object'||Array[_0x4a7481(0x15d)](_0x271408))throw new Error(_0x4a7481(0x191)+(_0x24c347+0x1)+'\x20must\x20be\x20an\x20object');const _0x2b89ed=_0x271408,_0x9902b0=requireString(_0x2b89ed[_0x4a7481(0x17e)],_0x4a7481(0x165)+_0x24c347+_0x4a7481(0x176)),_0x432bd6=requireString(_0x2b89ed['id'],_0x4a7481(0x165)+_0x24c347+_0x4a7481(0x175)),_0xe5c318=requireString(_0x2b89ed[_0x4a7481(0x160)],_0x4a7481(0x165)+_0x24c347+_0x4a7481(0x1a2));if(_0x9902b0===_0x4a7481(0x17c))return{'id':_0x432bd6,'type':_0x4a7481(0x17c),'title':_0xe5c318};const _0x217292=requireString(_0x2b89ed[_0x4a7481(0x170)],'nodes['+_0x24c347+_0x4a7481(0x1aa)),_0x4bb41b=_0x421473[_0x217292];if(!_0x4bb41b)throw new Error('Compiled\x20node\x20'+(_0x24c347+0x1)+_0x4a7481(0x1af)+_0x217292+'\x22');if(_0x9902b0===_0x4a7481(0x1ab))return{'id':_0x432bd6,'type':'task','title':_0xe5c318,'agentId':_0x217292,'goal':requireString(_0x2b89ed['goal'],_0x4a7481(0x165)+_0x24c347+_0x4a7481(0x16f)),'instructions':requireString(_0x2b89ed[_0x4a7481(0x195)],_0x4a7481(0x165)+_0x24c347+_0x4a7481(0x164)),'doneWhen':normalizeStringArray(_0x2b89ed[_0x4a7481(0x17b)]),'next':normalizeNullableString(_0x2b89ed[_0x4a7481(0x162)]),'permissions':_0x4bb41b[_0x4a7481(0x168)]};if(_0x9902b0===_0x4a7481(0x17d)){const _0x5af842=normalizeStringArray(_0x2b89ed['allowedBranches']),_0x3498b9=readRecord(_0x2b89ed['branches'],_0x4a7481(0x165)+_0x24c347+_0x4a7481(0x15f)),_0x2f62f8=Object[_0x4a7481(0x181)](Object[_0x4a7481(0x1a4)](_0x3498b9)[_0x4a7481(0x182)](([_0x413577,_0x19f3cc])=>[_0x413577,requireString(_0x19f3cc,_0x4a7481(0x165)+_0x24c347+_0x4a7481(0x1ac)+_0x413577)]));return{'id':_0x432bd6,'type':'judge','title':_0xe5c318,'agentId':_0x217292,'question':requireString(_0x2b89ed['question'],_0x4a7481(0x165)+_0x24c347+'].question'),'instructions':requireString(_0x2b89ed['instructions'],'nodes['+_0x24c347+'].instructions'),'allowedBranches':_0x5af842,'branches':_0x2f62f8,'permissions':_0x4bb41b[_0x4a7481(0x168)]};}throw new Error(_0x4a7481(0x191)+(_0x24c347+0x1)+_0x4a7481(0x179)+_0x9902b0+'\x22');}async function runEmbeddedPrompt(_0x4373d4){const _0x51bbfb=_0x5236,_0x28cf9e=await _0x4373d4[_0x51bbfb(0x18a)][_0x51bbfb(0x1a3)]['agent']['runEmbeddedPiAgent']({'sessionId':_0x4373d4['sessionId'],'runId':_0x4373d4['runId'],'sessionFile':_0x3cc90f[_0x51bbfb(0x1ae)](_0x4373d4[_0x51bbfb(0x1b9)],_0x51bbfb(0x19f),sanitizeId(_0x4373d4[_0x51bbfb(0x19e)])+_0x51bbfb(0x1a6)),'workspaceDir':_0x4373d4[_0x51bbfb(0x192)],'config':_0x4373d4[_0x51bbfb(0x18a)]['config'],'prompt':_0x4373d4[_0x51bbfb(0x1b3)],'timeoutMs':_0x4373d4[_0x51bbfb(0x1ad)],..._0x4373d4[_0x51bbfb(0x18b)]?{'provider':_0x4373d4['provider']}:{},..._0x4373d4[_0x51bbfb(0x1ba)]?{'model':_0x4373d4['model']}:{}}),_0x4bea23=extractEmbeddedRunOutputText(_0x28cf9e[_0x51bbfb(0x1b4)]);if(!_0x4bea23){const _0x5b824e=_0x28cf9e['meta']?.[_0x51bbfb(0x19d)]?.[_0x51bbfb(0x180)]?.[_0x51bbfb(0x185)]();throw new Error(_0x5b824e||_0x51bbfb(0x16b));}return _0x4bea23;}function extractEmbeddedRunOutputText(_0xfafdd7){const _0x19307e=_0x5236;if(!Array[_0x19307e(0x15d)](_0xfafdd7))return undefined;for(let _0x3f9b5e=_0xfafdd7['length']-0x1;_0x3f9b5e>=0x0;_0x3f9b5e-=0x1){const _0x4222d6=_0xfafdd7[_0x3f9b5e];if(_0x4222d6?.[_0x19307e(0x19a)])continue;const _0x32b42b=_0x4222d6?.[_0x19307e(0x163)]?.['trim']();if(_0x32b42b)return _0x32b42b;}return undefined;}function _0x5236(_0xb0f04d,_0x5846d1){_0xb0f04d=_0xb0f04d-0x15a;const _0x1f939e=_0x1f93();let _0x52367c=_0x1f939e[_0xb0f04d];return _0x52367c;}function extractJsonObject(_0x5443b8){const _0x197b7f=_0x5236,_0x18b810=_0x5443b8[_0x197b7f(0x185)]();if(_0x18b810['startsWith']('{')&&_0x18b810['endsWith']('}'))return _0x18b810;const _0x1387ce=/```(?:json)?\s*([\s\S]*?)```/i['exec'](_0x18b810);if(_0x1387ce?.[0x1]?.[_0x197b7f(0x185)]())return _0x1387ce[0x1][_0x197b7f(0x185)]();const _0x3ebf19=_0x18b810[_0x197b7f(0x183)]('{'),_0x25ef95=_0x18b810[_0x197b7f(0x18d)]('}');if(_0x3ebf19>=0x0&&_0x25ef95>_0x3ebf19)return _0x18b810[_0x197b7f(0x199)](_0x3ebf19,_0x25ef95+0x1);throw new Error(_0x197b7f(0x1b2));}function normalizeMaxSteps(_0x2b62d2,_0x3f026e){const _0x21597d=_0x5236;if(typeof _0x2b62d2!==_0x21597d(0x178)||!Number[_0x21597d(0x17a)](_0x2b62d2)||_0x2b62d2<0x1)return _0x3f026e;return Math[_0x21597d(0x16c)](Math[_0x21597d(0x167)](_0x2b62d2),_0x3f026e);}function normalizeStringArray(_0x51c183){const _0x50d5a3=_0x5236;if(!Array[_0x50d5a3(0x15d)](_0x51c183))return[];return _0x51c183[_0x50d5a3(0x182)](_0x54303a=>typeof _0x54303a===_0x50d5a3(0x177)?_0x54303a[_0x50d5a3(0x185)]():undefined)[_0x50d5a3(0x1a7)](_0x12005f=>Boolean(_0x12005f));}function normalizeNullableString(_0x4f2755){const _0x45f3f5=_0x5236;if(_0x4f2755==null)return null;return requireString(_0x4f2755,_0x45f3f5(0x162));}function requireString(_0x4ab474,_0x2d5cbc){const _0x79cdd2=_0x5236;if(typeof _0x4ab474!==_0x79cdd2(0x177)||!_0x4ab474[_0x79cdd2(0x185)]())throw new Error(_0x2d5cbc+_0x79cdd2(0x169));return _0x4ab474[_0x79cdd2(0x185)]();}function readRecord(_0x185191,_0x584f5e){const _0x5f179f=_0x5236;if(!_0x185191||typeof _0x185191!==_0x5f179f(0x1a9)||Array[_0x5f179f(0x15d)](_0x185191))throw new Error(_0x584f5e+_0x5f179f(0x1b5));return _0x185191;}function sanitizeId(_0xefbb5a){const _0x501146=_0x5236;return _0xefbb5a[_0x501146(0x193)](/[^a-zA-Z0-9._-]+/g,'_');}function _0x1f93(){const _0x1001b7=['filter','-\x20finish\x20nodes\x20must\x20set:\x20id,\x20type,\x20title.','object','].agentId','task','].branches.','timeoutMs','join','\x20references\x20unknown\x20agent\x20\x22','513826mrRzEx','-\x20task\x20nodes\x20must\x20set:\x20id,\x20type,\x20title,\x20agentId,\x20goal,\x20instructions,\x20doneWhen,\x20next.','Unable\x20to\x20locate\x20JSON\x20object\x20in\x20compiler\x20output','prompt','payloads','\x20must\x20be\x20an\x20object','-\x20entryNodeId\x20must\x20point\x20to\x20the\x20first\x20executable\x20node.','-\x20maxSteps\x20must\x20not\x20exceed\x20the\x20program\x20maxSteps.','name','runDir','model','-\x20Supported\x20node\x20types:\x20task,\x20judge,\x20finish.','3645072hooyjW','program','isArray','maxSteps','].branches','title','1608887MHJACz','next','text','].instructions','nodes[','207oRSnFM','trunc','permissions','\x20must\x20be\x20a\x20non-empty\x20string','nodes','Embedded\x20compiler\x20run\x20returned\x20no\x20output','min','Return\x20this\x20JSON\x20shape:','-\x20Do\x20not\x20include\x20permissions\x20in\x20the\x20output.','].goal','agentId','{\x22summary\x22:\x22...\x22,\x22entryNodeId\x22:\x22...\x22,\x22maxSteps\x22:12,\x22branchVocabulary\x22:[\x22...\x22],\x22nodes\x22:[{\x22id\x22:\x22...\x22,\x22type\x22:\x22task\x22,\x22title\x22:\x22...\x22,\x22agentId\x22:\x22...\x22,\x22goal\x22:\x22...\x22,\x22instructions\x22:\x22...\x22,\x22doneWhen\x22:[\x22...\x22],\x22next\x22:\x22...\x22},{\x22id\x22:\x22...\x22,\x22type\x22:\x22judge\x22,\x22title\x22:\x22...\x22,\x22agentId\x22:\x22...\x22,\x22question\x22:\x22...\x22,\x22instructions\x22:\x22...\x22,\x22allowedBranches\x22:[\x22...\x22],\x22branches\x22:{\x22branch\x22:\x22target\x22}},{\x22id\x22:\x22finish\x22,\x22type\x22:\x22finish\x22,\x22title\x22:\x22Workflow\x20complete\x22}]}','entryNodeId','workflow','You\x20are\x20the\x20own-prose\x20workflow\x20compiler.','].id','].type','string','number','\x20has\x20unsupported\x20type\x20\x22','isFinite','doneWhen','finish','judge','type','372VFCpRT','message','fromEntries','map','indexOf','222XKYpgI','trim','Rules:','-\x20judge\x20nodes\x20must\x20set:\x20id,\x20type,\x20title,\x20agentId,\x20question,\x20instructions,\x20allowedBranches,\x20branches.','Program:','outputContract','api','provider','78825pLzcqc','lastIndexOf','387SCYFzV','goal','stringify','Compiled\x20node\x20','workspaceDir','replace','19837gxlHQg','instructions','agents','own-prose-compile:','194350UUZwzm','slice','isError','Compiled\x20plan\x20must\x20contain\x20a\x20non-empty\x20nodes\x20array','values','error','sessionId','sessions','Convert\x20the\x20user\x27s\x20natural-language\x20workflow\x20into\x20a\x20strict\x20JSON\x20execution\x20plan.','constraints','].title','runtime','entries','summary','.jsonl'];_0x1f93=function(){return _0x1001b7;};return _0x1f93();}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x2eb4ab,_0x3b05c7){const _0x14dd9e=_0x168a,_0x41607b=_0x2eb4ab();while(!![]){try{const _0x16bb3c=-parseInt(_0x14dd9e(0x1a3))/0x1*(parseInt(_0x14dd9e(0x1aa))/0x2)+-parseInt(_0x14dd9e(0x1bb))/0x3*(parseInt(_0x14dd9e(0x1a8))/0x4)+parseInt(_0x14dd9e(0x1c3))/0x5+parseInt(_0x14dd9e(0x1b0))/0x6+-parseInt(_0x14dd9e(0x1cb))/0x7*(-parseInt(_0x14dd9e(0x1a4))/0x8)+-parseInt(_0x14dd9e(0x1cf))/0x9*(parseInt(_0x14dd9e(0x1c6))/0xa)+parseInt(_0x14dd9e(0x1c1))/0xb*(parseInt(_0x14dd9e(0x1af))/0xc);if(_0x16bb3c===_0x3b05c7)break;else _0x41607b['push'](_0x41607b['shift']());}catch(_0xf55c11){_0x41607b['push'](_0x41607b['shift']());}}}(_0x4f69,0x2fab5));function _0x168a(_0x53969e,_0x16000e){_0x53969e=_0x53969e-0x19f;const _0x4f6934=_0x4f69();let _0x168aaf=_0x4f6934[_0x53969e];return _0x168aaf;}export function validateCompiledPlan(_0x5c6282,_0x5b564f,_0x3b7cc1){const _0x54f511=_0x168a;if(_0x5c6282['version']!==0x1)throw new Error('Compiled\x20plan\x20version\x20must\x20be\x201');if(!_0x5c6282['nodes'][_0x54f511(0x1b2)])throw new Error(_0x54f511(0x1bd));const _0x5ef487=new Map(_0x5c6282[_0x54f511(0x1a6)][_0x54f511(0x1c5)](_0x6e49a1=>[_0x6e49a1['id'],_0x6e49a1]));if(!_0x5ef487['has'](_0x5c6282['entryNodeId']))throw new Error(_0x54f511(0x1c4)+_0x5c6282['entryNodeId']+_0x54f511(0x1b4));const _0x327093=findDuplicateIds(_0x5c6282['nodes'][_0x54f511(0x1c5)](_0x44604c=>_0x44604c['id']));if(_0x327093[_0x54f511(0x1b2)]>0x0)throw new Error(_0x54f511(0x1ab)+_0x327093[_0x54f511(0x1a9)](',\x20'));const _0x1db23d=_0x5c6282[_0x54f511(0x1a6)][_0x54f511(0x1a2)](_0x2f8907=>_0x2f8907['type']==='finish');if(_0x1db23d[_0x54f511(0x1b2)]===0x0)throw new Error(_0x54f511(0x1ce));const _0x471dce=new Map(),_0x2d8d96=new Set(_0x5b564f['agentIds']),_0x437d8a=new Map();for(const _0x177d9a of _0x5c6282[_0x54f511(0x1a6)]){_0x437d8a[_0x54f511(0x1b8)](_0x177d9a['id'],getOutgoingEdges(_0x177d9a));if(_0x177d9a['type']==='finish')continue;if(_0x5b564f[_0x54f511(0x1b6)][_0x54f511(0x1bc)]&&!_0x2d8d96[_0x54f511(0x1a1)](_0x177d9a[_0x54f511(0x1bf)]))throw new Error('Compiled\x20plan\x20references\x20undeclared\x20agent\x20\x22'+_0x177d9a[_0x54f511(0x1bf)]+'\x22');if(!_0x3b7cc1[_0x177d9a[_0x54f511(0x1bf)]])throw new Error('Compiled\x20plan\x20references\x20unknown\x20agent\x20\x22'+_0x177d9a['agentId']+'\x22');_0x471dce[_0x54f511(0x1b8)](_0x177d9a[_0x54f511(0x1bf)],(_0x471dce[_0x54f511(0x1c7)](_0x177d9a[_0x54f511(0x1bf)])??0x0)+0x1);for(const _0x4db0df of getOutgoingEdges(_0x177d9a)){if(!_0x5ef487[_0x54f511(0x1a1)](_0x4db0df))throw new Error(_0x54f511(0x1cd)+_0x177d9a['id']+'\x22\x20points\x20to\x20missing\x20node\x20\x22'+_0x4db0df+'\x22');}_0x177d9a[_0x54f511(0x1ca)]===_0x54f511(0x1b3)&&validateJudgeNode(_0x177d9a);}for(const [_0x3c001b,_0x36eb3b]of Object[_0x54f511(0x1b9)](_0x5b564f[_0x54f511(0x1b6)]['maxAgentCalls'])){if((_0x471dce[_0x54f511(0x1c7)](_0x3c001b)??0x0)>_0x36eb3b)throw new Error('Compiled\x20plan\x20exceeds\x20maxAgentCalls\x20for\x20\x22'+_0x3c001b+'\x22');}const _0x11d409=collectReachableNodes(_0x5c6282['entryNodeId'],_0x437d8a),_0xc3d73=_0x5c6282[_0x54f511(0x1a6)]['map'](_0x394fd3=>_0x394fd3['id'])[_0x54f511(0x1a2)](_0x8293ab=>!_0x11d409[_0x54f511(0x1a1)](_0x8293ab));if(_0xc3d73['length']>0x0)throw new Error('Compiled\x20plan\x20contains\x20unreachable\x20nodes:\x20'+_0xc3d73['join'](',\x20'));if(!_0x5b564f['constraints']['allowLoops']&&hasCycle(_0x5c6282['entryNodeId'],_0x437d8a))throw new Error('Compiled\x20plan\x20contains\x20a\x20loop\x20but\x20allowLoops\x20is\x20false');if(_0x5b564f['constraints']['allowLoops']&&_0x5b564f['constraints'][_0x54f511(0x1b5)]<0x0)throw new Error(_0x54f511(0x1ae));}function validateJudgeNode(_0x3dd31d){const _0xfe4e3=_0x168a,_0x3fb9c5=Object[_0xfe4e3(0x1be)](_0x3dd31d[_0xfe4e3(0x1c8)]);if(_0x3dd31d[_0xfe4e3(0x1cc)][_0xfe4e3(0x1b2)]===0x0)throw new Error(_0xfe4e3(0x1a5)+_0x3dd31d['id']+_0xfe4e3(0x19f));const _0x8bc54c=new Set(_0x3dd31d[_0xfe4e3(0x1cc)]);if(_0x8bc54c[_0xfe4e3(0x1a7)]!==_0x3dd31d['allowedBranches']['length'])throw new Error(_0xfe4e3(0x1a5)+_0x3dd31d['id']+_0xfe4e3(0x1b1));for(const _0x39e8ce of _0x3fb9c5){if(!_0x8bc54c[_0xfe4e3(0x1a1)](_0x39e8ce))throw new Error('Judge\x20node\x20\x22'+_0x3dd31d['id']+_0xfe4e3(0x1c9)+_0x39e8ce+'\x22');}for(const _0x3be468 of _0x3dd31d[_0xfe4e3(0x1cc)]){if(!_0x3dd31d[_0xfe4e3(0x1c8)][_0x3be468])throw new Error('Judge\x20node\x20\x22'+_0x3dd31d['id']+'\x22\x20is\x20missing\x20target\x20for\x20branch\x20\x22'+_0x3be468+'\x22');}}function getOutgoingEdges(_0x2cf528){const _0x2137f1=_0x168a;if(_0x2cf528[_0x2137f1(0x1ca)]===_0x2137f1(0x1a0))return _0x2cf528[_0x2137f1(0x1c2)]?[_0x2cf528['next']]:[];if(_0x2cf528[_0x2137f1(0x1ca)]===_0x2137f1(0x1b3))return Object[_0x2137f1(0x1ac)](_0x2cf528['branches']);return[];}function collectReachableNodes(_0x4c6913,_0x2cac06){const _0x4c606c=_0x168a,_0x1b1d71=new Set(),_0x44aaf1=[_0x4c6913];while(_0x44aaf1[_0x4c606c(0x1b2)]>0x0){const _0x79ac33=_0x44aaf1[_0x4c606c(0x1b7)]();if(_0x1b1d71['has'](_0x79ac33))continue;_0x1b1d71['add'](_0x79ac33);for(const _0xe196fa of _0x2cac06[_0x4c606c(0x1c7)](_0x79ac33)??[]){_0x44aaf1[_0x4c606c(0x1ba)](_0xe196fa);}}return _0x1b1d71;}function hasCycle(_0x31c935,_0x5a0b3a){const _0x5d930b=new Set(),_0x2cb895=new Set(),_0x46aae3=_0x152aab=>{const _0x56d00e=_0x168a;if(_0x2cb895[_0x56d00e(0x1a1)](_0x152aab))return!![];if(_0x5d930b[_0x56d00e(0x1a1)](_0x152aab))return![];_0x5d930b[_0x56d00e(0x1c0)](_0x152aab),_0x2cb895['add'](_0x152aab);for(const _0x242a25 of _0x5a0b3a[_0x56d00e(0x1c7)](_0x152aab)??[]){if(_0x46aae3(_0x242a25))return!![];}return _0x2cb895[_0x56d00e(0x1ad)](_0x152aab),![];};return _0x46aae3(_0x31c935);}function findDuplicateIds(_0x473e04){const _0x4450dc=_0x168a,_0x488334=new Set(),_0x26ffa1=new Set();for(const _0x67bb12 of _0x473e04){_0x488334[_0x4450dc(0x1a1)](_0x67bb12)&&_0x26ffa1[_0x4450dc(0x1c0)](_0x67bb12),_0x488334[_0x4450dc(0x1c0)](_0x67bb12);}return[..._0x26ffa1];}function _0x4f69(){const _0x38a01a=['allowedBranches','Compiled\x20plan\x20node\x20\x22','Compiled\x20plan\x20must\x20include\x20at\x20least\x20one\x20finish\x20node','54QnGOrO','\x22\x20must\x20declare\x20at\x20least\x20one\x20branch','task','has','filter','6yetSpM','8xocpsU','Judge\x20node\x20\x22','nodes','size','1146788iDoNmm','join','98612IwYoom','Compiled\x20plan\x20contains\x20duplicate\x20node\x20ids:\x20','values','delete','maxLoopCount\x20must\x20be\x20>=\x200','3913908rhAyUx','1328622IMuZBd','\x22\x20contains\x20duplicate\x20allowedBranches','length','judge','\x22\x20does\x20not\x20exist','maxLoopCount','constraints','pop','set','entries','push','3LTzbgZ','allowedAgentsOnly','Compiled\x20plan\x20must\x20include\x20at\x20least\x20one\x20node','keys','agentId','add','11tzdVPy','next','1591895rPBFLf','Compiled\x20plan\x20entry\x20node\x20\x22','map','321800FzOzKY','get','branches','\x22\x20contains\x20unexpected\x20branch\x20\x22','type','734237PxAkqu'];_0x4f69=function(){return _0x38a01a;};return _0x4f69();}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x22cbea,_0x4d0976){const _0x3270d9=_0x25fb,_0x3cb840=_0x22cbea();while(!![]){try{const _0x38f427=-parseInt(_0x3270d9(0x177))/0x1*(-parseInt(_0x3270d9(0x16e))/0x2)+-parseInt(_0x3270d9(0x179))/0x3*(-parseInt(_0x3270d9(0x17c))/0x4)+parseInt(_0x3270d9(0x175))/0x5*(parseInt(_0x3270d9(0x16c))/0x6)+parseInt(_0x3270d9(0x181))/0x7+parseInt(_0x3270d9(0x155))/0x8*(parseInt(_0x3270d9(0x167))/0x9)+-parseInt(_0x3270d9(0x178))/0xa+parseInt(_0x3270d9(0x17e))/0xb*(-parseInt(_0x3270d9(0x176))/0xc);if(_0x38f427===_0x4d0976)break;else _0x3cb840['push'](_0x3cb840['shift']());}catch(_0x32932d){_0x3cb840['push'](_0x3cb840['shift']());}}}(_0x2e4c,0x497ca));import _0x387090 from'node:fs/promises';import _0xd1d1c1 from'node:path';import{parse as _0xccf564}from'yaml';const DEFAULT_CONSTRAINTS={'maxSteps':0x18,'allowedAgentsOnly':!![],'allowLoops':![],'maxLoopCount':0x0,'maxAgentCalls':{},'planningReadOnly':!![]};function _0x2e4c(){const _0x147d89=['indexOf','version','output_contract','frontmatter.name','own-prose\x20program\x20must\x20start\x20with\x20YAML\x20frontmatter','object','360515VEVySI','40104XXMYUc','1ZOWKGu','1900040ZfLsuz','270687zQIeQp','own-prose\x20frontmatter\x20must\x20be\x20a\x20YAML\x20object','own-prose\x20program\x20must\x20include\x20a\x20\x22##\x20','8qvsXXC','maxAgentCalls','1067RNQYFP','workflow','length','2461942STPqgn','push','exec','readFile','slice','name','test','string','maxLoopCount','toUpperCase','583192lTpqxN','split','trim','\x22\x20section','true','overview','own-prose\x20frontmatter\x20is\x20missing\x20a\x20closing\x20---\x20line','utf8','description','constraints','parseInt','\x20must\x20be\x20a\x20non-empty\x20string','goal','replace','maxSteps','---\x0a','filter','join','9KHHFvl','isArray','\x0a---\x0a','Invalid\x20input\x20entry\x20\x22','toLowerCase','6AWBcIp','map','276028kiqvgL'];_0x2e4c=function(){return _0x147d89;};return _0x2e4c();}export async function parseProgramFile(_0x399999){const _0x15ddd5=_0x25fb,_0x474353=_0xd1d1c1['resolve'](_0x399999),_0x564f8e=await _0x387090[_0x15ddd5(0x14e)](_0x474353,_0x15ddd5(0x15c));return parseProgramMarkdown(_0x564f8e,_0x474353);}export function parseProgramMarkdown(_0x3eb2e3,_0x5c4a8b){const _0x1d3c29=_0x25fb,{frontmatter:_0x2bca7b,body:_0x1a5813}=splitFrontmatter(_0x3eb2e3),_0x42e9a6=normalizeFrontmatter(_0x2bca7b),_0x2f7990=parseSections(_0x1a5813),_0x4d331d=requireSection(_0x2f7990,_0x1d3c29(0x161)),_0x5b5103=requireSection(_0x2f7990,_0x1d3c29(0x17f)),_0x3d80e3=requireSection(_0x2f7990,'inputs'),_0x17779a=requireSection(_0x2f7990,'agents');return{'version':normalizeVersion(_0x42e9a6[_0x1d3c29(0x170)]),'name':requireNonEmptyString(_0x42e9a6[_0x1d3c29(0x150)],_0x1d3c29(0x172)),'description':optionalString(_0x42e9a6[_0x1d3c29(0x15d)]),'sourcePath':_0x5c4a8b,'goal':_0x4d331d,'workflow':_0x5b5103,'inputs':parseInputsSection(_0x3d80e3),'agentIds':parseBulletList(_0x17779a),'constraints':parseConstraintsSection(_0x2f7990[_0x1d3c29(0x15e)]),'outputContract':parseOutputContractSection(_0x2f7990[_0x1d3c29(0x171)]),'sections':{'goal':_0x4d331d,'inputs':_0x3d80e3,'agents':_0x17779a,'workflow':_0x5b5103,'constraints':_0x2f7990[_0x1d3c29(0x15e)],'outputContract':_0x2f7990[_0x1d3c29(0x171)]}};}function splitFrontmatter(_0x35f269){const _0x1585b4=_0x25fb,_0x5a1a5c=_0x35f269['replace'](/\r\n/g,'\x0a');if(!_0x5a1a5c['startsWith'](_0x1585b4(0x164)))throw new Error(_0x1585b4(0x173));const _0x37d0b1=_0x5a1a5c[_0x1585b4(0x16f)](_0x1585b4(0x169),0x4);if(_0x37d0b1<0x0)throw new Error(_0x1585b4(0x15b));return{'frontmatter':_0xccf564(_0x5a1a5c[_0x1585b4(0x14f)](0x4,_0x37d0b1)),'body':_0x5a1a5c['slice'](_0x37d0b1+0x5)['trim']()};}function _0x25fb(_0x362ee2,_0x18d698){_0x362ee2=_0x362ee2-0x14e;const _0x2e4c28=_0x2e4c();let _0x25fbb6=_0x2e4c28[_0x362ee2];return _0x25fbb6;}function normalizeFrontmatter(_0x30f09a){const _0x3e9308=_0x25fb;if(!_0x30f09a||typeof _0x30f09a!==_0x3e9308(0x174)||Array[_0x3e9308(0x168)](_0x30f09a))throw new Error(_0x3e9308(0x17a));return _0x30f09a;}function parseSections(_0x4d6c47){const _0x3cb00c=_0x25fb,_0x71d8ca={},_0x43b5fb=_0x4d6c47[_0x3cb00c(0x156)]('\x0a');let _0x325736=_0x3cb00c(0x15a),_0x25fe87=[];for(const _0x3bda56 of _0x43b5fb){const _0x2d390f=/^##\s+(.+?)\s*$/[_0x3cb00c(0x183)](_0x3bda56);if(_0x2d390f){_0x71d8ca[_0x325736]=_0x25fe87[_0x3cb00c(0x166)]('\x0a')[_0x3cb00c(0x157)](),_0x325736=normalizeSectionId(_0x2d390f[0x1]??''),_0x25fe87=[];continue;}_0x25fe87[_0x3cb00c(0x182)](_0x3bda56);}return _0x71d8ca[_0x325736]=_0x25fe87[_0x3cb00c(0x166)]('\x0a')[_0x3cb00c(0x157)](),_0x71d8ca;}function normalizeSectionId(_0x4dfc8b){const _0x303523=_0x25fb;return _0x4dfc8b[_0x303523(0x157)]()[_0x303523(0x16b)]()[_0x303523(0x162)](/[^a-z0-9]+/g,'_')['replace'](/^_+|_+$/g,'');}function requireSection(_0x28d49f,_0x2e1081){const _0x375c9e=_0x25fb,_0x5e49df=_0x28d49f[_0x2e1081];if(!_0x5e49df?.['trim']())throw new Error(_0x375c9e(0x17b)+humanizeSectionId(_0x2e1081)+_0x375c9e(0x158));return _0x5e49df[_0x375c9e(0x157)]();}function humanizeSectionId(_0x30f842){const _0x361cc4=_0x25fb;return _0x30f842['split']('_')[_0x361cc4(0x16d)](_0x302a58=>_0x302a58['slice'](0x0,0x1)[_0x361cc4(0x154)]()+_0x302a58[_0x361cc4(0x14f)](0x1))[_0x361cc4(0x166)]('\x20');}function parseInputsSection(_0x5cdc96){const _0x3b5167=_0x25fb,_0x1c0814=parseBulletList(_0x5cdc96,![]);if(_0x1c0814[_0x3b5167(0x180)]===0x0)return[];return _0x1c0814[_0x3b5167(0x16d)](_0x5d224a=>{const _0x11eeb6=_0x3b5167,[_0x29b15b,..._0x2ed115]=_0x5d224a[_0x11eeb6(0x156)](':'),_0x4af441=_0x29b15b?.['trim']();if(!_0x4af441)throw new Error(_0x11eeb6(0x16a)+_0x5d224a+'\x22');const _0x59a248=!/\?$|\[optional\]/i[_0x11eeb6(0x151)](_0x4af441),_0xc0d8a=_0x4af441['replace'](/\?$|\[optional\]/gi,'')[_0x11eeb6(0x157)]();return{'key':_0xc0d8a,'description':_0x2ed115['join'](':')[_0x11eeb6(0x157)]()||undefined,'required':_0x59a248};});}function parseConstraintsSection(_0x560966){const _0x307b2a=_0x25fb,_0x57d086={...DEFAULT_CONSTRAINTS,'maxAgentCalls':{}};if(!_0x560966?.[_0x307b2a(0x157)]())return _0x57d086;for(const _0x41fa45 of parseBulletList(_0x560966,![])){const _0x5d170c=/^maxSteps\s*:\s*(\d+)$/i[_0x307b2a(0x183)](_0x41fa45);if(_0x5d170c){_0x57d086[_0x307b2a(0x163)]=Number[_0x307b2a(0x15f)](_0x5d170c[0x1],0xa);continue;}const _0x1ab281=/^allowLoops\s*:\s*(true|false)$/i[_0x307b2a(0x183)](_0x41fa45);if(_0x1ab281){_0x57d086['allowLoops']=_0x1ab281[0x1][_0x307b2a(0x16b)]()===_0x307b2a(0x159);continue;}const _0x2dabe1=/^maxLoopCount\s*:\s*(\d+)$/i[_0x307b2a(0x183)](_0x41fa45);if(_0x2dabe1){_0x57d086[_0x307b2a(0x153)]=Number[_0x307b2a(0x15f)](_0x2dabe1[0x1],0xa);continue;}const _0x3f6b27=/^planningReadOnly\s*:\s*(true|false)$/i['exec'](_0x41fa45);if(_0x3f6b27){_0x57d086['planningReadOnly']=_0x3f6b27[0x1]['toLowerCase']()===_0x307b2a(0x159);continue;}const _0x57c71c=/^allowedAgentsOnly\s*:\s*(true|false)$/i[_0x307b2a(0x183)](_0x41fa45);if(_0x57c71c){_0x57d086['allowedAgentsOnly']=_0x57c71c[0x1][_0x307b2a(0x16b)]()==='true';continue;}const _0x3617b2=/^maxAgentCalls\.([A-Za-z0-9._-]+)\s*:\s*(\d+)$/i[_0x307b2a(0x183)](_0x41fa45);_0x3617b2&&(_0x57d086[_0x307b2a(0x17d)][_0x3617b2[0x1]]=Number[_0x307b2a(0x15f)](_0x3617b2[0x2],0xa));}return _0x57d086;}function parseOutputContractSection(_0x142997){if(!_0x142997?.['trim']())return{'requirements':[]};return{'requirements':parseBulletList(_0x142997,![])};}function parseBulletList(_0x598fe9,_0xfd25be=!![]){const _0x50e532=_0x25fb,_0x2b83cf=_0x598fe9['split']('\x0a')['map'](_0x51e089=>/^\s*-\s+(.*\S)\s*$/[_0x50e532(0x183)](_0x51e089)?.[0x1]?.['trim']())[_0x50e532(0x165)](_0x522cc8=>Boolean(_0x522cc8));if(_0xfd25be&&_0x2b83cf[_0x50e532(0x180)]===0x0)throw new Error('Expected\x20a\x20bullet\x20list');return _0x2b83cf;}function normalizeVersion(_0x12ecb5){if(_0x12ecb5==null)return 0x1;if(_0x12ecb5===0x1||_0x12ecb5==='1')return 0x1;throw new Error('frontmatter.version\x20must\x20be\x20\x221\x22');}function optionalString(_0x3e38f2){const _0x1fb0bd=_0x25fb;return typeof _0x3e38f2===_0x1fb0bd(0x152)&&_0x3e38f2[_0x1fb0bd(0x157)]()?_0x3e38f2[_0x1fb0bd(0x157)]():undefined;}function requireNonEmptyString(_0xb3bff,_0xa0dcce){const _0x2e1611=_0x25fb;if(typeof _0xb3bff!==_0x2e1611(0x152)||!_0xb3bff[_0x2e1611(0x157)]())throw new Error(_0xa0dcce+_0x2e1611(0x160));return _0xb3bff[_0x2e1611(0x157)]();}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CompiledPlan, ProgramSpec, RunId, RunState, RuntimeContext, TimelineEvent } from "./types.js";
|
|
2
|
+
export declare function createRunId(now?: Date): RunId;
|
|
3
|
+
export declare function getRunDir(stateRoot: string, runId: string): string;
|
|
4
|
+
export declare function ensureRunDirectories(runDir: string): Promise<void>;
|
|
5
|
+
export declare function writeProgramSource(runDir: string, source: string): Promise<void>;
|
|
6
|
+
export declare function initializeRunState(params: {
|
|
7
|
+
runDir: string;
|
|
8
|
+
runId: string;
|
|
9
|
+
program: ProgramSpec;
|
|
10
|
+
inputs: Record<string, unknown>;
|
|
11
|
+
plan: CompiledPlan;
|
|
12
|
+
runtime: RuntimeContext;
|
|
13
|
+
}): Promise<RunState>;
|
|
14
|
+
export declare function readRunState(runDir: string): Promise<RunState>;
|
|
15
|
+
export declare function writeRunState(runDir: string, state: RunState): Promise<void>;
|
|
16
|
+
export declare function readCompiledPlan(runDir: string): Promise<CompiledPlan>;
|
|
17
|
+
export declare function writeCompiledPlan(runDir: string, plan: CompiledPlan): Promise<string>;
|
|
18
|
+
export declare function appendTimeline(runDir: string, event: TimelineEvent): Promise<void>;
|
|
19
|
+
export declare function writeArtifact(runDir: string, nodeId: string, content: string): Promise<string>;
|
|
20
|
+
export declare function writeResumeFile(runDir: string, state: RunState, plan: CompiledPlan): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x5d8b01=_0x5434;(function(_0x51f645,_0x2f11b5){const _0x368be8=_0x5434,_0x161a14=_0x51f645();while(!![]){try{const _0x5e5098=-parseInt(_0x368be8(0x14e))/0x1*(parseInt(_0x368be8(0x118))/0x2)+parseInt(_0x368be8(0x131))/0x3*(-parseInt(_0x368be8(0x116))/0x4)+parseInt(_0x368be8(0x114))/0x5*(parseInt(_0x368be8(0x12e))/0x6)+parseInt(_0x368be8(0x150))/0x7*(-parseInt(_0x368be8(0x151))/0x8)+parseInt(_0x368be8(0x138))/0x9+-parseInt(_0x368be8(0x149))/0xa+parseInt(_0x368be8(0x147))/0xb;if(_0x5e5098===_0x2f11b5)break;else _0x161a14['push'](_0x161a14['shift']());}catch(_0x2faad0){_0x161a14['push'](_0x161a14['shift']());}}}(_0x34da,0x2f3f7));import _0x420b0e from'node:fs/promises';import _0x23472e from'node:path';const STATE_FILE=_0x5d8b01(0x122),PLAN_FILE='compiled-plan.json',TIMELINE_FILE=_0x5d8b01(0x115),RESUME_FILE=_0x5d8b01(0x110);export function createRunId(_0xd085a2=new Date()){const _0x84a30a=_0x5d8b01,_0x237f33=_0x1e7013=>String(_0x1e7013)['padStart'](0x2,'0'),_0x6e4b5b=[_0xd085a2[_0x84a30a(0x14d)](),_0x237f33(_0xd085a2[_0x84a30a(0x12c)]()+0x1),_0x237f33(_0xd085a2[_0x84a30a(0x141)]()),'-',_0x237f33(_0xd085a2[_0x84a30a(0x148)]()),_0x237f33(_0xd085a2[_0x84a30a(0x13a)]()),_0x237f33(_0xd085a2[_0x84a30a(0x13e)]())][_0x84a30a(0x136)](''),_0x3aab6e=Math[_0x84a30a(0x144)]()[_0x84a30a(0x13d)](0x24)[_0x84a30a(0x126)](0x2,0x8);return _0x6e4b5b+'-'+_0x3aab6e;}export function getRunDir(_0x406874,_0x29e376){const _0x421049=_0x5d8b01;return _0x23472e[_0x421049(0x136)](_0x406874,_0x421049(0x127),_0x29e376);}export async function ensureRunDirectories(_0x33d7de){const _0x34f207=_0x5d8b01;await _0x420b0e[_0x34f207(0x11e)](_0x23472e[_0x34f207(0x136)](_0x33d7de,'artifacts'),{'recursive':!![]}),await _0x420b0e['mkdir'](_0x23472e[_0x34f207(0x136)](_0x33d7de,_0x34f207(0x112)),{'recursive':!![]});}export async function writeProgramSource(_0x52154a,_0xb7d0e0){const _0x1e5832=_0x5d8b01;await _0x420b0e[_0x1e5832(0x13b)](_0x23472e[_0x1e5832(0x136)](_0x52154a,_0x1e5832(0x121)),_0xb7d0e0,_0x1e5832(0x123));}function _0x5434(_0x4d89d5,_0x1da62f){_0x4d89d5=_0x4d89d5-0x110;const _0x34da3c=_0x34da();let _0x54341f=_0x34da3c[_0x4d89d5];return _0x54341f;}function _0x34da(){const _0x41fb03=['state.json','utf8','stepsExecuted','readFile','slice','runs','#\x20own-prose\x20resume','-\x20Background:\x20','-\x20Failure:\x20','Started\x20run\x20for\x20','getUTCMonth','-\x20Run\x20id:\x20','654SLnhTq','pending','program','6yOSXyG','runId','inputs','appendFile','running','join','reason','2171709HlhYot','stringify','getUTCMinutes','writeFile','##\x20Node\x20status','toString','getUTCSeconds','background','name','getUTCDate','nodeStates','toISOString','random','failure','currentNodeId','5830792BeBcao','getUTCHours','1986170GbWbGd','plan','map','runDir','getUTCFullYear','106Ynsqki','worker','427uqeocg','16664hJSXMA','artifacts','resume.md','sourcePath','sessions','parse','9410cHugtB','timeline.jsonl','206104HZiLbT','sessionKey','6684DMHSjv','status','notification','run_started','updatedAt','-\x20Steps\x20executed:\x20','mkdir','-\x20Notification:\x20','none','program.md'];_0x34da=function(){return _0x41fb03;};return _0x34da();}export async function initializeRunState(_0x4b66a6){const _0x327151=_0x5d8b01,_0xe17e4a=new Date()[_0x327151(0x143)](),_0x56a92f=_0x23472e[_0x327151(0x136)](_0x4b66a6[_0x327151(0x14c)],PLAN_FILE),_0x259b93={'version':0x1,'runId':_0x4b66a6[_0x327151(0x132)],'status':_0x327151(0x135),'programPath':_0x4b66a6[_0x327151(0x130)][_0x327151(0x111)],'inputs':_0x4b66a6[_0x327151(0x133)],'compiledPlanPath':_0x56a92f,'entryNodeId':_0x4b66a6[_0x327151(0x14a)]['entryNodeId'],'currentNodeId':_0x4b66a6['plan']['entryNodeId'],'stepsExecuted':0x0,'maxSteps':_0x4b66a6[_0x327151(0x14a)]['maxSteps'],'startedAt':_0xe17e4a,'updatedAt':_0xe17e4a,'nodeStates':{},'branchDecisions':[],'artifacts':{},'runtime':_0x4b66a6['runtime']};return await writeCompiledPlan(_0x4b66a6[_0x327151(0x14c)],_0x4b66a6[_0x327151(0x14a)]),await writeRunState(_0x4b66a6['runDir'],_0x259b93),await appendTimeline(_0x4b66a6[_0x327151(0x14c)],{'at':_0xe17e4a,'type':_0x327151(0x11b),'runId':_0x259b93[_0x327151(0x132)],'message':_0x327151(0x12b)+_0x4b66a6['program'][_0x327151(0x140)]}),await writeResumeFile(_0x4b66a6[_0x327151(0x14c)],_0x259b93,_0x4b66a6[_0x327151(0x14a)]),_0x259b93;}export async function readRunState(_0x480ff4){const _0x214db=_0x5d8b01,_0x272cf8=await _0x420b0e[_0x214db(0x125)](_0x23472e[_0x214db(0x136)](_0x480ff4,STATE_FILE),_0x214db(0x123));return JSON['parse'](_0x272cf8);}export async function writeRunState(_0x30e09c,_0x4731f1){const _0x40c374=_0x5d8b01;_0x4731f1[_0x40c374(0x11c)]=new Date()[_0x40c374(0x143)](),await _0x420b0e[_0x40c374(0x13b)](_0x23472e['join'](_0x30e09c,STATE_FILE),JSON[_0x40c374(0x139)](_0x4731f1,null,0x2)+'\x0a',_0x40c374(0x123));}export async function readCompiledPlan(_0x59fd6b){const _0x1ed57a=_0x5d8b01,_0xa48315=await _0x420b0e[_0x1ed57a(0x125)](_0x23472e[_0x1ed57a(0x136)](_0x59fd6b,PLAN_FILE),_0x1ed57a(0x123));return JSON[_0x1ed57a(0x113)](_0xa48315);}export async function writeCompiledPlan(_0x51d1a4,_0x595607){const _0x3c340a=_0x5d8b01,_0x4a0635=_0x23472e[_0x3c340a(0x136)](_0x51d1a4,PLAN_FILE);return await _0x420b0e[_0x3c340a(0x13b)](_0x4a0635,JSON[_0x3c340a(0x139)](_0x595607,null,0x2)+'\x0a',_0x3c340a(0x123)),_0x4a0635;}export async function appendTimeline(_0x4a33d9,_0x2413f1){const _0x416523=_0x5d8b01;await _0x420b0e[_0x416523(0x134)](_0x23472e['join'](_0x4a33d9,TIMELINE_FILE),JSON[_0x416523(0x139)](_0x2413f1)+'\x0a',_0x416523(0x123));}export async function writeArtifact(_0x306166,_0x2fb058,_0x5bb5e5){const _0x3d60be=_0x5d8b01,_0x5212fc=_0x23472e[_0x3d60be(0x136)](_0x306166,_0x3d60be(0x152),_0x2fb058+'.md');return await _0x420b0e[_0x3d60be(0x13b)](_0x5212fc,_0x5bb5e5,_0x3d60be(0x123)),_0x5212fc;}export async function writeResumeFile(_0x59d168,_0x54e86d,_0x413c64){const _0x4aa6e1=_0x5d8b01,_0x1838c3=_0x54e86d[_0x4aa6e1(0x146)]?_0x413c64['nodes']['find'](_0x424b15=>_0x424b15['id']===_0x54e86d['currentNodeId']):undefined,_0x4bd984=[_0x4aa6e1(0x128),'',_0x4aa6e1(0x12d)+_0x54e86d[_0x4aa6e1(0x132)],'-\x20Status:\x20'+_0x54e86d[_0x4aa6e1(0x119)],_0x54e86d[_0x4aa6e1(0x13f)]?_0x4aa6e1(0x129)+_0x54e86d[_0x4aa6e1(0x13f)]['status']:undefined,_0x54e86d[_0x4aa6e1(0x13f)]?.[_0x4aa6e1(0x14f)]?'-\x20Worker:\x20'+_0x54e86d[_0x4aa6e1(0x13f)][_0x4aa6e1(0x14f)][_0x4aa6e1(0x119)]+(_0x54e86d[_0x4aa6e1(0x13f)][_0x4aa6e1(0x14f)][_0x4aa6e1(0x117)]?'\x20('+_0x54e86d['background']['worker']['sessionKey']+')':''):undefined,_0x54e86d['background']?.[_0x4aa6e1(0x11a)]?_0x4aa6e1(0x11f)+_0x54e86d['background'][_0x4aa6e1(0x11a)]['status']:undefined,'-\x20Current\x20node:\x20'+(_0x1838c3?.['id']??_0x4aa6e1(0x120)),_0x4aa6e1(0x11d)+_0x54e86d[_0x4aa6e1(0x124)]+'/'+_0x54e86d['maxSteps'],_0x54e86d[_0x4aa6e1(0x145)]?_0x4aa6e1(0x12a)+_0x54e86d['failure'][_0x4aa6e1(0x137)]:'-\x20Failure:\x20none','',_0x4aa6e1(0x13c),..._0x413c64['nodes'][_0x4aa6e1(0x14b)](_0x439802=>{const _0x48c990=_0x4aa6e1,_0x351d1d=_0x54e86d[_0x48c990(0x142)][_0x439802['id']];return'-\x20'+_0x439802['id']+':\x20'+(_0x351d1d?.[_0x48c990(0x119)]??_0x48c990(0x12f));})]['filter'](_0xdd671=>Boolean(_0xdd671));await _0x420b0e[_0x4aa6e1(0x13b)](_0x23472e[_0x4aa6e1(0x136)](_0x59d168,RESUME_FILE),_0x4bd984[_0x4aa6e1(0x136)]('\x0a')+'\x0a',_0x4aa6e1(0x123));}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { OpenClawPluginApi, OpenClawPluginToolContext } from "openclaw/plugin-sdk/core";
|
|
2
|
+
export declare function createOwnProseStartTool(api: OpenClawPluginApi, ctx: OpenClawPluginToolContext): {
|
|
3
|
+
name: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
7
|
+
programPath: import("@sinclair/typebox").TString;
|
|
8
|
+
input: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnknown>;
|
|
9
|
+
}>;
|
|
10
|
+
execute(_id: string, params: Record<string, unknown>): Promise<{
|
|
11
|
+
content: {
|
|
12
|
+
type: "text";
|
|
13
|
+
text: string;
|
|
14
|
+
}[];
|
|
15
|
+
details: {
|
|
16
|
+
error: string;
|
|
17
|
+
programPath?: string | undefined;
|
|
18
|
+
runId: string | null;
|
|
19
|
+
status: "error";
|
|
20
|
+
};
|
|
21
|
+
} | {
|
|
22
|
+
content: {
|
|
23
|
+
type: "text";
|
|
24
|
+
text: string;
|
|
25
|
+
}[];
|
|
26
|
+
details: {
|
|
27
|
+
runId: string;
|
|
28
|
+
status: import("./types.js").RunStatus;
|
|
29
|
+
background: "running" | "failed" | "queued" | "finished";
|
|
30
|
+
runDir: string;
|
|
31
|
+
};
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
34
|
+
export declare function createOwnProseDriveTool(api: OpenClawPluginApi, ctx: OpenClawPluginToolContext): {
|
|
35
|
+
name: string;
|
|
36
|
+
label: string;
|
|
37
|
+
description: string;
|
|
38
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
39
|
+
programPath: import("@sinclair/typebox").TString;
|
|
40
|
+
input: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnknown>;
|
|
41
|
+
}>;
|
|
42
|
+
execute(_id: string, params: Record<string, unknown>): Promise<{
|
|
43
|
+
content: {
|
|
44
|
+
type: "text";
|
|
45
|
+
text: string;
|
|
46
|
+
}[];
|
|
47
|
+
details: {
|
|
48
|
+
error: string;
|
|
49
|
+
programPath?: string | undefined;
|
|
50
|
+
runId: string | null;
|
|
51
|
+
status: "error";
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
content: {
|
|
55
|
+
type: "text";
|
|
56
|
+
text: string;
|
|
57
|
+
}[];
|
|
58
|
+
details: {
|
|
59
|
+
runId: string;
|
|
60
|
+
status: import("./types.js").RunStatus;
|
|
61
|
+
runDir: string;
|
|
62
|
+
finalOutputPath: string | null;
|
|
63
|
+
};
|
|
64
|
+
}>;
|
|
65
|
+
};
|
|
66
|
+
export declare function createOwnProseStatusTool(api: OpenClawPluginApi, ctx: OpenClawPluginToolContext): {
|
|
67
|
+
name: string;
|
|
68
|
+
label: string;
|
|
69
|
+
description: string;
|
|
70
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
71
|
+
runId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
72
|
+
programPath: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
73
|
+
}>;
|
|
74
|
+
execute(_id: string, params: Record<string, unknown>): Promise<{
|
|
75
|
+
content: {
|
|
76
|
+
type: "text";
|
|
77
|
+
text: string;
|
|
78
|
+
}[];
|
|
79
|
+
details: {
|
|
80
|
+
error: string;
|
|
81
|
+
programPath?: string | undefined;
|
|
82
|
+
runId: string | null;
|
|
83
|
+
status: "error";
|
|
84
|
+
};
|
|
85
|
+
} | {
|
|
86
|
+
content: {
|
|
87
|
+
type: "text";
|
|
88
|
+
text: string;
|
|
89
|
+
}[];
|
|
90
|
+
details: {
|
|
91
|
+
state: import("./types.js").RunState;
|
|
92
|
+
plan: import("./types.js").CompiledPlan;
|
|
93
|
+
};
|
|
94
|
+
} | {
|
|
95
|
+
content: {
|
|
96
|
+
type: "text";
|
|
97
|
+
text: string;
|
|
98
|
+
}[];
|
|
99
|
+
details: import("./types.js").ProgramBundle;
|
|
100
|
+
}>;
|
|
101
|
+
};
|
|
102
|
+
export declare function createOwnProseBackgroundRunTool(api: OpenClawPluginApi, ctx: OpenClawPluginToolContext): {
|
|
103
|
+
name: string;
|
|
104
|
+
label: string;
|
|
105
|
+
description: string;
|
|
106
|
+
parameters: import("@sinclair/typebox").TObject<{
|
|
107
|
+
runId: import("@sinclair/typebox").TString;
|
|
108
|
+
}>;
|
|
109
|
+
execute(_id: string, params: Record<string, unknown>): Promise<{
|
|
110
|
+
content: {
|
|
111
|
+
type: "text";
|
|
112
|
+
text: string;
|
|
113
|
+
}[];
|
|
114
|
+
details: {
|
|
115
|
+
error: string;
|
|
116
|
+
programPath?: string | undefined;
|
|
117
|
+
runId: string | null;
|
|
118
|
+
status: "error";
|
|
119
|
+
};
|
|
120
|
+
} | {
|
|
121
|
+
content: {
|
|
122
|
+
type: "text";
|
|
123
|
+
text: string;
|
|
124
|
+
}[];
|
|
125
|
+
details: {
|
|
126
|
+
runId: string;
|
|
127
|
+
status: import("./types.js").RunStatus;
|
|
128
|
+
background: "running" | "failed" | "queued" | "finished" | null;
|
|
129
|
+
worker: "running" | "failed" | "queued" | "finished" | null;
|
|
130
|
+
runDir: string;
|
|
131
|
+
};
|
|
132
|
+
}>;
|
|
133
|
+
};
|
package/dist/src/tool.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x5aace7,_0x38a954){const _0x1cd2d0=_0x1caf,_0x1a6254=_0x5aace7();while(!![]){try{const _0x1bea16=-parseInt(_0x1cd2d0(0x118))/0x1*(parseInt(_0x1cd2d0(0x100))/0x2)+-parseInt(_0x1cd2d0(0x108))/0x3*(parseInt(_0x1cd2d0(0x114))/0x4)+-parseInt(_0x1cd2d0(0xfa))/0x5*(-parseInt(_0x1cd2d0(0xfb))/0x6)+parseInt(_0x1cd2d0(0x106))/0x7+-parseInt(_0x1cd2d0(0xef))/0x8+-parseInt(_0x1cd2d0(0x11d))/0x9*(-parseInt(_0x1cd2d0(0x104))/0xa)+parseInt(_0x1cd2d0(0x10e))/0xb*(parseInt(_0x1cd2d0(0xff))/0xc);if(_0x1bea16===_0x38a954)break;else _0x1a6254['push'](_0x1a6254['shift']());}catch(_0x5b7cc2){_0x1a6254['push'](_0x1a6254['shift']());}}}(_0x360a,0x7e27b));import{Type}from'@sinclair/typebox';import{driveOwnProseProgram,inspectOwnProseProgramFile,loadOwnProseRunState,renderOwnProseStatus,resumeOwnProseBackgroundRun,resolveOwnProseProgramPath,startOwnProseProgram}from'./execution.js';export function createOwnProseStartTool(_0x11e8c0,_0x15f7fe){const _0xcafe2f=_0x1caf;return{'name':'own_prose_start','label':_0xcafe2f(0xf6),'description':_0xcafe2f(0xf0),'parameters':Type[_0xcafe2f(0xf7)]({'programPath':Type['String']({'description':_0xcafe2f(0xf1)}),'input':Type[_0xcafe2f(0x10d)](Type[_0xcafe2f(0x111)]({'description':_0xcafe2f(0xf2)}))}),async 'execute'(_0x18db8c,_0x5e245d){const _0x368ecb=_0xcafe2f,_0xb83194=_0x15f7fe['workspaceDir']??process['cwd'](),_0x4af683=requireString(_0x5e245d[_0x368ecb(0x115)],_0x368ecb(0x115));try{const _0x312183=await startOwnProseProgram({'api':_0x11e8c0,'workspaceDir':_0xb83194,'sessionKey':_0x15f7fe[_0x368ecb(0x117)],'agentId':_0x15f7fe['agentId'],'programPath':_0x4af683,'inputs':normalizeInput(_0x5e245d[_0x368ecb(0x112)])});return{'content':textContent(renderOwnProseStatus(_0x312183[_0x368ecb(0xfd)])),'details':{'runId':_0x312183[_0x368ecb(0x113)],'status':_0x312183[_0x368ecb(0xfd)][_0x368ecb(0x10f)],'background':_0x312183[_0x368ecb(0xfd)]['background']?.[_0x368ecb(0x10f)]??_0x368ecb(0x102),'runDir':_0x312183['runDir']}};}catch(_0x3b2ce1){return buildOwnProseErrorResponse({'status':_0x368ecb(0xfc),'programPath':_0x4af683,'error':_0x3b2ce1});}}};}export function createOwnProseDriveTool(_0x43e432,_0x198cce){const _0x4b8c03=_0x1caf;return{'name':_0x4b8c03(0x101),'label':_0x4b8c03(0xf9),'description':_0x4b8c03(0xfe),'parameters':Type[_0x4b8c03(0xf7)]({'programPath':Type[_0x4b8c03(0xf4)]({'description':_0x4b8c03(0xf1)}),'input':Type['Optional'](Type[_0x4b8c03(0x111)]({'description':'Optional\x20JSON\x20object\x20with\x20input\x20values.'}))}),async 'execute'(_0x3c1a13,_0x7c8fe9){const _0x568254=_0x4b8c03,_0x30d2e2=_0x198cce[_0x568254(0x105)]??process['cwd'](),_0x5d50ce=requireString(_0x7c8fe9[_0x568254(0x115)],_0x568254(0x115));try{const _0x4642b5=await driveOwnProseProgram({'api':_0x43e432,'workspaceDir':_0x30d2e2,'programPath':_0x5d50ce,'inputs':normalizeInput(_0x7c8fe9['input']),'sessionKey':_0x198cce[_0x568254(0x117)],'agentId':_0x198cce['agentId']});return{'content':textContent(renderOwnProseStatus(_0x4642b5['state'])),'details':{'runId':_0x4642b5[_0x568254(0x113)],'status':_0x4642b5['state'][_0x568254(0x10f)],'runDir':_0x4642b5['runDir'],'finalOutputPath':_0x4642b5['state']['finalOutputPath']??null}};}catch(_0x568206){return buildOwnProseErrorResponse({'status':_0x568254(0xfc),'programPath':_0x5d50ce,'error':_0x568206});}}};}export function createOwnProseStatusTool(_0x3391b2,_0x358c40){const _0x12b8d9=_0x1caf;return{'name':'own_prose_status','label':_0x12b8d9(0x10a),'description':'Show\x20the\x20current\x20state\x20of\x20an\x20own-prose\x20run\x20or\x20inspect\x20a\x20program.','parameters':Type['Object']({'runId':Type[_0x12b8d9(0x10d)](Type['String']({'description':_0x12b8d9(0x11c)})),'programPath':Type['Optional'](Type[_0x12b8d9(0xf4)]({'description':'Markdown\x20program\x20path\x20to\x20inspect.'}))}),async 'execute'(_0x332e54,_0xcd331f){const _0x1d1630=_0x12b8d9,_0x219066=_0x358c40[_0x1d1630(0x105)]??process[_0x1d1630(0x103)]();if(typeof _0xcd331f[_0x1d1630(0x113)]==='string'&&_0xcd331f[_0x1d1630(0x113)][_0x1d1630(0xf5)]()){const _0x314387=_0xcd331f[_0x1d1630(0x113)][_0x1d1630(0xf5)]();try{const {state:_0x51136a,plan:_0x61bcbb}=await loadOwnProseRunState(_0x219066,_0x3391b2['pluginConfig'],_0x314387);return{'content':textContent(renderOwnProseStatus(_0x51136a)),'details':{'state':_0x51136a,'plan':_0x61bcbb}};}catch(_0x1ac96f){return buildOwnProseErrorResponse({'status':_0x1d1630(0xfc),'runId':_0x314387,'error':_0x1ac96f});}}if(typeof _0xcd331f[_0x1d1630(0x115)]===_0x1d1630(0xed)&&_0xcd331f[_0x1d1630(0x115)][_0x1d1630(0xf5)]()){const _0x1beb4e=_0xcd331f[_0x1d1630(0x115)][_0x1d1630(0xf5)](),_0x2de3c4=resolveOwnProseProgramPath(_0x219066,_0x1beb4e);try{if(!_0x2de3c4)throw new Error(_0x1d1630(0x10b));const _0xa87a31=await inspectOwnProseProgramFile(_0x2de3c4);return{'content':textContent(JSON['stringify'](_0xa87a31,null,0x2)),'details':_0xa87a31};}catch(_0xbcadf){return buildOwnProseErrorResponse({'status':_0x1d1630(0xfc),'programPath':_0x1beb4e,'error':_0xbcadf});}}throw new Error('runId\x20or\x20programPath\x20required');}};}export function createOwnProseBackgroundRunTool(_0x516e39,_0x509085){const _0x594479=_0x1caf;return{'name':_0x594479(0xf8),'label':_0x594479(0x11b),'description':_0x594479(0x110),'parameters':Type[_0x594479(0xf7)]({'runId':Type[_0x594479(0xf4)]({'description':_0x594479(0x109)})}),async 'execute'(_0x40bdf5,_0x10fd2a){const _0x3de4a1=_0x594479,_0x4bb875=_0x509085[_0x3de4a1(0x105)]??process[_0x3de4a1(0x103)](),_0xe1f254=requireString(_0x10fd2a['runId'],_0x3de4a1(0x113));try{const _0x3f79f8=await resumeOwnProseBackgroundRun({'api':_0x516e39,'workspaceDir':_0x4bb875,'runId':_0xe1f254});return{'content':textContent(renderOwnProseStatus(_0x3f79f8[_0x3de4a1(0xfd)])),'details':{'runId':_0x3f79f8['runId'],'status':_0x3f79f8[_0x3de4a1(0xfd)][_0x3de4a1(0x10f)],'background':_0x3f79f8[_0x3de4a1(0xfd)][_0x3de4a1(0x10c)]?.[_0x3de4a1(0x10f)]??null,'worker':_0x3f79f8['state'][_0x3de4a1(0x10c)]?.['worker']?.[_0x3de4a1(0x10f)]??null,'runDir':_0x3f79f8[_0x3de4a1(0x11a)]}};}catch(_0x4de81a){return buildOwnProseErrorResponse({'status':'error','runId':_0xe1f254,'error':_0x4de81a});}}};}function requireString(_0xbaed81,_0x5538cc){const _0x587497=_0x1caf;if(typeof _0xbaed81!=='string'||!_0xbaed81[_0x587497(0xf5)]())throw new Error(_0x5538cc+_0x587497(0x116));return _0xbaed81[_0x587497(0xf5)]();}function _0x360a(){const _0x322595=['stringify','runDir','OwnProse\x20Background\x20Run','Existing\x20run\x20id.','5571BTPrhp','string','message','2052864hBJPsm','Compile\x20a\x20natural-language\x20own-prose\x20workflow,\x20start\x20it\x20in\x20the\x20background,\x20and\x20return\x20immediately.','Path\x20to\x20the\x20own-prose\x20Markdown\x20program.','Optional\x20JSON\x20object\x20with\x20input\x20values.','object','String','trim','OwnProse\x20Start','Object','own_prose_background_run','OwnProse\x20Drive','455QBdmrd','28668tPjnqt','error','state','Compile\x20a\x20natural-language\x20own-prose\x20workflow\x20and\x20execute\x20it\x20end-to-end.','4286868sjQxbO','1022862rgwhZj','own_prose_drive','queued','cwd','1620ffReFr','workspaceDir','2913050AACNkc','isArray','380934qldZUW','Queued\x20own-prose\x20run\x20id\x20to\x20resume.','OwnProse\x20Status','programPath\x20required','background','Optional','22LVaOte','status','Internal\x20own-prose\x20continuation\x20tool\x20that\x20resumes\x20a\x20queued\x20background\x20workflow\x20run.','Unknown','input','runId','12SiWMmV','programPath','\x20required','sessionKey','1QMEGmf'];_0x360a=function(){return _0x322595;};return _0x360a();}function normalizeInput(_0x1feb9d){const _0x3392b2=_0x1caf;if(_0x1feb9d==null)return{};if(!_0x1feb9d||typeof _0x1feb9d!==_0x3392b2(0xf3)||Array[_0x3392b2(0x107)](_0x1feb9d))throw new Error('input\x20must\x20be\x20an\x20object');return _0x1feb9d;}function _0x1caf(_0x5c3a4b,_0x3a6fc7){_0x5c3a4b=_0x5c3a4b-0xed;const _0x360a06=_0x360a();let _0x1cafaa=_0x360a06[_0x5c3a4b];return _0x1cafaa;}function textContent(_0x47a1e4){return[{'type':'text','text':_0x47a1e4}];}function buildOwnProseErrorResponse(_0x2122e0){const _0xf917d3=_0x1caf,_0x1bd441=formatOwnProseToolError(_0x2122e0[_0xf917d3(0xfc)]),_0x144962={'runId':_0x2122e0[_0xf917d3(0x113)]??null,'status':_0x2122e0['status'],..._0x2122e0[_0xf917d3(0x115)]?{'programPath':_0x2122e0[_0xf917d3(0x115)]}:{},'error':_0x1bd441};return{'content':textContent(JSON[_0xf917d3(0x119)](_0x144962,null,0x2)),'details':_0x144962};}function formatOwnProseToolError(_0x6470fa){const _0x50905b=_0x1caf;return _0x6470fa instanceof Error?_0x6470fa[_0x50905b(0xee)]:String(_0x6470fa);}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
export type OwnProseVersion = 1;
|
|
2
|
+
export type NodeId = string;
|
|
3
|
+
export type AgentId = string;
|
|
4
|
+
export type BranchKey = string;
|
|
5
|
+
export type RunId = string;
|
|
6
|
+
export type ExecutionTarget = "self" | "subagent";
|
|
7
|
+
export type RunStatus = "running" | "blocked" | "failed" | "completed";
|
|
8
|
+
export type NodeStatus = "pending" | "running" | "completed" | "failed" | "blocked";
|
|
9
|
+
export type ProgramInputSpec = {
|
|
10
|
+
key: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
required: boolean;
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
};
|
|
15
|
+
export type ProgramConstraintSpec = {
|
|
16
|
+
maxSteps: number;
|
|
17
|
+
allowedAgentsOnly: boolean;
|
|
18
|
+
allowLoops: boolean;
|
|
19
|
+
maxLoopCount: number;
|
|
20
|
+
maxAgentCalls: Record<AgentId, number>;
|
|
21
|
+
planningReadOnly: boolean;
|
|
22
|
+
};
|
|
23
|
+
export type ProgramOutputContract = {
|
|
24
|
+
requirements: string[];
|
|
25
|
+
};
|
|
26
|
+
export type ProgramSections = {
|
|
27
|
+
goal: string;
|
|
28
|
+
inputs: string;
|
|
29
|
+
agents: string;
|
|
30
|
+
workflow: string;
|
|
31
|
+
constraints?: string;
|
|
32
|
+
outputContract?: string;
|
|
33
|
+
};
|
|
34
|
+
export type ProgramSpec = {
|
|
35
|
+
version: OwnProseVersion;
|
|
36
|
+
name: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
sourcePath: string;
|
|
39
|
+
goal: string;
|
|
40
|
+
workflow: string;
|
|
41
|
+
inputs: ProgramInputSpec[];
|
|
42
|
+
agentIds: AgentId[];
|
|
43
|
+
constraints: ProgramConstraintSpec;
|
|
44
|
+
outputContract: ProgramOutputContract;
|
|
45
|
+
sections: ProgramSections;
|
|
46
|
+
};
|
|
47
|
+
export type AgentPermissionSpec = {
|
|
48
|
+
allowMutatingTools: boolean;
|
|
49
|
+
executionTarget: ExecutionTarget;
|
|
50
|
+
};
|
|
51
|
+
export type AgentSpec = {
|
|
52
|
+
id: AgentId;
|
|
53
|
+
name: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
sourcePath: string;
|
|
56
|
+
provider?: string;
|
|
57
|
+
model?: string;
|
|
58
|
+
timeoutMs?: number;
|
|
59
|
+
permissions: AgentPermissionSpec;
|
|
60
|
+
role: string;
|
|
61
|
+
instructions: string;
|
|
62
|
+
doneWhen: string[];
|
|
63
|
+
};
|
|
64
|
+
export type TaskNode = {
|
|
65
|
+
id: NodeId;
|
|
66
|
+
type: "task";
|
|
67
|
+
title: string;
|
|
68
|
+
agentId: AgentId;
|
|
69
|
+
goal: string;
|
|
70
|
+
instructions: string;
|
|
71
|
+
doneWhen: string[];
|
|
72
|
+
next: NodeId | null;
|
|
73
|
+
permissions: AgentPermissionSpec;
|
|
74
|
+
};
|
|
75
|
+
export type JudgeNode = {
|
|
76
|
+
id: NodeId;
|
|
77
|
+
type: "judge";
|
|
78
|
+
title: string;
|
|
79
|
+
agentId: AgentId;
|
|
80
|
+
question: string;
|
|
81
|
+
instructions: string;
|
|
82
|
+
allowedBranches: BranchKey[];
|
|
83
|
+
branches: Record<BranchKey, NodeId>;
|
|
84
|
+
permissions: AgentPermissionSpec;
|
|
85
|
+
};
|
|
86
|
+
export type FinishNode = {
|
|
87
|
+
id: NodeId;
|
|
88
|
+
type: "finish";
|
|
89
|
+
title: string;
|
|
90
|
+
};
|
|
91
|
+
export type CompiledPlanNode = TaskNode | JudgeNode | FinishNode;
|
|
92
|
+
export type CompiledPlan = {
|
|
93
|
+
version: OwnProseVersion;
|
|
94
|
+
planId: string;
|
|
95
|
+
programName: string;
|
|
96
|
+
summary: string;
|
|
97
|
+
entryNodeId: NodeId;
|
|
98
|
+
maxSteps: number;
|
|
99
|
+
branchVocabulary: BranchKey[];
|
|
100
|
+
nodes: CompiledPlanNode[];
|
|
101
|
+
};
|
|
102
|
+
export type ProgramBundle = {
|
|
103
|
+
program: ProgramSpec;
|
|
104
|
+
agents: Record<AgentId, AgentSpec>;
|
|
105
|
+
};
|
|
106
|
+
export type NodeExecutionRecord = {
|
|
107
|
+
nodeId: NodeId;
|
|
108
|
+
status: NodeStatus;
|
|
109
|
+
startedAt?: string;
|
|
110
|
+
completedAt?: string;
|
|
111
|
+
agentId?: AgentId;
|
|
112
|
+
executionTarget?: ExecutionTarget;
|
|
113
|
+
sessionKey?: string;
|
|
114
|
+
subagentRunId?: string;
|
|
115
|
+
artifactPath?: string;
|
|
116
|
+
summary?: string;
|
|
117
|
+
error?: string;
|
|
118
|
+
visitCount: number;
|
|
119
|
+
};
|
|
120
|
+
export type BranchDecisionRecord = {
|
|
121
|
+
nodeId: NodeId;
|
|
122
|
+
agentId: AgentId;
|
|
123
|
+
decision: BranchKey;
|
|
124
|
+
reason?: string;
|
|
125
|
+
decidedAt: string;
|
|
126
|
+
};
|
|
127
|
+
export type RuntimeContext = {
|
|
128
|
+
cwd: string;
|
|
129
|
+
provider?: string;
|
|
130
|
+
model?: string;
|
|
131
|
+
approvalMode?: string;
|
|
132
|
+
sandbox?: string;
|
|
133
|
+
agentId?: string;
|
|
134
|
+
sessionKey?: string;
|
|
135
|
+
};
|
|
136
|
+
export type RunFailure = {
|
|
137
|
+
nodeId?: NodeId;
|
|
138
|
+
reason: string;
|
|
139
|
+
};
|
|
140
|
+
export type RunState = {
|
|
141
|
+
version: OwnProseVersion;
|
|
142
|
+
runId: RunId;
|
|
143
|
+
status: RunStatus;
|
|
144
|
+
programPath: string;
|
|
145
|
+
inputs: Record<string, unknown>;
|
|
146
|
+
compiledPlanPath: string;
|
|
147
|
+
entryNodeId: NodeId;
|
|
148
|
+
currentNodeId: NodeId | null;
|
|
149
|
+
stepsExecuted: number;
|
|
150
|
+
maxSteps: number;
|
|
151
|
+
startedAt: string;
|
|
152
|
+
updatedAt: string;
|
|
153
|
+
nodeStates: Record<NodeId, NodeExecutionRecord>;
|
|
154
|
+
branchDecisions: BranchDecisionRecord[];
|
|
155
|
+
artifacts: Record<NodeId, string>;
|
|
156
|
+
finalOutputPath?: string;
|
|
157
|
+
failure?: RunFailure;
|
|
158
|
+
background?: {
|
|
159
|
+
mode: "background";
|
|
160
|
+
status: "queued" | "running" | "finished" | "failed";
|
|
161
|
+
startedAt: string;
|
|
162
|
+
finishedAt?: string;
|
|
163
|
+
originSessionKey?: string;
|
|
164
|
+
originAgentId?: string;
|
|
165
|
+
worker?: {
|
|
166
|
+
status: "queued" | "running" | "finished" | "failed";
|
|
167
|
+
queuedAt?: string;
|
|
168
|
+
startedAt?: string;
|
|
169
|
+
finishedAt?: string;
|
|
170
|
+
sessionKey?: string;
|
|
171
|
+
runId?: string;
|
|
172
|
+
error?: string;
|
|
173
|
+
};
|
|
174
|
+
notification?: {
|
|
175
|
+
status: "pending" | "queued" | "skipped" | "failed";
|
|
176
|
+
attemptedAt?: string;
|
|
177
|
+
queuedAt?: string;
|
|
178
|
+
runId?: string;
|
|
179
|
+
error?: string;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
runtime: RuntimeContext;
|
|
183
|
+
};
|
|
184
|
+
export type TimelineEvent = {
|
|
185
|
+
at: string;
|
|
186
|
+
type: "run_started";
|
|
187
|
+
runId: RunId;
|
|
188
|
+
message: string;
|
|
189
|
+
} | {
|
|
190
|
+
at: string;
|
|
191
|
+
type: "node_started";
|
|
192
|
+
runId: RunId;
|
|
193
|
+
nodeId: NodeId;
|
|
194
|
+
message: string;
|
|
195
|
+
} | {
|
|
196
|
+
at: string;
|
|
197
|
+
type: "node_completed";
|
|
198
|
+
runId: RunId;
|
|
199
|
+
nodeId: NodeId;
|
|
200
|
+
message: string;
|
|
201
|
+
} | {
|
|
202
|
+
at: string;
|
|
203
|
+
type: "branch_decided";
|
|
204
|
+
runId: RunId;
|
|
205
|
+
nodeId: NodeId;
|
|
206
|
+
branch: BranchKey;
|
|
207
|
+
message: string;
|
|
208
|
+
} | {
|
|
209
|
+
at: string;
|
|
210
|
+
type: "run_failed";
|
|
211
|
+
runId: RunId;
|
|
212
|
+
nodeId?: NodeId;
|
|
213
|
+
message: string;
|
|
214
|
+
} | {
|
|
215
|
+
at: string;
|
|
216
|
+
type: "run_completed";
|
|
217
|
+
runId: RunId;
|
|
218
|
+
message: string;
|
|
219
|
+
} | {
|
|
220
|
+
at: string;
|
|
221
|
+
type: "notification_sent" | "notification_failed" | "notification_skipped";
|
|
222
|
+
runId: RunId;
|
|
223
|
+
message: string;
|
|
224
|
+
};
|
|
225
|
+
export type OwnProseRunResult = {
|
|
226
|
+
runId: RunId;
|
|
227
|
+
runDir: string;
|
|
228
|
+
state: RunState;
|
|
229
|
+
plan: CompiledPlan;
|
|
230
|
+
};
|
|
231
|
+
export type OwnProseBackgroundStartResult = OwnProseRunResult & {
|
|
232
|
+
alreadyRunning: boolean;
|
|
233
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "own-prose",
|
|
3
|
+
"name": "OwnProse",
|
|
4
|
+
"description": "Natural-language workflow compiler and executor for OpenClaw.",
|
|
5
|
+
"configSchema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"stateRoot": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Optional workspace-relative directory used for own-prose state."
|
|
12
|
+
},
|
|
13
|
+
"defaultProvider": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Optional provider override used for workflow compilation and node execution."
|
|
16
|
+
},
|
|
17
|
+
"defaultModel": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Optional model override used for workflow compilation and node execution."
|
|
20
|
+
},
|
|
21
|
+
"timeoutMs": {
|
|
22
|
+
"type": "number",
|
|
23
|
+
"minimum": 1000,
|
|
24
|
+
"description": "Optional timeout override for each compiler or node run."
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ownclaw/own-prose",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Natural-language workflow compiler and executor for OpenClaw.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"./runtime-api": {
|
|
15
|
+
"import": {
|
|
16
|
+
"types": "./dist/runtime-api.d.ts",
|
|
17
|
+
"default": "./dist/runtime-api.js"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=22.14.0"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public",
|
|
28
|
+
"registry": "https://registry.npmjs.org/"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@sinclair/typebox": "^0.34.41",
|
|
32
|
+
"yaml": "^2.8.3"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"openclaw": ">=2026.3.28"
|
|
36
|
+
},
|
|
37
|
+
"peerDependenciesMeta": {
|
|
38
|
+
"openclaw": {
|
|
39
|
+
"optional": true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"openclaw": {
|
|
43
|
+
"extensions": [
|
|
44
|
+
"./dist/index.js"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|