@onetype/framework 2.0.41 → 2.0.42
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/addons/ai/agents/addon.js +23 -0
- package/addons/ai/agents/functions/parse.js +129 -0
- package/addons/ai/agents/item/functions/run.js +218 -0
- package/addons/ai/agents/load.js +8 -0
- package/addons/ai/orchestrator/addon.js +25 -0
- package/addons/ai/orchestrator/item/functions/run.js +277 -0
- package/addons/ai/orchestrator/item/functions/state/agent.js +41 -0
- package/addons/ai/orchestrator/item/functions/state/conclusion.js +27 -0
- package/addons/ai/orchestrator/item/functions/state/done.js +40 -0
- package/addons/ai/orchestrator/item/functions/state/execute.js +16 -0
- package/addons/ai/orchestrator/item/functions/state/goal.js +34 -0
- package/addons/ai/orchestrator/item/functions/state/input.js +55 -0
- package/addons/ai/orchestrator/item/functions/state/summary.js +26 -0
- package/addons/ai/orchestrator/items/agents/achievable.js +37 -0
- package/addons/ai/orchestrator/items/agents/agent.js +46 -0
- package/addons/ai/orchestrator/items/agents/conclusion.js +41 -0
- package/addons/ai/orchestrator/items/agents/done.js +40 -0
- package/addons/ai/orchestrator/items/agents/goal.js +58 -0
- package/addons/ai/orchestrator/items/agents/input.js +34 -0
- package/addons/ai/orchestrator/items/agents/planner.js +30 -0
- package/addons/ai/orchestrator/items/agents/summary.js +29 -0
- package/addons/ai/orchestrator/items/chat.js +10 -0
- package/addons/ai/orchestrator/load.js +25 -0
- package/addons/ai/providers/addon.js +16 -0
- package/addons/ai/providers/functions/default.js +14 -0
- package/addons/ai/providers/item/functions/request.js +62 -0
- package/addons/ai/providers/items/nue.js +98 -0
- package/addons/ai/providers/load.js +10 -0
- package/addons/render/elements/front/functions/runtime.js +25 -0
- package/lib/browser.js +1 -24
- package/lib/items/directives/160-slot.js +1 -1
- package/lib/items/directives/500-click-outside.js +43 -43
- package/lib/items/elements/ai/chat/chat.css +710 -0
- package/lib/items/elements/ai/chat/chat.js +429 -0
- package/lib/items/elements/cards/pricing/pricing.css +174 -0
- package/lib/items/elements/{sections → cards}/pricing/pricing.js +30 -11
- package/lib/items/elements/form/button/button.css +250 -0
- package/lib/items/elements/form/button/button.js +15 -20
- package/lib/items/elements/form/checkbox/checkbox.css +109 -0
- package/lib/items/elements/form/checkbox/checkbox.js +58 -54
- package/lib/items/elements/form/color/color.css +128 -0
- package/lib/items/elements/form/color/color.js +100 -0
- package/lib/items/elements/form/date/date.css +84 -0
- package/lib/items/elements/form/date/date.js +69 -0
- package/lib/items/elements/form/field/field.css +33 -57
- package/lib/items/elements/form/field/field.js +4 -4
- package/lib/items/elements/form/input/input.css +59 -84
- package/lib/items/elements/form/input/input.js +84 -75
- package/lib/items/elements/form/radio/radio.css +118 -0
- package/lib/items/elements/form/radio/radio.js +58 -54
- package/lib/items/elements/form/rating/rating.css +28 -66
- package/lib/items/elements/form/rating/rating.js +17 -21
- package/lib/items/elements/form/section/section.css +30 -73
- package/lib/items/elements/form/section/section.js +5 -5
- package/lib/items/elements/form/select/select.css +186 -0
- package/lib/items/elements/form/select/select.js +165 -0
- package/lib/items/elements/form/slider/slider.css +55 -176
- package/lib/items/elements/form/slider/slider.js +14 -10
- package/lib/items/elements/form/tags/tags.css +152 -0
- package/lib/items/elements/form/tags/tags.js +166 -0
- package/lib/items/elements/form/textarea/textarea.css +55 -92
- package/lib/items/elements/form/textarea/textarea.js +74 -66
- package/lib/items/elements/form/toggle/toggle.css +101 -0
- package/lib/items/elements/form/toggle/toggle.js +67 -0
- package/lib/items/elements/global/code/code.css +39 -8
- package/lib/items/elements/global/code/code.js +7 -2
- package/lib/items/elements/global/faq/faq.css +38 -16
- package/lib/items/elements/global/faq/faq.js +14 -2
- package/lib/items/elements/global/heading/heading.css +37 -14
- package/lib/items/elements/global/heading/heading.js +9 -4
- package/lib/items/elements/global/markdown/markdown.css +22 -15
- package/lib/items/elements/global/markdown/markdown.js +4 -4
- package/lib/items/elements/global/menu/menu.css +173 -0
- package/lib/items/elements/global/menu/menu.js +103 -0
- package/lib/items/elements/global/notice/notice.css +27 -61
- package/lib/items/elements/global/notice/notice.js +4 -4
- package/lib/items/elements/global/parameters/parameters.css +33 -14
- package/lib/items/elements/global/parameters/parameters.js +15 -6
- package/lib/items/elements/global/tags/tags.css +18 -5
- package/lib/items/elements/global/tags/tags.js +10 -2
- package/lib/items/elements/navigation/navbar/navbar.css +39 -17
- package/lib/items/elements/navigation/navbar/navbar.js +19 -9
- package/lib/items/elements/navigation/sidebar/sidebar.css +25 -39
- package/lib/items/elements/navigation/sidebar/sidebar.js +28 -6
- package/lib/items/elements/navigation/tabs/tabs.css +35 -16
- package/lib/items/elements/navigation/tabs/tabs.js +16 -2
- package/lib/items/elements/status/code/code.css +21 -12
- package/lib/items/elements/status/empty/empty.css +22 -17
- package/lib/items/elements/status/empty/empty.js +1 -1
- package/lib/items/elements/status/error/error.css +22 -12
- package/lib/items/elements/status/error/error.js +1 -1
- package/lib/items/elements/status/loading/loading.css +24 -14
- package/lib/items/elements/status/loading/loading.js +4 -4
- package/lib/load.js +14 -6
- package/lib/styles/reset.css +1 -1
- package/lists.md +586 -0
- package/orchestrator.md +288 -0
- package/package.json +9 -3
- package/lib/items/elements/form/button/styles/base.css +0 -176
- package/lib/items/elements/form/button/styles/sizes.css +0 -78
- package/lib/items/elements/form/button/styles/variants.css +0 -421
- package/lib/items/elements/form/checkbox/styles/base.css +0 -52
- package/lib/items/elements/form/checkbox/styles/sizes.css +0 -39
- package/lib/items/elements/form/checkbox/styles/variants.css +0 -121
- package/lib/items/elements/form/input/styles/base.css +0 -26
- package/lib/items/elements/form/input/styles/sizes.css +0 -15
- package/lib/items/elements/form/input/styles/variants.css +0 -98
- package/lib/items/elements/form/radio/styles/base.css +0 -48
- package/lib/items/elements/form/radio/styles/sizes.css +0 -36
- package/lib/items/elements/form/radio/styles/variants.css +0 -121
- package/lib/items/elements/global/card/card.css +0 -57
- package/lib/items/elements/global/card/card.js +0 -48
- package/lib/items/elements/sections/footer/footer.css +0 -205
- package/lib/items/elements/sections/footer/footer.js +0 -109
- package/lib/items/elements/sections/hero/hero.css +0 -100
- package/lib/items/elements/sections/hero/hero.js +0 -54
- package/lib/items/elements/sections/pricing/pricing.css +0 -148
- package/lib/items/elements/sections/stats/stats.css +0 -34
- package/lib/items/elements/sections/stats/stats.js +0 -74
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import onetype from 'onetype';
|
|
2
|
+
import agents from '#agents/load.js';
|
|
3
|
+
import orchestrator from '#orchestrator/addon.js';
|
|
4
|
+
|
|
5
|
+
orchestrator.Fn('item.state.agent', async function(item, state)
|
|
6
|
+
{
|
|
7
|
+
const payload = {
|
|
8
|
+
task: state.task,
|
|
9
|
+
history: state.history.map((item) =>
|
|
10
|
+
{
|
|
11
|
+
return {
|
|
12
|
+
step: item.step,
|
|
13
|
+
agent: item.agent,
|
|
14
|
+
goal: item.goal,
|
|
15
|
+
conclusion: item.conclusion
|
|
16
|
+
}
|
|
17
|
+
}),
|
|
18
|
+
agents: state.agents
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const result = await agents.ItemGet('orchestrator-agent').Fn('run', payload);
|
|
22
|
+
|
|
23
|
+
if (!state.agents.find((a) => a.id === result.agent))
|
|
24
|
+
{
|
|
25
|
+
throw onetype.Error(422, `Agent "${result.agent}" not found in available agents`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
state.agent = result.agent;
|
|
29
|
+
state.goal = result.goal;
|
|
30
|
+
state.tokens.input += result._meta.tokens.input;
|
|
31
|
+
state.tokens.output += result._meta.tokens.output;
|
|
32
|
+
|
|
33
|
+
const onAgent = item.Get('onAgent');
|
|
34
|
+
|
|
35
|
+
if(onAgent)
|
|
36
|
+
{
|
|
37
|
+
await onAgent({ state, output: result });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return result;
|
|
41
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import agents from '#agents/load.js';
|
|
2
|
+
import orchestrator from '#orchestrator/addon.js';
|
|
3
|
+
|
|
4
|
+
orchestrator.Fn('item.state.conclusion', async function(item, state)
|
|
5
|
+
{
|
|
6
|
+
const payload = {
|
|
7
|
+
task: state.task,
|
|
8
|
+
goal: state.goal,
|
|
9
|
+
agent: state.agents.find((entry) => entry.id === state.agent),
|
|
10
|
+
output: state.output
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const result = await agents.ItemGet('orchestrator-conclusion').Fn('run', payload);
|
|
14
|
+
|
|
15
|
+
state.conclusion = result.conclusion;
|
|
16
|
+
state.tokens.input += result._meta.tokens.input;
|
|
17
|
+
state.tokens.output += result._meta.tokens.output;
|
|
18
|
+
|
|
19
|
+
const onConclusion = item.Get('onConclusion');
|
|
20
|
+
|
|
21
|
+
if(onConclusion)
|
|
22
|
+
{
|
|
23
|
+
await onConclusion({ state, output: result });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return result;
|
|
27
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import agents from '#agents/load.js';
|
|
2
|
+
import orchestrator from '#orchestrator/addon.js';
|
|
3
|
+
|
|
4
|
+
orchestrator.Fn('item.state.done', async function(item, state)
|
|
5
|
+
{
|
|
6
|
+
const agent = agents.ItemGet('orchestrator-done');
|
|
7
|
+
|
|
8
|
+
const payload = {
|
|
9
|
+
task: state.task,
|
|
10
|
+
history: state.history.map((item) =>
|
|
11
|
+
{
|
|
12
|
+
return {
|
|
13
|
+
step: item.step,
|
|
14
|
+
agent: item.agent,
|
|
15
|
+
goal: item.goal,
|
|
16
|
+
conclusion: item.conclusion
|
|
17
|
+
}
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const result = await agent.Fn('run', payload);
|
|
22
|
+
|
|
23
|
+
state.done = result.done;
|
|
24
|
+
|
|
25
|
+
const actions = result.actions || [];
|
|
26
|
+
const confirmed = actions.filter(a => a.confirmed).length;
|
|
27
|
+
|
|
28
|
+
state.debug = { total: actions.length, confirmed, done: result.done, actions };
|
|
29
|
+
state.tokens.input += result._meta.tokens.input;
|
|
30
|
+
state.tokens.output += result._meta.tokens.output;
|
|
31
|
+
|
|
32
|
+
const onDone = item.Get('onDone');
|
|
33
|
+
|
|
34
|
+
if(onDone)
|
|
35
|
+
{
|
|
36
|
+
await onDone({ state, output: result });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return result;
|
|
40
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import agents from '#agents/load.js';
|
|
2
|
+
import orchestrator from '#orchestrator/addon.js';
|
|
3
|
+
|
|
4
|
+
orchestrator.Fn('item.state.execute', async function(item, state)
|
|
5
|
+
{
|
|
6
|
+
const result = await agents.ItemGet(state.agent).Fn('run', state.input);
|
|
7
|
+
|
|
8
|
+
const { _meta, ...output } = result;
|
|
9
|
+
|
|
10
|
+
state.output = output;
|
|
11
|
+
|
|
12
|
+
state.tokens.input += result._meta.tokens.input;
|
|
13
|
+
state.tokens.output += result._meta.tokens.output;
|
|
14
|
+
|
|
15
|
+
return result;
|
|
16
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import agents from '#agents/load.js';
|
|
2
|
+
import orchestrator from '#orchestrator/addon.js';
|
|
3
|
+
|
|
4
|
+
orchestrator.Fn('item.state.goal', async function(item, state)
|
|
5
|
+
{
|
|
6
|
+
const payload = {
|
|
7
|
+
task: state.task,
|
|
8
|
+
agent: state.agents.find((item) => item.id === state.agent),
|
|
9
|
+
history: state.history.map((entry) =>
|
|
10
|
+
{
|
|
11
|
+
return {
|
|
12
|
+
step: entry.step,
|
|
13
|
+
agent: entry.agent,
|
|
14
|
+
goal: entry.goal,
|
|
15
|
+
conclusion: entry.conclusion
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const result = await agents.ItemGet('orchestrator-goal').Fn('run', payload);
|
|
21
|
+
|
|
22
|
+
state.goal = result.goal;
|
|
23
|
+
state.tokens.input += result._meta.tokens.input;
|
|
24
|
+
state.tokens.output += result._meta.tokens.output;
|
|
25
|
+
|
|
26
|
+
const onGoal = item.Get('onGoal');
|
|
27
|
+
|
|
28
|
+
if(onGoal)
|
|
29
|
+
{
|
|
30
|
+
await onGoal({ state, output: result });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return result;
|
|
34
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import onetype from 'onetype';
|
|
2
|
+
import agents from '#agents/load.js';
|
|
3
|
+
import orchestrator from '#orchestrator/addon.js';
|
|
4
|
+
|
|
5
|
+
orchestrator.Fn('item.state.input', async function(item, state)
|
|
6
|
+
{
|
|
7
|
+
const agent = agents.ItemGet(state.agent);
|
|
8
|
+
const schema = agent.Get('input');
|
|
9
|
+
const fields = Object.keys(schema);
|
|
10
|
+
|
|
11
|
+
if (fields.length === 0)
|
|
12
|
+
{
|
|
13
|
+
state.input = {};
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const payload = {
|
|
18
|
+
goal: state.goal,
|
|
19
|
+
agent: {
|
|
20
|
+
id: agent.Get('id'),
|
|
21
|
+
description: agent.Get('description'),
|
|
22
|
+
config: agent.Get('input')
|
|
23
|
+
},
|
|
24
|
+
fields: schema
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const result = await agents.ItemGet('orchestrator-input').Fn('run', payload);
|
|
28
|
+
|
|
29
|
+
const matched = {};
|
|
30
|
+
|
|
31
|
+
for (const field of fields)
|
|
32
|
+
{
|
|
33
|
+
const value = result.values?.[field];
|
|
34
|
+
|
|
35
|
+
if (value === undefined || value === null) continue;
|
|
36
|
+
|
|
37
|
+
matched[field] = value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Defaults */
|
|
41
|
+
|
|
42
|
+
for (const field of fields)
|
|
43
|
+
{
|
|
44
|
+
if (matched[field] === undefined && schema[field]?.value !== undefined)
|
|
45
|
+
{
|
|
46
|
+
matched[field] = schema[field].value;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
state.input = onetype.DataDefine(matched, schema);
|
|
51
|
+
state.tokens.input += result._meta.tokens.input;
|
|
52
|
+
state.tokens.output += result._meta.tokens.output;
|
|
53
|
+
|
|
54
|
+
return result;
|
|
55
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import agents from '#agents/load.js';
|
|
2
|
+
import orchestrator from '#orchestrator/addon.js';
|
|
3
|
+
|
|
4
|
+
orchestrator.Fn('item.state.summary', async function(item, state)
|
|
5
|
+
{
|
|
6
|
+
const payload = {
|
|
7
|
+
task: state.task,
|
|
8
|
+
history: state.history.map((entry) =>
|
|
9
|
+
{
|
|
10
|
+
return {
|
|
11
|
+
step: entry.step,
|
|
12
|
+
agent: entry.agent,
|
|
13
|
+
goal: entry.goal,
|
|
14
|
+
conclusion: entry.conclusion
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const result = await agents.ItemGet('orchestrator-summary').Fn('run', payload);
|
|
20
|
+
|
|
21
|
+
state.summary = result.summary;
|
|
22
|
+
state.tokens.input += result._meta.tokens.input;
|
|
23
|
+
state.tokens.output += result._meta.tokens.output;
|
|
24
|
+
|
|
25
|
+
return result;
|
|
26
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
onetype.AddonReady('agents', (agents) =>
|
|
2
|
+
{
|
|
3
|
+
agents.Item({
|
|
4
|
+
id: 'orchestrator-achievable',
|
|
5
|
+
name: 'Orchestrator Achievable',
|
|
6
|
+
description: 'Checks if the planned tasks can be executed by the available agents',
|
|
7
|
+
instructions: `
|
|
8
|
+
You receive a list of planned tasks and a list of available agents.
|
|
9
|
+
For each task, determine if the required actions can be performed by the available agents.
|
|
10
|
+
Agents can be chained, repeated, and used conditionally by an orchestrator.
|
|
11
|
+
Filtering, looping, and conditional logic are handled by the orchestrator — not by agents.
|
|
12
|
+
A task is achievable if the underlying actions (list, create, delete, etc.) have matching agents.
|
|
13
|
+
Only reject when the action type itself has no matching agent.
|
|
14
|
+
`,
|
|
15
|
+
tokens: 1000,
|
|
16
|
+
input: {
|
|
17
|
+
tasks: {
|
|
18
|
+
type: 'array',
|
|
19
|
+
description: 'Planned tasks [{task, order}]'
|
|
20
|
+
},
|
|
21
|
+
agents: {
|
|
22
|
+
type: 'array',
|
|
23
|
+
description: 'Available agents [{id, description}]'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
output: {
|
|
27
|
+
achievable: {
|
|
28
|
+
type: 'boolean',
|
|
29
|
+
description: 'true if all tasks can be handled by available agents'
|
|
30
|
+
},
|
|
31
|
+
rejected: {
|
|
32
|
+
type: 'array',
|
|
33
|
+
description: 'Tasks that no agent can handle [{task, reason}]'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
onetype.AddonReady('agents', (agents) =>
|
|
2
|
+
{
|
|
3
|
+
agents.Item({
|
|
4
|
+
id: 'orchestrator-agent',
|
|
5
|
+
name: 'Orchestrator Agent',
|
|
6
|
+
description: 'Selects the next agent and writes its goal',
|
|
7
|
+
instructions: `
|
|
8
|
+
Pick the next agent and write its goal.
|
|
9
|
+
|
|
10
|
+
Read conclusions to know what is done. If data is missing, pick a listing agent first.
|
|
11
|
+
If data exists, pick the action agent. Complete remaining items of the same type before moving on.
|
|
12
|
+
Agent ID must exactly match one from the agents list.
|
|
13
|
+
|
|
14
|
+
Goal: one action, one target. Include concrete values from conclusions. Never guess.
|
|
15
|
+
`,
|
|
16
|
+
tokens: 400,
|
|
17
|
+
input: {
|
|
18
|
+
task: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'The original user request'
|
|
21
|
+
},
|
|
22
|
+
history: {
|
|
23
|
+
type: 'array',
|
|
24
|
+
description: 'Completed steps [{step, agent, goal, conclusion}]'
|
|
25
|
+
},
|
|
26
|
+
agents: {
|
|
27
|
+
type: 'array',
|
|
28
|
+
description: 'Available agents [{id, description, config}]'
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
output: {
|
|
32
|
+
agent: {
|
|
33
|
+
type: 'string',
|
|
34
|
+
description: 'Exact agent ID from the agents list'
|
|
35
|
+
},
|
|
36
|
+
reason: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
description: 'One sentence: why this agent now'
|
|
39
|
+
},
|
|
40
|
+
goal: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'Actionable goal with literal values for the agent'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
onetype.AddonReady('agents', (agents) =>
|
|
2
|
+
{
|
|
3
|
+
agents.Item({
|
|
4
|
+
id: 'orchestrator-conclusion',
|
|
5
|
+
name: 'Orchestrator Conclusion',
|
|
6
|
+
description: 'Records what happened — the only memory future steps can read',
|
|
7
|
+
instructions: `
|
|
8
|
+
You are the orchestrator's memory. Future steps ONLY read your conclusion.
|
|
9
|
+
Omitted data is lost forever.
|
|
10
|
+
|
|
11
|
+
Single dense paragraph. Include every field and value from the output.
|
|
12
|
+
ALL items if the output is a list. Preserve data relevant to the task and goal.
|
|
13
|
+
Past tense. Max 60 words.
|
|
14
|
+
`,
|
|
15
|
+
tokens: 300,
|
|
16
|
+
input: {
|
|
17
|
+
task: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: 'The original user request'
|
|
20
|
+
},
|
|
21
|
+
goal: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: 'What this step was trying to do'
|
|
24
|
+
},
|
|
25
|
+
agent: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
description: 'Agent that ran {id, description, config}'
|
|
28
|
+
},
|
|
29
|
+
output: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
description: 'Raw output from the agent'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
output: {
|
|
35
|
+
conclusion: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
description: 'Dense conclusion with all IDs'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
onetype.AddonReady('agents', (agents) =>
|
|
2
|
+
{
|
|
3
|
+
agents.Item({
|
|
4
|
+
id: 'orchestrator-done',
|
|
5
|
+
name: 'Orchestrator Done',
|
|
6
|
+
description: 'Checks if the orchestration task has been achieved',
|
|
7
|
+
instructions: `
|
|
8
|
+
Determine if the task is fully complete.
|
|
9
|
+
|
|
10
|
+
Parse the task into distinct required actions. Only count mutating actions
|
|
11
|
+
(create, update, delete, add, remove, publish, etc). Listings are not actions.
|
|
12
|
+
|
|
13
|
+
For each action, check if a conclusion confirms it succeeded.
|
|
14
|
+
Scope expands when conclusions reveal multiple items to process.
|
|
15
|
+
|
|
16
|
+
done = true ONLY when every required action has a confirming conclusion.
|
|
17
|
+
`,
|
|
18
|
+
tokens: 400,
|
|
19
|
+
input: {
|
|
20
|
+
task: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'The original user request'
|
|
23
|
+
},
|
|
24
|
+
history: {
|
|
25
|
+
type: 'array',
|
|
26
|
+
description: 'Completed steps [{step, agent, goal, conclusion}]'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
output: {
|
|
30
|
+
actions: {
|
|
31
|
+
type: 'array',
|
|
32
|
+
description: 'Each required action with its status [{action, confirmed}]'
|
|
33
|
+
},
|
|
34
|
+
done: {
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
description: 'true when every action is confirmed'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
onetype.AddonReady('agents', (agents) =>
|
|
2
|
+
{
|
|
3
|
+
agents.Item({
|
|
4
|
+
id: 'orchestrator-goal',
|
|
5
|
+
name: 'Orchestrator Goal',
|
|
6
|
+
description: 'Writes a specific goal for the next agent to execute',
|
|
7
|
+
instructions: `
|
|
8
|
+
Write a goal for the selected agent.
|
|
9
|
+
|
|
10
|
+
You receive:
|
|
11
|
+
- task: the original user request
|
|
12
|
+
- agent: the selected agent {id, description}
|
|
13
|
+
- history: completed steps [{step, agent, goal, conclusion}]
|
|
14
|
+
|
|
15
|
+
The goal is the ONLY instruction the agent receives.
|
|
16
|
+
It is also used to extract literal input values for the agent.
|
|
17
|
+
|
|
18
|
+
CRITICAL — ONE ACTION, ONE TARGET:
|
|
19
|
+
- The agent executes ONCE — one API call, one item
|
|
20
|
+
- If the task requires deleting 3 pages, the goal is for ONE page only
|
|
21
|
+
- Read the agent description to know what ONE call can do
|
|
22
|
+
- Never list multiple IDs or targets in a single goal
|
|
23
|
+
|
|
24
|
+
CRITICAL — RESOLVE ALL REFERENCES:
|
|
25
|
+
- Conclusions contain exact values from previous steps — USE THEM
|
|
26
|
+
- When the task references something by name, find its EXACT identifier in conclusions
|
|
27
|
+
- When the task uses relative references (first, last, second), resolve to ACTUAL values from conclusions
|
|
28
|
+
- NEVER guess or assume any value — only use what conclusions explicitly state
|
|
29
|
+
- If the value you need is NOT in any conclusion, the goal must describe what to look up
|
|
30
|
+
|
|
31
|
+
RULES:
|
|
32
|
+
- Max 80 words
|
|
33
|
+
- Include every concrete value the agent needs to execute
|
|
34
|
+
- Plain text only, no markdown
|
|
35
|
+
`,
|
|
36
|
+
tokens: 400,
|
|
37
|
+
input: {
|
|
38
|
+
task: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
description: 'The full original user request, used to know what the agent should work toward'
|
|
41
|
+
},
|
|
42
|
+
agent: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
description: 'The selected agent that will execute this goal, with {id, description, config}'
|
|
45
|
+
},
|
|
46
|
+
history: {
|
|
47
|
+
type: 'array',
|
|
48
|
+
description: 'Chronological list of completed steps, each with {step, agent, goal, conclusion} — use conclusions to resolve concrete values'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
output: {
|
|
52
|
+
goal: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
description: 'A single actionable goal with all literal values the agent needs to execute'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
onetype.AddonReady('agents', (agents) =>
|
|
2
|
+
{
|
|
3
|
+
agents.Item({
|
|
4
|
+
id: 'orchestrator-input',
|
|
5
|
+
name: 'Orchestrator Input',
|
|
6
|
+
description: 'Extracts input values from the goal text',
|
|
7
|
+
instructions: `
|
|
8
|
+
Extract literal values from the goal text for each field.
|
|
9
|
+
Extract exactly as stated. Plain values only — no objects, no arrays.
|
|
10
|
+
If the goal has no value for a field, omit it. Better to omit than guess.
|
|
11
|
+
`,
|
|
12
|
+
tokens: 300,
|
|
13
|
+
input: {
|
|
14
|
+
goal: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Goal text with concrete values to extract'
|
|
17
|
+
},
|
|
18
|
+
agent: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
description: 'Target agent {id, description, config}'
|
|
21
|
+
},
|
|
22
|
+
fields: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
description: 'Fields needing values {name → {type, description}}'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
output: {
|
|
28
|
+
values: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
description: 'Extracted values keyed by field name'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
onetype.AddonReady('agents', (agents) =>
|
|
2
|
+
{
|
|
3
|
+
agents.Item({
|
|
4
|
+
id: 'orchestrator-planner',
|
|
5
|
+
name: 'Orchestrator Planner',
|
|
6
|
+
description: 'Splits a user prompt into atomic tasks with ordering and parallelism',
|
|
7
|
+
instructions: `
|
|
8
|
+
Split the user prompt into logical steps.
|
|
9
|
+
Each step is a distinct action or group of actions.
|
|
10
|
+
Do not duplicate steps for unknown quantities — use one step to describe the repeated action.
|
|
11
|
+
|
|
12
|
+
For each step:
|
|
13
|
+
- task: what needs to be done
|
|
14
|
+
- order: batch number. Steps that need results from earlier steps get a higher number. Independent steps share the same number.
|
|
15
|
+
`,
|
|
16
|
+
tokens: 2000,
|
|
17
|
+
input: {
|
|
18
|
+
prompt: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'The full user prompt to split into tasks'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
output: {
|
|
24
|
+
tasks: {
|
|
25
|
+
type: 'array',
|
|
26
|
+
description: 'Atomic tasks [{task, order}]'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
onetype.AddonReady('agents', (agents) =>
|
|
2
|
+
{
|
|
3
|
+
agents.Item({
|
|
4
|
+
id: 'orchestrator-summary',
|
|
5
|
+
name: 'Orchestrator Summary',
|
|
6
|
+
description: 'Final user-facing summary of all actions',
|
|
7
|
+
instructions: `
|
|
8
|
+
Summarize what was accomplished across all steps.
|
|
9
|
+
Concrete results only. Mention failures if any. Max 40 words. Plain text.
|
|
10
|
+
`,
|
|
11
|
+
tokens: 200,
|
|
12
|
+
input: {
|
|
13
|
+
task: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: 'The original user request'
|
|
16
|
+
},
|
|
17
|
+
history: {
|
|
18
|
+
type: 'array',
|
|
19
|
+
description: 'All steps [{step, agent, goal, conclusion}]'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
output: {
|
|
23
|
+
summary: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: 'Concise summary of all actions performed'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import orchestrator from '#orchestrator/addon.js';
|
|
2
|
+
|
|
3
|
+
/* Items */
|
|
4
|
+
import '#orchestrator/items/chat.js';
|
|
5
|
+
import '#orchestrator/items/agents/done.js';
|
|
6
|
+
import '#orchestrator/items/agents/goal.js';
|
|
7
|
+
import '#orchestrator/items/agents/agent.js';
|
|
8
|
+
import '#orchestrator/items/agents/conclusion.js';
|
|
9
|
+
import '#orchestrator/items/agents/input.js';
|
|
10
|
+
import '#orchestrator/items/agents/summary.js';
|
|
11
|
+
import '#orchestrator/items/agents/planner.js';
|
|
12
|
+
import '#orchestrator/items/agents/achievable.js';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/* Functions */
|
|
16
|
+
import '#orchestrator/item/functions/state/agent.js';
|
|
17
|
+
import '#orchestrator/item/functions/state/goal.js';
|
|
18
|
+
import '#orchestrator/item/functions/state/done.js';
|
|
19
|
+
import '#orchestrator/item/functions/state/input.js';
|
|
20
|
+
import '#orchestrator/item/functions/state/conclusion.js';
|
|
21
|
+
import '#orchestrator/item/functions/state/execute.js';
|
|
22
|
+
import '#orchestrator/item/functions/state/summary.js';
|
|
23
|
+
import '#orchestrator/item/functions/run.js';
|
|
24
|
+
|
|
25
|
+
export default orchestrator;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import onetype from 'onetype';
|
|
2
|
+
|
|
3
|
+
const providers = onetype.Addon('providers', (addon) =>
|
|
4
|
+
{
|
|
5
|
+
addon.Field('id', ['string']);
|
|
6
|
+
addon.Field('name', ['string', '']);
|
|
7
|
+
addon.Field('endpoint', ['string']);
|
|
8
|
+
addon.Field('key', ['string', '']);
|
|
9
|
+
addon.Field('default', ['boolean', false]);
|
|
10
|
+
addon.Field('model', ['string', '']);
|
|
11
|
+
addon.Field('models', ['object', {}]);
|
|
12
|
+
addon.Field('onBeforeRequest', ['function']);
|
|
13
|
+
addon.Field('onAfterRequest', ['function']);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export default providers;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import providers from '#providers/addon.js';
|
|
2
|
+
|
|
3
|
+
providers.Fn('default', function()
|
|
4
|
+
{
|
|
5
|
+
const items = Object.values(providers.Items());
|
|
6
|
+
const defaults = items.filter(p => p.Get('default'));
|
|
7
|
+
|
|
8
|
+
if (defaults.length === 0)
|
|
9
|
+
{
|
|
10
|
+
return items[0] || null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return defaults[Math.floor(Math.random() * defaults.length)];
|
|
14
|
+
});
|