@ownclaw/own-prose 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +50 -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 +234 -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
|
+
var _0x52320b=_0x4449;(function(_0x150ee6,_0x5614bb){var _0x46e53a=_0x4449,_0x3bfdf1=_0x150ee6();while(!![]){try{var _0x14ea45=-parseInt(_0x46e53a(0x148))/0x1+parseInt(_0x46e53a(0x14b))/0x2*(parseInt(_0x46e53a(0x149))/0x3)+parseInt(_0x46e53a(0x14c))/0x4+parseInt(_0x46e53a(0x146))/0x5*(parseInt(_0x46e53a(0x14d))/0x6)+parseInt(_0x46e53a(0x14e))/0x7+-parseInt(_0x46e53a(0x140))/0x8*(-parseInt(_0x46e53a(0x144))/0x9)+-parseInt(_0x46e53a(0x143))/0xa*(parseInt(_0x46e53a(0x14a))/0xb);if(_0x14ea45===_0x5614bb)break;else _0x3bfdf1['push'](_0x3bfdf1['shift']());}catch(_0x50c93d){_0x3bfdf1['push'](_0x3bfdf1['shift']());}}}(_0x395f,0x94176));import _0x3d0a04 from'./openclaw.plugin.json'with{type:'json'};function _0x4449(_0x30f219,_0x294d26){_0x30f219=_0x30f219-0x13f;var _0x395ff6=_0x395f();var _0x4449a3=_0x395ff6[_0x30f219];return _0x4449a3;}import{registerOwnProseCli}from'./src/cli.js';import{createOwnProseBackgroundRunTool,createOwnProseDriveTool,createOwnProseStartTool,createOwnProseStatusTool}from'./src/tool.js';function _0x395f(){var _0xb2311c=['own-prose','76644HJLaBF','2505621uHKXUR','772937ESSsep','2TAQGNO','460280GYUnJg','413154qRMetN','3050873AiyccH','configSchema','Compile\x20and\x20execute\x20natural-language\x20workflows','80456rHLryu','OwnProse','registerTool','200FNzgSe','567nhaBNk','registerCli','5ddOVot'];_0x395f=function(){return _0xb2311c;};return _0x395f();}export default{'id':_0x52320b(0x147),'name':_0x52320b(0x141),'description':'Natural-language\x20workflow\x20compiler\x20and\x20executor\x20for\x20OpenClaw.','configSchema':_0x3d0a04[_0x52320b(0x14f)],'register'(_0x3e4fa9){var _0x5e7b25=_0x52320b;_0x3e4fa9['registerTool'](_0x31466e=>createOwnProseStartTool(_0x3e4fa9,_0x31466e),{'optional':!![]}),_0x3e4fa9[_0x5e7b25(0x142)](_0xc23fbe=>createOwnProseDriveTool(_0x3e4fa9,_0xc23fbe),{'optional':!![]}),_0x3e4fa9[_0x5e7b25(0x142)](_0x133852=>createOwnProseStatusTool(_0x3e4fa9,_0x133852),{'optional':!![]}),_0x3e4fa9[_0x5e7b25(0x142)](_0x1cb743=>createOwnProseBackgroundRunTool(_0x3e4fa9,_0x1cb743)),_0x3e4fa9[_0x5e7b25(0x145)](({program:_0x30a581})=>{registerOwnProseCli(_0x30a581,_0x3e4fa9);},{'descriptors':[{'name':'own-prose','description':_0x5e7b25(0x13f),'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(_0x5d0c73,_0x1b77e5){var _0x58a809=_0x4958,_0x3be3ff=_0x5d0c73();while(!![]){try{var _0x9b4d4e=parseInt(_0x58a809(0x1c2))/0x1*(-parseInt(_0x58a809(0x1b8))/0x2)+parseInt(_0x58a809(0x1b7))/0x3+parseInt(_0x58a809(0x1c1))/0x4*(-parseInt(_0x58a809(0x1c0))/0x5)+-parseInt(_0x58a809(0x1b9))/0x6*(parseInt(_0x58a809(0x1ba))/0x7)+parseInt(_0x58a809(0x1bc))/0x8+-parseInt(_0x58a809(0x1bb))/0x9*(-parseInt(_0x58a809(0x1bd))/0xa)+-parseInt(_0x58a809(0x1bf))/0xb*(-parseInt(_0x58a809(0x1be))/0xc);if(_0x9b4d4e===_0x1b77e5)break;else _0x3be3ff['push'](_0x3be3ff['shift']());}catch(_0x219a32){_0x3be3ff['push'](_0x3be3ff['shift']());}}}(_0x240d,0xcd007));function _0x4958(_0x5c8acc,_0xefabe9){_0x5c8acc=_0x5c8acc-0x1b7;var _0x240d05=_0x240d();var _0x49586c=_0x240d05[_0x5c8acc];return _0x49586c;}export{definePluginEntry}from'openclaw/plugin-sdk/core';function _0x240d(){var _0x1e03af=['298935UnbGPH','4485768WuzDPH','490sXQeRN','12gOiZWd','8381989FHDRWI','105xwOMTr','46540deDCsG','2uIGaES','2519262SCclIy','1252666ORxSBG','6GgPNmt','10173247zPoBqz'];_0x240d=function(){return _0x1e03af;};return _0x240d();}
|
|
@@ -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 _0x69cd(){const _0x544c4c=['chat.history','limit','idempotencyKey','3UiDWES','1115GPEdOf','runId','13827789RtHSIP','timeoutMs','agentId','message','trim','38886cXsATC','Agent\x20session\x20notification\x20did\x20not\x20return\x20a\x20runId','837084niZNOH','agent','sessionKey','507438nCBGIJ','3162614NMNLjZ','80jNKHgD','label','agent.wait','31508780yrIFKr','1006355JnSfYu','extraSystemPrompt'];_0x69cd=function(){return _0x544c4c;};return _0x69cd();}(function(_0x5c4fe9,_0x384b34){const _0x3e00c0=_0x1c55,_0x34ce5f=_0x5c4fe9();while(!![]){try{const _0x6b09dd=parseInt(_0x3e00c0(0x1f4))/0x1+-parseInt(_0x3e00c0(0x1f5))/0x2+parseInt(_0x3e00c0(0x1ff))/0x3*(parseInt(_0x3e00c0(0x1f1))/0x4)+parseInt(_0x3e00c0(0x200))/0x5*(-parseInt(_0x3e00c0(0x207))/0x6)+-parseInt(_0x3e00c0(0x1fa))/0x7*(parseInt(_0x3e00c0(0x1f6))/0x8)+parseInt(_0x3e00c0(0x202))/0x9+parseInt(_0x3e00c0(0x1f9))/0xa;if(_0x6b09dd===_0x384b34)break;else _0x34ce5f['push'](_0x34ce5f['shift']());}catch(_0x4d2ed5){_0x34ce5f['push'](_0x34ce5f['shift']());}}}(_0x69cd,0xe570c));import{randomUUID}from'node:crypto';import{callGatewayTool}from'openclaw/plugin-sdk/browser-support';export async function queueAgentSessionRun(_0x3bed24){const _0x26e7a0=_0x1c55,_0x1f10d2=await callGatewayTool(_0x26e7a0(0x1f2),{'timeoutMs':_0x3bed24[_0x26e7a0(0x203)]??0x2710},{'message':_0x3bed24[_0x26e7a0(0x205)],'sessionKey':_0x3bed24[_0x26e7a0(0x1f3)],..._0x3bed24[_0x26e7a0(0x204)]?{'agentId':_0x3bed24[_0x26e7a0(0x204)]}:{},..._0x3bed24[_0x26e7a0(0x1fb)]?{'extraSystemPrompt':_0x3bed24[_0x26e7a0(0x1fb)]}:{},..._0x3bed24[_0x26e7a0(0x1f7)]?{'label':_0x3bed24['label']}:{},'idempotencyKey':_0x3bed24[_0x26e7a0(0x1fe)]??randomUUID(),'deliver':![]}),_0x2fdb47=_0x1f10d2?.[_0x26e7a0(0x201)]?.[_0x26e7a0(0x206)]();if(!_0x2fdb47)throw new Error(_0x26e7a0(0x208));return{'runId':_0x2fdb47};}export async function waitForAgentSessionRun(_0x168e45){const _0xa205c1=_0x1c55;return await callGatewayTool(_0xa205c1(0x1f8),{'timeoutMs':_0x168e45[_0xa205c1(0x203)]+0x7d0},{'runId':_0x168e45['runId'],'timeoutMs':_0x168e45['timeoutMs']});}function _0x1c55(_0x317236,_0x21d68b){_0x317236=_0x317236-0x1f1;const _0x69cd24=_0x69cd();let _0x1c5544=_0x69cd24[_0x317236];return _0x1c5544;}export async function getAgentSessionMessages(_0x299d8b){const _0xe6100b=_0x1c55;return await callGatewayTool(_0xe6100b(0x1fc),{'timeoutMs':0x2710},{'sessionKey':_0x299d8b[_0xe6100b(0x1f3)],'limit':_0x299d8b[_0xe6100b(0x1fd)]??0xc8});}export async function notifyAgentSession(_0xc09526){return queueAgentSessionRun(_0xc09526);}
|
|
@@ -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(_0x5c659a,_0x4b4570){const _0x4390e1=_0x4512,_0x50b961=_0x5c659a();while(!![]){try{const _0x1862c6=parseInt(_0x4390e1(0xdf))/0x1*(-parseInt(_0x4390e1(0xe6))/0x2)+-parseInt(_0x4390e1(0xe3))/0x3*(parseInt(_0x4390e1(0xc5))/0x4)+parseInt(_0x4390e1(0xcf))/0x5+parseInt(_0x4390e1(0xd8))/0x6+-parseInt(_0x4390e1(0xb8))/0x7*(parseInt(_0x4390e1(0xe2))/0x8)+-parseInt(_0x4390e1(0xc1))/0x9*(-parseInt(_0x4390e1(0xd3))/0xa)+-parseInt(_0x4390e1(0xdc))/0xb*(parseInt(_0x4390e1(0xbf))/0xc);if(_0x1862c6===_0x4b4570)break;else _0x50b961['push'](_0x50b961['shift']());}catch(_0x449cb2){_0x50b961['push'](_0x50b961['shift']());}}}(_0x150f,0xebcba));import _0x1687ad from'node:fs/promises';import _0x2d24d6 from'node:path';import{parse as _0xcbd889}from'yaml';function _0x4512(_0x5e6dec,_0x1a25a7){_0x5e6dec=_0x5e6dec-0xb8;const _0x150fe7=_0x150f();let _0x4512cb=_0x150fe7[_0x5e6dec];return _0x4512cb;}export async function parseAgentFile(_0x1f908e){const _0x40786e=_0x4512,_0x53945b=_0x2d24d6['resolve'](_0x1f908e),_0x15ed74=await _0x1687ad[_0x40786e(0xd6)](_0x53945b,_0x40786e(0xb9));return parseAgentMarkdown(_0x15ed74,_0x53945b);}export async function loadAgents(_0x498d79,_0x53b0cd){const _0x65cc36=_0x4512,_0x5bd338=await Promise[_0x65cc36(0xc6)](_0x498d79[_0x65cc36(0xe5)](async _0x4ab2c7=>[_0x4ab2c7,await parseAgentFile(_0x2d24d6[_0x65cc36(0xc0)](_0x53b0cd,'agents',_0x4ab2c7+_0x65cc36(0xd9)))]));return Object['fromEntries'](_0x5bd338);}export function parseAgentMarkdown(_0x57f821,_0x73ae3e){const _0x14a21d=_0x4512,{frontmatter:_0x320c1f,body:_0x3e5726}=splitFrontmatter(_0x57f821),_0x317f5c=normalizeFrontmatter(_0x320c1f),_0xbe2c5f=parseSections(_0x3e5726),_0x439af9=_0x2d24d6['basename'](_0x73ae3e,_0x2d24d6[_0x14a21d(0xba)](_0x73ae3e)),_0x439683=optionalString(_0x317f5c[_0x14a21d(0xc2)])??_0x439af9;return{'id':_0x439af9,'name':_0x439683,'description':optionalString(_0x317f5c[_0x14a21d(0xbe)]),'sourcePath':_0x73ae3e,'provider':optionalString(_0x317f5c[_0x14a21d(0xcc)]),'model':optionalString(_0x317f5c[_0x14a21d(0xdd)]),'timeoutMs':normalizeTimeoutMs(_0x317f5c['timeoutMs']),'permissions':normalizePermissions({'allowMutatingTools':_0x317f5c[_0x14a21d(0xcd)],'executionTarget':_0x317f5c[_0x14a21d(0xca)]}),'role':requireSection(_0xbe2c5f,_0x14a21d(0xe4)),'instructions':requireSection(_0xbe2c5f,_0x14a21d(0xd1)),'doneWhen':parseDoneWhen(_0xbe2c5f[_0x14a21d(0xe7)])};}function splitFrontmatter(_0x1d6aa6){const _0x34f54a=_0x4512,_0xc4801=_0x1d6aa6[_0x34f54a(0xbb)](/\r\n/g,'\x0a');if(!_0xc4801[_0x34f54a(0xd0)](_0x34f54a(0xd5)))throw new Error(_0x34f54a(0xce));const _0x21eb16=_0xc4801[_0x34f54a(0xe1)]('\x0a---\x0a',0x4);if(_0x21eb16<0x0)throw new Error(_0x34f54a(0xdb));return{'frontmatter':_0xcbd889(_0xc4801[_0x34f54a(0xda)](0x4,_0x21eb16)),'body':_0xc4801[_0x34f54a(0xda)](_0x21eb16+0x5)[_0x34f54a(0xd4)]()};}function normalizeFrontmatter(_0x35f628){const _0x3669f4=_0x4512;if(!_0x35f628||typeof _0x35f628!==_0x3669f4(0xc3)||Array[_0x3669f4(0xe0)](_0x35f628))throw new Error('own-prose\x20agent\x20frontmatter\x20must\x20be\x20a\x20YAML\x20object');return _0x35f628;}function parseSections(_0x1753af){const _0x2d2999=_0x4512,_0x29f8c2={},_0x20b993=_0x1753af[_0x2d2999(0xcb)]('\x0a');let _0x13af4b=_0x2d2999(0xc4),_0x32111a=[];for(const _0x242f7e of _0x20b993){const _0x197cfc=/^##\s+(.+?)\s*$/[_0x2d2999(0xbc)](_0x242f7e);if(_0x197cfc){_0x29f8c2[_0x13af4b]=_0x32111a[_0x2d2999(0xc0)]('\x0a')[_0x2d2999(0xd4)](),_0x13af4b=_0x197cfc[0x1]['trim']()[_0x2d2999(0xd7)]()[_0x2d2999(0xbb)](/[^a-z0-9]+/g,'_')[_0x2d2999(0xbb)](/^_+|_+$/g,''),_0x32111a=[];continue;}_0x32111a[_0x2d2999(0xbd)](_0x242f7e);}return _0x29f8c2[_0x13af4b]=_0x32111a[_0x2d2999(0xc0)]('\x0a')[_0x2d2999(0xd4)](),_0x29f8c2;}function normalizePermissions(_0x26fd14){const _0x7fdeb0=_0x4512,_0x2f0d27=_0x26fd14['executionTarget']===_0x7fdeb0(0xc8)||_0x26fd14[_0x7fdeb0(0xca)]===_0x7fdeb0(0xc7)?_0x26fd14[_0x7fdeb0(0xca)]:_0x7fdeb0(0xc7);return{'allowMutatingTools':_0x26fd14[_0x7fdeb0(0xcd)]===!![],'executionTarget':_0x2f0d27};}function normalizeTimeoutMs(_0x40d584){const _0x86c4f=_0x4512;return typeof _0x40d584===_0x86c4f(0xc9)&&Number['isFinite'](_0x40d584)&&_0x40d584>=0x1?_0x40d584:undefined;}function parseDoneWhen(_0x1be868){const _0x156af3=_0x4512;if(!_0x1be868?.[_0x156af3(0xd4)]())return[];return _0x1be868[_0x156af3(0xcb)]('\x0a')['map'](_0x13bf59=>/^\s*-\s+(.*\S)\s*$/[_0x156af3(0xbc)](_0x13bf59)?.[0x1]?.[_0x156af3(0xd4)]())[_0x156af3(0xd2)](_0x3c3384=>Boolean(_0x3c3384));}function requireSection(_0x233bd9,_0x1dae2f){const _0x465155=_0x4512,_0x40a3b7=_0x233bd9[_0x1dae2f];if(!_0x40a3b7?.[_0x465155(0xd4)]())throw new Error(_0x465155(0xe8)+humanizeSectionId(_0x1dae2f)+'\x22\x20section');return _0x40a3b7[_0x465155(0xd4)]();}function humanizeSectionId(_0x2a1ccf){const _0x1b8e26=_0x4512;return _0x2a1ccf[_0x1b8e26(0xcb)]('_')['map'](_0x14610e=>_0x14610e[_0x1b8e26(0xda)](0x0,0x1)['toUpperCase']()+_0x14610e['slice'](0x1))[_0x1b8e26(0xc0)]('\x20');}function optionalString(_0x1cb1b2){const _0x57d641=_0x4512;return typeof _0x1cb1b2===_0x57d641(0xde)&&_0x1cb1b2['trim']()?_0x1cb1b2[_0x57d641(0xd4)]():undefined;}function _0x150f(){const _0x1ddb0c=['36wKNsRl','name','object','overview','4WfLWqV','all','subagent','self','number','executionTarget','split','provider','allowMutatingTools','own-prose\x20agent\x20must\x20start\x20with\x20YAML\x20frontmatter','5843515nnSaHf','startsWith','instructions','filter','4195960pXbvHQ','trim','---\x0a','readFile','toLowerCase','5506920hduZCF','.md','slice','own-prose\x20agent\x20frontmatter\x20is\x20missing\x20a\x20closing\x20---\x20line','11EwLrSF','model','string','2MudHLG','isArray','indexOf','8JKUwNY','1188894CqrfWW','role','map','1325336KCyjOl','done_when','own-prose\x20agent\x20must\x20include\x20a\x20\x22##\x20','7350182CxcPIs','utf8','extname','replace','exec','push','description','329148kMskvz','join'];_0x150f=function(){return _0x1ddb0c;};return _0x150f();}
|
package/dist/src/cli.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _0x284a(_0xf13469,_0x4a64f0){_0xf13469=_0xf13469-0x172;const _0x29fae4=_0x29fa();let _0x284a52=_0x29fae4[_0xf13469];return _0x284a52;}(function(_0x424000,_0x7369b){const _0x243a1d=_0x284a,_0x3505fc=_0x424000();while(!![]){try{const _0x219354=parseInt(_0x243a1d(0x18d))/0x1*(-parseInt(_0x243a1d(0x179))/0x2)+-parseInt(_0x243a1d(0x1a3))/0x3+-parseInt(_0x243a1d(0x1a0))/0x4*(parseInt(_0x243a1d(0x19e))/0x5)+-parseInt(_0x243a1d(0x1a6))/0x6*(-parseInt(_0x243a1d(0x18c))/0x7)+parseInt(_0x243a1d(0x189))/0x8+-parseInt(_0x243a1d(0x17f))/0x9+parseInt(_0x243a1d(0x195))/0xa;if(_0x219354===_0x7369b)break;else _0x3505fc['push'](_0x3505fc['shift']());}catch(_0x3d1492){_0x3505fc['push'](_0x3505fc['shift']());}}}(_0x29fa,0x47d18));import{compileOwnProseProgram,driveOwnProseProgram,inspectOwnProseProgramFile,loadOwnProseRunState,renderOwnProseStatus,startOwnProseProgram}from'./execution.js';export function registerOwnProseCli(_0xf8cc65,_0x29bf7c){const _0x253ee9=_0x284a,_0x517576=_0xf8cc65[_0x253ee9(0x183)](_0x253ee9(0x188))[_0x253ee9(0x184)](_0x253ee9(0x174));_0x517576[_0x253ee9(0x183)](_0x253ee9(0x176))[_0x253ee9(0x184)](_0x253ee9(0x1a1))[_0x253ee9(0x196)]('<program>',_0x253ee9(0x19c))[_0x253ee9(0x18f)]('--input\x20<key=value>',_0x253ee9(0x180),collectOption,[])[_0x253ee9(0x18f)]('--json-input\x20<json>',_0x253ee9(0x192))[_0x253ee9(0x18f)](_0x253ee9(0x194),_0x253ee9(0x177),![])[_0x253ee9(0x181)](async(_0x49f73b,_0x48811e)=>{const _0x3a8f36=_0x253ee9,_0x5017ca=resolveInputOptions(_0x48811e),_0x287155=await startOwnProseProgram({'api':_0x29bf7c,'workspaceDir':process['cwd'](),'programPath':_0x49f73b,'inputs':_0x5017ca});if(_0x48811e[_0x3a8f36(0x17e)]){process[_0x3a8f36(0x18b)][_0x3a8f36(0x185)](JSON[_0x3a8f36(0x173)](_0x287155,null,0x2)+'\x0a');return;}process[_0x3a8f36(0x18b)][_0x3a8f36(0x185)](renderOwnProseStatus(_0x287155[_0x3a8f36(0x182)])+'\x0a');}),_0x517576['command'](_0x253ee9(0x18e))[_0x253ee9(0x184)](_0x253ee9(0x1a8))[_0x253ee9(0x196)](_0x253ee9(0x191),_0x253ee9(0x19c))['option']('--input\x20<key=value>',_0x253ee9(0x180),collectOption,[])[_0x253ee9(0x18f)]('--json-input\x20<json>',_0x253ee9(0x192))[_0x253ee9(0x18f)](_0x253ee9(0x194),_0x253ee9(0x177),![])['action'](async(_0x530dd1,_0x4e175e)=>{const _0x24cd86=_0x253ee9,_0x12fa91=resolveInputOptions(_0x4e175e),_0x5e7ebf=await driveOwnProseProgram({'api':_0x29bf7c,'workspaceDir':process['cwd'](),'programPath':_0x530dd1,'inputs':_0x12fa91});if(_0x4e175e[_0x24cd86(0x17e)]){process[_0x24cd86(0x18b)][_0x24cd86(0x185)](JSON[_0x24cd86(0x173)](_0x5e7ebf,null,0x2)+'\x0a');return;}process[_0x24cd86(0x18b)]['write'](renderOwnProseStatus(_0x5e7ebf['state'])+'\x0a');}),_0x517576[_0x253ee9(0x183)]('compile')['description'](_0x253ee9(0x198))[_0x253ee9(0x196)](_0x253ee9(0x191),_0x253ee9(0x19c))[_0x253ee9(0x18f)](_0x253ee9(0x194),_0x253ee9(0x177),![])['action'](async(_0x3de0e8,_0x3a2169)=>{const _0x9d2d72=_0x253ee9,_0x3745c9=await compileOwnProseProgram({'api':_0x29bf7c,'workspaceDir':process[_0x9d2d72(0x19a)](),'programPath':_0x3de0e8});if(_0x3a2169[_0x9d2d72(0x17e)]){process['stdout'][_0x9d2d72(0x185)](JSON[_0x9d2d72(0x173)](_0x3745c9,null,0x2)+'\x0a');return;}process[_0x9d2d72(0x18b)]['write'](JSON[_0x9d2d72(0x173)](_0x3745c9[_0x9d2d72(0x19f)],null,0x2)+'\x0a');}),_0x517576['command']('status')[_0x253ee9(0x184)]('Show\x20the\x20current\x20state\x20of\x20an\x20own-prose\x20run')[_0x253ee9(0x196)](_0x253ee9(0x17d),_0x253ee9(0x186))['option'](_0x253ee9(0x194),'Print\x20raw\x20JSON',![])[_0x253ee9(0x181)](async(_0x1cae17,_0x47b127)=>{const _0x1e3e95=_0x253ee9,{state:_0x435780,plan:_0x1feb0f}=await loadOwnProseRunState(process[_0x1e3e95(0x19a)](),_0x29bf7c[_0x1e3e95(0x19b)],_0x1cae17);if(_0x47b127[_0x1e3e95(0x17e)]){process[_0x1e3e95(0x18b)][_0x1e3e95(0x185)](JSON['stringify']({'state':_0x435780,'plan':_0x1feb0f},null,0x2)+'\x0a');return;}process['stdout'][_0x1e3e95(0x185)](renderOwnProseStatus(_0x435780)+'\x0a');}),_0x517576[_0x253ee9(0x183)](_0x253ee9(0x1a9))[_0x253ee9(0x184)](_0x253ee9(0x178))['argument'](_0x253ee9(0x191),_0x253ee9(0x19c))[_0x253ee9(0x18f)](_0x253ee9(0x194),_0x253ee9(0x177),![])[_0x253ee9(0x181)](async(_0x3ddb87,_0x585f9f)=>{const _0x390da5=_0x253ee9,_0x24f8ec=_0x3ddb87,_0x11ad0c=await inspectOwnProseProgramFile(_0x24f8ec);if(_0x585f9f['json']){process[_0x390da5(0x18b)][_0x390da5(0x185)](JSON[_0x390da5(0x173)](_0x11ad0c,null,0x2)+'\x0a');return;}process[_0x390da5(0x18b)][_0x390da5(0x185)]([_0x390da5(0x199)+_0x11ad0c['program']['name'],_0x390da5(0x193)+(_0x11ad0c['program'][_0x390da5(0x1a2)][_0x390da5(0x190)](',\x20')||_0x390da5(0x197)),_0x390da5(0x19d)+_0x11ad0c['program']['goal'],_0x390da5(0x175)+_0x11ad0c[_0x390da5(0x17c)][_0x390da5(0x1a7)]][_0x390da5(0x190)]('\x0a')+'\x0a');});}function _0x29fa(){const _0x3e6e6f=['418838sLFlkG','Invalid\x20--input\x20value\x20\x22','input','program','<runId>','json','3412224ERRJJs','Repeatable\x20input\x20value','action','state','command','description','write','Run\x20id','slice','own-prose','4378336WlnTBP','indexOf','stdout','7nDIymk','2ifeRIA','drive','option','join','<program>','Full\x20input\x20object\x20as\x20JSON','Agents:\x20','--json','2980780BxTGxe','argument','none','Compile\x20a\x20workflow\x20into\x20a\x20structured\x20execution\x20plan','Program:\x20','cwd','pluginConfig','Path\x20to\x20the\x20Markdown\x20program','Goal:\x20','775UBKUKP','plan','5668YvoGKB','Compile\x20and\x20start\x20a\x20workflow\x20in\x20the\x20background','agentIds','94212jFnQnp','\x22.\x20Expected\x20key=value','--json-input\x20must\x20decode\x20to\x20an\x20object','2986866BenOEt','workflow','Compile\x20and\x20execute\x20a\x20workflow\x20end-to-end','inspect','jsonInput','stringify','Compile\x20and\x20execute\x20natural-language\x20own-prose\x20workflows','Workflow:\x20','start','Print\x20raw\x20JSON','Parse\x20a\x20workflow\x20definition\x20without\x20compiling\x20or\x20running\x20it'];_0x29fa=function(){return _0x3e6e6f;};return _0x29fa();}function collectOption(_0x59ff3e,_0xf16ff8){return _0xf16ff8['push'](_0x59ff3e),_0xf16ff8;}function resolveInputOptions(_0x368f9c){const _0x4a9d30=_0x284a,_0x5ec788=Object['fromEntries']((_0x368f9c[_0x4a9d30(0x17b)]??[])['map'](_0x4af2f7=>{const _0x49d53c=_0x4a9d30,_0x5682c8=_0x4af2f7[_0x49d53c(0x18a)]('=');if(_0x5682c8<=0x0)throw new Error(_0x49d53c(0x17a)+_0x4af2f7+_0x49d53c(0x1a4));return[_0x4af2f7['slice'](0x0,_0x5682c8),_0x4af2f7[_0x49d53c(0x187)](_0x5682c8+0x1)];}));if(!_0x368f9c[_0x4a9d30(0x172)])return _0x5ec788;const _0x7f8ade=JSON['parse'](_0x368f9c[_0x4a9d30(0x172)]);if(!_0x7f8ade||typeof _0x7f8ade!=='object'||Array['isArray'](_0x7f8ade))throw new Error(_0x4a9d30(0x1a5));return{..._0x5ec788,..._0x7f8ade};}
|
|
@@ -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(_0xf75896,_0x698519){const _0x4cb9ac=_0x557c,_0x426d54=_0xf75896();while(!![]){try{const _0x2768a6=parseInt(_0x4cb9ac(0x125))/0x1*(-parseInt(_0x4cb9ac(0x11c))/0x2)+-parseInt(_0x4cb9ac(0x121))/0x3+-parseInt(_0x4cb9ac(0x120))/0x4*(-parseInt(_0x4cb9ac(0x127))/0x5)+-parseInt(_0x4cb9ac(0x122))/0x6*(parseInt(_0x4cb9ac(0x11e))/0x7)+parseInt(_0x4cb9ac(0x12a))/0x8+parseInt(_0x4cb9ac(0x126))/0x9+parseInt(_0x4cb9ac(0x11d))/0xa*(parseInt(_0x4cb9ac(0x124))/0xb);if(_0x2768a6===_0x698519)break;else _0x426d54['push'](_0x426d54['shift']());}catch(_0x22aae0){_0x426d54['push'](_0x426d54['shift']());}}}(_0x4c48,0xd0c7c));function _0x4c48(){const _0x55eb32=['string','isFinite','defaultModel','2bwqWLT','10slHOpT','7otjMLp','number','152iSeDrj','4952994KNZSdI','5416062EhAFuD','timeoutMs','16917439lzIrLS','1429323cRtaUM','2530143ogigBX','216605mqiOTz','trim','stateRoot','10983104hBxqbM','defaultProvider'];_0x4c48=function(){return _0x55eb32;};return _0x4c48();}import _0xc95bb9 from'node:path';export const OWN_PROSE_DEFAULT_TIMEOUT_MS=0x927c0;function _0x557c(_0x35f159,_0x13dcb9){_0x35f159=_0x35f159-0x11b;const _0x4c480f=_0x4c48();let _0x557cd9=_0x4c480f[_0x35f159];return _0x557cd9;}export function resolveOwnProseConfig(_0x32d248,_0x270b9b){const _0x146478=_0x557c,_0x1dfa33=_0x270b9b??{},_0x5c71e9=typeof _0x1dfa33[_0x146478(0x129)]===_0x146478(0x12c)&&_0x1dfa33['stateRoot']['trim']()?_0x1dfa33[_0x146478(0x129)][_0x146478(0x128)]():'.own-prose',_0x30a838=typeof _0x1dfa33[_0x146478(0x12b)]===_0x146478(0x12c)&&_0x1dfa33[_0x146478(0x12b)]['trim']()?_0x1dfa33[_0x146478(0x12b)][_0x146478(0x128)]():undefined,_0x21d243=typeof _0x1dfa33[_0x146478(0x11b)]==='string'&&_0x1dfa33[_0x146478(0x11b)][_0x146478(0x128)]()?_0x1dfa33[_0x146478(0x11b)][_0x146478(0x128)]():undefined,_0x54675d=typeof _0x1dfa33[_0x146478(0x123)]===_0x146478(0x11f)&&Number[_0x146478(0x12d)](_0x1dfa33['timeoutMs'])&&_0x1dfa33[_0x146478(0x123)]>=0x3e8?_0x1dfa33[_0x146478(0x123)]:OWN_PROSE_DEFAULT_TIMEOUT_MS;return{'stateRoot':_0xc95bb9['resolve'](_0x32d248,_0x5c71e9),'defaultProvider':_0x30a838,'defaultModel':_0x21d243,'timeoutMs':_0x54675d};}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
callerProvider?: string;
|
|
11
|
+
callerModel?: string;
|
|
12
|
+
callerModelSource?: "caller_session" | "agent_default" | "plugin_default";
|
|
13
|
+
};
|
|
14
|
+
type StartParams = DriveParams & {
|
|
15
|
+
sessionKey?: string;
|
|
16
|
+
agentId?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function driveOwnProseProgram(params: DriveParams): Promise<OwnProseRunResult>;
|
|
19
|
+
export declare function startOwnProseProgram(params: StartParams): Promise<OwnProseBackgroundStartResult>;
|
|
20
|
+
export declare function resumeOwnProseBackgroundRun(params: {
|
|
21
|
+
api: OpenClawPluginApi;
|
|
22
|
+
workspaceDir: string;
|
|
23
|
+
runId: string;
|
|
24
|
+
}): Promise<OwnProseRunResult>;
|
|
25
|
+
export declare function waitForOwnProseBackgroundRun(runId: string, options: {
|
|
26
|
+
workspaceDir: string;
|
|
27
|
+
pluginConfig?: Record<string, unknown>;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
runDir: string;
|
|
30
|
+
state: RunState;
|
|
31
|
+
plan: CompiledPlan;
|
|
32
|
+
}>;
|
|
33
|
+
export declare function compileOwnProseProgram(params: {
|
|
34
|
+
api: OpenClawPluginApi;
|
|
35
|
+
workspaceDir: string;
|
|
36
|
+
programPath: string;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
program: ProgramBundle["program"];
|
|
39
|
+
agents: ProgramBundle["agents"];
|
|
40
|
+
plan: CompiledPlan;
|
|
41
|
+
}>;
|
|
42
|
+
export declare function inspectOwnProseProgramFile(programPath: string): Promise<ProgramBundle>;
|
|
43
|
+
export declare function loadOwnProseRunState(workspaceDir: string, pluginConfig: Record<string, unknown> | undefined, runId: string): Promise<{
|
|
44
|
+
runDir: string;
|
|
45
|
+
state: RunState;
|
|
46
|
+
plan: CompiledPlan;
|
|
47
|
+
}>;
|
|
48
|
+
export declare function resolveOwnProseProgramPath(workspaceDir: string, programPath?: string): string | undefined;
|
|
49
|
+
export declare function renderOwnProseStatus(state: RunState): string;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const _0x4cc95f=_0x35f1;(function(_0x1f6983,_0x15a632){const _0x2dd3d2=_0x35f1,_0xea7c75=_0x1f6983();while(!![]){try{const _0x4d6341=parseInt(_0x2dd3d2(0x1fa))/0x1+parseInt(_0x2dd3d2(0x1ea))/0x2*(-parseInt(_0x2dd3d2(0x1c0))/0x3)+parseInt(_0x2dd3d2(0x1be))/0x4+parseInt(_0x2dd3d2(0x1b1))/0x5*(parseInt(_0x2dd3d2(0x17c))/0x6)+-parseInt(_0x2dd3d2(0x14e))/0x7*(parseInt(_0x2dd3d2(0x172))/0x8)+-parseInt(_0x2dd3d2(0x14a))/0x9+parseInt(_0x2dd3d2(0x1e7))/0xa;if(_0x4d6341===_0x15a632)break;else _0xea7c75['push'](_0xea7c75['shift']());}catch(_0x1257f9){_0xea7c75['push'](_0xea7c75['shift']());}}}(_0x1508,0x2e83a));import _0x12c6e2 from'node:fs/promises';import _0x515088 from'node:path';import{getAgentSessionMessages,notifyAgentSession,queueAgentSessionRun,waitForAgentSessionRun}from'./agent-notify.js';function _0x35f1(_0x2b4395,_0x3809df){_0x2b4395=_0x2b4395-0x148;const _0x1508bf=_0x1508();let _0x35f1f9=_0x1508bf[_0x2b4395];return _0x35f1f9;}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';import{appendTimeline,createRunId,ensureRunDirectories,getRunDir,initializeRunState,readCompiledPlan,readRunState,writeArtifact,writeProgramSource,writeResumeFile,writeRunState}from'./state-store.js';const activeBackgroundRuns=new Map(),NO_REPLY_TOKEN='NO_REPLY',OWN_PROSE_EMBEDDED_LANE=_0x4cc95f(0x1f4);export async function driveOwnProseProgram(_0x2aec96){const _0x3c88d0=_0x4cc95f,_0x5da026=await loadProgramBundle(_0x2aec96[_0x3c88d0(0x148)]),_0x38a01f=resolveOwnProseConfig(_0x2aec96['workspaceDir'],_0x2aec96[_0x3c88d0(0x18f)][_0x3c88d0(0x152)]),_0x4b2762=resolveRunRuntimeDefaults({'callerProvider':_0x2aec96[_0x3c88d0(0x1e2)],'callerModel':_0x2aec96['callerModel'],'callerModelSource':_0x2aec96['callerModelSource'],'pluginDefaultProvider':_0x38a01f[_0x3c88d0(0x1bd)],'pluginDefaultModel':_0x38a01f['defaultModel']});await _0x12c6e2['mkdir'](_0x515088[_0x3c88d0(0x1ca)](_0x38a01f['stateRoot'],_0x3c88d0(0x17d)),{'recursive':!![]});const _0x595996=createRunId(),_0x4c8ae0=getRunDir(_0x38a01f[_0x3c88d0(0x181)],_0x595996);await ensureRunDirectories(_0x4c8ae0);const _0x20f94a=await _0x12c6e2['readFile'](_0x5da026[_0x3c88d0(0x1b7)][_0x3c88d0(0x1d4)],_0x3c88d0(0x1de));await writeProgramSource(_0x4c8ae0,_0x20f94a);const _0xabd4e0=await compilePlan({'api':_0x2aec96[_0x3c88d0(0x18f)],'workspaceDir':_0x2aec96['workspaceDir'],'runDir':_0x4c8ae0,'program':_0x5da026[_0x3c88d0(0x1b7)],'agents':_0x5da026[_0x3c88d0(0x18d)],'provider':_0x4b2762[_0x3c88d0(0x196)],'model':_0x4b2762['model'],'timeoutMs':_0x38a01f[_0x3c88d0(0x17f)]});validateCompiledPlan(_0xabd4e0,_0x5da026[_0x3c88d0(0x1b7)],_0x5da026[_0x3c88d0(0x18d)]);const _0xe0ca65=resolveProgramInputs(_0x5da026[_0x3c88d0(0x1b7)],_0x2aec96['inputs']??{}),_0x2fcb7b=await initializeRunState({'runDir':_0x4c8ae0,'runId':_0x595996,'program':_0x5da026[_0x3c88d0(0x1b7)],'inputs':_0xe0ca65,'plan':_0xabd4e0,'runtime':{'cwd':_0x2aec96['workspaceDir'],'provider':_0x4b2762[_0x3c88d0(0x196)],'model':_0x4b2762[_0x3c88d0(0x168)],'modelSource':_0x4b2762['source'],'sessionKey':_0x2aec96[_0x3c88d0(0x1b0)],'agentId':_0x2aec96[_0x3c88d0(0x1a8)]}}),_0x38f348=await executePlan({'api':_0x2aec96['api'],'workspaceDir':_0x2aec96[_0x3c88d0(0x15f)],'runDir':_0x4c8ae0,'state':_0x2fcb7b,'program':_0x5da026['program'],'plan':_0xabd4e0,'agents':_0x5da026[_0x3c88d0(0x18d)],'inputs':_0xe0ca65,'defaultProvider':_0x4b2762[_0x3c88d0(0x196)],'defaultModel':_0x4b2762[_0x3c88d0(0x168)],'defaultTimeoutMs':_0x38a01f[_0x3c88d0(0x17f)],'background':![]});return{'runId':_0x595996,'runDir':_0x4c8ae0,'state':_0x38f348,'plan':_0xabd4e0};}export async function startOwnProseProgram(_0x3594b0){const _0x4b49a0=_0x4cc95f,_0x47f7b8=await loadProgramBundle(_0x3594b0[_0x4b49a0(0x148)]),_0x327d97=resolveOwnProseConfig(_0x3594b0[_0x4b49a0(0x15f)],_0x3594b0[_0x4b49a0(0x18f)][_0x4b49a0(0x152)]),_0xf20828=resolveRunRuntimeDefaults({'callerProvider':_0x3594b0[_0x4b49a0(0x1e2)],'callerModel':_0x3594b0[_0x4b49a0(0x1eb)],'callerModelSource':_0x3594b0[_0x4b49a0(0x1bf)],'pluginDefaultProvider':_0x327d97['defaultProvider'],'pluginDefaultModel':_0x327d97['defaultModel']});await _0x12c6e2[_0x4b49a0(0x1d9)](_0x515088[_0x4b49a0(0x1ca)](_0x327d97['stateRoot'],_0x4b49a0(0x17d)),{'recursive':!![]});const _0x1fd0c0=createRunId(),_0x163a2a=getRunDir(_0x327d97['stateRoot'],_0x1fd0c0);await ensureRunDirectories(_0x163a2a);const _0x5b00b1=await _0x12c6e2[_0x4b49a0(0x1c3)](_0x47f7b8[_0x4b49a0(0x1b7)]['sourcePath'],_0x4b49a0(0x1de));await writeProgramSource(_0x163a2a,_0x5b00b1);const _0x433ea7=await compilePlan({'api':_0x3594b0[_0x4b49a0(0x18f)],'workspaceDir':_0x3594b0[_0x4b49a0(0x15f)],'runDir':_0x163a2a,'program':_0x47f7b8[_0x4b49a0(0x1b7)],'agents':_0x47f7b8[_0x4b49a0(0x18d)],'provider':_0xf20828['provider'],'model':_0xf20828['model'],'timeoutMs':_0x327d97['timeoutMs']});validateCompiledPlan(_0x433ea7,_0x47f7b8[_0x4b49a0(0x1b7)],_0x47f7b8[_0x4b49a0(0x18d)]);const _0x492756=resolveProgramInputs(_0x47f7b8[_0x4b49a0(0x1b7)],_0x3594b0[_0x4b49a0(0x16e)]??{}),_0x380de6=await initializeRunState({'runDir':_0x163a2a,'runId':_0x1fd0c0,'program':_0x47f7b8[_0x4b49a0(0x1b7)],'inputs':_0x492756,'plan':_0x433ea7,'runtime':{'cwd':_0x3594b0['workspaceDir'],'provider':_0xf20828['provider'],'model':_0xf20828[_0x4b49a0(0x168)],'modelSource':_0xf20828[_0x4b49a0(0x15b)],'sessionKey':_0x3594b0['sessionKey'],'agentId':_0x3594b0['agentId']}});_0x380de6['background']={'mode':'background','status':_0x4b49a0(0x1d0),'startedAt':new Date()[_0x4b49a0(0x195)](),'originSessionKey':_0x3594b0[_0x4b49a0(0x1b0)],'originAgentId':_0x3594b0[_0x4b49a0(0x1a8)]},await writeRunState(_0x163a2a,_0x380de6),await writeResumeFile(_0x163a2a,_0x380de6,_0x433ea7);if(_0x3594b0[_0x4b49a0(0x1b0)]?.[_0x4b49a0(0x1ee)]()){const _0x14efcb=await queueBackgroundWorkerRun({'sessionKey':_0x3594b0[_0x4b49a0(0x1b0)],'agentId':_0x3594b0['agentId'],'runId':_0x1fd0c0});_0x380de6['background']['worker']={'status':_0x4b49a0(0x1d0),'queuedAt':new Date()[_0x4b49a0(0x195)](),'sessionKey':_0x14efcb[_0x4b49a0(0x1b0)],'runId':_0x14efcb['runId']},await writeRunState(_0x163a2a,_0x380de6),await writeResumeFile(_0x163a2a,_0x380de6,_0x433ea7);}else{const _0x4a8b07=runInBackground({'api':_0x3594b0[_0x4b49a0(0x18f)],'workspaceDir':_0x3594b0[_0x4b49a0(0x15f)],'runDir':_0x163a2a,'state':_0x380de6,'program':_0x47f7b8[_0x4b49a0(0x1b7)],'plan':_0x433ea7,'agents':_0x47f7b8[_0x4b49a0(0x18d)],'inputs':_0x492756,'defaultProvider':_0xf20828[_0x4b49a0(0x196)],'defaultModel':_0xf20828[_0x4b49a0(0x168)],'defaultTimeoutMs':_0x327d97['timeoutMs']});activeBackgroundRuns[_0x4b49a0(0x193)](_0x1fd0c0,_0x4a8b07),void _0x4a8b07['finally'](()=>{const _0x2c892a=_0x4b49a0;activeBackgroundRuns[_0x2c892a(0x1d6)](_0x1fd0c0);});}return{'runId':_0x1fd0c0,'runDir':_0x163a2a,'state':_0x380de6,'plan':_0x433ea7,'alreadyRunning':![]};}export async function resumeOwnProseBackgroundRun(_0x47d3bc){const _0x23209a=_0x4cc95f,{runDir:_0x29acd2,state:_0x4060f2,plan:_0x29dae9}=await loadOwnProseRunState(_0x47d3bc[_0x23209a(0x15f)],_0x47d3bc['api']['pluginConfig'],_0x47d3bc[_0x23209a(0x198)]);if(_0x4060f2[_0x23209a(0x154)]!==_0x23209a(0x1ef))return{'runId':_0x4060f2[_0x23209a(0x198)],'runDir':_0x29acd2,'state':_0x4060f2,'plan':_0x29dae9};const _0x3cd5fc=await loadProgramBundle(_0x4060f2[_0x23209a(0x148)]),_0x42ddc3=resolveOwnProseConfig(_0x47d3bc[_0x23209a(0x15f)],_0x47d3bc[_0x23209a(0x18f)][_0x23209a(0x152)]),_0x35d2e5=resolveRunRuntimeDefaults({'callerProvider':_0x4060f2['runtime'][_0x23209a(0x196)],'callerModel':_0x4060f2[_0x23209a(0x1f5)][_0x23209a(0x168)],'callerModelSource':_0x4060f2[_0x23209a(0x1f5)]['modelSource'],'pluginDefaultProvider':_0x42ddc3[_0x23209a(0x1bd)],'pluginDefaultModel':_0x42ddc3[_0x23209a(0x1da)]}),_0x3f5f00=await runInBackground({'api':_0x47d3bc[_0x23209a(0x18f)],'workspaceDir':_0x47d3bc['workspaceDir'],'runDir':_0x29acd2,'state':_0x4060f2,'program':_0x3cd5fc[_0x23209a(0x1b7)],'plan':_0x29dae9,'agents':_0x3cd5fc[_0x23209a(0x18d)],'inputs':_0x4060f2[_0x23209a(0x16e)],'defaultProvider':_0x35d2e5[_0x23209a(0x196)],'defaultModel':_0x35d2e5[_0x23209a(0x168)],'defaultTimeoutMs':_0x42ddc3[_0x23209a(0x17f)]});return{'runId':_0x4060f2['runId'],'runDir':_0x29acd2,'state':_0x3f5f00,'plan':_0x29dae9};}export async function waitForOwnProseBackgroundRun(_0x40ab32,_0x476386){const _0x36ee06=_0x4cc95f,_0x38cbdc=activeBackgroundRuns[_0x36ee06(0x1db)](_0x40ab32);return _0x38cbdc&&await _0x38cbdc,loadOwnProseRunState(_0x476386[_0x36ee06(0x15f)],_0x476386[_0x36ee06(0x152)],_0x40ab32);}export async function compileOwnProseProgram(_0x389bea){const _0x5b913f=_0x4cc95f,_0x3e93f7=await loadProgramBundle(_0x389bea[_0x5b913f(0x148)]),_0x3ae349=resolveOwnProseConfig(_0x389bea[_0x5b913f(0x15f)],_0x389bea['api']['pluginConfig']),_0x25f880=_0x515088[_0x5b913f(0x1ca)](_0x3ae349[_0x5b913f(0x181)],_0x5b913f(0x1e3));await ensureRunDirectories(_0x25f880);const _0x573ec5=await compilePlan({'api':_0x389bea[_0x5b913f(0x18f)],'workspaceDir':_0x389bea[_0x5b913f(0x15f)],'runDir':_0x25f880,'program':_0x3e93f7[_0x5b913f(0x1b7)],'agents':_0x3e93f7[_0x5b913f(0x18d)],'provider':_0x3ae349[_0x5b913f(0x1bd)],'model':_0x3ae349['defaultModel'],'timeoutMs':_0x3ae349[_0x5b913f(0x17f)]});return validateCompiledPlan(_0x573ec5,_0x3e93f7[_0x5b913f(0x1b7)],_0x3e93f7[_0x5b913f(0x18d)]),{'program':_0x3e93f7[_0x5b913f(0x1b7)],'agents':_0x3e93f7['agents'],'plan':_0x573ec5};}export async function inspectOwnProseProgramFile(_0x2477a1){return loadProgramBundle(_0x2477a1);}function resolveRunRuntimeDefaults(_0x57191c){const _0x2b7fed=_0x4cc95f;if(_0x57191c[_0x2b7fed(0x1e2)]||_0x57191c[_0x2b7fed(0x1eb)])return{'provider':_0x57191c[_0x2b7fed(0x1e2)],'model':_0x57191c[_0x2b7fed(0x1eb)],'source':_0x57191c['callerModelSource']??_0x2b7fed(0x1f8)};if(_0x57191c['pluginDefaultProvider']||_0x57191c[_0x2b7fed(0x1cc)])return{'provider':_0x57191c[_0x2b7fed(0x19d)],'model':_0x57191c[_0x2b7fed(0x1cc)],'source':_0x2b7fed(0x1d2)};return{};}export async function loadOwnProseRunState(_0x4b5c2e,_0x52b17f,_0x3fcde4){const _0x448652=resolveOwnProseConfig(_0x4b5c2e,_0x52b17f),_0x204009=getRunDir(_0x448652['stateRoot'],_0x3fcde4),_0x5bc28d=await readRunState(_0x204009),_0x275a9b=await readCompiledPlan(_0x204009);return{'runDir':_0x204009,'state':_0x5bc28d,'plan':_0x275a9b};}export function resolveOwnProseProgramPath(_0x55cbf0,_0x463329){const _0x10c986=_0x4cc95f;if(!_0x463329?.[_0x10c986(0x1ee)]())return undefined;const _0x4f0213=_0x463329[_0x10c986(0x1ee)]();if(_0x4f0213[_0x10c986(0x1d7)]('~/'))return _0x515088['join'](process.env.HOME??'',_0x4f0213[_0x10c986(0x188)](0x2));return _0x515088[_0x10c986(0x1c1)](_0x55cbf0,_0x4f0213);}export function renderOwnProseStatus(_0x249461){const _0x5f2a60=_0x4cc95f,_0x221be0=[_0x5f2a60(0x1fe)+_0x249461['runId'],'Status:\x20'+_0x249461[_0x5f2a60(0x154)],_0x249461[_0x5f2a60(0x1b2)]?'Background:\x20'+_0x249461['background'][_0x5f2a60(0x154)]:undefined,_0x249461[_0x5f2a60(0x1b2)]?.[_0x5f2a60(0x1a5)]?'Worker:\x20'+_0x249461['background'][_0x5f2a60(0x1a5)][_0x5f2a60(0x154)]+(_0x249461['background'][_0x5f2a60(0x1a5)]['sessionKey']?'\x20('+_0x249461['background']['worker'][_0x5f2a60(0x1b0)]+')':''):undefined,_0x249461[_0x5f2a60(0x1b2)]?.[_0x5f2a60(0x1ad)]?'Notification:\x20'+_0x249461['background'][_0x5f2a60(0x1ad)][_0x5f2a60(0x154)]:undefined,_0x5f2a60(0x170)+(_0x249461['currentNodeId']??'none'),'Steps\x20executed:\x20'+_0x249461[_0x5f2a60(0x1a6)]+'/'+_0x249461[_0x5f2a60(0x184)],_0x249461[_0x5f2a60(0x153)]?_0x5f2a60(0x194)+_0x249461[_0x5f2a60(0x153)]:undefined,_0x249461[_0x5f2a60(0x1aa)]?_0x5f2a60(0x1f9)+_0x249461['failure'][_0x5f2a60(0x155)]:undefined,'','Node\x20states:',...Object[_0x5f2a60(0x197)](_0x249461[_0x5f2a60(0x182)])[_0x5f2a60(0x1cd)](_0xe88c84=>'-\x20'+_0xe88c84[_0x5f2a60(0x156)]+':\x20'+_0xe88c84[_0x5f2a60(0x154)]+(_0xe88c84[_0x5f2a60(0x157)]?_0x5f2a60(0x165)+_0xe88c84[_0x5f2a60(0x157)]:''))];return _0x221be0['filter'](_0x499486=>Boolean(_0x499486))['join']('\x0a');}async function loadProgramBundle(_0x4c574a){const _0x1ef474=_0x4cc95f,_0x42667b=_0x515088[_0x1ef474(0x1c1)](_0x4c574a),_0x42dd58=await parseProgramFile(_0x42667b),_0x177308=await loadAgents(_0x42dd58[_0x1ef474(0x151)],_0x515088['dirname'](_0x42667b));return{'program':_0x42dd58,'agents':_0x177308};}function resolveProgramInputs(_0x31c1b1,_0x99b46a){const _0x51bc59=_0x4cc95f,_0x5119e9={..._0x99b46a};for(const _0x11f08a of _0x31c1b1[_0x51bc59(0x16e)]){_0x5119e9[_0x11f08a['key']]==null&&_0x11f08a[_0x51bc59(0x199)]!=null&&(_0x5119e9[_0x11f08a[_0x51bc59(0x19e)]]=_0x11f08a[_0x51bc59(0x199)]);if(_0x11f08a['required']&&_0x5119e9[_0x11f08a[_0x51bc59(0x19e)]]==null)throw new Error(_0x51bc59(0x177)+_0x11f08a[_0x51bc59(0x19e)]+'\x22');}return _0x5119e9;}async function executePlan(_0x32479c){const _0x3b9aa0=_0x4cc95f,_0x3b4058=new Map(_0x32479c[_0x3b9aa0(0x1cf)][_0x3b9aa0(0x192)][_0x3b9aa0(0x1cd)](_0x57b124=>[_0x57b124['id'],_0x57b124]));while(_0x32479c[_0x3b9aa0(0x1a2)][_0x3b9aa0(0x154)]===_0x3b9aa0(0x1ef)&&_0x32479c[_0x3b9aa0(0x1a2)][_0x3b9aa0(0x160)]){if(_0x32479c[_0x3b9aa0(0x1a2)]['stepsExecuted']>=_0x32479c[_0x3b9aa0(0x1a2)][_0x3b9aa0(0x184)]){await failRun(_0x32479c['runDir'],_0x32479c[_0x3b9aa0(0x1a2)],_0x32479c[_0x3b9aa0(0x1cf)],{'reason':_0x3b9aa0(0x174)+_0x32479c['state']['maxSteps']+')'});break;}const _0x59439f=_0x3b4058[_0x3b9aa0(0x1db)](_0x32479c['state'][_0x3b9aa0(0x160)]);if(!_0x59439f){await failRun(_0x32479c[_0x3b9aa0(0x18c)],_0x32479c[_0x3b9aa0(0x1a2)],_0x32479c[_0x3b9aa0(0x1cf)],{'nodeId':_0x32479c[_0x3b9aa0(0x1a2)][_0x3b9aa0(0x160)],'reason':_0x3b9aa0(0x1bc)+_0x32479c['state']['currentNodeId']+'\x22\x20does\x20not\x20exist'});break;}if(_0x59439f[_0x3b9aa0(0x17b)]===_0x3b9aa0(0x183)){_0x32479c[_0x3b9aa0(0x1a2)]['status']='completed',_0x32479c[_0x3b9aa0(0x1a2)][_0x3b9aa0(0x160)]=null,await appendTimeline(_0x32479c['runDir'],{'at':new Date()[_0x3b9aa0(0x195)](),'type':_0x3b9aa0(0x149),'runId':_0x32479c[_0x3b9aa0(0x1a2)][_0x3b9aa0(0x198)],'message':_0x3b9aa0(0x14b)}),await writeRunState(_0x32479c[_0x3b9aa0(0x18c)],_0x32479c[_0x3b9aa0(0x1a2)]),await writeResumeFile(_0x32479c[_0x3b9aa0(0x18c)],_0x32479c[_0x3b9aa0(0x1a2)],_0x32479c[_0x3b9aa0(0x1cf)]);break;}const _0x655af9=startNodeRecord(_0x32479c[_0x3b9aa0(0x1a2)],_0x59439f['id'],_0x59439f['agentId'],_0x59439f[_0x3b9aa0(0x161)][_0x3b9aa0(0x187)]);await appendTimeline(_0x32479c['runDir'],{'at':_0x655af9['startedAt'],'type':_0x3b9aa0(0x14d),'runId':_0x32479c['state'][_0x3b9aa0(0x198)],'nodeId':_0x59439f['id'],'message':'Started\x20'+_0x59439f['type']+_0x3b9aa0(0x1f3)+_0x59439f['id']}),await writeRunState(_0x32479c['runDir'],_0x32479c[_0x3b9aa0(0x1a2)]);try{if(_0x59439f[_0x3b9aa0(0x17b)]===_0x3b9aa0(0x1f6)){const _0x325ad9=await executeTaskNode({'api':_0x32479c[_0x3b9aa0(0x18f)],'workspaceDir':_0x32479c['workspaceDir'],'runDir':_0x32479c[_0x3b9aa0(0x18c)],'state':_0x32479c[_0x3b9aa0(0x1a2)],'program':_0x32479c[_0x3b9aa0(0x1b7)],'plan':_0x32479c[_0x3b9aa0(0x1cf)],'node':_0x59439f,'agent':_0x32479c[_0x3b9aa0(0x18d)][_0x59439f[_0x3b9aa0(0x1a8)]],'inputs':_0x32479c[_0x3b9aa0(0x16e)],'defaultProvider':_0x32479c[_0x3b9aa0(0x1bd)],'defaultModel':_0x32479c[_0x3b9aa0(0x1da)],'defaultTimeoutMs':_0x32479c['defaultTimeoutMs'],'background':_0x32479c[_0x3b9aa0(0x1b2)]}),_0xe80832=await writeArtifact(_0x32479c[_0x3b9aa0(0x18c)],_0x59439f['id'],_0x325ad9);_0x655af9[_0x3b9aa0(0x154)]=_0x3b9aa0(0x1ff),_0x655af9[_0x3b9aa0(0x1a3)]=new Date()[_0x3b9aa0(0x195)](),_0x655af9[_0x3b9aa0(0x1ae)]=_0xe80832,_0x655af9['summary']=summarizeText(_0x325ad9),_0x32479c['state'][_0x3b9aa0(0x15e)][_0x59439f['id']]=_0xe80832,_0x32479c[_0x3b9aa0(0x1a2)][_0x3b9aa0(0x1a6)]+=0x1;const _0x2a2c82=_0x59439f[_0x3b9aa0(0x1ec)]?_0x3b4058['get'](_0x59439f[_0x3b9aa0(0x1ec)]):undefined;(_0x2a2c82?.[_0x3b9aa0(0x17b)]==='finish'||_0x59439f[_0x3b9aa0(0x1ec)]==null)&&(_0x32479c[_0x3b9aa0(0x1a2)][_0x3b9aa0(0x153)]=_0xe80832),_0x32479c[_0x3b9aa0(0x1a2)][_0x3b9aa0(0x160)]=_0x59439f['next'],await appendTimeline(_0x32479c['runDir'],{'at':_0x655af9[_0x3b9aa0(0x1a3)],'type':'node_completed','runId':_0x32479c[_0x3b9aa0(0x1a2)][_0x3b9aa0(0x198)],'nodeId':_0x59439f['id'],'message':_0x655af9['summary']});}else{const _0x4c2812=await executeJudgeNode({'api':_0x32479c[_0x3b9aa0(0x18f)],'workspaceDir':_0x32479c[_0x3b9aa0(0x15f)],'runDir':_0x32479c['runDir'],'state':_0x32479c['state'],'program':_0x32479c[_0x3b9aa0(0x1b7)],'plan':_0x32479c[_0x3b9aa0(0x1cf)],'node':_0x59439f,'agent':_0x32479c['agents'][_0x59439f[_0x3b9aa0(0x1a8)]],'inputs':_0x32479c[_0x3b9aa0(0x16e)],'defaultProvider':_0x32479c[_0x3b9aa0(0x1bd)],'defaultModel':_0x32479c[_0x3b9aa0(0x1da)],'defaultTimeoutMs':_0x32479c[_0x3b9aa0(0x1e4)]});if(!_0x59439f[_0x3b9aa0(0x1f7)][_0x3b9aa0(0x158)](_0x4c2812[_0x3b9aa0(0x189)]))throw new Error(_0x3b9aa0(0x171)+_0x59439f['id']+_0x3b9aa0(0x1b3)+_0x4c2812[_0x3b9aa0(0x189)]+'\x22');const _0x58df20=_0x59439f[_0x3b9aa0(0x1bb)][_0x4c2812[_0x3b9aa0(0x189)]];_0x655af9[_0x3b9aa0(0x154)]=_0x3b9aa0(0x1ff),_0x655af9[_0x3b9aa0(0x1a3)]=new Date()[_0x3b9aa0(0x195)](),_0x655af9[_0x3b9aa0(0x157)]=''+_0x4c2812[_0x3b9aa0(0x189)]+(_0x4c2812['reason']?'\x20-\x20'+_0x4c2812[_0x3b9aa0(0x155)]:''),_0x32479c[_0x3b9aa0(0x1a2)][_0x3b9aa0(0x169)][_0x3b9aa0(0x16f)]({'nodeId':_0x59439f['id'],'agentId':_0x59439f[_0x3b9aa0(0x1a8)],'decision':_0x4c2812['decision'],'reason':_0x4c2812[_0x3b9aa0(0x155)],'decidedAt':_0x655af9[_0x3b9aa0(0x1a3)]}),_0x32479c[_0x3b9aa0(0x1a2)]['stepsExecuted']+=0x1,_0x32479c['state'][_0x3b9aa0(0x160)]=_0x58df20,await appendTimeline(_0x32479c['runDir'],{'at':_0x655af9['completedAt'],'type':_0x3b9aa0(0x164),'runId':_0x32479c[_0x3b9aa0(0x1a2)][_0x3b9aa0(0x198)],'nodeId':_0x59439f['id'],'branch':_0x4c2812[_0x3b9aa0(0x189)],'message':_0x655af9['summary']});}await writeRunState(_0x32479c[_0x3b9aa0(0x18c)],_0x32479c['state']),await writeResumeFile(_0x32479c[_0x3b9aa0(0x18c)],_0x32479c['state'],_0x32479c[_0x3b9aa0(0x1cf)]);}catch(_0x3f951a){_0x655af9[_0x3b9aa0(0x154)]=_0x3b9aa0(0x1fb),_0x655af9[_0x3b9aa0(0x1a3)]=new Date()['toISOString'](),_0x655af9[_0x3b9aa0(0x17e)]=_0x3f951a instanceof Error?_0x3f951a['message']:String(_0x3f951a),await failRun(_0x32479c[_0x3b9aa0(0x18c)],_0x32479c[_0x3b9aa0(0x1a2)],_0x32479c[_0x3b9aa0(0x1cf)],{'nodeId':_0x59439f['id'],'reason':_0x655af9['error']});break;}}return _0x32479c[_0x3b9aa0(0x1a2)];}function startNodeRecord(_0x5e8d23,_0x4eafcb,_0x354144,_0x436b5c){const _0x44c4f5=_0x4cc95f,_0x4def18=_0x5e8d23[_0x44c4f5(0x182)][_0x4eafcb],_0x4357f2=(_0x4def18?.[_0x44c4f5(0x1d8)]??0x0)+0x1,_0xfe6ba5={'nodeId':_0x4eafcb,'status':_0x44c4f5(0x1ef),'startedAt':new Date()[_0x44c4f5(0x195)](),'agentId':_0x354144,'executionTarget':_0x436b5c,'visitCount':_0x4357f2};return _0x5e8d23[_0x44c4f5(0x182)][_0x4eafcb]=_0xfe6ba5,_0xfe6ba5;}async function executeTaskNode(_0x15f200){const _0x3d15d4=_0x4cc95f,_0x4eef33=[_0x3d15d4(0x18b),'Return\x20only\x20the\x20deliverable\x20for\x20this\x20node.\x20Do\x20not\x20explain\x20your\x20process.','',_0x3d15d4(0x202)+_0x15f200[_0x3d15d4(0x1b7)][_0x3d15d4(0x1e0)],_0x3d15d4(0x1b6)+_0x15f200[_0x3d15d4(0x1c6)][_0x3d15d4(0x1ce)],_0x3d15d4(0x150)+_0x15f200[_0x3d15d4(0x1c6)]['goal'],'','Agent\x20role:',_0x15f200[_0x3d15d4(0x200)][_0x3d15d4(0x180)],'','Agent\x20instructions:',_0x15f200[_0x3d15d4(0x200)][_0x3d15d4(0x18e)],'','Node\x20instructions:',_0x15f200[_0x3d15d4(0x1c6)][_0x3d15d4(0x18e)],'','Done\x20when:',..._0x15f200[_0x3d15d4(0x1c6)][_0x3d15d4(0x1e1)][_0x3d15d4(0x1cd)](_0xd359c4=>'-\x20'+_0xd359c4),'',_0x3d15d4(0x16b),JSON['stringify'](_0x15f200[_0x3d15d4(0x16e)],null,0x2),'',_0x3d15d4(0x1ba),await buildPriorNodeContext(_0x15f200[_0x3d15d4(0x18c)],_0x15f200['state']),'',_0x3d15d4(0x15d),..._0x15f200[_0x3d15d4(0x1b7)][_0x3d15d4(0x19f)][_0x3d15d4(0x14c)][_0x3d15d4(0x1cd)](_0x323ca1=>'-\x20'+_0x323ca1)][_0x3d15d4(0x1ca)]('\x0a');if(_0x15f200[_0x3d15d4(0x1c6)][_0x3d15d4(0x161)]['executionTarget']===_0x3d15d4(0x1ab))return executeSubagentTaskNode({'api':_0x15f200['api'],'runDir':_0x15f200[_0x3d15d4(0x18c)],'state':_0x15f200[_0x3d15d4(0x1a2)],'node':_0x15f200[_0x3d15d4(0x1c6)],'agent':_0x15f200[_0x3d15d4(0x200)],'prompt':_0x4eef33,'timeoutMs':_0x15f200['agent']['timeoutMs']??_0x15f200[_0x3d15d4(0x1e4)],'provider':_0x15f200['agent'][_0x3d15d4(0x196)]??_0x15f200[_0x3d15d4(0x1bd)],'model':_0x15f200[_0x3d15d4(0x200)][_0x3d15d4(0x168)]??_0x15f200[_0x3d15d4(0x1da)]});return executeEmbeddedPrompt({'api':_0x15f200['api'],'workspaceDir':_0x15f200[_0x3d15d4(0x15f)],'runDir':_0x15f200[_0x3d15d4(0x18c)],'sessionId':_0x15f200[_0x3d15d4(0x1a2)][_0x3d15d4(0x198)]+':'+_0x15f200[_0x3d15d4(0x1c6)]['id'],'runId':_0x15f200[_0x3d15d4(0x1a2)][_0x3d15d4(0x198)]+':'+_0x15f200[_0x3d15d4(0x1c6)]['id'],'prompt':_0x4eef33,'provider':_0x15f200[_0x3d15d4(0x200)][_0x3d15d4(0x196)]??_0x15f200[_0x3d15d4(0x1bd)],'model':_0x15f200['agent'][_0x3d15d4(0x168)]??_0x15f200[_0x3d15d4(0x1da)],'timeoutMs':_0x15f200['agent'][_0x3d15d4(0x17f)]??_0x15f200[_0x3d15d4(0x1e4)]});}async function executeJudgeNode(_0x34743e){const _0x36bde0=_0x4cc95f,_0x2610a5=['You\x20are\x20executing\x20one\x20own-prose\x20judge\x20node.',_0x36bde0(0x18a),_0x36bde0(0x15c),'',_0x36bde0(0x202)+_0x34743e[_0x36bde0(0x1b7)][_0x36bde0(0x1e0)],_0x36bde0(0x1d1)+_0x34743e[_0x36bde0(0x1c6)][_0x36bde0(0x1ce)],'Question:\x20'+_0x34743e[_0x36bde0(0x1c6)][_0x36bde0(0x1c2)],'',_0x36bde0(0x1cb),_0x34743e['agent'][_0x36bde0(0x180)],'',_0x36bde0(0x16d),_0x34743e['agent'][_0x36bde0(0x18e)],'',_0x36bde0(0x1e8),_0x34743e[_0x36bde0(0x1c6)][_0x36bde0(0x18e)],'','Allowed\x20branches:\x20'+_0x34743e[_0x36bde0(0x1c6)][_0x36bde0(0x1f7)][_0x36bde0(0x1ca)](',\x20'),'','Inputs\x20JSON:',JSON['stringify'](_0x34743e[_0x36bde0(0x16e)],null,0x2),'','Previous\x20completed\x20node\x20outputs:',await buildPriorNodeContext(_0x34743e['runDir'],_0x34743e[_0x36bde0(0x1a2)])][_0x36bde0(0x1ca)]('\x0a'),_0x294329=await executeEmbeddedPrompt({'api':_0x34743e['api'],'workspaceDir':_0x34743e[_0x36bde0(0x15f)],'runDir':_0x34743e[_0x36bde0(0x18c)],'sessionId':_0x34743e['state'][_0x36bde0(0x198)]+':'+_0x34743e[_0x36bde0(0x1c6)]['id'],'runId':_0x34743e['state'][_0x36bde0(0x198)]+':'+_0x34743e[_0x36bde0(0x1c6)]['id'],'prompt':_0x2610a5,'provider':_0x34743e[_0x36bde0(0x200)][_0x36bde0(0x196)]??_0x34743e[_0x36bde0(0x1bd)],'model':_0x34743e[_0x36bde0(0x200)][_0x36bde0(0x168)]??_0x34743e[_0x36bde0(0x1da)],'timeoutMs':_0x34743e[_0x36bde0(0x200)][_0x36bde0(0x17f)]??_0x34743e[_0x36bde0(0x1e4)]});return parseJudgeDecision(_0x294329);}async function executeSubagentTaskNode(_0x54b136){const _0x44bc0e=_0x4cc95f,_0x2c6870=_0x54b136[_0x44bc0e(0x1a2)][_0x44bc0e(0x182)][_0x54b136['node']['id']],_0x21bc13='own-prose:'+_0x54b136[_0x44bc0e(0x1a2)][_0x44bc0e(0x198)]+':'+_0x54b136[_0x44bc0e(0x1c6)]['id']+':v'+(_0x2c6870?.['visitCount']??0x1);try{const _0x40db69=await _0x54b136[_0x44bc0e(0x18f)][_0x44bc0e(0x1f5)]['subagent'][_0x44bc0e(0x17a)]({'sessionKey':_0x21bc13,'message':_0x54b136[_0x44bc0e(0x14f)],'deliver':![],..._0x54b136[_0x44bc0e(0x196)]?{'provider':_0x54b136[_0x44bc0e(0x196)]}:{},..._0x54b136[_0x44bc0e(0x168)]?{'model':_0x54b136[_0x44bc0e(0x168)]}:{}});_0x2c6870&&(_0x2c6870['sessionKey']=_0x21bc13,_0x2c6870[_0x44bc0e(0x15a)]=_0x40db69['runId'],await writeRunState(_0x54b136['runDir'],_0x54b136[_0x44bc0e(0x1a2)]));const _0x154715=await _0x54b136[_0x44bc0e(0x18f)][_0x44bc0e(0x1f5)]['subagent']['waitForRun']({'runId':_0x40db69[_0x44bc0e(0x198)],'timeoutMs':_0x54b136[_0x44bc0e(0x17f)]});if(_0x154715['status']!=='ok')throw new Error(_0x154715[_0x44bc0e(0x154)]===_0x44bc0e(0x167)?_0x44bc0e(0x1b5)+_0x54b136[_0x44bc0e(0x1c6)]['id']:_0x44bc0e(0x204)+(_0x154715[_0x44bc0e(0x17e)]??_0x54b136[_0x44bc0e(0x1c6)]['id']));const _0x4ce520=await _0x54b136[_0x44bc0e(0x18f)]['runtime'][_0x44bc0e(0x1ab)][_0x44bc0e(0x166)]({'sessionKey':_0x21bc13,'limit':0xc8});return extractSubagentOutputText(_0x4ce520[_0x44bc0e(0x201)]);}catch(_0x17e6bd){if(!isUnavailablePluginSubagentRuntimeError(_0x17e6bd))throw _0x17e6bd;}const _0x4c0da8=_0x54b136[_0x44bc0e(0x1a2)][_0x44bc0e(0x1f5)][_0x44bc0e(0x1a8)]??_0x54b136[_0x44bc0e(0x1a2)]['background']?.[_0x44bc0e(0x1dc)];if(!_0x4c0da8)throw new Error(_0x44bc0e(0x206));const _0x42b0e4=await queueAgentSessionRun({'sessionKey':_0x21bc13,'agentId':_0x4c0da8,'label':'own-prose\x20task\x20'+_0x54b136['state'][_0x44bc0e(0x198)]+':'+_0x54b136['node']['id'],'message':_0x54b136[_0x44bc0e(0x14f)]});_0x2c6870&&(_0x2c6870[_0x44bc0e(0x1b0)]=_0x21bc13,_0x2c6870[_0x44bc0e(0x15a)]=_0x42b0e4[_0x44bc0e(0x198)],await writeRunState(_0x54b136[_0x44bc0e(0x18c)],_0x54b136[_0x44bc0e(0x1a2)]));const _0x37cac9=await waitForAgentSessionRun({'runId':_0x42b0e4[_0x44bc0e(0x198)],'timeoutMs':_0x54b136['timeoutMs']});if(_0x37cac9['status']!=='ok')throw new Error(_0x37cac9[_0x44bc0e(0x154)]==='timeout'?_0x44bc0e(0x1b5)+_0x54b136[_0x44bc0e(0x1c6)]['id']:_0x44bc0e(0x204)+(_0x37cac9['error']??_0x54b136[_0x44bc0e(0x1c6)]['id']));const _0x4216d9=await getAgentSessionMessages({'sessionKey':_0x21bc13,'limit':0xc8});return extractSubagentOutputText(_0x4216d9['messages']);}async function executeEmbeddedPrompt(_0x54507f){const _0x29b13e=_0x4cc95f,_0x3e31c8=await _0x54507f[_0x29b13e(0x18f)][_0x29b13e(0x1f5)]['agent'][_0x29b13e(0x19c)]({'sessionId':_0x54507f[_0x29b13e(0x1a9)],'runId':_0x54507f[_0x29b13e(0x198)],'sessionFile':_0x515088[_0x29b13e(0x1ca)](_0x54507f[_0x29b13e(0x18c)],_0x29b13e(0x1a1),sanitizeId(_0x54507f[_0x29b13e(0x1a9)])+'.jsonl'),'workspaceDir':_0x54507f['workspaceDir'],'config':_0x54507f[_0x29b13e(0x18f)][_0x29b13e(0x1f2)],'lane':OWN_PROSE_EMBEDDED_LANE,'prompt':_0x54507f[_0x29b13e(0x14f)],'timeoutMs':_0x54507f[_0x29b13e(0x17f)],..._0x54507f[_0x29b13e(0x196)]?{'provider':_0x54507f[_0x29b13e(0x196)]}:{},..._0x54507f[_0x29b13e(0x168)]?{'model':_0x54507f[_0x29b13e(0x168)]}:{}}),_0x539c8c=extractEmbeddedRunOutputText(_0x3e31c8[_0x29b13e(0x1ac)]);if(_0x539c8c)return _0x539c8c;const _0x1cd551=_0x3e31c8['meta']?.[_0x29b13e(0x17e)]?.[_0x29b13e(0x1fd)]?.[_0x29b13e(0x1ee)]();throw new Error(_0x1cd551||_0x29b13e(0x162));}async function buildPriorNodeContext(_0x100703,_0x2fe46e){const _0x478827=_0x4cc95f,_0x31ba8b=await Promise[_0x478827(0x16c)](Object[_0x478827(0x176)](_0x2fe46e[_0x478827(0x15e)])[_0x478827(0x1cd)](async([_0x261fe8,_0x9724fe])=>{const _0x117a19=_0x478827,_0x36cbe3=await _0x12c6e2[_0x117a19(0x1c3)](_0x515088[_0x117a19(0x1c1)](_0x100703,_0x9724fe),_0x117a19(0x1de))[_0x117a19(0x191)](()=>'');return _0x117a19(0x173)+_0x261fe8+'\x0a'+truncateText(_0x36cbe3,0x5dc);}));return _0x31ba8b[_0x478827(0x159)]>0x0?_0x31ba8b[_0x478827(0x1ca)]('\x0a\x0a'):_0x478827(0x1f1);}function parseJudgeDecision(_0x480c7f){const _0x2713ca=_0x4cc95f,_0x3df1a1=_0x480c7f[_0x2713ca(0x1ee)]();try{const _0x2c7594=extractJsonObject(_0x3df1a1),_0x13c80b=JSON[_0x2713ca(0x190)](_0x2c7594),_0x3bbffa=typeof _0x13c80b[_0x2713ca(0x189)]==='string'?_0x13c80b[_0x2713ca(0x189)][_0x2713ca(0x1ee)]():'';if(!_0x3bbffa)throw new Error('Judge\x20output\x20is\x20missing\x20decision');const _0x58a804=typeof _0x13c80b[_0x2713ca(0x155)]===_0x2713ca(0x1d3)&&_0x13c80b['reason'][_0x2713ca(0x1ee)]()?_0x13c80b[_0x2713ca(0x155)][_0x2713ca(0x1ee)]():undefined;return{'decision':_0x3bbffa,'reason':_0x58a804};}catch{if(_0x3df1a1&&!_0x3df1a1[_0x2713ca(0x158)]('\x0a'))return{'decision':_0x3df1a1};throw new Error('Judge\x20output\x20must\x20be\x20JSON\x20or\x20a\x20single\x20branch\x20token');}}async function failRun(_0x2c29e4,_0x2e96d8,_0x9c57d1,_0x2e9cb5){const _0x22ab88=_0x4cc95f;_0x2e96d8[_0x22ab88(0x154)]='failed',_0x2e96d8[_0x22ab88(0x1aa)]=_0x2e9cb5,await appendTimeline(_0x2c29e4,{'at':new Date()[_0x22ab88(0x195)](),'type':'run_failed','runId':_0x2e96d8[_0x22ab88(0x198)],'nodeId':_0x2e9cb5['nodeId'],'message':_0x2e9cb5[_0x22ab88(0x155)]}),await writeRunState(_0x2c29e4,_0x2e96d8),await writeResumeFile(_0x2c29e4,_0x2e96d8,_0x9c57d1);}async function runInBackground(_0x2f46f3){const _0x4a8c6d=_0x4cc95f;_0x2f46f3[_0x4a8c6d(0x1a2)][_0x4a8c6d(0x1b2)]={..._0x2f46f3[_0x4a8c6d(0x1a2)]['background']??{'mode':_0x4a8c6d(0x1b2),'startedAt':new Date()[_0x4a8c6d(0x195)]()},'mode':_0x4a8c6d(0x1b2),'status':'running'};_0x2f46f3[_0x4a8c6d(0x1a2)][_0x4a8c6d(0x1b2)][_0x4a8c6d(0x1a5)]&&(_0x2f46f3[_0x4a8c6d(0x1a2)]['background'][_0x4a8c6d(0x1a5)]={..._0x2f46f3[_0x4a8c6d(0x1a2)][_0x4a8c6d(0x1b2)][_0x4a8c6d(0x1a5)],'status':_0x4a8c6d(0x1ef),'startedAt':new Date()[_0x4a8c6d(0x195)](),'error':undefined});await writeRunState(_0x2f46f3[_0x4a8c6d(0x18c)],_0x2f46f3[_0x4a8c6d(0x1a2)]),await writeResumeFile(_0x2f46f3[_0x4a8c6d(0x18c)],_0x2f46f3[_0x4a8c6d(0x1a2)],_0x2f46f3['plan']);const _0x43cde0=await executePlan({..._0x2f46f3,'background':!![]});return _0x43cde0['background']={..._0x43cde0[_0x4a8c6d(0x1b2)]??{'mode':_0x4a8c6d(0x1b2),'startedAt':new Date()[_0x4a8c6d(0x195)]()},'mode':'background','status':_0x43cde0[_0x4a8c6d(0x154)]==='completed'?'finished':_0x4a8c6d(0x1fb),'finishedAt':new Date()[_0x4a8c6d(0x195)]()},_0x43cde0['background'][_0x4a8c6d(0x1a5)]&&(_0x43cde0[_0x4a8c6d(0x1b2)][_0x4a8c6d(0x1a5)]={..._0x43cde0[_0x4a8c6d(0x1b2)]['worker'],'status':_0x43cde0[_0x4a8c6d(0x154)]==='completed'?'finished':_0x4a8c6d(0x1fb),'finishedAt':new Date()[_0x4a8c6d(0x195)](),'error':_0x43cde0[_0x4a8c6d(0x1aa)]?.[_0x4a8c6d(0x155)]}),await writeRunState(_0x2f46f3[_0x4a8c6d(0x18c)],_0x43cde0),await writeResumeFile(_0x2f46f3[_0x4a8c6d(0x18c)],_0x43cde0,_0x2f46f3[_0x4a8c6d(0x1cf)]),await notifyBackgroundRunFinished({'runDir':_0x2f46f3[_0x4a8c6d(0x18c)],'state':_0x43cde0,'plan':_0x2f46f3[_0x4a8c6d(0x1cf)]}),_0x43cde0;}async function notifyBackgroundRunFinished(_0x358b5e){const _0x44f2a2=_0x4cc95f,_0x261684=_0x358b5e['state'][_0x44f2a2(0x1b2)];if(!_0x261684)return;const _0x10e0aa=new Date()[_0x44f2a2(0x195)](),_0x2b49de=_0x261684[_0x44f2a2(0x186)]?.[_0x44f2a2(0x1ee)]();if(!_0x2b49de){_0x261684[_0x44f2a2(0x1ad)]={'status':_0x44f2a2(0x1a4),'attemptedAt':_0x10e0aa},await writeRunState(_0x358b5e[_0x44f2a2(0x18c)],_0x358b5e[_0x44f2a2(0x1a2)]),await writeResumeFile(_0x358b5e[_0x44f2a2(0x18c)],_0x358b5e[_0x44f2a2(0x1a2)],_0x358b5e[_0x44f2a2(0x1cf)]),await appendTimeline(_0x358b5e[_0x44f2a2(0x18c)],{'at':_0x10e0aa,'type':'notification_skipped','runId':_0x358b5e[_0x44f2a2(0x1a2)][_0x44f2a2(0x198)],'message':'Skipped\x20background\x20notification\x20because\x20no\x20origin\x20session\x20was\x20recorded'});return;}_0x261684[_0x44f2a2(0x1ad)]={'status':_0x44f2a2(0x205),'attemptedAt':_0x10e0aa},await writeRunState(_0x358b5e['runDir'],_0x358b5e[_0x44f2a2(0x1a2)]),await writeResumeFile(_0x358b5e['runDir'],_0x358b5e[_0x44f2a2(0x1a2)],_0x358b5e[_0x44f2a2(0x1cf)]);try{const _0x5ed31c=await notifyAgentSession({'sessionKey':_0x2b49de,'message':await buildOwnProseNotificationMessage(_0x358b5e[_0x44f2a2(0x18c)],_0x358b5e[_0x44f2a2(0x1a2)],_0x358b5e['plan'])});_0x261684[_0x44f2a2(0x1ad)]={'status':'queued','attemptedAt':_0x10e0aa,'queuedAt':new Date()[_0x44f2a2(0x195)](),'runId':_0x5ed31c[_0x44f2a2(0x198)]};const _0x4b9837=_0x261684[_0x44f2a2(0x1ad)][_0x44f2a2(0x1c8)]??new Date()['toISOString']();await appendTimeline(_0x358b5e[_0x44f2a2(0x18c)],{'at':_0x4b9837,'type':'notification_sent','runId':_0x358b5e['state'][_0x44f2a2(0x198)],'message':_0x44f2a2(0x207)+_0x2b49de+_0x44f2a2(0x185)+_0x5ed31c[_0x44f2a2(0x198)]});}catch(_0x233901){const _0x48668d=_0x233901 instanceof Error?_0x233901[_0x44f2a2(0x1fd)]:String(_0x233901);_0x261684[_0x44f2a2(0x1ad)]={'status':_0x44f2a2(0x1fb),'attemptedAt':_0x10e0aa,'error':_0x48668d},await appendTimeline(_0x358b5e[_0x44f2a2(0x18c)],{'at':new Date()['toISOString'](),'type':_0x44f2a2(0x1e6),'runId':_0x358b5e['state']['runId'],'message':_0x48668d});}await writeRunState(_0x358b5e[_0x44f2a2(0x18c)],_0x358b5e[_0x44f2a2(0x1a2)]),await writeResumeFile(_0x358b5e['runDir'],_0x358b5e[_0x44f2a2(0x1a2)],_0x358b5e['plan']);}async function queueBackgroundWorkerRun(_0x1baab4){const _0x10b721=_0x4cc95f,_0x426000=_0x1baab4[_0x10b721(0x1a8)]?.[_0x10b721(0x1ee)]()?_0x10b721(0x179)+_0x1baab4[_0x10b721(0x1a8)][_0x10b721(0x1ee)]()+':'+_0x1baab4[_0x10b721(0x198)]:_0x1baab4[_0x10b721(0x1b0)][_0x10b721(0x1ee)](),_0x3e3f7c=await queueAgentSessionRun({'sessionKey':_0x426000,'agentId':_0x1baab4['agentId']?.[_0x10b721(0x1ee)]()||undefined,'label':_0x10b721(0x1af)+_0x1baab4[_0x10b721(0x198)],'message':[_0x10b721(0x19b),_0x10b721(0x1b8)+_0x1baab4[_0x10b721(0x198)]+'\x22.','Do\x20not\x20call\x20own_prose_start,\x20own_prose_drive,\x20or\x20own_prose_status.','After\x20the\x20tool\x20finishes,\x20reply\x20only\x20with\x20'+NO_REPLY_TOKEN+'.']['join']('\x0a'),'extraSystemPrompt':[_0x10b721(0x1c5),_0x10b721(0x1c4),_0x10b721(0x1a7),_0x10b721(0x1a0),'After\x20the\x20tool\x20succeeds\x20or\x20fails,\x20respond\x20with\x20exactly\x20'+NO_REPLY_TOKEN+'.']['join']('\x0a')});return{'runId':_0x3e3f7c[_0x10b721(0x198)],'sessionKey':_0x426000};}async function buildOwnProseNotificationMessage(_0x418330,_0x2c599a,_0x36cd35){const _0x52c039=_0x4cc95f,_0x336c9d=await readFinalOutputMaybe(_0x2c599a['finalOutputPath']);return[_0x52c039(0x163),_0x52c039(0x16a)+_0x2c599a['runId'],_0x52c039(0x1c7)+_0x36cd35[_0x52c039(0x1c9)],'Status:\x20'+_0x2c599a['status'],_0x2c599a[_0x52c039(0x160)]?_0x52c039(0x170)+_0x2c599a['currentNodeId']:undefined,_0x2c599a[_0x52c039(0x1aa)]?_0x52c039(0x1f9)+_0x2c599a[_0x52c039(0x1aa)][_0x52c039(0x155)]:undefined,_0x336c9d?'':undefined,_0x336c9d?'Final\x20output:':undefined,_0x336c9d][_0x52c039(0x203)](_0x3960d4=>Boolean(_0x3960d4))[_0x52c039(0x1ca)]('\x0a');}async function readFinalOutputMaybe(_0x558baf){const _0x3c9c7b=_0x4cc95f;if(!_0x558baf)return undefined;const _0x5e144d=await _0x12c6e2[_0x3c9c7b(0x1c3)](_0x558baf,_0x3c9c7b(0x1de))['catch'](()=>''),_0x1f6003=_0x5e144d[_0x3c9c7b(0x1ee)]();return _0x1f6003||undefined;}function summarizeText(_0x476ae0,_0x3d2e9f=0xa0){return truncateText(_0x476ae0['replace'](/\s+/g,'\x20')['trim'](),_0x3d2e9f);}function truncateText(_0xc4a45b,_0x13fedf){const _0x3609d8=_0x4cc95f;if(_0xc4a45b['length']<=_0x13fedf)return _0xc4a45b;return _0xc4a45b['slice'](0x0,_0x13fedf-0x1)+_0x3609d8(0x1fc);}function sanitizeId(_0x29ea8f){const _0x3b82e7=_0x4cc95f;return _0x29ea8f[_0x3b82e7(0x178)](/[^a-zA-Z0-9._-]+/g,'_');}function extractEmbeddedRunOutputText(_0x29d4b4){const _0x52389d=_0x4cc95f;if(!Array[_0x52389d(0x1b4)](_0x29d4b4))return undefined;for(let _0x51415b=_0x29d4b4[_0x52389d(0x159)]-0x1;_0x51415b>=0x0;_0x51415b-=0x1){const _0x18cd30=_0x29d4b4[_0x51415b];if(_0x18cd30?.['isError'])continue;const _0x1891f9=_0x18cd30?.[_0x52389d(0x1b9)]?.[_0x52389d(0x1ee)]();if(_0x1891f9)return _0x1891f9;}return undefined;}function extractSubagentOutputText(_0x20832c){const _0x31415a=_0x4cc95f;for(let _0x5deb00=_0x20832c['length']-0x1;_0x5deb00>=0x0;_0x5deb00-=0x1){const _0x1b562f=extractAssistantText(_0x20832c[_0x5deb00]);if(_0x1b562f)return _0x1b562f;}throw new Error(_0x31415a(0x1e5));}function extractAssistantText(_0x5af98c){const _0x1cdc70=_0x4cc95f,_0x2b5a46=readRecordMaybe(_0x5af98c),_0x1194b6=readRecordMaybe(_0x2b5a46?.['message'])??_0x2b5a46;if(readStringMaybe(_0x1194b6?.[_0x1cdc70(0x180)])!==_0x1cdc70(0x1f0))return undefined;const _0x31493f=_0x1194b6?.[_0x1cdc70(0x1d5)];if(typeof _0x31493f===_0x1cdc70(0x1d3)&&_0x31493f['trim']())return _0x31493f['trim']();if(!Array[_0x1cdc70(0x1b4)](_0x31493f))return undefined;const _0x3ee5a3=_0x31493f[_0x1cdc70(0x1cd)](_0x431a4e=>{const _0x417f3e=_0x1cdc70,_0x16ec63=readRecordMaybe(_0x431a4e);if(typeof _0x16ec63?.['text']===_0x417f3e(0x1d3)&&_0x16ec63[_0x417f3e(0x1b9)][_0x417f3e(0x1ee)]())return _0x16ec63['text'][_0x417f3e(0x1ee)]();return undefined;})[_0x1cdc70(0x203)](_0x333591=>Boolean(_0x333591));return _0x3ee5a3[_0x1cdc70(0x159)]>0x0?_0x3ee5a3['join']('\x0a')['trim']():undefined;}function extractJsonObject(_0x28a8d4){const _0x45a409=_0x4cc95f,_0x507b12=_0x28a8d4[_0x45a409(0x1ee)]();if(_0x507b12[_0x45a409(0x1d7)]('{')&&_0x507b12[_0x45a409(0x1e9)]('}'))return _0x507b12;const _0x5a1193=/```(?:json)?\s*([\s\S]*?)```/i[_0x45a409(0x19a)](_0x507b12);if(_0x5a1193?.[0x1]?.[_0x45a409(0x1ee)]())return _0x5a1193[0x1][_0x45a409(0x1ee)]();const _0x484c9c=_0x507b12[_0x45a409(0x1dd)]('{'),_0x4db514=_0x507b12[_0x45a409(0x175)]('}');if(_0x484c9c>=0x0&&_0x4db514>_0x484c9c)return _0x507b12[_0x45a409(0x188)](_0x484c9c,_0x4db514+0x1);throw new Error(_0x45a409(0x1df));}function _0x1508(){const _0xd9fcc8=['run_completed','815904uOzReQ','Workflow\x20complete','requirements','node_started','7mjsBSs','prompt','Node\x20goal:\x20','agentIds','pluginConfig','finalOutputPath','status','reason','nodeId','summary','includes','length','subagentRunId','source','Do\x20not\x20include\x20markdown\x20fences.','Final\x20output\x20contract:','artifacts','workspaceDir','currentNodeId','permissions','Embedded\x20node\x20run\x20returned\x20no\x20output','own-prose\x20background\x20run\x20finished.','branch_decided','\x20-\x20','getSessionMessages','timeout','model','branchDecisions','Run\x20ID:\x20','Inputs\x20JSON:','all','Agent\x20instructions:','inputs','push','Current\x20node:\x20','Judge\x20node\x20\x22','370312DMBPyr','###\x20','Run\x20exceeded\x20max\x20steps\x20(','lastIndexOf','entries','Missing\x20required\x20input\x20\x22','replace','own-prose:bg:','run','type','41286FFTVHf','runs','error','timeoutMs','role','stateRoot','nodeStates','finish','maxSteps','\x20as\x20agent\x20run\x20','originSessionKey','executionTarget','slice','decision','Return\x20JSON\x20only\x20with\x20shape\x20{\x22decision\x22:\x22branch_key\x22,\x22reason\x22:\x22optional\x20short\x20reason\x22}.','You\x20are\x20executing\x20one\x20own-prose\x20task\x20node.','runDir','agents','instructions','api','parse','catch','nodes','set','Final\x20output:\x20','toISOString','provider','values','runId','defaultValue','exec','Internal\x20own-prose\x20background\x20continuation\x20request.','runEmbeddedPiAgent','pluginDefaultProvider','key','outputContract','Do\x20not\x20call\x20any\x20other\x20own-prose\x20tool.','sessions','state','completedAt','skipped','worker','stepsExecuted','Do\x20not\x20ask\x20follow-up\x20questions.','agentId','sessionId','failure','subagent','payloads','notification','artifactPath','own-prose\x20background\x20','sessionKey','25LvjXuc','background','\x22\x20returned\x20invalid\x20branch\x20\x22','isArray','Subagent\x20task\x20timed\x20out:\x20','Node\x20title:\x20','program','Run\x20the\x20`own_prose_background_run`\x20tool\x20with\x20runId\x20\x22','text','Previous\x20completed\x20node\x20outputs:','branches','Current\x20node\x20\x22','defaultProvider','659332OQsBRE','callerModelSource','1719tpUAhW','resolve','question','readFile','You\x20must\x20call\x20the\x20own_prose_background_run\x20tool\x20exactly\x20once\x20with\x20the\x20provided\x20runId.','This\x20is\x20an\x20internal\x20own-prose\x20background\x20worker\x20request.','node','Program:\x20','queuedAt','programName','join','Agent\x20role:','pluginDefaultModel','map','title','plan','queued','Judge\x20title:\x20','plugin_default','string','sourcePath','content','delete','startsWith','visitCount','mkdir','defaultModel','get','originAgentId','indexOf','utf8','Unable\x20to\x20locate\x20JSON\x20object\x20in\x20output','goal','doneWhen','callerProvider','compile-preview','defaultTimeoutMs','Subagent\x20run\x20returned\x20no\x20assistant\x20output','notification_failed','1825740rPjTXu','Judge\x20instructions:','endsWith','502NPPtEh','callerModel','next','Plugin\x20runtime\x20subagent\x20methods\x20are\x20only\x20available\x20during\x20a\x20gateway\x20request.','trim','running','assistant','None','config','\x20node\x20','nested','runtime','task','allowedBranches','caller_session','Failure:\x20','89478roDwmE','failed','...','message','Run:\x20','completed','agent','messages','Program\x20goal:\x20','filter','Subagent\x20task\x20failed:\x20','pending','Subagent\x20runtime\x20unavailable\x20and\x20no\x20OpenClaw\x20agent\x20context\x20was\x20recorded\x20for\x20gateway\x20fallback.','Queued\x20background\x20notification\x20to\x20','programPath'];_0x1508=function(){return _0xd9fcc8;};return _0x1508();}function readRecordMaybe(_0x6f4b56){return _0x6f4b56&&typeof _0x6f4b56==='object'&&!Array['isArray'](_0x6f4b56)?_0x6f4b56:undefined;}function readStringMaybe(_0x34f0c1){const _0x40eecc=_0x4cc95f;return typeof _0x34f0c1===_0x40eecc(0x1d3)&&_0x34f0c1[_0x40eecc(0x1ee)]()?_0x34f0c1[_0x40eecc(0x1ee)]():undefined;}function isUnavailablePluginSubagentRuntimeError(_0x4decbc){const _0x565127=_0x4cc95f;return _0x4decbc instanceof Error&&_0x4decbc[_0x565127(0x1fd)]['includes'](_0x565127(0x1ed));}
|
|
@@ -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
|
+
const _0x6d3518=_0x29ab;(function(_0x511ff2,_0x2a7da2){const _0x4f50ef=_0x29ab,_0x9ee1b6=_0x511ff2();while(!![]){try{const _0x48251b=-parseInt(_0x4f50ef(0x148))/0x1*(parseInt(_0x4f50ef(0x16d))/0x2)+-parseInt(_0x4f50ef(0x16a))/0x3*(parseInt(_0x4f50ef(0x147))/0x4)+parseInt(_0x4f50ef(0x13d))/0x5*(parseInt(_0x4f50ef(0x14e))/0x6)+parseInt(_0x4f50ef(0x15e))/0x7+-parseInt(_0x4f50ef(0x132))/0x8*(parseInt(_0x4f50ef(0x166))/0x9)+parseInt(_0x4f50ef(0x11f))/0xa+-parseInt(_0x4f50ef(0x14f))/0xb*(-parseInt(_0x4f50ef(0x130))/0xc);if(_0x48251b===_0x2a7da2)break;else _0x9ee1b6['push'](_0x9ee1b6['shift']());}catch(_0x435b84){_0x9ee1b6['push'](_0x9ee1b6['shift']());}}}(_0x4526,0xe013b));import{randomUUID}from'node:crypto';function _0x29ab(_0x2aef03,_0x48dc24){_0x2aef03=_0x2aef03-0x11a;const _0x4526de=_0x4526();let _0x29ab63=_0x4526de[_0x2aef03];return _0x29ab63;}import _0x450e60 from'node:path';function _0x4526(){const _0x5be883=['permissions','entries','finish','allowedBranches','.jsonl','isFinite','instructions','nodes[','trim','summary','trunc','-\x20finish\x20nodes\x20must\x20set:\x20id,\x20type,\x20title.','stringify','outputContract','min','exec','runId','{\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}]}','].question','runEmbeddedPiAgent','9385480ZKhjpp','branches','entryNodeId','error','\x20references\x20unknown\x20agent\x20\x22','].title','lastIndexOf','nodes','task','].branches.','text','Compiled\x20plan\x20must\x20contain\x20a\x20non-empty\x20nodes\x20array','maxSteps','provider','endsWith','agents','api','48QSBMYv','judge','312BdIsVK','constraints','filter','question','string','Compiled\x20node\x20','Convert\x20the\x20user\x27s\x20natural-language\x20workflow\x20into\x20a\x20strict\x20JSON\x20execution\x20plan.','next','payloads','\x20must\x20be\x20a\x20non-empty\x20string','workspaceDir','2135FgkEsU','].id','-\x20judge\x20nodes\x20must\x20set:\x20id,\x20type,\x20title,\x20agentId,\x20question,\x20instructions,\x20allowedBranches,\x20branches.','nested','isArray','runtime','model','parse','type','length','12QzvVql','195514smboNC','own-prose-compile:','timeoutMs','title','replace','own-prose:compile:','7602pDEnDy','7733099ofOyBZ','meta','\x20must\x20be\x20an\x20object','].branches','Return\x20this\x20JSON\x20shape:','sessionId','-\x20Do\x20not\x20include\x20permissions\x20in\x20the\x20output.','].instructions','now','-\x20entryNodeId\x20must\x20point\x20to\x20the\x20first\x20executable\x20node.','doneWhen','role','goal','].type','Rules:','29792iUoSQY','program','fromEntries','indexOf','-\x20maxSteps\x20must\x20not\x20exceed\x20the\x20program\x20maxSteps.','object','-\x20task\x20nodes\x20must\x20set:\x20id,\x20type,\x20title,\x20agentId,\x20goal,\x20instructions,\x20doneWhen,\x20next.','name','233775YPETAQ','runDir','map','-\x20Supported\x20node\x20types:\x20task,\x20judge,\x20finish.','1191921hiKxHj','agentId','values','12jIkrgg','slice','isError','-\x20If\x20allowLoops\x20is\x20false,\x20do\x20not\x20create\x20loops.','\x20has\x20unsupported\x20type\x20\x22','agent','join'];_0x4526=function(){return _0x5be883;};return _0x4526();}const OWN_PROSE_EMBEDDED_LANE=_0x6d3518(0x140);export async function compilePlan(_0x9a5c3f){const _0x245862=_0x6d3518,_0x5b7030=buildCompilePrompt(_0x9a5c3f[_0x245862(0x15f)],_0x9a5c3f['agents']),_0x2468a9=randomUUID(),_0xcfe906=await runEmbeddedPrompt({'api':_0x9a5c3f[_0x245862(0x12f)],'workspaceDir':_0x9a5c3f[_0x245862(0x13c)],'runDir':_0x9a5c3f['runDir'],'sessionId':_0x245862(0x14d)+_0x9a5c3f[_0x245862(0x15f)]['name']+':'+_0x2468a9,'runId':_0x245862(0x149)+_0x9a5c3f[_0x245862(0x15f)][_0x245862(0x165)]+':'+_0x2468a9,'prompt':_0x5b7030,'provider':_0x9a5c3f[_0x245862(0x12c)],'model':_0x9a5c3f['model'],'timeoutMs':_0x9a5c3f[_0x245862(0x14a)]});return parseCompiledPlan(_0xcfe906,_0x9a5c3f['program'],_0x9a5c3f[_0x245862(0x12e)]);}function buildCompilePrompt(_0x5f4e2b,_0x183566){const _0xc11206=_0x6d3518,_0x285606=JSON[_0xc11206(0x180)](Object[_0xc11206(0x16c)](_0x183566)[_0xc11206(0x168)](_0x4b7831=>({'id':_0x4b7831['id'],'role':_0x4b7831[_0xc11206(0x15a)],'instructions':_0x4b7831[_0xc11206(0x17a)],'doneWhen':_0x4b7831[_0xc11206(0x159)],'permissions':_0x4b7831[_0xc11206(0x174)]})),null,0x2);return['You\x20are\x20the\x20own-prose\x20workflow\x20compiler.',_0xc11206(0x138),'Return\x20JSON\x20only.\x20Do\x20not\x20wrap\x20it\x20in\x20markdown\x20fences.','',_0xc11206(0x15d),'-\x20Use\x20only\x20agents\x20listed\x20below.',_0xc11206(0x169),_0xc11206(0x164),_0xc11206(0x13f),_0xc11206(0x17f),_0xc11206(0x155),_0xc11206(0x158),_0xc11206(0x162),_0xc11206(0x170),'','Program:',JSON['stringify']({'name':_0x5f4e2b['name'],'goal':_0x5f4e2b[_0xc11206(0x15b)],'workflow':_0x5f4e2b['workflow'],'constraints':_0x5f4e2b[_0xc11206(0x133)],'outputContract':_0x5f4e2b[_0xc11206(0x181)]},null,0x2),'','Available\x20agents:',_0x285606,'',_0xc11206(0x153),_0xc11206(0x11c)][_0xc11206(0x173)]('\x0a');}function parseCompiledPlan(_0x49016d,_0x2f723e,_0x3e52c0){const _0x590c75=_0x6d3518,_0x5614c9=extractJsonObject(_0x49016d),_0x2b25c5=JSON[_0x590c75(0x144)](_0x5614c9),_0x32ea54=Array[_0x590c75(0x141)](_0x2b25c5[_0x590c75(0x126)])?_0x2b25c5[_0x590c75(0x126)]:undefined;if(!_0x32ea54||_0x32ea54[_0x590c75(0x146)]===0x0)throw new Error(_0x590c75(0x12a));const _0x162764=_0x32ea54['map']((_0x132c63,_0x301825)=>normalizeNode(_0x132c63,_0x301825,_0x3e52c0)),_0x58cbf4=requireString(_0x2b25c5['entryNodeId'],_0x590c75(0x121)),_0x360227=normalizeMaxSteps(_0x2b25c5[_0x590c75(0x12b)],_0x2f723e['constraints']['maxSteps']),_0x566880=normalizeStringArray(_0x2b25c5['branchVocabulary']);return{'version':0x1,'planId':_0x2f723e[_0x590c75(0x165)]+':'+Date[_0x590c75(0x157)](),'programName':_0x2f723e['name'],'summary':requireString(_0x2b25c5[_0x590c75(0x17d)],_0x590c75(0x17d)),'entryNodeId':_0x58cbf4,'maxSteps':_0x360227,'branchVocabulary':_0x566880,'nodes':_0x162764};}function normalizeNode(_0x5d2c3b,_0x2abea4,_0x209fb1){const _0x2baa42=_0x6d3518;if(!_0x5d2c3b||typeof _0x5d2c3b!==_0x2baa42(0x163)||Array[_0x2baa42(0x141)](_0x5d2c3b))throw new Error('Compiled\x20node\x20'+(_0x2abea4+0x1)+_0x2baa42(0x151));const _0x4daed6=_0x5d2c3b,_0x352ebc=requireString(_0x4daed6[_0x2baa42(0x145)],_0x2baa42(0x17b)+_0x2abea4+_0x2baa42(0x15c)),_0x37840e=requireString(_0x4daed6['id'],'nodes['+_0x2abea4+_0x2baa42(0x13e)),_0x42f85b=requireString(_0x4daed6[_0x2baa42(0x14b)],_0x2baa42(0x17b)+_0x2abea4+_0x2baa42(0x124));if(_0x352ebc===_0x2baa42(0x176))return{'id':_0x37840e,'type':_0x2baa42(0x176),'title':_0x42f85b};const _0x1ef66b=requireString(_0x4daed6[_0x2baa42(0x16b)],_0x2baa42(0x17b)+_0x2abea4+'].agentId'),_0x2045c5=_0x209fb1[_0x1ef66b];if(!_0x2045c5)throw new Error(_0x2baa42(0x137)+(_0x2abea4+0x1)+_0x2baa42(0x123)+_0x1ef66b+'\x22');if(_0x352ebc===_0x2baa42(0x127))return{'id':_0x37840e,'type':_0x2baa42(0x127),'title':_0x42f85b,'agentId':_0x1ef66b,'goal':requireString(_0x4daed6[_0x2baa42(0x15b)],'nodes['+_0x2abea4+'].goal'),'instructions':requireString(_0x4daed6[_0x2baa42(0x17a)],_0x2baa42(0x17b)+_0x2abea4+'].instructions'),'doneWhen':normalizeStringArray(_0x4daed6[_0x2baa42(0x159)]),'next':normalizeNullableString(_0x4daed6[_0x2baa42(0x139)]),'permissions':_0x2045c5[_0x2baa42(0x174)]};if(_0x352ebc===_0x2baa42(0x131)){const _0x39285a=normalizeStringArray(_0x4daed6[_0x2baa42(0x177)]),_0xa23d93=readRecord(_0x4daed6[_0x2baa42(0x120)],_0x2baa42(0x17b)+_0x2abea4+_0x2baa42(0x152)),_0x45994b=Object[_0x2baa42(0x160)](Object[_0x2baa42(0x175)](_0xa23d93)['map'](([_0x189bff,_0xd3ce3a])=>[_0x189bff,requireString(_0xd3ce3a,_0x2baa42(0x17b)+_0x2abea4+_0x2baa42(0x128)+_0x189bff)]));return{'id':_0x37840e,'type':_0x2baa42(0x131),'title':_0x42f85b,'agentId':_0x1ef66b,'question':requireString(_0x4daed6[_0x2baa42(0x135)],_0x2baa42(0x17b)+_0x2abea4+_0x2baa42(0x11d)),'instructions':requireString(_0x4daed6[_0x2baa42(0x17a)],_0x2baa42(0x17b)+_0x2abea4+_0x2baa42(0x156)),'allowedBranches':_0x39285a,'branches':_0x45994b,'permissions':_0x2045c5['permissions']};}throw new Error(_0x2baa42(0x137)+(_0x2abea4+0x1)+_0x2baa42(0x171)+_0x352ebc+'\x22');}async function runEmbeddedPrompt(_0x5b76b9){const _0x4eebd7=_0x6d3518,_0x2b6015=await _0x5b76b9['api'][_0x4eebd7(0x142)][_0x4eebd7(0x172)][_0x4eebd7(0x11e)]({'sessionId':_0x5b76b9[_0x4eebd7(0x154)],'runId':_0x5b76b9[_0x4eebd7(0x11b)],'sessionFile':_0x450e60[_0x4eebd7(0x173)](_0x5b76b9[_0x4eebd7(0x167)],'sessions',sanitizeId(_0x5b76b9[_0x4eebd7(0x154)])+_0x4eebd7(0x178)),'workspaceDir':_0x5b76b9[_0x4eebd7(0x13c)],'config':_0x5b76b9[_0x4eebd7(0x12f)]['config'],'lane':OWN_PROSE_EMBEDDED_LANE,'prompt':_0x5b76b9['prompt'],'timeoutMs':_0x5b76b9[_0x4eebd7(0x14a)],..._0x5b76b9[_0x4eebd7(0x12c)]?{'provider':_0x5b76b9[_0x4eebd7(0x12c)]}:{},..._0x5b76b9[_0x4eebd7(0x143)]?{'model':_0x5b76b9[_0x4eebd7(0x143)]}:{}}),_0x35d448=extractEmbeddedRunOutputText(_0x2b6015[_0x4eebd7(0x13a)]);if(!_0x35d448){const _0x2e10c8=_0x2b6015[_0x4eebd7(0x150)]?.[_0x4eebd7(0x122)]?.['message']?.[_0x4eebd7(0x17c)]();throw new Error(_0x2e10c8||'Embedded\x20compiler\x20run\x20returned\x20no\x20output');}return _0x35d448;}function extractEmbeddedRunOutputText(_0x2394b7){const _0x2b7d1d=_0x6d3518;if(!Array[_0x2b7d1d(0x141)](_0x2394b7))return undefined;for(let _0x5e86=_0x2394b7[_0x2b7d1d(0x146)]-0x1;_0x5e86>=0x0;_0x5e86-=0x1){const _0x26184d=_0x2394b7[_0x5e86];if(_0x26184d?.[_0x2b7d1d(0x16f)])continue;const _0x36747f=_0x26184d?.[_0x2b7d1d(0x129)]?.['trim']();if(_0x36747f)return _0x36747f;}return undefined;}function extractJsonObject(_0x429e1d){const _0x13102a=_0x6d3518,_0x46ca5e=_0x429e1d[_0x13102a(0x17c)]();if(_0x46ca5e['startsWith']('{')&&_0x46ca5e[_0x13102a(0x12d)]('}'))return _0x46ca5e;const _0x1cfc6c=/```(?:json)?\s*([\s\S]*?)```/i[_0x13102a(0x11a)](_0x46ca5e);if(_0x1cfc6c?.[0x1]?.[_0x13102a(0x17c)]())return _0x1cfc6c[0x1]['trim']();const _0x277952=_0x46ca5e[_0x13102a(0x161)]('{'),_0x1d78a4=_0x46ca5e[_0x13102a(0x125)]('}');if(_0x277952>=0x0&&_0x1d78a4>_0x277952)return _0x46ca5e[_0x13102a(0x16e)](_0x277952,_0x1d78a4+0x1);throw new Error('Unable\x20to\x20locate\x20JSON\x20object\x20in\x20compiler\x20output');}function normalizeMaxSteps(_0x4c0565,_0x2e526f){const _0x29e796=_0x6d3518;if(typeof _0x4c0565!=='number'||!Number[_0x29e796(0x179)](_0x4c0565)||_0x4c0565<0x1)return _0x2e526f;return Math[_0x29e796(0x182)](Math[_0x29e796(0x17e)](_0x4c0565),_0x2e526f);}function normalizeStringArray(_0x157e2a){const _0x9dc78d=_0x6d3518;if(!Array['isArray'](_0x157e2a))return[];return _0x157e2a[_0x9dc78d(0x168)](_0x1bd2e6=>typeof _0x1bd2e6===_0x9dc78d(0x136)?_0x1bd2e6[_0x9dc78d(0x17c)]():undefined)[_0x9dc78d(0x134)](_0x2056e2=>Boolean(_0x2056e2));}function normalizeNullableString(_0x2979d3){const _0x39957e=_0x6d3518;if(_0x2979d3==null)return null;return requireString(_0x2979d3,_0x39957e(0x139));}function requireString(_0x11440d,_0x4b898e){const _0x35d217=_0x6d3518;if(typeof _0x11440d!==_0x35d217(0x136)||!_0x11440d[_0x35d217(0x17c)]())throw new Error(_0x4b898e+_0x35d217(0x13b));return _0x11440d[_0x35d217(0x17c)]();}function readRecord(_0x440481,_0x25a7b0){const _0x42f27c=_0x6d3518;if(!_0x440481||typeof _0x440481!==_0x42f27c(0x163)||Array[_0x42f27c(0x141)](_0x440481))throw new Error(_0x25a7b0+'\x20must\x20be\x20an\x20object');return _0x440481;}function sanitizeId(_0x24d6fc){const _0x74b595=_0x6d3518;return _0x24d6fc[_0x74b595(0x14c)](/[^a-zA-Z0-9._-]+/g,'_');}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function _0x2297(){const _0x36bdb6=['Compiled\x20plan\x20version\x20must\x20be\x201','Compiled\x20plan\x20must\x20include\x20at\x20least\x20one\x20node','Compiled\x20plan\x20exceeds\x20maxAgentCalls\x20for\x20\x22','maxLoopCount\x20must\x20be\x20>=\x200','keys','192528qYJiga','allowLoops','entries','get','finish','Compiled\x20plan\x20node\x20\x22','707833IYxAjv','allowedAgentsOnly','948959AqnSZs','maxLoopCount','250214TAPhGk','Judge\x20node\x20\x22','\x22\x20contains\x20duplicate\x20allowedBranches','has','constraints','10hOybpW','task','\x22\x20must\x20declare\x20at\x20least\x20one\x20branch','allowedBranches','agentIds','Compiled\x20plan\x20references\x20unknown\x20agent\x20\x22','next','162162qSxDEE','\x22\x20does\x20not\x20exist','612612aHoOWY','size','agentId','maxAgentCalls','type','add','335lkwnQc','length','nodes','entryNodeId','version','judge','filter','branches','\x22\x20is\x20missing\x20target\x20for\x20branch\x20\x22','7984nfaqpq','map','pop','push','Compiled\x20plan\x20contains\x20unreachable\x20nodes:\x20','8krvaPk','set','values','delete','Compiled\x20plan\x20contains\x20a\x20loop\x20but\x20allowLoops\x20is\x20false','Compiled\x20plan\x20references\x20undeclared\x20agent\x20\x22','join','1SMEbQp','Compiled\x20plan\x20entry\x20node\x20\x22'];_0x2297=function(){return _0x36bdb6;};return _0x2297();}(function(_0x2985ca,_0x2bec53){const _0x401e34=_0x3134,_0x524b74=_0x2985ca();while(!![]){try{const _0x574051=parseInt(_0x401e34(0xf0))/0x1*(-parseInt(_0x401e34(0xc7))/0x2)+parseInt(_0x401e34(0xbd))/0x3+-parseInt(_0x401e34(0xe4))/0x4*(-parseInt(_0x401e34(0xdb))/0x5)+parseInt(_0x401e34(0xd3))/0x6+parseInt(_0x401e34(0xc3))/0x7*(-parseInt(_0x401e34(0xe9))/0x8)+parseInt(_0x401e34(0xd5))/0x9+-parseInt(_0x401e34(0xcc))/0xa*(-parseInt(_0x401e34(0xc5))/0xb);if(_0x574051===_0x2bec53)break;else _0x524b74['push'](_0x524b74['shift']());}catch(_0x1a4fbe){_0x524b74['push'](_0x524b74['shift']());}}}(_0x2297,0x255d6));export function validateCompiledPlan(_0xf5eb12,_0x1ee9b7,_0x100ff2){const _0x115a6f=_0x3134;if(_0xf5eb12[_0x115a6f(0xdf)]!==0x1)throw new Error(_0x115a6f(0xf2));if(!_0xf5eb12['nodes']['length'])throw new Error(_0x115a6f(0xf3));const _0xe62afd=new Map(_0xf5eb12[_0x115a6f(0xdd)][_0x115a6f(0xe5)](_0x285140=>[_0x285140['id'],_0x285140]));if(!_0xe62afd[_0x115a6f(0xca)](_0xf5eb12[_0x115a6f(0xde)]))throw new Error(_0x115a6f(0xf1)+_0xf5eb12['entryNodeId']+_0x115a6f(0xd4));const _0xed7cf3=findDuplicateIds(_0xf5eb12[_0x115a6f(0xdd)][_0x115a6f(0xe5)](_0x1d7778=>_0x1d7778['id']));if(_0xed7cf3[_0x115a6f(0xdc)]>0x0)throw new Error('Compiled\x20plan\x20contains\x20duplicate\x20node\x20ids:\x20'+_0xed7cf3[_0x115a6f(0xef)](',\x20'));const _0x4a2b7e=_0xf5eb12[_0x115a6f(0xdd)][_0x115a6f(0xe1)](_0x14e03d=>_0x14e03d['type']===_0x115a6f(0xc1));if(_0x4a2b7e[_0x115a6f(0xdc)]===0x0)throw new Error('Compiled\x20plan\x20must\x20include\x20at\x20least\x20one\x20finish\x20node');const _0x3b104c=new Map(),_0x5c3397=new Set(_0x1ee9b7[_0x115a6f(0xd0)]),_0x1b67cb=new Map();for(const _0x3ea97c of _0xf5eb12[_0x115a6f(0xdd)]){_0x1b67cb[_0x115a6f(0xea)](_0x3ea97c['id'],getOutgoingEdges(_0x3ea97c));if(_0x3ea97c[_0x115a6f(0xd9)]===_0x115a6f(0xc1))continue;if(_0x1ee9b7['constraints'][_0x115a6f(0xc4)]&&!_0x5c3397[_0x115a6f(0xca)](_0x3ea97c[_0x115a6f(0xd7)]))throw new Error(_0x115a6f(0xee)+_0x3ea97c[_0x115a6f(0xd7)]+'\x22');if(!_0x100ff2[_0x3ea97c[_0x115a6f(0xd7)]])throw new Error(_0x115a6f(0xd1)+_0x3ea97c[_0x115a6f(0xd7)]+'\x22');_0x3b104c['set'](_0x3ea97c['agentId'],(_0x3b104c[_0x115a6f(0xc0)](_0x3ea97c[_0x115a6f(0xd7)])??0x0)+0x1);for(const _0xae00e7 of getOutgoingEdges(_0x3ea97c)){if(!_0xe62afd[_0x115a6f(0xca)](_0xae00e7))throw new Error(_0x115a6f(0xc2)+_0x3ea97c['id']+'\x22\x20points\x20to\x20missing\x20node\x20\x22'+_0xae00e7+'\x22');}_0x3ea97c[_0x115a6f(0xd9)]==='judge'&&validateJudgeNode(_0x3ea97c);}for(const [_0x29215f,_0x44a891]of Object[_0x115a6f(0xbf)](_0x1ee9b7[_0x115a6f(0xcb)][_0x115a6f(0xd8)])){if((_0x3b104c[_0x115a6f(0xc0)](_0x29215f)??0x0)>_0x44a891)throw new Error(_0x115a6f(0xf4)+_0x29215f+'\x22');}const _0x5693c2=collectReachableNodes(_0xf5eb12[_0x115a6f(0xde)],_0x1b67cb),_0x393df8=_0xf5eb12[_0x115a6f(0xdd)][_0x115a6f(0xe5)](_0x371d4c=>_0x371d4c['id'])[_0x115a6f(0xe1)](_0x171827=>!_0x5693c2['has'](_0x171827));if(_0x393df8[_0x115a6f(0xdc)]>0x0)throw new Error(_0x115a6f(0xe8)+_0x393df8[_0x115a6f(0xef)](',\x20'));if(!_0x1ee9b7[_0x115a6f(0xcb)][_0x115a6f(0xbe)]&&hasCycle(_0xf5eb12[_0x115a6f(0xde)],_0x1b67cb))throw new Error(_0x115a6f(0xed));if(_0x1ee9b7[_0x115a6f(0xcb)]['allowLoops']&&_0x1ee9b7[_0x115a6f(0xcb)][_0x115a6f(0xc6)]<0x0)throw new Error(_0x115a6f(0xf5));}function validateJudgeNode(_0x41b63f){const _0x567c8=_0x3134,_0x2bdeeb=Object[_0x567c8(0xf6)](_0x41b63f[_0x567c8(0xe2)]);if(_0x41b63f[_0x567c8(0xcf)]['length']===0x0)throw new Error(_0x567c8(0xc8)+_0x41b63f['id']+_0x567c8(0xce));const _0x55fd3b=new Set(_0x41b63f['allowedBranches']);if(_0x55fd3b[_0x567c8(0xd6)]!==_0x41b63f['allowedBranches'][_0x567c8(0xdc)])throw new Error(_0x567c8(0xc8)+_0x41b63f['id']+_0x567c8(0xc9));for(const _0x19f748 of _0x2bdeeb){if(!_0x55fd3b[_0x567c8(0xca)](_0x19f748))throw new Error(_0x567c8(0xc8)+_0x41b63f['id']+'\x22\x20contains\x20unexpected\x20branch\x20\x22'+_0x19f748+'\x22');}for(const _0x424319 of _0x41b63f[_0x567c8(0xcf)]){if(!_0x41b63f[_0x567c8(0xe2)][_0x424319])throw new Error('Judge\x20node\x20\x22'+_0x41b63f['id']+_0x567c8(0xe3)+_0x424319+'\x22');}}function _0x3134(_0x3a0987,_0x14d830){_0x3a0987=_0x3a0987-0xbd;const _0x2297a5=_0x2297();let _0x313469=_0x2297a5[_0x3a0987];return _0x313469;}function getOutgoingEdges(_0xfb7063){const _0x1d4b83=_0x3134;if(_0xfb7063['type']===_0x1d4b83(0xcd))return _0xfb7063[_0x1d4b83(0xd2)]?[_0xfb7063[_0x1d4b83(0xd2)]]:[];if(_0xfb7063[_0x1d4b83(0xd9)]===_0x1d4b83(0xe0))return Object[_0x1d4b83(0xeb)](_0xfb7063[_0x1d4b83(0xe2)]);return[];}function collectReachableNodes(_0x3666fc,_0x270787){const _0x2d2d47=_0x3134,_0x1c1f73=new Set(),_0x38f10a=[_0x3666fc];while(_0x38f10a['length']>0x0){const _0x2d323b=_0x38f10a[_0x2d2d47(0xe6)]();if(_0x1c1f73[_0x2d2d47(0xca)](_0x2d323b))continue;_0x1c1f73[_0x2d2d47(0xda)](_0x2d323b);for(const _0x4bf6ab of _0x270787[_0x2d2d47(0xc0)](_0x2d323b)??[]){_0x38f10a[_0x2d2d47(0xe7)](_0x4bf6ab);}}return _0x1c1f73;}function hasCycle(_0x45aec1,_0x54e105){const _0x7f6454=new Set(),_0x5741e4=new Set(),_0x547f38=_0xa38dbd=>{const _0x2198f3=_0x3134;if(_0x5741e4[_0x2198f3(0xca)](_0xa38dbd))return!![];if(_0x7f6454[_0x2198f3(0xca)](_0xa38dbd))return![];_0x7f6454[_0x2198f3(0xda)](_0xa38dbd),_0x5741e4['add'](_0xa38dbd);for(const _0xd2d629 of _0x54e105[_0x2198f3(0xc0)](_0xa38dbd)??[]){if(_0x547f38(_0xd2d629))return!![];}return _0x5741e4[_0x2198f3(0xec)](_0xa38dbd),![];};return _0x547f38(_0x45aec1);}function findDuplicateIds(_0xb89c50){const _0x3719fd=_0x3134,_0x1b30f5=new Set(),_0x2cd79e=new Set();for(const _0x25b514 of _0xb89c50){_0x1b30f5['has'](_0x25b514)&&_0x2cd79e['add'](_0x25b514),_0x1b30f5[_0x3719fd(0xda)](_0x25b514);}return[..._0x2cd79e];}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0xa538aa,_0x635f4d){const _0x1ae582=_0x1358,_0x3f7bed=_0xa538aa();while(!![]){try{const _0x4c3774=parseInt(_0x1ae582(0x1fe))/0x1+parseInt(_0x1ae582(0x209))/0x2*(parseInt(_0x1ae582(0x218))/0x3)+-parseInt(_0x1ae582(0x226))/0x4*(parseInt(_0x1ae582(0x200))/0x5)+-parseInt(_0x1ae582(0x215))/0x6+-parseInt(_0x1ae582(0x214))/0x7+-parseInt(_0x1ae582(0x1fb))/0x8*(parseInt(_0x1ae582(0x21d))/0x9)+-parseInt(_0x1ae582(0x204))/0xa*(-parseInt(_0x1ae582(0x213))/0xb);if(_0x4c3774===_0x635f4d)break;else _0x3f7bed['push'](_0x3f7bed['shift']());}catch(_0x14d6f0){_0x3f7bed['push'](_0x3f7bed['shift']());}}}(_0x12ac,0x29e3f));import _0x46e31b from'node:fs/promises';import _0x3a6a15 from'node:path';import{parse as _0x44036b}from'yaml';function _0x1358(_0x5ee70e,_0x3c4006){_0x5ee70e=_0x5ee70e-0x1f0;const _0x12ac4a=_0x12ac();let _0x1358f0=_0x12ac4a[_0x5ee70e];return _0x1358f0;}const DEFAULT_CONSTRAINTS={'maxSteps':0x18,'allowedAgentsOnly':!![],'allowLoops':![],'maxLoopCount':0x0,'maxAgentCalls':{},'planningReadOnly':!![]};export async function parseProgramFile(_0x300be6){const _0x317cd1=_0x1358,_0x26c418=_0x3a6a15[_0x317cd1(0x217)](_0x300be6),_0x3cf4c6=await _0x46e31b['readFile'](_0x26c418,_0x317cd1(0x203));return parseProgramMarkdown(_0x3cf4c6,_0x26c418);}export function parseProgramMarkdown(_0x274026,_0x2fa779){const _0x56ab58=_0x1358,{frontmatter:_0x191646,body:_0x3a41a3}=splitFrontmatter(_0x274026),_0x48fea4=normalizeFrontmatter(_0x191646),_0x3b9967=parseSections(_0x3a41a3),_0x5bdedb=requireSection(_0x3b9967,_0x56ab58(0x1f4)),_0x573d56=requireSection(_0x3b9967,'workflow'),_0x5975a2=requireSection(_0x3b9967,_0x56ab58(0x219)),_0x50371b=requireSection(_0x3b9967,_0x56ab58(0x210));return{'version':normalizeVersion(_0x48fea4['version']),'name':requireNonEmptyString(_0x48fea4[_0x56ab58(0x20c)],_0x56ab58(0x225)),'description':optionalString(_0x48fea4[_0x56ab58(0x212)]),'sourcePath':_0x2fa779,'goal':_0x5bdedb,'workflow':_0x573d56,'inputs':parseInputsSection(_0x5975a2),'agentIds':parseBulletList(_0x50371b),'constraints':parseConstraintsSection(_0x3b9967[_0x56ab58(0x223)]),'outputContract':parseOutputContractSection(_0x3b9967[_0x56ab58(0x20a)]),'sections':{'goal':_0x5bdedb,'inputs':_0x5975a2,'agents':_0x50371b,'workflow':_0x573d56,'constraints':_0x3b9967['constraints'],'outputContract':_0x3b9967[_0x56ab58(0x20a)]}};}function _0x12ac(){const _0x7e8386=['\x20must\x20be\x20a\x20non-empty\x20string','own-prose\x20frontmatter\x20is\x20missing\x20a\x20closing\x20---\x20line','constraints','maxLoopCount','frontmatter.name','4VfhfLs','Expected\x20a\x20bullet\x20list','parseInt','split','trim','string','goal','maxSteps','own-prose\x20program\x20must\x20include\x20a\x20\x22##\x20','allowLoops','maxAgentCalls','slice','object','1392CzqHWf','exec','isArray','219271MIvasJ','toUpperCase','861475zrXPqo','startsWith','true','utf8','1901910tXweho','map','---\x0a','filter','\x22\x20section','496894XvXmmd','output_contract','toLowerCase','name','push','frontmatter.version\x20must\x20be\x20\x221\x22','planningReadOnly','agents','Invalid\x20input\x20entry\x20\x22','description','22ialpWV','1919890bCYaPw','1265916CjzWui','own-prose\x20frontmatter\x20must\x20be\x20a\x20YAML\x20object','resolve','3qjpVDi','inputs','join','length','allowedAgentsOnly','981DWZtYq','indexOf','replace','test'];_0x12ac=function(){return _0x7e8386;};return _0x12ac();}function splitFrontmatter(_0x2f1e0c){const _0x38c02d=_0x1358,_0x453816=_0x2f1e0c[_0x38c02d(0x21f)](/\r\n/g,'\x0a');if(!_0x453816[_0x38c02d(0x201)](_0x38c02d(0x206)))throw new Error('own-prose\x20program\x20must\x20start\x20with\x20YAML\x20frontmatter');const _0x4bb9b8=_0x453816[_0x38c02d(0x21e)]('\x0a---\x0a',0x4);if(_0x4bb9b8<0x0)throw new Error(_0x38c02d(0x222));return{'frontmatter':_0x44036b(_0x453816[_0x38c02d(0x1f9)](0x4,_0x4bb9b8)),'body':_0x453816['slice'](_0x4bb9b8+0x5)['trim']()};}function normalizeFrontmatter(_0x3be0ce){const _0x434ae1=_0x1358;if(!_0x3be0ce||typeof _0x3be0ce!==_0x434ae1(0x1fa)||Array[_0x434ae1(0x1fd)](_0x3be0ce))throw new Error(_0x434ae1(0x216));return _0x3be0ce;}function parseSections(_0xc46468){const _0x1f27f2=_0x1358,_0x12f858={},_0x46bccc=_0xc46468[_0x1f27f2(0x1f1)]('\x0a');let _0x4c0ff2='overview',_0x4b9305=[];for(const _0x2a39fd of _0x46bccc){const _0x2ab551=/^##\s+(.+?)\s*$/[_0x1f27f2(0x1fc)](_0x2a39fd);if(_0x2ab551){_0x12f858[_0x4c0ff2]=_0x4b9305[_0x1f27f2(0x21a)]('\x0a')['trim'](),_0x4c0ff2=normalizeSectionId(_0x2ab551[0x1]??''),_0x4b9305=[];continue;}_0x4b9305[_0x1f27f2(0x20d)](_0x2a39fd);}return _0x12f858[_0x4c0ff2]=_0x4b9305['join']('\x0a')['trim'](),_0x12f858;}function normalizeSectionId(_0x8dcfd4){const _0x519535=_0x1358;return _0x8dcfd4['trim']()['toLowerCase']()[_0x519535(0x21f)](/[^a-z0-9]+/g,'_')['replace'](/^_+|_+$/g,'');}function requireSection(_0x2508b0,_0x3ba201){const _0x1ba90c=_0x1358,_0x5f4c9f=_0x2508b0[_0x3ba201];if(!_0x5f4c9f?.[_0x1ba90c(0x1f2)]())throw new Error(_0x1ba90c(0x1f6)+humanizeSectionId(_0x3ba201)+_0x1ba90c(0x208));return _0x5f4c9f[_0x1ba90c(0x1f2)]();}function humanizeSectionId(_0x5ee416){const _0x31c99d=_0x1358;return _0x5ee416[_0x31c99d(0x1f1)]('_')[_0x31c99d(0x205)](_0x5302db=>_0x5302db[_0x31c99d(0x1f9)](0x0,0x1)[_0x31c99d(0x1ff)]()+_0x5302db[_0x31c99d(0x1f9)](0x1))['join']('\x20');}function parseInputsSection(_0x51d0ef){const _0x4017d8=_0x1358,_0x26078b=parseBulletList(_0x51d0ef,![]);if(_0x26078b[_0x4017d8(0x21b)]===0x0)return[];return _0x26078b['map'](_0x16d150=>{const _0x79ee9b=_0x4017d8,[_0x4ddec6,..._0x88d8ad]=_0x16d150['split'](':'),_0x426a8c=_0x4ddec6?.[_0x79ee9b(0x1f2)]();if(!_0x426a8c)throw new Error(_0x79ee9b(0x211)+_0x16d150+'\x22');const _0x1b5189=!/\?$|\[optional\]/i[_0x79ee9b(0x220)](_0x426a8c),_0x221c2c=_0x426a8c[_0x79ee9b(0x21f)](/\?$|\[optional\]/gi,'')[_0x79ee9b(0x1f2)]();return{'key':_0x221c2c,'description':_0x88d8ad[_0x79ee9b(0x21a)](':')[_0x79ee9b(0x1f2)]()||undefined,'required':_0x1b5189};});}function parseConstraintsSection(_0x33e383){const _0x2cbea6=_0x1358,_0x44e43f={...DEFAULT_CONSTRAINTS,'maxAgentCalls':{}};if(!_0x33e383?.[_0x2cbea6(0x1f2)]())return _0x44e43f;for(const _0x2dce4a of parseBulletList(_0x33e383,![])){const _0x49435d=/^maxSteps\s*:\s*(\d+)$/i['exec'](_0x2dce4a);if(_0x49435d){_0x44e43f[_0x2cbea6(0x1f5)]=Number[_0x2cbea6(0x1f0)](_0x49435d[0x1],0xa);continue;}const _0x3a0808=/^allowLoops\s*:\s*(true|false)$/i[_0x2cbea6(0x1fc)](_0x2dce4a);if(_0x3a0808){_0x44e43f[_0x2cbea6(0x1f7)]=_0x3a0808[0x1][_0x2cbea6(0x20b)]()===_0x2cbea6(0x202);continue;}const _0x530b10=/^maxLoopCount\s*:\s*(\d+)$/i[_0x2cbea6(0x1fc)](_0x2dce4a);if(_0x530b10){_0x44e43f[_0x2cbea6(0x224)]=Number['parseInt'](_0x530b10[0x1],0xa);continue;}const _0x20600f=/^planningReadOnly\s*:\s*(true|false)$/i[_0x2cbea6(0x1fc)](_0x2dce4a);if(_0x20600f){_0x44e43f[_0x2cbea6(0x20f)]=_0x20600f[0x1][_0x2cbea6(0x20b)]()===_0x2cbea6(0x202);continue;}const _0x461c13=/^allowedAgentsOnly\s*:\s*(true|false)$/i['exec'](_0x2dce4a);if(_0x461c13){_0x44e43f[_0x2cbea6(0x21c)]=_0x461c13[0x1][_0x2cbea6(0x20b)]()===_0x2cbea6(0x202);continue;}const _0x5f52bd=/^maxAgentCalls\.([A-Za-z0-9._-]+)\s*:\s*(\d+)$/i[_0x2cbea6(0x1fc)](_0x2dce4a);_0x5f52bd&&(_0x44e43f[_0x2cbea6(0x1f8)][_0x5f52bd[0x1]]=Number['parseInt'](_0x5f52bd[0x2],0xa));}return _0x44e43f;}function parseOutputContractSection(_0x12694b){const _0x4a42b1=_0x1358;if(!_0x12694b?.[_0x4a42b1(0x1f2)]())return{'requirements':[]};return{'requirements':parseBulletList(_0x12694b,![])};}function parseBulletList(_0x298343,_0x1e073e=!![]){const _0x140b1f=_0x1358,_0x2ab4d3=_0x298343[_0x140b1f(0x1f1)]('\x0a')[_0x140b1f(0x205)](_0x11afbc=>/^\s*-\s+(.*\S)\s*$/[_0x140b1f(0x1fc)](_0x11afbc)?.[0x1]?.[_0x140b1f(0x1f2)]())[_0x140b1f(0x207)](_0x3c4242=>Boolean(_0x3c4242));if(_0x1e073e&&_0x2ab4d3['length']===0x0)throw new Error(_0x140b1f(0x227));return _0x2ab4d3;}function normalizeVersion(_0x52b4f6){const _0x4f8f20=_0x1358;if(_0x52b4f6==null)return 0x1;if(_0x52b4f6===0x1||_0x52b4f6==='1')return 0x1;throw new Error(_0x4f8f20(0x20e));}function optionalString(_0x103ada){const _0x2a6bcf=_0x1358;return typeof _0x103ada===_0x2a6bcf(0x1f3)&&_0x103ada[_0x2a6bcf(0x1f2)]()?_0x103ada[_0x2a6bcf(0x1f2)]():undefined;}function requireNonEmptyString(_0x2211ff,_0x915e65){const _0x3ff9b2=_0x1358;if(typeof _0x2211ff!==_0x3ff9b2(0x1f3)||!_0x2211ff[_0x3ff9b2(0x1f2)]())throw new Error(_0x915e65+_0x3ff9b2(0x221));return _0x2211ff['trim']();}
|
|
@@ -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 _0x506390=_0x40d0;(function(_0x319a6e,_0x5e99fb){const _0x5ef5db=_0x40d0,_0x563f43=_0x319a6e();while(!![]){try{const _0x363636=-parseInt(_0x5ef5db(0x1c9))/0x1+-parseInt(_0x5ef5db(0x1ab))/0x2+-parseInt(_0x5ef5db(0x1c5))/0x3*(-parseInt(_0x5ef5db(0x1a0))/0x4)+-parseInt(_0x5ef5db(0x1bb))/0x5*(-parseInt(_0x5ef5db(0x1d2))/0x6)+parseInt(_0x5ef5db(0x1b5))/0x7+parseInt(_0x5ef5db(0x1da))/0x8*(parseInt(_0x5ef5db(0x1b0))/0x9)+parseInt(_0x5ef5db(0x1b1))/0xa*(-parseInt(_0x5ef5db(0x1a3))/0xb);if(_0x363636===_0x5e99fb)break;else _0x563f43['push'](_0x563f43['shift']());}catch(_0x492a5b){_0x563f43['push'](_0x563f43['shift']());}}}(_0x42a7,0xcefad));function _0x40d0(_0x355b37,_0x8ea827){_0x355b37=_0x355b37-0x1a0;const _0x42a71d=_0x42a7();let _0x40d0ae=_0x42a71d[_0x355b37];return _0x40d0ae;}function _0x42a7(){const _0x1ce8f8=['30qrdYmK','entryNodeId','-\x20Notification:\x20','notification','1858815tNTZjQ','.md','none','-\x20Run\x20id:\x20','timeline.jsonl','slice','40FQLIeo','nodes','toISOString','readFile','-\x20Current\x20node:\x20','-\x20Steps\x20executed:\x20','worker','currentNodeId','toString','stringify','33XuCKLj','-\x20Status:\x20','Started\x20run\x20for\x20','running','402169CmdXAa','runId','getUTCHours','sourcePath','status','program','find','runtime','#\x20own-prose\x20resume','742074mRgujN','parse','appendFile','pending','reason','runDir','failure','name','3491760lDKkCR','-\x20Background:\x20','utf8','getUTCMinutes','getUTCFullYear','runs','getUTCMonth','padStart','130852OTkCLO','plan','mkdir','4133503rjynID','-\x20Worker:\x20','nodeStates','sessionKey','getUTCSeconds','join','artifacts','writeFile','220966xXnUmn','getUTCDate','background','maxSteps','-\x20Failure:\x20','18kBBWHR'];_0x42a7=function(){return _0x1ce8f8;};return _0x42a7();}import _0x1c6c04 from'node:fs/promises';import _0x5eabcb from'node:path';const STATE_FILE='state.json',PLAN_FILE='compiled-plan.json',TIMELINE_FILE=_0x506390(0x1b9),RESUME_FILE='resume.md';export function createRunId(_0x4b011f=new Date()){const _0x46746a=_0x506390,_0x280105=_0x19f014=>String(_0x19f014)[_0x46746a(0x1e1)](0x2,'0'),_0x11c2a4=[_0x4b011f[_0x46746a(0x1de)](),_0x280105(_0x4b011f[_0x46746a(0x1e0)]()+0x1),_0x280105(_0x4b011f[_0x46746a(0x1ac)]()),'-',_0x280105(_0x4b011f[_0x46746a(0x1cb)]()),_0x280105(_0x4b011f[_0x46746a(0x1dd)]()),_0x280105(_0x4b011f[_0x46746a(0x1a7)]())][_0x46746a(0x1a8)](''),_0xe1dc2=Math['random']()[_0x46746a(0x1c3)](0x24)[_0x46746a(0x1ba)](0x2,0x8);return _0x11c2a4+'-'+_0xe1dc2;}export function getRunDir(_0x3eb613,_0x972871){const _0x1bafe6=_0x506390;return _0x5eabcb[_0x1bafe6(0x1a8)](_0x3eb613,_0x1bafe6(0x1df),_0x972871);}export async function ensureRunDirectories(_0x333595){const _0x28b0f0=_0x506390;await _0x1c6c04[_0x28b0f0(0x1a2)](_0x5eabcb['join'](_0x333595,_0x28b0f0(0x1a9)),{'recursive':!![]}),await _0x1c6c04[_0x28b0f0(0x1a2)](_0x5eabcb[_0x28b0f0(0x1a8)](_0x333595,'sessions'),{'recursive':!![]});}export async function writeProgramSource(_0xbed29d,_0x27c44b){const _0x1a9ec6=_0x506390;await _0x1c6c04[_0x1a9ec6(0x1aa)](_0x5eabcb['join'](_0xbed29d,'program.md'),_0x27c44b,_0x1a9ec6(0x1dc));}export async function initializeRunState(_0x52e442){const _0x234d45=_0x506390,_0x391a51=new Date()[_0x234d45(0x1bd)](),_0xa8d6bb=_0x5eabcb[_0x234d45(0x1a8)](_0x52e442[_0x234d45(0x1d7)],PLAN_FILE),_0x22e5c3={'version':0x1,'runId':_0x52e442[_0x234d45(0x1ca)],'status':_0x234d45(0x1c8),'programPath':_0x52e442[_0x234d45(0x1ce)][_0x234d45(0x1cc)],'inputs':_0x52e442['inputs'],'compiledPlanPath':_0xa8d6bb,'entryNodeId':_0x52e442[_0x234d45(0x1a1)][_0x234d45(0x1b2)],'currentNodeId':_0x52e442[_0x234d45(0x1a1)][_0x234d45(0x1b2)],'stepsExecuted':0x0,'maxSteps':_0x52e442[_0x234d45(0x1a1)]['maxSteps'],'startedAt':_0x391a51,'updatedAt':_0x391a51,'nodeStates':{},'branchDecisions':[],'artifacts':{},'runtime':_0x52e442[_0x234d45(0x1d0)]};return await writeCompiledPlan(_0x52e442[_0x234d45(0x1d7)],_0x52e442[_0x234d45(0x1a1)]),await writeRunState(_0x52e442[_0x234d45(0x1d7)],_0x22e5c3),await appendTimeline(_0x52e442[_0x234d45(0x1d7)],{'at':_0x391a51,'type':'run_started','runId':_0x22e5c3[_0x234d45(0x1ca)],'message':_0x234d45(0x1c7)+_0x52e442['program'][_0x234d45(0x1d9)]}),await writeResumeFile(_0x52e442['runDir'],_0x22e5c3,_0x52e442[_0x234d45(0x1a1)]),_0x22e5c3;}export async function readRunState(_0x1347e4){const _0x42f7c6=_0x506390,_0x226907=await _0x1c6c04[_0x42f7c6(0x1be)](_0x5eabcb[_0x42f7c6(0x1a8)](_0x1347e4,STATE_FILE),_0x42f7c6(0x1dc));return JSON[_0x42f7c6(0x1d3)](_0x226907);}export async function writeRunState(_0x585561,_0x180899){const _0x5697d1=_0x506390;_0x180899['updatedAt']=new Date()[_0x5697d1(0x1bd)](),await _0x1c6c04[_0x5697d1(0x1aa)](_0x5eabcb[_0x5697d1(0x1a8)](_0x585561,STATE_FILE),JSON[_0x5697d1(0x1c4)](_0x180899,null,0x2)+'\x0a',_0x5697d1(0x1dc));}export async function readCompiledPlan(_0x73bd39){const _0x50ed67=_0x506390,_0x42dd9d=await _0x1c6c04[_0x50ed67(0x1be)](_0x5eabcb[_0x50ed67(0x1a8)](_0x73bd39,PLAN_FILE),_0x50ed67(0x1dc));return JSON['parse'](_0x42dd9d);}export async function writeCompiledPlan(_0x57b381,_0xc1fc00){const _0x125e05=_0x506390,_0x101964=_0x5eabcb['join'](_0x57b381,PLAN_FILE);return await _0x1c6c04['writeFile'](_0x101964,JSON[_0x125e05(0x1c4)](_0xc1fc00,null,0x2)+'\x0a',_0x125e05(0x1dc)),_0x101964;}export async function appendTimeline(_0x2267ab,_0x5983e1){const _0x54af88=_0x506390;await _0x1c6c04[_0x54af88(0x1d4)](_0x5eabcb[_0x54af88(0x1a8)](_0x2267ab,TIMELINE_FILE),JSON[_0x54af88(0x1c4)](_0x5983e1)+'\x0a','utf8');}export async function writeArtifact(_0x441866,_0x40f57e,_0x25dc6e){const _0x2d19e4=_0x506390,_0x1d7f4b=_0x5eabcb[_0x2d19e4(0x1a8)](_0x441866,_0x2d19e4(0x1a9),_0x40f57e+_0x2d19e4(0x1b6));return await _0x1c6c04[_0x2d19e4(0x1aa)](_0x1d7f4b,_0x25dc6e,_0x2d19e4(0x1dc)),_0x1d7f4b;}export async function writeResumeFile(_0x2e6d70,_0x156a2c,_0x52bc6e){const _0x3bfddd=_0x506390,_0x1656c3=_0x156a2c['currentNodeId']?_0x52bc6e['nodes'][_0x3bfddd(0x1cf)](_0x13e388=>_0x13e388['id']===_0x156a2c[_0x3bfddd(0x1c2)]):undefined,_0x1ca5a8=[_0x3bfddd(0x1d1),'',_0x3bfddd(0x1b8)+_0x156a2c[_0x3bfddd(0x1ca)],_0x3bfddd(0x1c6)+_0x156a2c[_0x3bfddd(0x1cd)],_0x156a2c[_0x3bfddd(0x1ad)]?_0x3bfddd(0x1db)+_0x156a2c[_0x3bfddd(0x1ad)][_0x3bfddd(0x1cd)]:undefined,_0x156a2c['background']?.[_0x3bfddd(0x1c1)]?_0x3bfddd(0x1a4)+_0x156a2c[_0x3bfddd(0x1ad)][_0x3bfddd(0x1c1)]['status']+(_0x156a2c['background'][_0x3bfddd(0x1c1)][_0x3bfddd(0x1a6)]?'\x20('+_0x156a2c[_0x3bfddd(0x1ad)][_0x3bfddd(0x1c1)][_0x3bfddd(0x1a6)]+')':''):undefined,_0x156a2c[_0x3bfddd(0x1ad)]?.['notification']?_0x3bfddd(0x1b3)+_0x156a2c[_0x3bfddd(0x1ad)][_0x3bfddd(0x1b4)]['status']:undefined,_0x3bfddd(0x1bf)+(_0x1656c3?.['id']??_0x3bfddd(0x1b7)),_0x3bfddd(0x1c0)+_0x156a2c['stepsExecuted']+'/'+_0x156a2c[_0x3bfddd(0x1ae)],_0x156a2c[_0x3bfddd(0x1d8)]?_0x3bfddd(0x1af)+_0x156a2c[_0x3bfddd(0x1d8)][_0x3bfddd(0x1d6)]:'-\x20Failure:\x20none','','##\x20Node\x20status',..._0x52bc6e[_0x3bfddd(0x1bc)]['map'](_0x58b1b8=>{const _0x1cf35e=_0x3bfddd,_0x52aa03=_0x156a2c[_0x1cf35e(0x1a5)][_0x58b1b8['id']];return'-\x20'+_0x58b1b8['id']+':\x20'+(_0x52aa03?.[_0x1cf35e(0x1cd)]??_0x1cf35e(0x1d5));})]['filter'](_0x18f967=>Boolean(_0x18f967));await _0x1c6c04[_0x3bfddd(0x1aa)](_0x5eabcb[_0x3bfddd(0x1a8)](_0x2e6d70,RESUME_FILE),_0x1ca5a8[_0x3bfddd(0x1a8)]('\x0a')+'\x0a',_0x3bfddd(0x1dc));}
|
|
@@ -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(_0x2803d1,_0x23d023){const _0x368520=_0x4813,_0x24f221=_0x2803d1();while(!![]){try{const _0x5814c1=-parseInt(_0x368520(0x13d))/0x1+-parseInt(_0x368520(0x106))/0x2+-parseInt(_0x368520(0x130))/0x3*(-parseInt(_0x368520(0x113))/0x4)+parseInt(_0x368520(0x10d))/0x5*(parseInt(_0x368520(0x118))/0x6)+parseInt(_0x368520(0x10c))/0x7+parseInt(_0x368520(0x123))/0x8+parseInt(_0x368520(0x127))/0x9;if(_0x5814c1===_0x23d023)break;else _0x24f221['push'](_0x24f221['shift']());}catch(_0x8d0cf0){_0x24f221['push'](_0x24f221['shift']());}}}(_0x13e4,0x2aa79));import{Type}from'@sinclair/typebox';import _0x39614a from'node:fs/promises';import _0x542708 from'node:path';import{driveOwnProseProgram,inspectOwnProseProgramFile,loadOwnProseRunState,renderOwnProseStatus,resumeOwnProseBackgroundRun,resolveOwnProseProgramPath,startOwnProseProgram}from'./execution.js';export function createOwnProseStartTool(_0x39f1b4,_0x1321d6){const _0x296227=_0x4813;return{'name':_0x296227(0x105),'label':_0x296227(0x115),'description':'Compile\x20a\x20natural-language\x20own-prose\x20workflow,\x20start\x20it\x20in\x20the\x20background,\x20and\x20return\x20immediately.','parameters':Type['Object']({'programPath':Type[_0x296227(0x100)]({'description':'Path\x20to\x20the\x20own-prose\x20Markdown\x20program.'}),'input':Type[_0x296227(0x142)](Type[_0x296227(0x108)]({'description':_0x296227(0x12e)}))}),async 'execute'(_0x43f109,_0x366948){const _0x926bf=_0x296227,_0x1aa67b=_0x1321d6[_0x926bf(0x140)]??process['cwd'](),_0x5ef821=requireString(_0x366948['programPath'],'programPath'),_0x385424=await resolveCallerRuntimeModelContext(_0x1321d6);try{const _0x141d7c=await startOwnProseProgram({'api':_0x39f1b4,'workspaceDir':_0x1aa67b,'sessionKey':_0x1321d6[_0x926bf(0x13c)],'agentId':_0x1321d6[_0x926bf(0x139)],'callerProvider':_0x385424[_0x926bf(0x137)],'callerModel':_0x385424[_0x926bf(0xfd)],'callerModelSource':_0x385424[_0x926bf(0x132)],'programPath':_0x5ef821,'inputs':normalizeInput(_0x366948['input'])});return{'content':textContent(renderOwnProseStatus(_0x141d7c[_0x926bf(0x114)])),'details':{'runId':_0x141d7c['runId'],'status':_0x141d7c['state'][_0x926bf(0x126)],'background':_0x141d7c[_0x926bf(0x114)]['background']?.['status']??_0x926bf(0x107),'runDir':_0x141d7c['runDir']}};}catch(_0xcd44c9){return buildOwnProseErrorResponse({'status':'error','programPath':_0x5ef821,'error':_0xcd44c9});}}};}export function createOwnProseDriveTool(_0x51e456,_0x15691a){const _0x1b56e0=_0x4813;return{'name':_0x1b56e0(0x10a),'label':_0x1b56e0(0x11d),'description':'Compile\x20a\x20natural-language\x20own-prose\x20workflow\x20and\x20execute\x20it\x20end-to-end.','parameters':Type[_0x1b56e0(0x119)]({'programPath':Type[_0x1b56e0(0x100)]({'description':_0x1b56e0(0x110)}),'input':Type[_0x1b56e0(0x142)](Type[_0x1b56e0(0x108)]({'description':_0x1b56e0(0x12e)}))}),async 'execute'(_0x178b85,_0xba0694){const _0x43d420=_0x1b56e0,_0x46f9ae=_0x15691a[_0x43d420(0x140)]??process[_0x43d420(0x13e)](),_0x1a4df6=requireString(_0xba0694[_0x43d420(0x133)],_0x43d420(0x133)),_0x222020=await resolveCallerRuntimeModelContext(_0x15691a);try{const _0x14dff0=await driveOwnProseProgram({'api':_0x51e456,'workspaceDir':_0x46f9ae,'programPath':_0x1a4df6,'inputs':normalizeInput(_0xba0694[_0x43d420(0x11b)]),'sessionKey':_0x15691a[_0x43d420(0x13c)],'agentId':_0x15691a[_0x43d420(0x139)],'callerProvider':_0x222020['provider'],'callerModel':_0x222020[_0x43d420(0xfd)],'callerModelSource':_0x222020['source']});return{'content':textContent(renderOwnProseStatus(_0x14dff0['state'])),'details':{'runId':_0x14dff0['runId'],'status':_0x14dff0['state']['status'],'runDir':_0x14dff0[_0x43d420(0x134)],'finalOutputPath':_0x14dff0['state'][_0x43d420(0x13b)]??null}};}catch(_0x98f93b){return buildOwnProseErrorResponse({'status':'error','programPath':_0x1a4df6,'error':_0x98f93b});}}};}export function createOwnProseStatusTool(_0x45dcae,_0x4e678c){const _0x2fe06a=_0x4813;return{'name':_0x2fe06a(0x10e),'label':_0x2fe06a(0x12a),'description':_0x2fe06a(0x10b),'parameters':Type['Object']({'runId':Type[_0x2fe06a(0x142)](Type[_0x2fe06a(0x100)]({'description':_0x2fe06a(0x10f)})),'programPath':Type[_0x2fe06a(0x142)](Type[_0x2fe06a(0x100)]({'description':_0x2fe06a(0x128)}))}),async 'execute'(_0x1dcf8c,_0x30d0e1){const _0x19fec4=_0x2fe06a,_0xd2cdb1=_0x4e678c[_0x19fec4(0x140)]??process[_0x19fec4(0x13e)]();if(typeof _0x30d0e1[_0x19fec4(0x129)]==='string'&&_0x30d0e1[_0x19fec4(0x129)]['trim']()){const _0x526c74=_0x30d0e1[_0x19fec4(0x129)][_0x19fec4(0x144)]();try{const {state:_0x154048,plan:_0x79603d}=await loadOwnProseRunState(_0xd2cdb1,_0x45dcae[_0x19fec4(0x116)],_0x526c74);return{'content':textContent(renderOwnProseStatus(_0x154048)),'details':{'state':_0x154048,'plan':_0x79603d}};}catch(_0x28d8ca){return buildOwnProseErrorResponse({'status':_0x19fec4(0x12b),'runId':_0x526c74,'error':_0x28d8ca});}}if(typeof _0x30d0e1[_0x19fec4(0x133)]===_0x19fec4(0x125)&&_0x30d0e1[_0x19fec4(0x133)][_0x19fec4(0x144)]()){const _0xa53d4c=_0x30d0e1[_0x19fec4(0x133)][_0x19fec4(0x144)](),_0xea843c=resolveOwnProseProgramPath(_0xd2cdb1,_0xa53d4c);try{if(!_0xea843c)throw new Error(_0x19fec4(0xfc));const _0x59c7d6=await inspectOwnProseProgramFile(_0xea843c);return{'content':textContent(JSON[_0x19fec4(0x111)](_0x59c7d6,null,0x2)),'details':_0x59c7d6};}catch(_0x2e5135){return buildOwnProseErrorResponse({'status':_0x19fec4(0x12b),'programPath':_0xa53d4c,'error':_0x2e5135});}}throw new Error('runId\x20or\x20programPath\x20required');}};}export function createOwnProseBackgroundRunTool(_0x2b1f3e,_0x2bd006){const _0x461459=_0x4813;return{'name':_0x461459(0x136),'label':'OwnProse\x20Background\x20Run','description':_0x461459(0x138),'parameters':Type['Object']({'runId':Type[_0x461459(0x100)]({'description':_0x461459(0x131)})}),async 'execute'(_0x3f214e,_0x5f120d){const _0xcc4a77=_0x461459,_0x58b54c=_0x2bd006[_0xcc4a77(0x140)]??process[_0xcc4a77(0x13e)](),_0x437558=requireString(_0x5f120d[_0xcc4a77(0x129)],_0xcc4a77(0x129));try{const _0x268dc6=await resumeOwnProseBackgroundRun({'api':_0x2b1f3e,'workspaceDir':_0x58b54c,'runId':_0x437558});return{'content':textContent(renderOwnProseStatus(_0x268dc6[_0xcc4a77(0x114)])),'details':{'runId':_0x268dc6['runId'],'status':_0x268dc6[_0xcc4a77(0x114)][_0xcc4a77(0x126)],'background':_0x268dc6[_0xcc4a77(0x114)]['background']?.[_0xcc4a77(0x126)]??null,'worker':_0x268dc6[_0xcc4a77(0x114)][_0xcc4a77(0x117)]?.[_0xcc4a77(0xff)]?.[_0xcc4a77(0x126)]??null,'runDir':_0x268dc6['runDir']}};}catch(_0x7a4b28){return buildOwnProseErrorResponse({'status':_0xcc4a77(0x12b),'runId':_0x437558,'error':_0x7a4b28});}}};}function requireString(_0x5d12cb,_0x2587d1){const _0x35ab6f=_0x4813;if(typeof _0x5d12cb!==_0x35ab6f(0x125)||!_0x5d12cb[_0x35ab6f(0x144)]())throw new Error(_0x2587d1+_0x35ab6f(0x12c));return _0x5d12cb[_0x35ab6f(0x144)]();}function normalizeInput(_0x21234c){const _0x10e3f3=_0x4813;if(_0x21234c==null)return{};if(!_0x21234c||typeof _0x21234c!=='object'||Array[_0x10e3f3(0x112)](_0x21234c))throw new Error(_0x10e3f3(0x104));return _0x21234c;}function textContent(_0x5d8d88){const _0x246c80=_0x4813;return[{'type':_0x246c80(0x101),'text':_0x5d8d88}];}function buildOwnProseErrorResponse(_0x1d137d){const _0x1f49e0=_0x4813,_0x2e7be1=formatOwnProseToolError(_0x1d137d['error']),_0x384dec={'runId':_0x1d137d[_0x1f49e0(0x129)]??null,'status':_0x1d137d['status'],..._0x1d137d['programPath']?{'programPath':_0x1d137d[_0x1f49e0(0x133)]}:{},'error':_0x2e7be1};return{'content':textContent(JSON[_0x1f49e0(0x111)](_0x384dec,null,0x2)),'details':_0x384dec};}function formatOwnProseToolError(_0x14f883){const _0x1ece8b=_0x4813;return _0x14f883 instanceof Error?_0x14f883[_0x1ece8b(0x11e)]:String(_0x14f883);}async function resolveCallerRuntimeModelContext(_0x574d17){const _0x977bd4=_0x4813,_0x1a3f3a=await resolveSessionRuntimeModelContext(_0x574d17);if(_0x1a3f3a[_0x977bd4(0x137)]||_0x1a3f3a['model'])return{'provider':_0x1a3f3a[_0x977bd4(0x137)],'model':_0x1a3f3a['model'],'source':_0x977bd4(0x109)};const _0x2b70c6=resolveAgentDefaultModelContext(_0x574d17[_0x977bd4(0x13f)]??_0x574d17[_0x977bd4(0x121)]);if(_0x2b70c6[_0x977bd4(0x137)]||_0x2b70c6['model'])return{'provider':_0x2b70c6[_0x977bd4(0x137)],'model':_0x2b70c6[_0x977bd4(0xfd)],'source':_0x977bd4(0x12f)};return{};}function _0x4813(_0x59fe16,_0x202994){_0x59fe16=_0x59fe16-0xfc;const _0x13e4ba=_0x13e4();let _0x4813e7=_0x13e4ba[_0x59fe16];return _0x4813e7;}async function resolveSessionRuntimeModelContext(_0x30342c){const _0x5f2310=_0x4813;if(!_0x30342c['sessionKey']||!_0x30342c[_0x5f2310(0x103)])return{};const _0x4bdb3f=_0x542708[_0x5f2310(0x143)](_0x30342c[_0x5f2310(0x103)],_0x5f2310(0x11c),_0x5f2310(0x120));try{const _0x14cf56=await _0x39614a[_0x5f2310(0x122)](_0x4bdb3f,_0x5f2310(0x11a)),_0x2ea9ec=JSON[_0x5f2310(0x102)](_0x14cf56),_0x2f9c0a=_0x2ea9ec[_0x30342c['sessionKey']];if(!_0x2f9c0a||typeof _0x2f9c0a!=='object'||Array[_0x5f2310(0x112)](_0x2f9c0a))return{};const _0x22fb54=_0x2f9c0a;return{'provider':typeof _0x22fb54[_0x5f2310(0x13a)]==='string'&&_0x22fb54[_0x5f2310(0x13a)][_0x5f2310(0x144)]()?_0x22fb54['modelProvider']['trim']():undefined,'model':typeof _0x22fb54[_0x5f2310(0xfd)]===_0x5f2310(0x125)&&_0x22fb54[_0x5f2310(0xfd)][_0x5f2310(0x144)]()?_0x22fb54['model']['trim']():undefined};}catch{return{};}}function resolveAgentDefaultModelContext(_0xa672c8){const _0x30cdba=readPrimaryModelRef(_0xa672c8);if(!_0x30cdba)return{};return splitModelRef(_0x30cdba);}function readPrimaryModelRef(_0x54882a){const _0x3eb285=_0x4813,_0x3b993f=asRecord(_0x54882a?.['agents']),_0x8f265f=asRecord(_0x3b993f?.[_0x3eb285(0x11f)]),_0x2598f6=asRecord(_0x8f265f?.['model']),_0x3677e5=_0x2598f6?.[_0x3eb285(0xfe)];return typeof _0x3677e5===_0x3eb285(0x125)&&_0x3677e5['trim']()?_0x3677e5[_0x3eb285(0x144)]():undefined;}function splitModelRef(_0x13318e){const _0x3ff27a=_0x4813,_0x552851=_0x13318e['trim'](),_0x26bfba=_0x552851[_0x3ff27a(0x124)]('/');if(_0x26bfba<=0x0||_0x26bfba>=_0x552851[_0x3ff27a(0x12d)]-0x1)return{'model':_0x552851||undefined};return{'provider':_0x552851[_0x3ff27a(0x135)](0x0,_0x26bfba),'model':_0x552851[_0x3ff27a(0x135)](_0x26bfba+0x1)};}function asRecord(_0x45cddd){const _0x4791cd=_0x4813;return _0x45cddd&&typeof _0x45cddd===_0x4791cd(0x141)&&!Array[_0x4791cd(0x112)](_0x45cddd)?_0x45cddd:undefined;}function _0x13e4(){const _0x138362=['trim','programPath\x20required','model','primary','worker','String','text','parse','agentDir','input\x20must\x20be\x20an\x20object','own_prose_start','387534JHuDQB','queued','Unknown','caller_session','own_prose_drive','Show\x20the\x20current\x20state\x20of\x20an\x20own-prose\x20run\x20or\x20inspect\x20a\x20program.','439607exXVpz','175bfbTsy','own_prose_status','Existing\x20run\x20id.','Path\x20to\x20the\x20own-prose\x20Markdown\x20program.','stringify','isArray','4ZJxdzt','state','OwnProse\x20Start','pluginConfig','background','24564cJLmdF','Object','utf8','input','sessions','OwnProse\x20Drive','message','defaults','sessions.json','config','readFile','1261576cbfMUg','indexOf','string','status','2316321VPLGYK','Markdown\x20program\x20path\x20to\x20inspect.','runId','OwnProse\x20Status','error','\x20required','length','Optional\x20JSON\x20object\x20with\x20input\x20values.','agent_default','95457RRnTZz','Queued\x20own-prose\x20run\x20id\x20to\x20resume.','source','programPath','runDir','slice','own_prose_background_run','provider','Internal\x20own-prose\x20continuation\x20tool\x20that\x20resumes\x20a\x20queued\x20background\x20workflow\x20run.','agentId','modelProvider','finalOutputPath','sessionKey','284496XkbmMw','cwd','runtimeConfig','workspaceDir','object','Optional','join'];_0x13e4=function(){return _0x138362;};return _0x13e4();}
|
|
@@ -0,0 +1,234 @@
|
|
|
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
|
+
modelSource?: "caller_session" | "agent_default" | "plugin_default";
|
|
132
|
+
approvalMode?: string;
|
|
133
|
+
sandbox?: string;
|
|
134
|
+
agentId?: string;
|
|
135
|
+
sessionKey?: string;
|
|
136
|
+
};
|
|
137
|
+
export type RunFailure = {
|
|
138
|
+
nodeId?: NodeId;
|
|
139
|
+
reason: string;
|
|
140
|
+
};
|
|
141
|
+
export type RunState = {
|
|
142
|
+
version: OwnProseVersion;
|
|
143
|
+
runId: RunId;
|
|
144
|
+
status: RunStatus;
|
|
145
|
+
programPath: string;
|
|
146
|
+
inputs: Record<string, unknown>;
|
|
147
|
+
compiledPlanPath: string;
|
|
148
|
+
entryNodeId: NodeId;
|
|
149
|
+
currentNodeId: NodeId | null;
|
|
150
|
+
stepsExecuted: number;
|
|
151
|
+
maxSteps: number;
|
|
152
|
+
startedAt: string;
|
|
153
|
+
updatedAt: string;
|
|
154
|
+
nodeStates: Record<NodeId, NodeExecutionRecord>;
|
|
155
|
+
branchDecisions: BranchDecisionRecord[];
|
|
156
|
+
artifacts: Record<NodeId, string>;
|
|
157
|
+
finalOutputPath?: string;
|
|
158
|
+
failure?: RunFailure;
|
|
159
|
+
background?: {
|
|
160
|
+
mode: "background";
|
|
161
|
+
status: "queued" | "running" | "finished" | "failed";
|
|
162
|
+
startedAt: string;
|
|
163
|
+
finishedAt?: string;
|
|
164
|
+
originSessionKey?: string;
|
|
165
|
+
originAgentId?: string;
|
|
166
|
+
worker?: {
|
|
167
|
+
status: "queued" | "running" | "finished" | "failed";
|
|
168
|
+
queuedAt?: string;
|
|
169
|
+
startedAt?: string;
|
|
170
|
+
finishedAt?: string;
|
|
171
|
+
sessionKey?: string;
|
|
172
|
+
runId?: string;
|
|
173
|
+
error?: string;
|
|
174
|
+
};
|
|
175
|
+
notification?: {
|
|
176
|
+
status: "pending" | "queued" | "skipped" | "failed";
|
|
177
|
+
attemptedAt?: string;
|
|
178
|
+
queuedAt?: string;
|
|
179
|
+
runId?: string;
|
|
180
|
+
error?: string;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
runtime: RuntimeContext;
|
|
184
|
+
};
|
|
185
|
+
export type TimelineEvent = {
|
|
186
|
+
at: string;
|
|
187
|
+
type: "run_started";
|
|
188
|
+
runId: RunId;
|
|
189
|
+
message: string;
|
|
190
|
+
} | {
|
|
191
|
+
at: string;
|
|
192
|
+
type: "node_started";
|
|
193
|
+
runId: RunId;
|
|
194
|
+
nodeId: NodeId;
|
|
195
|
+
message: string;
|
|
196
|
+
} | {
|
|
197
|
+
at: string;
|
|
198
|
+
type: "node_completed";
|
|
199
|
+
runId: RunId;
|
|
200
|
+
nodeId: NodeId;
|
|
201
|
+
message: string;
|
|
202
|
+
} | {
|
|
203
|
+
at: string;
|
|
204
|
+
type: "branch_decided";
|
|
205
|
+
runId: RunId;
|
|
206
|
+
nodeId: NodeId;
|
|
207
|
+
branch: BranchKey;
|
|
208
|
+
message: string;
|
|
209
|
+
} | {
|
|
210
|
+
at: string;
|
|
211
|
+
type: "run_failed";
|
|
212
|
+
runId: RunId;
|
|
213
|
+
nodeId?: NodeId;
|
|
214
|
+
message: string;
|
|
215
|
+
} | {
|
|
216
|
+
at: string;
|
|
217
|
+
type: "run_completed";
|
|
218
|
+
runId: RunId;
|
|
219
|
+
message: string;
|
|
220
|
+
} | {
|
|
221
|
+
at: string;
|
|
222
|
+
type: "notification_sent" | "notification_failed" | "notification_skipped";
|
|
223
|
+
runId: RunId;
|
|
224
|
+
message: string;
|
|
225
|
+
};
|
|
226
|
+
export type OwnProseRunResult = {
|
|
227
|
+
runId: RunId;
|
|
228
|
+
runDir: string;
|
|
229
|
+
state: RunState;
|
|
230
|
+
plan: CompiledPlan;
|
|
231
|
+
};
|
|
232
|
+
export type OwnProseBackgroundStartResult = OwnProseRunResult & {
|
|
233
|
+
alreadyRunning: boolean;
|
|
234
|
+
};
|
|
@@ -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-alpha.1",
|
|
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
|
+
}
|