loopengine 0.5.8 → 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.
- package/dist/core/audit-store.d.ts +12 -7
- package/dist/core/audit-store.js +13 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/web/agents-config-page.js +115 -64
- package/dist/web/agents-list-page.js +1 -1
- package/dist/web/console-shell.js +10 -38
- package/dist/web/dev-ui-styles.js +9 -8
- package/dist/web/global-config-page.js +45 -3
- package/dist/web/global-config.d.ts +8 -0
- package/dist/web/global-config.js +16 -0
- package/dist/web/schedules-page.js +10 -22
- package/package.json +1 -1
|
@@ -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';
|
|
@@ -126,7 +126,7 @@ export { startMcpSignIn, finishMcpSignIn, mcpSignInSupport, mcpOAuthEnvName, par
|
|
|
126
126
|
export { abilityDetails } from './web/ability-details-admin.js';
|
|
127
127
|
export { WorkspaceAbilityError, listWorkspaceAbilities, addWorkspaceAbility, removeWorkspaceAbility, workspaceAbilitiesDir, type WorkspaceAbility } from './core/workspace-abilities.js';
|
|
128
128
|
export { installWorkspaceAbility, installUploadedAbility, MAX_UPLOAD_BYTES, type AbilityUpload } from './web/workspace-abilities-admin.js';
|
|
129
|
-
export { callCost, modelPrice, describeModelProviders, describeGateways, setModelProviderKey, clearModelProviderKey, listProviderModels, ModelKeyError, describeTimeZone, setWorkspaceTimeZone, TimeZoneError } from './web/global-config.js';
|
|
129
|
+
export { callCost, modelPrice, describeModelProviders, describeGateways, setModelProviderKey, clearModelProviderKey, listProviderModels, ModelKeyError, describeTimeZone, setWorkspaceTimeZone, TimeZoneError, requireReview, setRequireReview, REQUIRE_REVIEW_ENV } from './web/global-config.js';
|
|
130
130
|
export { loopengineVersion } from './core/version.js';
|
|
131
131
|
export { describeUpgrade, runUpgrade, UpgradeError } from './web/upgrade-admin.js';
|
|
132
132
|
export type { ModelPrice, ModelPrices, ModelProviderInfo, AgentModelUsage, ModelsView, ProviderModelsView, GatewayProviderInfo, GatewaysView, TimeZoneView } from './web/global-config.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';
|
|
@@ -116,7 +116,7 @@ export { startMcpSignIn, finishMcpSignIn, mcpSignInSupport, mcpOAuthEnvName, par
|
|
|
116
116
|
export { abilityDetails } from './web/ability-details-admin.js';
|
|
117
117
|
export { WorkspaceAbilityError, listWorkspaceAbilities, addWorkspaceAbility, removeWorkspaceAbility, workspaceAbilitiesDir } from './core/workspace-abilities.js';
|
|
118
118
|
export { installWorkspaceAbility, installUploadedAbility, MAX_UPLOAD_BYTES } from './web/workspace-abilities-admin.js';
|
|
119
|
-
export { callCost, modelPrice, describeModelProviders, describeGateways, setModelProviderKey, clearModelProviderKey, listProviderModels, ModelKeyError, describeTimeZone, setWorkspaceTimeZone, TimeZoneError } from './web/global-config.js';
|
|
119
|
+
export { callCost, modelPrice, describeModelProviders, describeGateways, setModelProviderKey, clearModelProviderKey, listProviderModels, ModelKeyError, describeTimeZone, setWorkspaceTimeZone, TimeZoneError, requireReview, setRequireReview, REQUIRE_REVIEW_ENV } from './web/global-config.js';
|
|
120
120
|
export { loopengineVersion } from './core/version.js';
|
|
121
121
|
export { describeUpgrade, runUpgrade, UpgradeError } from './web/upgrade-admin.js';
|
|
122
122
|
export { workspaceTimeZone, serverTimeZone, isValidTimeZone, TIME_ZONE_ENV } from '#core/time-zone.js';
|
|
@@ -1080,9 +1080,8 @@ ${renderMarkdownScript}
|
|
|
1080
1080
|
var inner = '<span class="le-card-label"><span>' + label + '</span>' + (tab ? '<span aria-hidden="true">→</span>' : '') + '</span>' +
|
|
1081
1081
|
'<span class="le-card-value">' + value + '</span>' +
|
|
1082
1082
|
'<span class="le-card-detail">' + detailText + '</span>';
|
|
1083
|
-
var adv = ['tools', 'env'].indexOf(tab) !== -1 ? ' data-advanced' : '';
|
|
1084
1083
|
return tab
|
|
1085
|
-
? '<a class="le-card" data-tab="' + tab + '" href="' + leShell.tabHref(cfg.name, tab) + '"
|
|
1084
|
+
? '<a class="le-card" data-tab="' + tab + '" href="' + leShell.tabHref(cfg.name, tab) + '">' + inner + '</a>'
|
|
1086
1085
|
: '<div class="le-card">' + inner + '</div>';
|
|
1087
1086
|
}
|
|
1088
1087
|
return '<div class="le-cards" style="margin-bottom:28px">' +
|
|
@@ -1459,7 +1458,7 @@ ${renderMarkdownScript}
|
|
|
1459
1458
|
'<button type="button" class="wf-msg-clear-hook" data-trigger="' + escapeHtml(t.trigger_id) + '">Use these instead</button></p>';
|
|
1460
1459
|
}).join('') + '</div>'
|
|
1461
1460
|
: '') +
|
|
1462
|
-
'<div class="wf-msg-foot"><span class="hint wf-msg-result" role="status"
|
|
1461
|
+
'<div class="wf-msg-foot"><span class="hint wf-msg-result" role="status">Saved straight away: every run from now on follows it.</span><button type="submit" class="primary">Save</button></div>' +
|
|
1463
1462
|
'</form>';
|
|
1464
1463
|
}
|
|
1465
1464
|
|
|
@@ -1469,7 +1468,7 @@ ${renderMarkdownScript}
|
|
|
1469
1468
|
var schedules = workflowScheduleItemsHtml(w, name);
|
|
1470
1469
|
var hasHooks = Boolean(w.webhooks || w.webhooksWaiting || w.webhooksOff);
|
|
1471
1470
|
var way = function (key, title, what, body) {
|
|
1472
|
-
return '<section class="wf-way wf-way-' + key + '"' +
|
|
1471
|
+
return '<section class="wf-way wf-way-' + key + '"' + '><h4>' + title + '</h4><p class="wf-way-what">' + what + '</p>' + body + '</section>';
|
|
1473
1472
|
};
|
|
1474
1473
|
return '<div class="wf-ways">' +
|
|
1475
1474
|
way('run', 'Run now', 'Starts a run right away, from here. Follow it in Activity.', workflowRunBarHtml(w, params)) +
|
|
@@ -2004,7 +2003,7 @@ ${renderMarkdownScript}
|
|
|
2004
2003
|
'<div class="wf-crit-form" hidden>' +
|
|
2005
2004
|
'<div class="wf-crit-rows">' + (evals.criteria && evals.criteria.length ? evals.criteria : []).map(critRowHtml).join('') + '</div>' +
|
|
2006
2005
|
'<div class="wf-crit-bar"><button type="button" class="plain wf-crit-add">+ Add a criterion</button><button type="button" class="plain wf-crit-draft">Suggest from its instructions</button>' +
|
|
2007
|
-
'<span style="flex:1"></span><button type="button" class="plain wf-crit-cancel">Cancel</button><button type="button" class="wf-crit-save">Save
|
|
2006
|
+
'<span style="flex:1"></span><button type="button" class="plain wf-crit-cancel">Cancel</button><button type="button" class="wf-crit-save">Save as draft</button><button type="button" class="primary wf-crit-save wf-crit-publish" data-publish-offer hidden>Save and publish</button></div>' +
|
|
2008
2007
|
'<span class="hint wf-crit-status"></span>' +
|
|
2009
2008
|
'</div>';
|
|
2010
2009
|
var latest = {};
|
|
@@ -2097,10 +2096,6 @@ ${renderMarkdownScript}
|
|
|
2097
2096
|
return parts.length ? '<div class="wf-run-evidence">' + parts.join('') + '</div>' : '';
|
|
2098
2097
|
}
|
|
2099
2098
|
|
|
2100
|
-
// A workflow's tabs for Advanced view only: for whoever builds and
|
|
2101
|
-
// audits it, not the operator who runs it.
|
|
2102
|
-
var WORKFLOW_ADVANCED_TABS = ['evaluation', 'contract', 'versions'];
|
|
2103
|
-
|
|
2104
2099
|
function renderWorkflowsHtml(name, workflows) {
|
|
2105
2100
|
if (workflowPageId) {
|
|
2106
2101
|
var page = workflows.filter(function (x) { return x.id === workflowPageId; });
|
|
@@ -2142,7 +2137,7 @@ ${renderMarkdownScript}
|
|
|
2142
2137
|
var tab = workflowTabs[w.id] || 'activity';
|
|
2143
2138
|
var open = openWorkflowId === w.id;
|
|
2144
2139
|
var panel = function (key, html) { return '<div class="wf-panel" data-panel="' + key + '"' + (tab === key ? '' : ' hidden') + '>' + html + '</div>'; };
|
|
2145
|
-
var tabBtn = function (key, label) { return '<button type="button" role="tab" class="wf-tab" data-tab="' + key + '"
|
|
2140
|
+
var tabBtn = function (key, label) { return '<button type="button" role="tab" class="wf-tab" data-tab="' + key + '" aria-selected="' + (tab === key) + '">' + label + '</button>'; };
|
|
2146
2141
|
if (workflowPageId) {
|
|
2147
2142
|
var agentLabel = currentCfg && currentCfg.displayName ? currentCfg.displayName : name;
|
|
2148
2143
|
document.title = w.title + ' ' + String.fromCharCode(183) + ' ' + agentLabel;
|
|
@@ -2164,7 +2159,7 @@ ${renderMarkdownScript}
|
|
|
2164
2159
|
'</header>' +
|
|
2165
2160
|
workflowDraftBannerHtml(w) +
|
|
2166
2161
|
'<div class="wf-row-body wf-page-body">' +
|
|
2167
|
-
'<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>' +
|
|
2168
2163
|
panel('brief', workflowBriefHtml(w)) +
|
|
2169
2164
|
panel('activity', workflowActivityHtml(w, runs, name)) +
|
|
2170
2165
|
panel('evaluation', workflowEvaluationHtml(w)) +
|
|
@@ -2191,7 +2186,7 @@ ${renderMarkdownScript}
|
|
|
2191
2186
|
'<div class="wf-row-body"' + (open ? '' : ' hidden') + '>' +
|
|
2192
2187
|
// What it does, in full, once it's open (the row shows just its name).
|
|
2193
2188
|
(w.description && w.description !== w.title ? '<p class="wf-desc">' + escapeHtml(w.description) + '</p>' : '') +
|
|
2194
|
-
'<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>' +
|
|
2195
2190
|
panel('contract', workflowContractHtml(w, name, params)) +
|
|
2196
2191
|
panel('versions', workflowVersionsHtml()) +
|
|
2197
2192
|
panel('feedback', workflowFeedbackHtml()) +
|
|
@@ -2411,7 +2406,10 @@ ${renderMarkdownScript}
|
|
|
2411
2406
|
'</select><input name="modelName" aria-label="Model name" placeholder="e.g. gpt-6.1-sol" value="' + escapeHtml((w.model && w.model.model) || '') + '"></div></div>' +
|
|
2412
2407
|
'<p class="hint workflow-editor-check" style="margin:0"></p>' +
|
|
2413
2408
|
'<div class="hint workflow-editor-result"></div>' +
|
|
2414
|
-
|
|
2409
|
+
// Save and publish shows once the workspace's Publishing setting is
|
|
2410
|
+
// known not to require review (openWorkflowEditor).
|
|
2411
|
+
'<label class="wp-note-field" hidden>Note <span class="hint">(optional: what changed and why, kept with the version when you publish)</span><input name="publishNote" maxlength="500" placeholder="e.g. Ask for the order number before looking it up"></label>' +
|
|
2412
|
+
'<div class="ed-actions"><span class="hint wp-save-hint">Runs keep using the published workflow until you publish.</span><button type="button" class="wp-cancel">Cancel</button><button type="submit" class="primary wp-save-draft">Save as draft</button><button type="submit" class="primary wp-save-publish" hidden>Save and publish</button></div></form>';
|
|
2415
2413
|
}
|
|
2416
2414
|
|
|
2417
2415
|
// Placeholders the instructions use that no parameter declares, and
|
|
@@ -2538,6 +2536,31 @@ ${renderMarkdownScript}
|
|
|
2538
2536
|
});
|
|
2539
2537
|
}
|
|
2540
2538
|
|
|
2539
|
+
// Whether this workspace requires review before publishing (Settings,
|
|
2540
|
+
// Publishing): then changes are only saved as drafts, published from
|
|
2541
|
+
// Review and publish; otherwise Save and publish does both in one step.
|
|
2542
|
+
function reviewRequired() {
|
|
2543
|
+
return Promise.resolve(window.leShell && leShell.settings ? leShell.settings() : null).then(function (st) { return Boolean(st && st.requireReview); });
|
|
2544
|
+
}
|
|
2545
|
+
// Shows the one-step publish buttons in root unless review is required.
|
|
2546
|
+
function offerPublish(root) {
|
|
2547
|
+
reviewRequired().then(function (required) {
|
|
2548
|
+
if (required) return;
|
|
2549
|
+
var list = root.querySelectorAll('[data-publish-offer]');
|
|
2550
|
+
for (var i = 0; i < list.length; i++) list[i].hidden = false;
|
|
2551
|
+
});
|
|
2552
|
+
}
|
|
2553
|
+
// Publishes the draft just saved. A draft the same as the published
|
|
2554
|
+
// workflow isn't kept (or is discarded here): there was nothing to publish.
|
|
2555
|
+
function publishSavedDraft(wfBase, note) {
|
|
2556
|
+
return fetchJsonRetryOnce(wfBase + '/publish', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ note: note || '' }) }).then(function (p) {
|
|
2557
|
+
if (!p.ok && p.body.code === 'no_draft') return { ok: true, body: {} };
|
|
2558
|
+
if (!p.ok && p.body.code === 'unchanged') return fetchJsonRetryOnce(wfBase + '/draft', { method: 'DELETE' }).then(function () { return { ok: true, body: {} }; });
|
|
2559
|
+
if (!p.ok) p.body.error = (p.body.error || 'Could not publish') + ' Your changes are saved as a draft.';
|
|
2560
|
+
return p;
|
|
2561
|
+
});
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2541
2564
|
function openWorkflowEditor(name, card) {
|
|
2542
2565
|
var published = workflowsById[card.dataset.workflow];
|
|
2543
2566
|
if (!published) return;
|
|
@@ -2594,8 +2617,29 @@ ${renderMarkdownScript}
|
|
|
2594
2617
|
// A preview shown goes stale as the instructions change: hide it.
|
|
2595
2618
|
form.addEventListener('input', function () { previewBox.hidden = true; });
|
|
2596
2619
|
form.querySelector('.wp-cancel').addEventListener('click', close);
|
|
2620
|
+
// Save and publish, in one step, unless the workspace requires review
|
|
2621
|
+
// before publishing (Settings, Publishing): then a change is saved as a
|
|
2622
|
+
// draft and published from Review and publish.
|
|
2623
|
+
var draftBtn = form.querySelector('.wp-save-draft');
|
|
2624
|
+
var publishBtn = form.querySelector('.wp-save-publish');
|
|
2625
|
+
var publishing = false;
|
|
2626
|
+
draftBtn.addEventListener('click', function () { publishing = false; });
|
|
2627
|
+
publishBtn.addEventListener('click', function () { publishing = true; });
|
|
2628
|
+
reviewRequired().then(function (required) {
|
|
2629
|
+
if (required) {
|
|
2630
|
+
form.querySelector('.wp-save-hint').textContent = 'This workspace requires review: runs keep using the published workflow until the draft is reviewed and published.';
|
|
2631
|
+
return;
|
|
2632
|
+
}
|
|
2633
|
+
publishBtn.hidden = false;
|
|
2634
|
+
draftBtn.classList.remove('primary');
|
|
2635
|
+
form.querySelector('.wp-note-field').hidden = false;
|
|
2636
|
+
form.querySelector('.wp-save-hint').textContent = published.draft
|
|
2637
|
+
? 'Publishing includes everything in the draft.'
|
|
2638
|
+
: 'Save as draft to publish later; until then runs keep the published version.';
|
|
2639
|
+
});
|
|
2597
2640
|
form.addEventListener('submit', function (ev) {
|
|
2598
2641
|
ev.preventDefault();
|
|
2642
|
+
if (ev.submitter) publishing = ev.submitter === publishBtn;
|
|
2599
2643
|
var parameters = {};
|
|
2600
2644
|
var problem = '';
|
|
2601
2645
|
var list = rows.querySelectorAll('.workflow-param-row');
|
|
@@ -2610,14 +2654,22 @@ ${renderMarkdownScript}
|
|
|
2610
2654
|
try { JSON.parse(form.outputSchema.value); } catch (e) { problem = 'The output schema isn' + String.fromCharCode(8217) + 't valid JSON: ' + e.message; }
|
|
2611
2655
|
}
|
|
2612
2656
|
if (problem) { result.textContent = problem; return; }
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
if (!r.ok) { result.textContent = r.body.error || 'Could not save'; return; }
|
|
2657
|
+
var wfBase = '/agents/' + encodeURIComponent(name) + '/workflows/' + encodeURIComponent(w.id);
|
|
2658
|
+
draftBtn.disabled = publishBtn.disabled = true;
|
|
2659
|
+
var done = function (message) {
|
|
2660
|
+
draftBtn.disabled = publishBtn.disabled = false;
|
|
2661
|
+
if (message) { result.textContent = message; return; }
|
|
2619
2662
|
close();
|
|
2620
2663
|
loadWorkflowsSection(name);
|
|
2664
|
+
};
|
|
2665
|
+
result.textContent = (publishing ? 'Publishing' : 'Saving the draft') + String.fromCharCode(8230);
|
|
2666
|
+
fetchJsonRetryOnce(wfBase + '/draft', {
|
|
2667
|
+
method: 'PUT', headers: { 'content-type': 'application/json' },
|
|
2668
|
+
body: JSON.stringify({ title: form.title.value, description: form.description.value, instructions: form.instructions.value, parameters: parameters, output: form.output.value, outputSchema: form.outputSchema.value, model: form.modelProvider.value && form.modelName.value.trim() ? { provider: form.modelProvider.value, model: form.modelName.value.trim() } : null, note: form.publishNote.value }),
|
|
2669
|
+
}).then(function (r) {
|
|
2670
|
+
if (!r.ok) return done(r.body.error || 'Could not save');
|
|
2671
|
+
if (!publishing) return done();
|
|
2672
|
+
return publishSavedDraft(wfBase, form.publishNote.value).then(function (p) { done(p.ok ? '' : p.body.error); });
|
|
2621
2673
|
});
|
|
2622
2674
|
});
|
|
2623
2675
|
check();
|
|
@@ -2866,6 +2918,7 @@ ${renderMarkdownScript}
|
|
|
2866
2918
|
var addBox = card.querySelector('.workflow-hooks-add');
|
|
2867
2919
|
if (!w || !box) return;
|
|
2868
2920
|
var base = '/agents/' + encodeURIComponent(name) + '/workflows/' + encodeURIComponent(w.id) + '/triggers';
|
|
2921
|
+
// A webhook made or changed in a draft before webhooks went live at once.
|
|
2869
2922
|
var draftBase = '/agents/' + encodeURIComponent(name) + '/workflows/' + encodeURIComponent(w.id) + '/draft/webhooks';
|
|
2870
2923
|
var hooksById = {};
|
|
2871
2924
|
function render(shownUrl, shownId) {
|
|
@@ -2909,10 +2962,10 @@ ${renderMarkdownScript}
|
|
|
2909
2962
|
for (var i = 0; i < rows.length; i++) {
|
|
2910
2963
|
(function (row) {
|
|
2911
2964
|
var id = row.dataset.trigger;
|
|
2912
|
-
//
|
|
2913
|
-
// and
|
|
2965
|
+
// A webhook is how the workflow starts, not what it does, so every
|
|
2966
|
+
// change to it is live at once (and in Audit), with no draft.
|
|
2914
2967
|
row.querySelector('.hook-edit').addEventListener('click', function () {
|
|
2915
|
-
if (hooksById[id]) openHookFormDialog(w,
|
|
2968
|
+
if (hooksById[id]) openHookFormDialog(w, base, function () { render(null, null); }, hooksById[id]);
|
|
2916
2969
|
});
|
|
2917
2970
|
var undo = row.querySelector('.hook-undo');
|
|
2918
2971
|
if (undo) undo.addEventListener('click', function () {
|
|
@@ -2945,10 +2998,9 @@ ${renderMarkdownScript}
|
|
|
2945
2998
|
row.querySelector('.hook-delete').addEventListener('click', function (ev) {
|
|
2946
2999
|
var btn = ev.currentTarget;
|
|
2947
3000
|
if (btn.dataset.confirming !== '1') { btn.dataset.confirming = '1'; btn.textContent = 'Click again to delete'; return; }
|
|
2948
|
-
fetchJsonRetryOnce(
|
|
3001
|
+
fetchJsonRetryOnce(base + '/' + encodeURIComponent(id), { method: 'DELETE' }).then(function (r) {
|
|
2949
3002
|
if (!r.ok) { alert(r.body.error || 'That didn' + String.fromCharCode(8217) + 't work'); return; }
|
|
2950
|
-
|
|
2951
|
-
refreshDraft(name, card);
|
|
3003
|
+
loadWorkflowsSection(name);
|
|
2952
3004
|
});
|
|
2953
3005
|
});
|
|
2954
3006
|
})(rows[i]);
|
|
@@ -3014,7 +3066,7 @@ ${renderMarkdownScript}
|
|
|
3014
3066
|
'<div class="wf-fb-way"><b>Inbox</b><span>Under each finished run' + RSQ + 's conversation: Good or Needs work, a note, and the result as it should have been.</span></div>' +
|
|
3015
3067
|
'<div class="wf-fb-way"><b>Messaging apps</b><span>' + (toChat ? 'Each result posted to chat ends with Good and Needs work links.' : 'Turn on ' + String.fromCharCode(8220) + 'result to chat' + String.fromCharCode(8221) + ' in Messaging, and each result posted ends with Good and Needs work links.') + '</span></div>' +
|
|
3016
3068
|
'<div class="wf-fb-way"><b>Other platforms</b><span>Each finished run' + RSQ + 's callback has a <code>feedback_url</code> to post to.</span>' +
|
|
3017
|
-
'<span
|
|
3069
|
+
'<span>Or with an API key:</span><pre>POST /agents/' + escapeHtml(name) + '/runs/<runId>/feedback' + String.fromCharCode(10) + '{ "verdict": "bad", "note": "...", "final": "...", "source": "api", "by": "jane@acme.com" }</pre></div>' +
|
|
3018
3070
|
'</div></section>';
|
|
3019
3071
|
var trace = function (ev) {
|
|
3020
3072
|
var a = ev.target.closest('.wf-fb-trace');
|
|
@@ -3056,16 +3108,19 @@ ${renderMarkdownScript}
|
|
|
3056
3108
|
'<label style="display:flex;gap:8px;align-items:center;font-size:13.5px"><input type="checkbox" class="wf-fb-take-prompt" checked> Add these prompt changes</label>' : '') +
|
|
3057
3109
|
(sg.criteria.length ? '<h4>// New success criteria</h4><div class="wf-fb-crits">' + sg.criteria.map(function (c, i) { return '<label><input type="checkbox" data-crit="' + i + '" checked> <span>' + escapeHtml(c.text) + ' <span class="hint">(' + escapeHtml(critKindText(c)) + ')</span></span></label>'; }).join('') + '</div>' : '') +
|
|
3058
3110
|
(sg.open.length ? '<h4>// Only you can answer</h4><ul class="wf-fb-open">' + sg.open.map(function (q) { return '<li>' + escapeHtml(q) + '</li>'; }).join('') + '</ul>' : '') +
|
|
3059
|
-
'<div class="wf-fb-improve-bar"><button type="button" class="le-btn-dark wf-fb-add">Add
|
|
3111
|
+
'<div class="wf-fb-improve-bar"><button type="button" class="wf-fb-add">Add to draft</button><button type="button" class="le-btn-dark wf-fb-add wf-fb-add-publish" data-publish-offer hidden>Add and publish</button><span class="hint wf-fb-add-status">Then Evaluate to check it does better.</span></div>' +
|
|
3060
3112
|
'<p class="hint" style="margin:0">Suggested by ' + escapeHtml(sg.model) + ' from ' + sg.basedOn + ' piece' + (sg.basedOn === 1 ? '' : 's') + ' of feedback.</p>';
|
|
3061
|
-
panel
|
|
3113
|
+
offerPublish(panel);
|
|
3114
|
+
var addButtons = panel.querySelectorAll('.wf-fb-add');
|
|
3115
|
+
for (var ab = 0; ab < addButtons.length; ab++) addButtons[ab].addEventListener('click', function (ev) {
|
|
3062
3116
|
var btn = ev.currentTarget;
|
|
3117
|
+
var andPublish = btn.classList.contains('wf-fb-add-publish');
|
|
3063
3118
|
var status = panel.querySelector('.wf-fb-add-status');
|
|
3064
3119
|
var takePrompt = changed && panel.querySelector('.wf-fb-take-prompt') && panel.querySelector('.wf-fb-take-prompt').checked;
|
|
3065
3120
|
var picked = sg.criteria.filter(function (c, i) { var b = panel.querySelector('[data-crit="' + i + '"]'); return b && b.checked; });
|
|
3066
3121
|
if (!takePrompt && !picked.length) { status.textContent = 'Tick at least one change to add.'; return; }
|
|
3067
|
-
|
|
3068
|
-
status.textContent = 'Adding' + String.fromCharCode(8230);
|
|
3122
|
+
for (var d = 0; d < addButtons.length; d++) addButtons[d].disabled = true;
|
|
3123
|
+
status.textContent = (andPublish ? 'Publishing' : 'Adding') + String.fromCharCode(8230);
|
|
3069
3124
|
var id = card.dataset.workflow;
|
|
3070
3125
|
var w = withDraftFields(workflowsById[id]);
|
|
3071
3126
|
// The whole editor form, as the workflow stands in its draft, with
|
|
@@ -3087,7 +3142,16 @@ ${renderMarkdownScript}
|
|
|
3087
3142
|
steps.reduce(function (p, step) {
|
|
3088
3143
|
return p.then(function (prev) { if (prev && !prev.ok) return prev; return step(); });
|
|
3089
3144
|
}, Promise.resolve(null)).then(function (last) {
|
|
3090
|
-
|
|
3145
|
+
return last && last.ok && andPublish ? publishSavedDraft(base, ('Self-Improve: ' + (sg.summary || 'changes from feedback')).slice(0, 480)) : last;
|
|
3146
|
+
}).then(function (last) {
|
|
3147
|
+
if (last && !last.ok) { for (var e = 0; e < addButtons.length; e++) addButtons[e].disabled = false; status.textContent = last.body.error || 'Could not add them'; return; }
|
|
3148
|
+
for (var h = 0; h < addButtons.length; h++) addButtons[h].hidden = addButtons[h] !== btn;
|
|
3149
|
+
if (andPublish) {
|
|
3150
|
+
btn.textContent = 'Published';
|
|
3151
|
+
status.innerHTML = 'Every run from now on uses it. Run Evaluate to check it does better.';
|
|
3152
|
+
loadWorkflowsSection(name);
|
|
3153
|
+
return;
|
|
3154
|
+
}
|
|
3091
3155
|
btn.textContent = 'Added to the draft';
|
|
3092
3156
|
status.innerHTML = 'Review and publish the draft (at the top) to make it live, then run Evaluate to check it does better.';
|
|
3093
3157
|
refreshDraft(name, card);
|
|
@@ -3219,7 +3283,6 @@ ${renderMarkdownScript}
|
|
|
3219
3283
|
(f.outputSchema ? '<details class="wf-schema"><summary>Output schema</summary><pre>' + escapeHtml(JSON.stringify(f.outputSchema, null, 2)) + '</pre></details>' : ''));
|
|
3220
3284
|
if (versionFull(v)) rows += row('Model', escapeHtml(versionModelText(f.model)));
|
|
3221
3285
|
if (f.tools) rows += row('Tools', list(f.tools, 'None named in its prompt', versionToolHtml));
|
|
3222
|
-
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>'; }));
|
|
3223
3286
|
if (f.criteria) rows += row('Success criteria', list(f.criteria, 'None', function (c) { return '<div>' + escapeHtml(versionCritText(c)) + '</div>'; }));
|
|
3224
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>');
|
|
3225
3288
|
}
|
|
@@ -3279,10 +3342,6 @@ ${renderMarkdownScript}
|
|
|
3279
3342
|
});
|
|
3280
3343
|
if (tools.length) add('Tools', tools.join(''), tools.length + ' changed');
|
|
3281
3344
|
}
|
|
3282
|
-
if (a.triggers && b.triggers) {
|
|
3283
|
-
var trig = setDiff(a.triggers, b.triggers, function (t) { return t; }, escapeHtml);
|
|
3284
|
-
if (trig.length) add('Triggers', trig.join(''), trig.length + ' changed');
|
|
3285
|
-
}
|
|
3286
3345
|
if (a.criteria && b.criteria) {
|
|
3287
3346
|
var crit = setDiff(a.criteria, b.criteria, function (c) { return c.kind + '|' + (c.value || '') + '|' + c.text; }, function (c) { return escapeHtml(versionCritText(c)); });
|
|
3288
3347
|
if (crit.length) add('Success criteria', crit.join(''), crit.length + ' changed');
|
|
@@ -3459,7 +3518,7 @@ ${renderMarkdownScript}
|
|
|
3459
3518
|
if (msgForm.msgNoticeOn && msgForm.msgNoticeOn.checked && msgForm.msgNotice.value.trim()) body.chat_notice = msgForm.msgNotice.value.trim();
|
|
3460
3519
|
if (msgForm.msgResult && msgForm.msgResult.checked) body.result_to_chat = true;
|
|
3461
3520
|
msgResult.textContent = 'Saving' + String.fromCharCode(8230);
|
|
3462
|
-
fetchJsonRetryOnce(base + '/
|
|
3521
|
+
fetchJsonRetryOnce(base + '/messages', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) }).then(function (r) {
|
|
3463
3522
|
if (!r.ok) { msgResult.textContent = r.body.error || 'Could not save'; return; }
|
|
3464
3523
|
reloadOnMessages();
|
|
3465
3524
|
});
|
|
@@ -3468,7 +3527,7 @@ ${renderMarkdownScript}
|
|
|
3468
3527
|
for (var cb = 0; cb < clearButtons.length; cb++) {
|
|
3469
3528
|
clearButtons[cb].addEventListener('click', function (ev) {
|
|
3470
3529
|
var tid = ev.currentTarget.dataset.trigger;
|
|
3471
|
-
fetchJsonRetryOnce(base + '/
|
|
3530
|
+
fetchJsonRetryOnce(base + '/triggers/' + encodeURIComponent(tid), {
|
|
3472
3531
|
method: 'PUT', headers: { 'content-type': 'application/json' },
|
|
3473
3532
|
body: JSON.stringify({ callback_url: null, decisions: null, chat_notice: null, result_to_chat: false }),
|
|
3474
3533
|
}).then(function (r) {
|
|
@@ -3497,6 +3556,7 @@ ${renderMarkdownScript}
|
|
|
3497
3556
|
if (cbtn.classList.contains('wf-crit-edit')) {
|
|
3498
3557
|
critForm.hidden = false;
|
|
3499
3558
|
cbtn.hidden = true;
|
|
3559
|
+
offerPublish(critForm);
|
|
3500
3560
|
if (!rows.children.length) rows.insertAdjacentHTML('beforeend', critRowHtml({ kind: 'judge' }));
|
|
3501
3561
|
return;
|
|
3502
3562
|
}
|
|
@@ -3517,8 +3577,12 @@ ${renderMarkdownScript}
|
|
|
3517
3577
|
var list = Array.prototype.map.call(rows.querySelectorAll('.wf-crit-row'), function (row) {
|
|
3518
3578
|
return { id: row.dataset.critId || undefined, kind: row.querySelector('[data-crit-kind]').value, text: row.querySelector('[data-crit-text]').value, value: row.querySelector('[data-crit-value]').value };
|
|
3519
3579
|
}).filter(function (c) { return c.text.trim() || c.value.trim(); });
|
|
3520
|
-
// Saved to the draft: published with the rest of it
|
|
3580
|
+
// Saved to the draft: published with the rest of it, now with Save
|
|
3581
|
+
// and publish, or later from Review and publish.
|
|
3582
|
+
var andPublish = cbtn.classList.contains('wf-crit-publish');
|
|
3521
3583
|
fetchJsonRetryOnce(base + '/draft/criteria', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ criteria: list }) }).then(function (r) {
|
|
3584
|
+
return r.ok && andPublish ? publishSavedDraft(base, 'Changed the success criteria') : r;
|
|
3585
|
+
}).then(function (r) {
|
|
3522
3586
|
cbtn.disabled = false;
|
|
3523
3587
|
if (!r.ok) { critStatus.textContent = r.body.error || 'That didn' + String.fromCharCode(8217) + 't save.'; return; }
|
|
3524
3588
|
workflowTabs[id] = 'evaluation';
|
|
@@ -3561,10 +3625,9 @@ ${renderMarkdownScript}
|
|
|
3561
3625
|
card.querySelector('.workflow-hooks-btn').addEventListener('click', function () {
|
|
3562
3626
|
var w = workflowsById[id];
|
|
3563
3627
|
if (!w) return;
|
|
3564
|
-
//
|
|
3565
|
-
openHookFormDialog(w, base + '/
|
|
3628
|
+
// Live at once: its URL now, to set up in the sending app.
|
|
3629
|
+
openHookFormDialog(w, base + '/triggers', function (url, triggerId) {
|
|
3566
3630
|
loadWorkflowHooks(name, card, { url: url, id: triggerId });
|
|
3567
|
-
refreshDraft(name, card);
|
|
3568
3631
|
});
|
|
3569
3632
|
});
|
|
3570
3633
|
var wf = workflowsById[id];
|
|
@@ -3574,8 +3637,7 @@ ${renderMarkdownScript}
|
|
|
3574
3637
|
pendingScheduleWorkflow = id;
|
|
3575
3638
|
switchTab('schedules');
|
|
3576
3639
|
});
|
|
3577
|
-
//
|
|
3578
|
-
// and resuming act now.
|
|
3640
|
+
// Undoing a removal drafted before schedules went live at once.
|
|
3579
3641
|
var draftScheduleBtns = card.querySelectorAll('.workflow-schedule-draft');
|
|
3580
3642
|
for (var dsb = 0; dsb < draftScheduleBtns.length; dsb++) {
|
|
3581
3643
|
draftScheduleBtns[dsb].addEventListener('click', function (ev) {
|
|
@@ -3592,9 +3654,8 @@ ${renderMarkdownScript}
|
|
|
3592
3654
|
var action = btn.dataset.action;
|
|
3593
3655
|
if (action === 'cancel' && btn.dataset.confirming !== '1') { btn.dataset.confirming = '1'; btn.textContent = 'Click again to remove'; return; }
|
|
3594
3656
|
btn.disabled = true;
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
: fetchJsonRetryOnce('/schedules/' + encodeURIComponent(btn.dataset.id) + '/' + action, { method: 'POST' });
|
|
3657
|
+
// Schedules are live at once (and in Audit): removing one cancels it.
|
|
3658
|
+
var request = fetchJsonRetryOnce('/schedules/' + encodeURIComponent(btn.dataset.id) + '/' + action, { method: 'POST' });
|
|
3598
3659
|
request.then(function () {
|
|
3599
3660
|
loadWorkflowsSection(name);
|
|
3600
3661
|
// The Schedules tab's count, and the Overview's tile.
|
|
@@ -3700,7 +3761,7 @@ ${renderMarkdownScript}
|
|
|
3700
3761
|
var nameSection =
|
|
3701
3762
|
'<h3>Name <button type="button" class="edit-btn" id="editDisplayNameBtn">Edit</button></h3>' +
|
|
3702
3763
|
'<p class="ov-name"><span id="displayNameDisplay">' + escapeHtml(cfg.displayName || cfg.name) + '</span>' +
|
|
3703
|
-
' <span class="muted"
|
|
3764
|
+
' <span class="muted">· id <code>' + escapeHtml(cfg.name) + '</code></span></p>' +
|
|
3704
3765
|
editDialogHtml('<h3>Edit name</h3>', '<p>The name shown in the sidebar and at the top of its pages. Its id, <code>' + escapeHtml(cfg.name) + '</code>, stays the same: its API address and saved runs use it.</p>',
|
|
3705
3766
|
'<form class="add-source" id="displayNameForm" style="display:none">' +
|
|
3706
3767
|
'<label>Name<input type="text" name="displayName" maxlength="60" placeholder="' + escapeHtml(cfg.name) + '" value="' + escapeHtml(cfg.displayName || '') + '"></label>' +
|
|
@@ -3769,8 +3830,8 @@ ${renderMarkdownScript}
|
|
|
3769
3830
|
return renderOverviewCards(cfg) +
|
|
3770
3831
|
'<section>' + nameSection + '</section>' +
|
|
3771
3832
|
'<section>' + systemPromptSection + '</section>' +
|
|
3772
|
-
'<section
|
|
3773
|
-
'<section
|
|
3833
|
+
'<section>' + modelSection + '</section>' +
|
|
3834
|
+
'<section><h3>Limits <button type="button" class="edit-btn" id="editLimitsBtn">Edit</button></h3>' +
|
|
3774
3835
|
'<dl class="kv kv-wide" id="limitsDisplay">' +
|
|
3775
3836
|
'<dt>Model turns per run</dt><dd>' + escapeHtml(cfg.maxTurns) + ' <span class="hint">then the run stops</span></dd>' +
|
|
3776
3837
|
'<dt>Conversation size</dt><dd>' + escapeHtml(Number(cfg.contextBudgetTokens).toLocaleString()) + ' tokens <span class="hint">older steps are summarised beyond this</span></dd>' +
|
|
@@ -5044,11 +5105,7 @@ ${renderMarkdownScript}
|
|
|
5044
5105
|
return;
|
|
5045
5106
|
}
|
|
5046
5107
|
btn.disabled = true;
|
|
5047
|
-
|
|
5048
|
-
var wfId = btn.dataset.workflow;
|
|
5049
|
-
var request = wfId && (action === 'cancel' || action === 'delete')
|
|
5050
|
-
? fetchJsonRetryOnce('/agents/' + encodeURIComponent(name) + '/workflows/' + encodeURIComponent(wfId) + '/draft/schedules/' + encodeURIComponent(btn.dataset.id), { method: 'DELETE' })
|
|
5051
|
-
: action === 'delete'
|
|
5108
|
+
var request = action === 'delete'
|
|
5052
5109
|
? fetchJsonRetryOnce('/schedules/' + encodeURIComponent(btn.dataset.id), { method: 'DELETE' })
|
|
5053
5110
|
: fetchJsonRetryOnce('/schedules/' + encodeURIComponent(btn.dataset.id) + '/' + action, { method: 'POST' });
|
|
5054
5111
|
request.then(function () { setTimeout(function () { loadSchedulesTab(name); }, action === 'run' ? 800 : 0); });
|
|
@@ -5125,11 +5182,9 @@ ${renderMarkdownScript}
|
|
|
5125
5182
|
if (data.get('everyStart')) schedule.start_at = scheduleFormTime(data.get('everyStart'));
|
|
5126
5183
|
}
|
|
5127
5184
|
result.textContent = 'Scheduling' + String.fromCharCode(8230);
|
|
5128
|
-
//
|
|
5129
|
-
//
|
|
5130
|
-
var target =
|
|
5131
|
-
? '/agents/' + encodeURIComponent(name) + '/workflows/' + encodeURIComponent(data.get('workflow_id')) + '/draft/schedules'
|
|
5132
|
-
: '/agents/' + encodeURIComponent(name) + '/schedules';
|
|
5185
|
+
// Live at once, a workflow's schedule too (it's how the workflow
|
|
5186
|
+
// starts, not what it does), and in Audit.
|
|
5187
|
+
var target = '/agents/' + encodeURIComponent(name) + '/schedules';
|
|
5133
5188
|
fetchJsonRetryOnce(target, {
|
|
5134
5189
|
method: 'POST', headers: { 'content-type': 'application/json' },
|
|
5135
5190
|
body: JSON.stringify(Object.assign(
|
|
@@ -5138,10 +5193,6 @@ ${renderMarkdownScript}
|
|
|
5138
5193
|
)),
|
|
5139
5194
|
}).then(function (r) {
|
|
5140
5195
|
if (!r.ok) { result.textContent = r.body.error || 'Could not schedule'; return; }
|
|
5141
|
-
if (runsWorkflow) {
|
|
5142
|
-
result.innerHTML = 'Added to the workflow' + String.fromCharCode(8217) + 's draft: it starts when the draft is published. <a href="' + workflowPageHref(name, data.get('workflow_id')) + '">Review and publish</a>';
|
|
5143
|
-
return;
|
|
5144
|
-
}
|
|
5145
5196
|
loadSchedulesTab(name);
|
|
5146
5197
|
});
|
|
5147
5198
|
});
|
|
@@ -156,7 +156,7 @@ ${consoleShellScript}
|
|
|
156
156
|
var qs = '?agent=' + encodeURIComponent(agent.name);
|
|
157
157
|
li.innerHTML =
|
|
158
158
|
'<div class="le-card agent-card">' +
|
|
159
|
-
'<div class="name">' + escapeHtml(agent.displayName || agent.name) + (agent.displayName ? ' <span class="hint"
|
|
159
|
+
'<div class="name">' + escapeHtml(agent.displayName || agent.name) + (agent.displayName ? ' <span class="hint" style="font-family:var(--font-mono);font-weight:400">' + escapeHtml(agent.name) + '</span>' : '') + '</div>' +
|
|
160
160
|
'<div class="does" data-agent-does="' + escapeHtml(agent.name) + '"></div>' +
|
|
161
161
|
'<div class="prompt">' + escapeHtml(agent.systemPrompt) + '</div>' +
|
|
162
162
|
'<div class="links">' +
|
|
@@ -19,16 +19,8 @@
|
|
|
19
19
|
// leShell.applyProviderKeys(form, keys, keep) only providers with a key
|
|
20
20
|
// leShell.abilityOriginBadge(origin) Official/Public/Private badge for an ability
|
|
21
21
|
// leShell.toggleAbilityDetails(btn) an ability's tools, skills and settings
|
|
22
|
-
// leShell.advanced() whether this person has Advanced view on
|
|
23
22
|
// leShell.adminNote(tech) "Only your workspace admin can change this",
|
|
24
|
-
// with the technical how-to
|
|
25
|
-
//
|
|
26
|
-
// Simple and Advanced view: the console is for operators first, so what
|
|
27
|
-
// only a developer or the workspace's admin needs (version history,
|
|
28
|
-
// evaluations, the contract, the API, environment, limits) is marked
|
|
29
|
-
// data-advanced and hidden until a person turns on Advanced in the
|
|
30
|
-
// sidebar (kept in this browser). data-simple marks what shows only
|
|
31
|
-
// without it.
|
|
23
|
+
// with the technical how-to
|
|
32
24
|
// Same embedded-string conventions as the pages themselves: plain
|
|
33
25
|
// string concatenation and no backslashes inside the script, so nothing
|
|
34
26
|
// here needs double-escaping in the template literal.
|
|
@@ -48,7 +40,6 @@ const GOALS_ICON = '<svg class="le-nav-icon" viewBox="0 0 24 24" fill="none" str
|
|
|
48
40
|
const AUDIT_ICON = '<svg class="le-nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5" y="4" width="14" height="17" rx="2"/><path d="M9 4V3h6v1"/><path d="m9 13 2 2 4-4"/></svg>';
|
|
49
41
|
// A gear, for Settings.
|
|
50
42
|
const SCHEDULES_ICON = '<svg class="le-nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/></svg>';
|
|
51
|
-
const ADVANCED_ICON = '<svg class="le-nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" y1="21" x2="4" y2="14"/><line x1="4" y1="10" x2="4" y2="3"/><line x1="12" y1="21" x2="12" y2="12"/><line x1="12" y1="8" x2="12" y2="3"/><line x1="20" y1="21" x2="20" y2="16"/><line x1="20" y1="12" x2="20" y2="3"/><line x1="1" y1="14" x2="7" y2="14"/><line x1="9" y1="8" x2="15" y2="8"/><line x1="17" y1="16" x2="23" y2="16"/></svg>';
|
|
52
43
|
const SETTINGS_ICON = '<svg class="le-nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>';
|
|
53
44
|
// Two columns: the sections (Inbox, Goals, Agents, Workflows, Audit,
|
|
54
45
|
// Settings), and beside them what's in the current one. A goal holds the
|
|
@@ -64,9 +55,8 @@ export const consoleSidebarHtml = `<aside class="le-sidebar" aria-label="Console
|
|
|
64
55
|
<a class="le-rail-item" href="/agents" data-le-nav-head="agents" data-le-section="agents">${AGENTS_ICON}<span>Agents</span></a>
|
|
65
56
|
<a class="le-rail-item" href="/workflows" data-le-nav-head="workflows" data-le-section="workflows">${WORKFLOWS_ICON}<span>Workflows</span></a>
|
|
66
57
|
<a class="le-rail-item" href="/schedules" data-le-nav-head="schedules" data-le-section="schedules">${SCHEDULES_ICON}<span>Schedules</span></a>
|
|
67
|
-
<a class="le-rail-item" href="/audit" data-le-nav-head="audit" data-le-section="audit">${AUDIT_ICON}<span>Audit</span></a>
|
|
68
58
|
<span class="le-rail-gap"></span>
|
|
69
|
-
<
|
|
59
|
+
<a class="le-rail-item" href="/audit" data-le-nav-head="audit" data-le-section="audit">${AUDIT_ICON}<span>Audit</span></a>
|
|
70
60
|
<a class="le-rail-item" href="/config?section=settings" data-le-nav-head="settings" data-le-section="settings">${SETTINGS_ICON}<span>Settings</span></a>
|
|
71
61
|
<div class="le-who" id="leWho" hidden></div>
|
|
72
62
|
</nav>
|
|
@@ -82,14 +72,14 @@ export const consoleSidebarHtml = `<aside class="le-sidebar" aria-label="Console
|
|
|
82
72
|
</section>
|
|
83
73
|
<section class="le-pane" data-le-pane="workflows">
|
|
84
74
|
<div class="le-pane-head"><a href="/workflows">Workflows</a><a class="le-pane-new" href="/workflows/new">+ New</a></div>
|
|
85
|
-
<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>
|
|
86
76
|
</section>
|
|
87
77
|
<section class="le-pane" data-le-pane="settings">
|
|
88
78
|
<div class="le-pane-head"><a href="/config?section=settings">Settings</a></div>
|
|
89
79
|
<nav class="le-settings-menu" aria-label="Settings">
|
|
90
80
|
<a href="/config?section=models" data-le-nav="models">Models</a>
|
|
91
81
|
<a href="/config?section=apps" data-le-nav="apps">Apps</a>
|
|
92
|
-
<a href="/config?section=abilities" data-le-nav="abilities"
|
|
82
|
+
<a href="/config?section=abilities" data-le-nav="abilities">Abilities</a>
|
|
93
83
|
<a href="/config?section=settings" data-le-nav="settings">General settings</a>
|
|
94
84
|
</nav>
|
|
95
85
|
</section>
|
|
@@ -97,25 +87,10 @@ export const consoleSidebarHtml = `<aside class="le-sidebar" aria-label="Console
|
|
|
97
87
|
</aside>`;
|
|
98
88
|
export const consoleShellScript = `<script>
|
|
99
89
|
(function () {
|
|
100
|
-
// Simple view unless this person turned Advanced on.
|
|
101
|
-
var advancedOn = false;
|
|
102
|
-
try { advancedOn = localStorage.getItem('le-advanced') === '1'; } catch (e) {}
|
|
103
|
-
document.documentElement.classList.toggle('le-simple', !advancedOn);
|
|
104
|
-
var advToggle = document.getElementById('leAdvToggle');
|
|
105
|
-
if (advToggle) {
|
|
106
|
-
advToggle.setAttribute('aria-pressed', String(advancedOn));
|
|
107
|
-
advToggle.addEventListener('click', function () {
|
|
108
|
-
advancedOn = !advancedOn;
|
|
109
|
-
try { localStorage.setItem('le-advanced', advancedOn ? '1' : '0'); } catch (e) {}
|
|
110
|
-
document.documentElement.classList.toggle('le-simple', !advancedOn);
|
|
111
|
-
advToggle.setAttribute('aria-pressed', String(advancedOn));
|
|
112
|
-
document.dispatchEvent(new CustomEvent('le-advanced', { detail: advancedOn }));
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
90
|
// A setting only the workspace's admin can change: said plainly, with
|
|
116
|
-
// the technical how-to
|
|
91
|
+
// the technical how-to.
|
|
117
92
|
function adminNote(tech) {
|
|
118
|
-
return '<p class="hint le-admin-note"
|
|
93
|
+
return '<p class="hint le-admin-note">Only your workspace admin can change this. ' + tech + '</p>';
|
|
119
94
|
}
|
|
120
95
|
var page = document.body.getAttribute('data-le-page') || '';
|
|
121
96
|
var params = new URLSearchParams(location.search);
|
|
@@ -137,9 +112,6 @@ export const consoleShellScript = `<script>
|
|
|
137
112
|
['schedules', 'Schedules'], ['chat', 'Chat'], ['actauth', 'Permissions'], ['env', 'Environment'], ['advanced', 'Advanced']
|
|
138
113
|
];
|
|
139
114
|
|
|
140
|
-
// The agent tabs for Advanced view only.
|
|
141
|
-
var ADVANCED_TABS = ['env', 'advanced'];
|
|
142
|
-
|
|
143
115
|
function esc(s) {
|
|
144
116
|
return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) {
|
|
145
117
|
return { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c];
|
|
@@ -290,7 +262,7 @@ export const consoleShellScript = `<script>
|
|
|
290
262
|
workflowList.innerHTML = list.length ? list.map(function (w) {
|
|
291
263
|
var on = w.agent === currentAgent && w.id === currentId;
|
|
292
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"' : '') + '>' +
|
|
293
|
-
'<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>';
|
|
294
266
|
}).join('') : '<li class="le-agent-item"><span></span><span class="le-meta">No workflows yet</span><span></span></li>';
|
|
295
267
|
});
|
|
296
268
|
}
|
|
@@ -351,12 +323,12 @@ export const consoleShellScript = `<script>
|
|
|
351
323
|
var count = t[0] === 'env'
|
|
352
324
|
? '<span data-le-env-count="' + esc(opts.name) + '">' + envCountHtml(opts.name) + '</span>'
|
|
353
325
|
: (counts[t[0]] != null ? '<span class="le-count">' + counts[t[0]] + '</span>' : '');
|
|
354
|
-
return '<a class="le-tab" data-tab="' + t[0] + '" href="' + tabHref(opts.name, t[0]) + '" aria-selected="' + (t[0] === opts.tab) + '"
|
|
326
|
+
return '<a class="le-tab" data-tab="' + t[0] + '" href="' + tabHref(opts.name, t[0]) + '" aria-selected="' + (t[0] === opts.tab) + '">' + t[1] + count + '</a>';
|
|
355
327
|
}).join('');
|
|
356
328
|
return '<div class="le-head"><div class="le-head-row">' +
|
|
357
329
|
'<div class="le-title"><button type="button" class="le-menu-btn" data-le-menu aria-label="Open navigation">☰</button>' +
|
|
358
330
|
'<div style="min-width:0"><h1><span data-le-head-name>' + esc(opts.displayName || opts.name) + '</span>' +
|
|
359
|
-
'<span class="le-head-id" data-le-head-id
|
|
331
|
+
'<span class="le-head-id" data-le-head-id' + (opts.displayName ? '' : ' hidden') + '>' + esc(opts.name) + '</span></h1>' + (opts.prompt ? '<p>' + esc(opts.prompt) + '</p>' : '') + '</div></div>' +
|
|
360
332
|
'<div class="le-chips">' + chips + '</div></div>' +
|
|
361
333
|
'<nav class="le-tabs" aria-label="Agent sections">' + tabs + '</nav></div>';
|
|
362
334
|
}
|
|
@@ -708,6 +680,6 @@ export const consoleShellScript = `<script>
|
|
|
708
680
|
}
|
|
709
681
|
|
|
710
682
|
|
|
711
|
-
window.leShell = {
|
|
683
|
+
window.leShell = { adminNote: adminNote, loadError: function () { return loadError; }, ready: ready, settings: function () { return settings; }, getJson: getJson, reloadGoals: reloadGoals, reloadJobs: reloadJobs, reloadWorkflows: reloadWorkflows, reloadInboxCount: reloadInboxCount, renderHead: renderHead, setTab: setTab, setActive: setActive, setDisplayName: setDisplayName, displayNameOf: displayNameOf, esc: esc, tabHref: tabHref, envCountHtml: envCountHtml, setCount: setCount, wireModelPicker: wireModelPicker, loadProviderKeys: loadProviderKeys, applyProviderKeys: applyProviderKeys, abilityOriginBadge: abilityOriginBadge, toggleAbilityDetails: toggleAbilityDetails };
|
|
712
684
|
})();
|
|
713
685
|
</script>`;
|
|
@@ -151,10 +151,6 @@ export const devUiCss = `
|
|
|
151
151
|
.le-rail-item .le-inbox-count { position: absolute; top: 2px; right: 4px; margin: 0; padding: 0 5px; font-size: 10px; }
|
|
152
152
|
.le-inbox-count[hidden] { display: none; }
|
|
153
153
|
.le-rail-gap { flex: 1; }
|
|
154
|
-
button.le-rail-item { border: 0; background: none; height: 40px; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; width: 100%; }
|
|
155
|
-
.le-adv-toggle[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
|
|
156
|
-
.le-simple [data-advanced] { display: none !important; }
|
|
157
|
-
html:not(.le-simple) [data-simple] { display: none !important; }
|
|
158
154
|
.le-nav-icon { width: 15px; height: 15px; flex-shrink: 0; }
|
|
159
155
|
.le-panel { width: 228px; flex: none; display: flex; flex-direction: column; min-height: 0; padding-top: 14px; }
|
|
160
156
|
.le-panel[hidden] { display: none; }
|
|
@@ -168,13 +164,18 @@ export const devUiCss = `
|
|
|
168
164
|
.le-pane-head a.le-pane-new[aria-current="page"] { text-decoration: underline; }
|
|
169
165
|
.le-pane .le-agent-list { max-height: none; }
|
|
170
166
|
.le-goal-item .le-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
|
|
171
|
-
|
|
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; }
|
|
172
173
|
/* Find your first agent: one more item under Agents. */
|
|
173
|
-
.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; }
|
|
174
175
|
.le-sub-link:hover { background: var(--surface-2); }
|
|
175
176
|
.le-sub-link[aria-current="page"] { background: var(--accent-soft); font-weight: 600; }
|
|
176
177
|
/* List items read smaller than their section's head. */
|
|
177
|
-
.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; }
|
|
178
179
|
.le-agent-item:hover { background: var(--surface-2); }
|
|
179
180
|
.le-agent-item[aria-current="page"] { background: var(--bg); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
|
|
180
181
|
.le-agent-item .le-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
@@ -187,7 +188,7 @@ export const devUiCss = `
|
|
|
187
188
|
.le-inbox-only .le-rail-item:not([data-le-section="inbox"]), .le-inbox-only .le-panel { display: none; }
|
|
188
189
|
.le-dot.idle { background: var(--ink-faint); }
|
|
189
190
|
.le-settings-menu { display: grid; gap: 2px; padding: 0 8px; }
|
|
190
|
-
.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; }
|
|
191
192
|
.le-settings-menu a:hover { background: var(--surface-2); color: var(--ink); }
|
|
192
193
|
.le-settings-menu a[aria-current="page"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
|
|
193
194
|
.le-who { position: relative; display: grid; place-items: center; padding-top: 8px; }
|
|
@@ -1024,7 +1024,7 @@ ${consoleShellScript}
|
|
|
1024
1024
|
(si.dashboardUrl ? ' · <a href="' + escapeHtml(si.dashboardUrl) + '">Dashboard</a>' : '')
|
|
1025
1025
|
: si.mode === 'basic'
|
|
1026
1026
|
? 'Basic Auth (<code>LOOPENGINE_ADMIN_AUTH</code>)'
|
|
1027
|
-
: '<span class="error">None: anyone who can reach this workspace can use it.</span><span class="hint"
|
|
1027
|
+
: '<span class="error">None: anyone who can reach this workspace can use it.</span><span class="hint"> Set <code>LOOPENGINE_ADMIN_AUTH</code>.</span>';
|
|
1028
1028
|
var rows = [
|
|
1029
1029
|
['Admin sign-in', signIn],
|
|
1030
1030
|
['LoopEngine version', '<code>' + escapeHtml(d.version) + '</code>'],
|
|
@@ -1036,11 +1036,12 @@ ${consoleShellScript}
|
|
|
1036
1036
|
['Theme', 'Follows your system'],
|
|
1037
1037
|
];
|
|
1038
1038
|
return '<section><table><thead><tr><th>Setting</th><th>Value</th></tr></thead><tbody>' +
|
|
1039
|
-
rows.filter(Boolean).map(function (r) { return '<tr
|
|
1039
|
+
rows.filter(Boolean).map(function (r) { return '<tr><td>' + r[0] + '</td><td>' + r[1] + '</td></tr>'; }).join('') +
|
|
1040
1040
|
'</tbody></table></section>' +
|
|
1041
1041
|
(d.timeZone ? '<section><h3>Time zone</h3><div class="source" id="timeZoneBox"><p class="hint">Loading' + String.fromCharCode(8230) + '</p></div></section>' : '') +
|
|
1042
|
+
'<section><h3>Publishing</h3><div class="source" id="publishingBox"></div></section>' +
|
|
1042
1043
|
'<section><h3>Shared policies</h3><div class="source" id="policiesBox"><p class="hint">Loading' + String.fromCharCode(8230) + '</p></div></section>' +
|
|
1043
|
-
'<section
|
|
1044
|
+
'<section><h3>Private ability sources</h3><p class="muted" style="margin:0 0 10px">Where your own abilities come from, listed under Private on the Abilities page next to LoopEngine's official ones.</p><div class="source" id="abilitySourcesBox"><p class="hint">Loading' + String.fromCharCode(8230) + '</p></div></section>' +
|
|
1044
1045
|
'<section><h3>Updates</h3><div class="source" id="upgradeBox"><p class="hint">Checking for a newer LoopEngine' + String.fromCharCode(8230) + '</p></div></section>';
|
|
1045
1046
|
}
|
|
1046
1047
|
|
|
@@ -1192,6 +1193,46 @@ ${consoleShellScript}
|
|
|
1192
1193
|
});
|
|
1193
1194
|
}
|
|
1194
1195
|
|
|
1196
|
+
// ---- Publishing: whether a change to what a workflow's runs do (its
|
|
1197
|
+
// prompt, inputs, model, result format, success criteria) can be
|
|
1198
|
+
// published in one click from the editor, or must be saved as a draft
|
|
1199
|
+
// and published after its review. Schedules, webhooks and where messages
|
|
1200
|
+
// go change straight away either way. ----
|
|
1201
|
+
function renderPublishing(d) {
|
|
1202
|
+
var box = document.getElementById('publishingBox');
|
|
1203
|
+
if (!box) return;
|
|
1204
|
+
var on = d.requireReview === true;
|
|
1205
|
+
var intro = '<p>Changes to what a workflow does (its prompt, inputs, model, result format and success criteria) become a new version when they' + String.fromCharCode(8217) + 're published. Schedules, webhooks and where messages go change straight away, and are recorded in Audit.</p>';
|
|
1206
|
+
if (!d.canChangeSettings) {
|
|
1207
|
+
box.innerHTML = intro + '<p>' + (on ? 'Review is required before publishing.' : 'Changes can be saved and published in one step.') + '</p>' +
|
|
1208
|
+
leShell.adminNote('Set <code>LOOPENGINE_ADMIN_AUTH</code> to change it here, or put <code>LOOPENGINE_REQUIRE_REVIEW=1</code> in .env.');
|
|
1209
|
+
return;
|
|
1210
|
+
}
|
|
1211
|
+
box.innerHTML = intro +
|
|
1212
|
+
'<label style="display:flex;gap:8px;align-items:flex-start;max-width:560px"><input type="checkbox" id="requireReview"' + (on ? ' checked' : '') + ' style="margin-top:3px">' +
|
|
1213
|
+
'<span><strong>Require review before publishing</strong><br><span class="hint">Every change is saved as a draft first, then published from Review and publish. Off, the editor also offers Save and publish.</span></span></label>' +
|
|
1214
|
+
'<div id="publishingMsg" class="hint" style="margin-top:8px"></div>';
|
|
1215
|
+
var box2 = document.getElementById('requireReview');
|
|
1216
|
+
box2.addEventListener('change', function () {
|
|
1217
|
+
var msg = document.getElementById('publishingMsg');
|
|
1218
|
+
box2.disabled = true;
|
|
1219
|
+
msg.textContent = 'Saving' + String.fromCharCode(8230);
|
|
1220
|
+
fetch('/config/publishing', {
|
|
1221
|
+
method: 'PUT',
|
|
1222
|
+
headers: { 'content-type': 'application/json' },
|
|
1223
|
+
body: JSON.stringify({ requireReview: box2.checked }),
|
|
1224
|
+
})
|
|
1225
|
+
.then(function (r) { return r.json().then(function (b) { return { ok: r.ok, body: b }; }); })
|
|
1226
|
+
.then(function (r) {
|
|
1227
|
+
box2.disabled = false;
|
|
1228
|
+
if (!r.ok) { box2.checked = !box2.checked; msg.innerHTML = '<span class="error">' + escapeHtml(r.body.error || 'Could not save') + '</span>'; return; }
|
|
1229
|
+
box2.checked = r.body.requireReview === true;
|
|
1230
|
+
msg.textContent = r.body.requireReview ? 'Saved: changes now wait for review.' : 'Saved: changes can be published in one step.';
|
|
1231
|
+
})
|
|
1232
|
+
.catch(function (err) { box2.disabled = false; box2.checked = !box2.checked; msg.innerHTML = '<span class="error">' + escapeHtml(err.message) + '</span>'; });
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1195
1236
|
// ---- Shared policies: the business's rules every workflow run reads,
|
|
1196
1237
|
// above its own instructions (policies.md in the project). ----
|
|
1197
1238
|
function renderPolicies(p) {
|
|
@@ -1416,6 +1457,7 @@ ${consoleShellScript}
|
|
|
1416
1457
|
.then(function (d) {
|
|
1417
1458
|
content.innerHTML = renderSettings(d);
|
|
1418
1459
|
loadedSections.settings = true;
|
|
1460
|
+
renderPublishing(d);
|
|
1419
1461
|
loadTimeZone();
|
|
1420
1462
|
loadPolicies();
|
|
1421
1463
|
loadAbilitySources();
|
|
@@ -160,3 +160,11 @@ export declare function setWorkspaceTimeZone(value: unknown, options?: {
|
|
|
160
160
|
timeZone: string;
|
|
161
161
|
moved: number;
|
|
162
162
|
}>;
|
|
163
|
+
/** Settings → Publishing: whether a workflow's changes must go through
|
|
164
|
+
* Review and publish. Off (the default), the editor, the success
|
|
165
|
+
* criteria and Self-Improve also offer Save and publish in one click; on,
|
|
166
|
+
* every change to what a run does is saved as a draft and published only
|
|
167
|
+
* after its review. Saved like the time zone (the project's .env). */
|
|
168
|
+
export declare const REQUIRE_REVIEW_ENV = "LOOPENGINE_REQUIRE_REVIEW";
|
|
169
|
+
export declare function requireReview(): boolean;
|
|
170
|
+
export declare function setRequireReview(on: boolean): Promise<boolean>;
|
|
@@ -328,3 +328,19 @@ export async function setWorkspaceTimeZone(value, options = {}) {
|
|
|
328
328
|
const moved = options.moveSchedules && timeZone !== before ? await moveScheduledTasksToTimeZone(before, timeZone) : 0;
|
|
329
329
|
return { timeZone, moved };
|
|
330
330
|
}
|
|
331
|
+
/** Settings → Publishing: whether a workflow's changes must go through
|
|
332
|
+
* Review and publish. Off (the default), the editor, the success
|
|
333
|
+
* criteria and Self-Improve also offer Save and publish in one click; on,
|
|
334
|
+
* every change to what a run does is saved as a draft and published only
|
|
335
|
+
* after its review. Saved like the time zone (the project's .env). */
|
|
336
|
+
export const REQUIRE_REVIEW_ENV = 'LOOPENGINE_REQUIRE_REVIEW';
|
|
337
|
+
export function requireReview() {
|
|
338
|
+
return /^(1|true|yes|on)$/i.test(process.env[REQUIRE_REVIEW_ENV]?.trim() ?? '');
|
|
339
|
+
}
|
|
340
|
+
export async function setRequireReview(on) {
|
|
341
|
+
if (on)
|
|
342
|
+
await setEnvVar(REQUIRE_REVIEW_ENV, '1');
|
|
343
|
+
else
|
|
344
|
+
await unsetEnvVar(REQUIRE_REVIEW_ENV);
|
|
345
|
+
return requireReview();
|
|
346
|
+
}
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
// + Add schedule opens Create schedule: which workflow, its name, how
|
|
14
14
|
// often (an interval, daily at a time, weekly on a day, or once), whether
|
|
15
15
|
// each result goes to the messaging app, and the workflow's inputs for
|
|
16
|
-
// every run.
|
|
17
|
-
// workflow
|
|
18
|
-
//
|
|
16
|
+
// every run. It starts at once (POST /agents/:name/schedules): a schedule
|
|
17
|
+
// is how a workflow starts, not what it does, so it has no draft, and the
|
|
18
|
+
// change is in Audit.
|
|
19
19
|
//
|
|
20
20
|
// Its data is each agent's /agents/:name/schedules. Like the other
|
|
21
21
|
// console pages, its inline script avoids backslashes and template
|
|
@@ -174,7 +174,7 @@ ${consoleSidebarHtml}
|
|
|
174
174
|
</div>
|
|
175
175
|
<div class="sc-dlg-col">
|
|
176
176
|
<div class="sc-field"><span class="sc-field-k">Inputs for every run</span><div class="sc-inputs" id="scInputs"></div></div>
|
|
177
|
-
<div class="sc-field"><span class="sc-field-k">
|
|
177
|
+
<div class="sc-field"><span class="sc-field-k">When it starts</span><p class="hint">Right away: the first run is at the next time you chose. Switch it off on its card to pause it.</p></div>
|
|
178
178
|
</div>
|
|
179
179
|
</div>
|
|
180
180
|
<div class="sc-dlg-foot" id="scFoot"></div>
|
|
@@ -530,25 +530,13 @@ ${consoleShellScript}
|
|
|
530
530
|
var save = document.getElementById('scSave');
|
|
531
531
|
save.disabled = true;
|
|
532
532
|
foot.textContent = 'Saving' + String.fromCharCode(8230);
|
|
533
|
-
|
|
534
|
-
|
|
533
|
+
// Live at once: a schedule is how a workflow starts, not what it does,
|
|
534
|
+
// so it needs no draft (and is in Audit).
|
|
535
|
+
body.workflow_id = w.id;
|
|
536
|
+
api('POST', '/agents/' + encodeURIComponent(w.agent) + '/schedules', body).then(function (r) {
|
|
535
537
|
if (!r.ok) { save.disabled = false; foot.innerHTML = '<span class="error">' + esc(r.body.error || 'Could not add it') + '</span>'; return; }
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
// they're reviewed together on the workflow's page.
|
|
539
|
-
foot.innerHTML = only
|
|
540
|
-
? '<span>Added to ' + esc(w.title) + String.fromCharCode(8217) + 's draft. Publish it to start the schedule.</span><span style="flex:1"></span><button type="button" class="le-btn-dark" id="scPublish">Publish now</button>'
|
|
541
|
-
: '<span>Added to ' + esc(w.title) + String.fromCharCode(8217) + 's draft, with its other changes.</span><span style="flex:1"></span><a class="le-btn-dark" href="' + wfHref(w.agent, w.id, 'triggers') + '">Review and publish</a>';
|
|
542
|
-
var pub = document.getElementById('scPublish');
|
|
543
|
-
if (pub) pub.addEventListener('click', function () {
|
|
544
|
-
pub.disabled = true;
|
|
545
|
-
pub.textContent = 'Publishing' + String.fromCharCode(8230);
|
|
546
|
-
api('POST', base + '/publish', { note: 'Added a schedule' + (name ? ': ' + name : '') }).then(function (p) {
|
|
547
|
-
if (!p.ok) { pub.disabled = false; pub.textContent = 'Publish now'; foot.insertAdjacentHTML('beforeend', '<span class="error">' + esc(p.body.error || 'Could not publish') + '</span>'); return; }
|
|
548
|
-
dlg.close();
|
|
549
|
-
load();
|
|
550
|
-
});
|
|
551
|
-
});
|
|
538
|
+
dlg.close();
|
|
539
|
+
load();
|
|
552
540
|
});
|
|
553
541
|
});
|
|
554
542
|
|