loopengine 0.5.9 → 0.5.10
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.
|
@@ -148,9 +148,10 @@ export declare function getVersion(key: {
|
|
|
148
148
|
}, number: number, database?: DatabaseSync | undefined): Version | undefined;
|
|
149
149
|
/** What a workflow version holds, as text people can read and compare
|
|
150
150
|
* line by line: which workflow it is, its name and description, its input
|
|
151
|
-
* schema, model, the tools it uses with each one's permission, its
|
|
152
|
-
*
|
|
153
|
-
* its
|
|
151
|
+
* schema, model, the tools it uses with each one's permission, its success
|
|
152
|
+
* criteria, its output schema, its instructions and its result format.
|
|
153
|
+
* What starts it (schedules, webhooks) and where its messages go aren't
|
|
154
|
+
* part of it: they change straight away, recorded in the change log. */
|
|
154
155
|
export interface WorkflowSnapshot {
|
|
155
156
|
agent: string;
|
|
156
157
|
workflowId: string;
|
|
@@ -173,8 +174,6 @@ export interface WorkflowSnapshot {
|
|
|
173
174
|
name: string;
|
|
174
175
|
permission: string;
|
|
175
176
|
}[];
|
|
176
|
-
/** Each schedule and webhook that starts it, in a line. */
|
|
177
|
-
triggers: string[];
|
|
178
177
|
criteria: {
|
|
179
178
|
text: string;
|
|
180
179
|
kind: string;
|
|
@@ -189,10 +188,16 @@ export interface WorkflowSnapshot {
|
|
|
189
188
|
inputSchema?: Record<string, unknown>;
|
|
190
189
|
}
|
|
191
190
|
export declare function workflowContent(w: WorkflowSnapshot): string;
|
|
191
|
+
/** A version's text without the schedules and webhooks that started the
|
|
192
|
+
* workflow, which versions held until they became settings that change
|
|
193
|
+
* straight away: the same workflow with only that dropped is the same
|
|
194
|
+
* version, not a new one. */
|
|
195
|
+
export declare function withoutTriggers(content: string): string;
|
|
192
196
|
/** What a version holds. Older versions hold less: one from when only
|
|
193
197
|
* the brief was numbered has just the instructions and result format;
|
|
194
|
-
* one from before tools
|
|
195
|
-
*
|
|
198
|
+
* one from before tools and criteria were part of it has no such
|
|
199
|
+
* sections, and none comes back. The schedules and webhooks older
|
|
200
|
+
* versions held are left out. */
|
|
196
201
|
export declare function workflowFromContent(content: string): Partial<WorkflowSnapshot> & {
|
|
197
202
|
instructions: string;
|
|
198
203
|
};
|
package/dist/core/audit-store.js
CHANGED
|
@@ -515,11 +515,20 @@ export function workflowContent(w) {
|
|
|
515
515
|
`\n\n## Input schema\n\n${json(inputSchemaOf(w.parameters))}` +
|
|
516
516
|
`\n\n## Model\n\n${w.model ? `${w.model.provider}/${w.model.model}` : "The agent's"}` +
|
|
517
517
|
`\n\n## Tools\n\n${list(w.tools.map((t) => `- ${t.name}: ${t.permission}`))}` +
|
|
518
|
-
`\n\n## Triggers\n\n${list(w.triggers.map((t) => `- ${line(t)}`))}` +
|
|
519
518
|
`\n\n## Success criteria\n\n${list(criteria)}` +
|
|
520
519
|
`\n\n## Output schema\n\n${w.outputSchema ? json(w.outputSchema) : 'None'}\n`;
|
|
521
520
|
return head + INSTRUCTIONS_HEADING + w.instructions + (w.output?.trim() ? RESULT_HEADING + w.output.trim() : '');
|
|
522
521
|
}
|
|
522
|
+
/** A version's text without the schedules and webhooks that started the
|
|
523
|
+
* workflow, which versions held until they became settings that change
|
|
524
|
+
* straight away: the same workflow with only that dropped is the same
|
|
525
|
+
* version, not a new one. */
|
|
526
|
+
export function withoutTriggers(content) {
|
|
527
|
+
const at = content.indexOf(INSTRUCTIONS_HEADING);
|
|
528
|
+
if (at < 0)
|
|
529
|
+
return content;
|
|
530
|
+
return content.slice(0, at).replace(/\n\n## Triggers\n\n[\s\S]*?(?=\n\n## )/, '') + content.slice(at);
|
|
531
|
+
}
|
|
523
532
|
/** A section's ```json block, parsed. */
|
|
524
533
|
function jsonBlock(text) {
|
|
525
534
|
const json = text?.match(/^```json\n([\s\S]*)\n```$/)?.[1];
|
|
@@ -545,8 +554,9 @@ function parametersFromSchema(schema) {
|
|
|
545
554
|
}
|
|
546
555
|
/** What a version holds. Older versions hold less: one from when only
|
|
547
556
|
* the brief was numbered has just the instructions and result format;
|
|
548
|
-
* one from before tools
|
|
549
|
-
*
|
|
557
|
+
* one from before tools and criteria were part of it has no such
|
|
558
|
+
* sections, and none comes back. The schedules and webhooks older
|
|
559
|
+
* versions held are left out. */
|
|
550
560
|
export function workflowFromContent(content) {
|
|
551
561
|
const split = (body) => {
|
|
552
562
|
const at = body.lastIndexOf(RESULT_HEADING);
|
|
@@ -584,7 +594,6 @@ export function workflowFromContent(content) {
|
|
|
584
594
|
...(inputSchema ? { inputSchema } : {}),
|
|
585
595
|
...(model ? { model: { provider: model[1], model: model[2] } } : {}),
|
|
586
596
|
...(section('Tools') !== undefined ? { tools: lines('Tools').flatMap((l) => { const m = l.match(/^(.+): (\S+)$/); return m ? [{ name: m[1], permission: m[2] }] : []; }) } : {}),
|
|
587
|
-
...(section('Triggers') !== undefined ? { triggers: lines('Triggers') } : {}),
|
|
588
597
|
...(criteria ? { criteria } : {}),
|
|
589
598
|
...(outputSchema ? { outputSchema } : {}),
|
|
590
599
|
...split(content.slice(at + INSTRUCTIONS_HEADING.length)),
|
package/dist/index.d.ts
CHANGED
|
@@ -98,7 +98,7 @@ export { WORKFLOW_EXAMPLES, workflowExample, type WorkflowExample } from './core
|
|
|
98
98
|
export { WORKFLOW_EXAMPLE_MESSAGES, type WorkflowExampleMessage } from './core/system-agents/workflow-example-messages.js';
|
|
99
99
|
export { createTrigger, updateTrigger, rotateTrigger, listTriggers, findTriggerByToken, publicTrigger, checkTriggerSettings, verifySenderSignature, parsePayload, valueAt, deliveryId, passesFilter, paramsFromPayload, checkRunDelivery, fillChatNotice, resultToChat, recordDelivery as recordTriggerDelivery, FileTriggerStore, getTriggerStore, setTriggerStore, TriggerError, type WorkflowTrigger, type PublicTrigger, type TriggerSettings, type TriggerVerify, type TriggerFilter, type TriggerSender, type SignatureAlgorithm, type TriggerDelivery, type TriggerOutcome, type TriggerStore } from './core/workflow-triggers.js';
|
|
100
100
|
export { checkCallbackUrl, callbackSecret, signCallback, deliverCallback, runCallbackPayload, isPrivateAddress, CallbackUrlError, type CallbackDelivery, type CallbackPending, type RunCallbackEvent } from './core/run-callbacks.js';
|
|
101
|
-
export { auditDb, openAuditDb, setAuditDb, recordEvent, runEvents, listEvents, eventPeople, eventHash, verifyEventChain, latestEventHash, type ChainCheck, readMeta, writeMeta, type EventFilter, noteVersion, listVersions, getVersion, workflowContent, workflowFromContent, type WorkflowSnapshot, recordTraceSpan, recordTracePrompt, listTraceSpans, pruneTraces, type TraceSpan, retentionDays, type Version, type VersionKind, type AuditEvent, type AuditEventKind } from './core/audit-store.js';
|
|
101
|
+
export { auditDb, openAuditDb, setAuditDb, recordEvent, runEvents, listEvents, eventPeople, eventHash, verifyEventChain, latestEventHash, type ChainCheck, readMeta, writeMeta, type EventFilter, noteVersion, listVersions, getVersion, workflowContent, workflowFromContent, withoutTriggers, type WorkflowSnapshot, recordTraceSpan, recordTracePrompt, listTraceSpans, pruneTraces, type TraceSpan, retentionDays, type Version, type VersionKind, type AuditEvent, type AuditEventKind } from './core/audit-store.js';
|
|
102
102
|
export { WorkflowRunner, FileRunStore, SqliteRunStore, getRunStore, setRunStore, listRuns, runsSince, searchRuns, type RunSearch, getRun, isUnderWay, RunError, type WorkflowRun, type WorkflowRunStatus, type RunVersions, workflowVersionOf, FEEDBACK_SOURCES, type FeedbackSource, type RunFeedback, type RunDecision, type RunStore, type ExecuteRun, type RunOutcome, type StartRunInput } from './core/workflow-runs.js';
|
|
103
103
|
export { readWorkflows, readWorkflow, setWorkflowFields, setWorkflowDelivery, clearWorkflowFields, validateParams, workflowRunMessage, workflowPreviewMessage, migrateWorkflowsFile, WorkflowParamsError, readWorkspacePolicies, writeWorkspacePolicies, type Workflow, type WorkflowFields, type WorkflowParameter, type WorkflowModel, type WorkflowDelivery, type RunMessageExtras } from './core/workflows.js';
|
|
104
104
|
export { EvidenceError, evalCandidates, suggestedCriteria, type EvalCandidate, workflowScores, runFeedbackFrom, feedbackSourceOf, readEvals, addEvalCase, updateEvalCase, removeEvalCase, setEvalCriteria, effectiveCriteria, codeCheck, judgeCriteria, checkCase, roundSummary, draftCriteria, startEvalRound, EVAL_CRITERIA_PROMPT, DRAFT_CRITERIA_PROMPT, REFERENCE_CRITERION, type WorkflowScores, type EvalCase, type EvalCaseResult, type EvalCheck, type EvalCriterion, type CriterionKind, type EvalRound, type WorkflowEvals, type EvalRunDeps, type StandIn } from './web/workflow-evidence.js';
|
package/dist/index.js
CHANGED
|
@@ -91,7 +91,7 @@ export { WORKFLOW_EXAMPLES, workflowExample } from './core/system-agents/workflo
|
|
|
91
91
|
export { WORKFLOW_EXAMPLE_MESSAGES } from './core/system-agents/workflow-example-messages.js';
|
|
92
92
|
export { createTrigger, updateTrigger, rotateTrigger, listTriggers, findTriggerByToken, publicTrigger, checkTriggerSettings, verifySenderSignature, parsePayload, valueAt, deliveryId, passesFilter, paramsFromPayload, checkRunDelivery, fillChatNotice, resultToChat, recordDelivery as recordTriggerDelivery, FileTriggerStore, getTriggerStore, setTriggerStore, TriggerError } from './core/workflow-triggers.js';
|
|
93
93
|
export { checkCallbackUrl, callbackSecret, signCallback, deliverCallback, runCallbackPayload, isPrivateAddress, CallbackUrlError } from './core/run-callbacks.js';
|
|
94
|
-
export { auditDb, openAuditDb, setAuditDb, recordEvent, runEvents, listEvents, eventPeople, eventHash, verifyEventChain, latestEventHash, readMeta, writeMeta, noteVersion, listVersions, getVersion, workflowContent, workflowFromContent, recordTraceSpan, recordTracePrompt, listTraceSpans, pruneTraces, retentionDays } from './core/audit-store.js';
|
|
94
|
+
export { auditDb, openAuditDb, setAuditDb, recordEvent, runEvents, listEvents, eventPeople, eventHash, verifyEventChain, latestEventHash, readMeta, writeMeta, noteVersion, listVersions, getVersion, workflowContent, workflowFromContent, withoutTriggers, recordTraceSpan, recordTracePrompt, listTraceSpans, pruneTraces, retentionDays } from './core/audit-store.js';
|
|
95
95
|
export { WorkflowRunner, FileRunStore, SqliteRunStore, getRunStore, setRunStore, listRuns, runsSince, searchRuns, getRun, isUnderWay, RunError, workflowVersionOf, FEEDBACK_SOURCES } from './core/workflow-runs.js';
|
|
96
96
|
export { readWorkflows, readWorkflow, setWorkflowFields, setWorkflowDelivery, clearWorkflowFields, validateParams, workflowRunMessage, workflowPreviewMessage, migrateWorkflowsFile, WorkflowParamsError, readWorkspacePolicies, writeWorkspacePolicies } from './core/workflows.js';
|
|
97
97
|
export { EvidenceError, evalCandidates, suggestedCriteria, workflowScores, runFeedbackFrom, feedbackSourceOf, readEvals, addEvalCase, updateEvalCase, removeEvalCase, setEvalCriteria, effectiveCriteria, codeCheck, judgeCriteria, checkCase, roundSummary, draftCriteria, startEvalRound, EVAL_CRITERIA_PROMPT, DRAFT_CRITERIA_PROMPT, REFERENCE_CRITERION } from './web/workflow-evidence.js';
|
|
@@ -2159,7 +2159,7 @@ ${renderMarkdownScript}
|
|
|
2159
2159
|
'</header>' +
|
|
2160
2160
|
workflowDraftBannerHtml(w) +
|
|
2161
2161
|
'<div class="wf-row-body wf-page-body">' +
|
|
2162
|
-
'<div class="wf-tabs" role="tablist">' + tabBtn('activity', 'Activity') + tabBtn('
|
|
2162
|
+
'<div class="wf-tabs" role="tablist">' + tabBtn('activity', 'Activity') + tabBtn('brief', 'Prompt') + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messaging') + tabBtn('feedback', 'Feedback') + tabBtn('evaluation', 'Evaluation') + tabBtn('contract', 'Contract') + tabBtn('versions', 'Versions') + '</div>' +
|
|
2163
2163
|
panel('brief', workflowBriefHtml(w)) +
|
|
2164
2164
|
panel('activity', workflowActivityHtml(w, runs, name)) +
|
|
2165
2165
|
panel('evaluation', workflowEvaluationHtml(w)) +
|
|
@@ -2186,7 +2186,7 @@ ${renderMarkdownScript}
|
|
|
2186
2186
|
'<div class="wf-row-body"' + (open ? '' : ' hidden') + '>' +
|
|
2187
2187
|
// What it does, in full, once it's open (the row shows just its name).
|
|
2188
2188
|
(w.description && w.description !== w.title ? '<p class="wf-desc">' + escapeHtml(w.description) + '</p>' : '') +
|
|
2189
|
-
'<div class="wf-tabs" role="tablist">' + tabBtn('activity', 'Activity') + tabBtn('
|
|
2189
|
+
'<div class="wf-tabs" role="tablist">' + tabBtn('activity', 'Activity') + tabBtn('brief', 'Prompt') + tabBtn('triggers', 'Triggers') + tabBtn('messages', 'Messaging') + tabBtn('feedback', 'Feedback') + tabBtn('evaluation', 'Evaluation') + tabBtn('contract', 'Contract') + tabBtn('versions', 'Versions') + '</div>' +
|
|
2190
2190
|
panel('contract', workflowContractHtml(w, name, params)) +
|
|
2191
2191
|
panel('versions', workflowVersionsHtml()) +
|
|
2192
2192
|
panel('feedback', workflowFeedbackHtml()) +
|
|
@@ -3283,7 +3283,6 @@ ${renderMarkdownScript}
|
|
|
3283
3283
|
(f.outputSchema ? '<details class="wf-schema"><summary>Output schema</summary><pre>' + escapeHtml(JSON.stringify(f.outputSchema, null, 2)) + '</pre></details>' : ''));
|
|
3284
3284
|
if (versionFull(v)) rows += row('Model', escapeHtml(versionModelText(f.model)));
|
|
3285
3285
|
if (f.tools) rows += row('Tools', list(f.tools, 'None named in its prompt', versionToolHtml));
|
|
3286
|
-
if (f.triggers) rows += row('Triggers', list(f.triggers, 'None: run by hand (Run now) or from an app', function (t) { return '<div>' + escapeHtml(t) + '</div>'; }));
|
|
3287
3286
|
if (f.criteria) rows += row('Success criteria', list(f.criteria, 'None', function (c) { return '<div>' + escapeHtml(versionCritText(c)) + '</div>'; }));
|
|
3288
3287
|
return '<div class="wf-vd">' + rows + '</div>' + (versionFull(v) ? '' : '<p class="hint" style="margin:6px 0 0">An early version: only its prompt and result format were kept.</p>');
|
|
3289
3288
|
}
|
|
@@ -3343,10 +3342,6 @@ ${renderMarkdownScript}
|
|
|
3343
3342
|
});
|
|
3344
3343
|
if (tools.length) add('Tools', tools.join(''), tools.length + ' changed');
|
|
3345
3344
|
}
|
|
3346
|
-
if (a.triggers && b.triggers) {
|
|
3347
|
-
var trig = setDiff(a.triggers, b.triggers, function (t) { return t; }, escapeHtml);
|
|
3348
|
-
if (trig.length) add('Triggers', trig.join(''), trig.length + ' changed');
|
|
3349
|
-
}
|
|
3350
3345
|
if (a.criteria && b.criteria) {
|
|
3351
3346
|
var crit = setDiff(a.criteria, b.criteria, function (c) { return c.kind + '|' + (c.value || '') + '|' + c.text; }, function (c) { return escapeHtml(versionCritText(c)); });
|
|
3352
3347
|
if (crit.length) add('Success criteria', crit.join(''), crit.length + ' changed');
|
|
@@ -72,7 +72,7 @@ export const consoleSidebarHtml = `<aside class="le-sidebar" aria-label="Console
|
|
|
72
72
|
</section>
|
|
73
73
|
<section class="le-pane" data-le-pane="workflows">
|
|
74
74
|
<div class="le-pane-head"><a href="/workflows">Workflows</a><a class="le-pane-new" href="/workflows/new">+ New</a></div>
|
|
75
|
-
<ul class="le-agent-list le-goal-list" id="leWorkflowList"></ul>
|
|
75
|
+
<ul class="le-agent-list le-goal-list le-wf-list" id="leWorkflowList"></ul>
|
|
76
76
|
</section>
|
|
77
77
|
<section class="le-pane" data-le-pane="settings">
|
|
78
78
|
<div class="le-pane-head"><a href="/config?section=settings">Settings</a></div>
|
|
@@ -262,7 +262,7 @@ export const consoleShellScript = `<script>
|
|
|
262
262
|
workflowList.innerHTML = list.length ? list.map(function (w) {
|
|
263
263
|
var on = w.agent === currentAgent && w.id === currentId;
|
|
264
264
|
return '<li><a class="le-agent-item le-goal-item" href="/agents/config?agent=' + enc(w.agent) + '&tab=workflows&workflow=' + enc(w.id) + '" title="' + esc(w.title) + ' (' + esc(w.agentLabel) + DOT_SEP + (w.live ? 'Running' : 'Pending') + ')"' + (on ? ' aria-current="page"' : '') + '>' +
|
|
265
|
-
'<span class="le-dot ' + (w.live ? 'tint' : 'pending') + '" aria-hidden="true"></span><span class="le-name">' + esc(w.title) + '</span></a></li>';
|
|
265
|
+
'<span class="le-dot ' + (w.live ? 'tint' : 'pending') + '" aria-hidden="true"></span><span class="le-wf-text"><span class="le-name">' + esc(w.title) + '</span><span class="le-meta">' + esc(w.agentLabel) + '</span></span></a></li>';
|
|
266
266
|
}).join('') : '<li class="le-agent-item"><span></span><span class="le-meta">No workflows yet</span><span></span></li>';
|
|
267
267
|
});
|
|
268
268
|
}
|
|
@@ -164,13 +164,18 @@ export const devUiCss = `
|
|
|
164
164
|
.le-pane-head a.le-pane-new[aria-current="page"] { text-decoration: underline; }
|
|
165
165
|
.le-pane .le-agent-list { max-height: none; }
|
|
166
166
|
.le-goal-item .le-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
|
|
167
|
-
|
|
167
|
+
/* Workflows: each with its agent under its name. */
|
|
168
|
+
.le-wf-list .le-agent-item { align-items: start; }
|
|
169
|
+
.le-wf-list .le-dot { margin-top: 5px; }
|
|
170
|
+
.le-wf-text { display: grid; gap: 1px; min-width: 0; }
|
|
171
|
+
.le-wf-text .le-name, .le-wf-text .le-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
172
|
+
.le-agent-list { list-style: none; margin: 0; padding: 0 8px; overflow-y: auto; flex: 0 1 auto; max-height: 40vh; min-height: 0; display: grid; gap: 2px; align-content: start; }
|
|
168
173
|
/* Find your first agent: one more item under Agents. */
|
|
169
|
-
.le-sub-link { margin: 2px 8px 0; padding:
|
|
174
|
+
.le-sub-link { margin: 2px 8px 0; padding: 8px 10px 8px 28px; flex: none; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--accent-ink); text-decoration: none; }
|
|
170
175
|
.le-sub-link:hover { background: var(--surface-2); }
|
|
171
176
|
.le-sub-link[aria-current="page"] { background: var(--accent-soft); font-weight: 600; }
|
|
172
177
|
/* List items read smaller than their section's head. */
|
|
173
|
-
.le-agent-item { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding:
|
|
178
|
+
.le-agent-item { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 13px; }
|
|
174
179
|
.le-agent-item:hover { background: var(--surface-2); }
|
|
175
180
|
.le-agent-item[aria-current="page"] { background: var(--bg); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
|
|
176
181
|
.le-agent-item .le-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
@@ -183,7 +188,7 @@ export const devUiCss = `
|
|
|
183
188
|
.le-inbox-only .le-rail-item:not([data-le-section="inbox"]), .le-inbox-only .le-panel { display: none; }
|
|
184
189
|
.le-dot.idle { background: var(--ink-faint); }
|
|
185
190
|
.le-settings-menu { display: grid; gap: 2px; padding: 0 8px; }
|
|
186
|
-
.le-settings-menu a { padding:
|
|
191
|
+
.le-settings-menu a { padding: 8px 10px; border-radius: 8px; color: var(--ink-muted); text-decoration: none; font-size: 13px; }
|
|
187
192
|
.le-settings-menu a:hover { background: var(--surface-2); color: var(--ink); }
|
|
188
193
|
.le-settings-menu a[aria-current="page"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
|
|
189
194
|
.le-who { position: relative; display: grid; place-items: center; padding-top: 8px; }
|