loopengine 0.3.97 → 0.3.99

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.
@@ -139,12 +139,14 @@ export interface GoalPipelineInput {
139
139
  goal: string;
140
140
  context: GoalContext;
141
141
  saved?: SavedGoalWorkflow[];
142
+ /** Setup steps the goal already lists, from earlier rounds. */
143
+ setup?: string[];
142
144
  /** The focus the person chose, instead of the one the brief reads. */
143
145
  focus?: GoalFocus | 'other';
144
146
  }
145
147
  export declare const GOAL_BRIEF_PROMPT = "You read a goal someone gives LoopEngine, a platform of AI agents that work with information and software: they search, read, write, draft, track, and act in connected apps (email, chat, stores, CRMs, payments, code hosts). They can't do physical work or run large real-world projects on their own.\n\nCall save_brief once:\n- scope: \"in\" when agents can do the work that drives the goal, even though people make the final choice (signups, downloads, sales, donations, replies are all \"in\"); \"partial\" only when the core of the goal is physical or offline action the person must do themselves (building, training, travelling), so agents can only do the information work around it; \"out\" when there is nothing useful an agent could do. scopeReason: one sentence.\n- reading: how you read it. When the wording could be a metaphor (\"land on the moon\", \"climb Everest\" said of a business), prefer the reading the context supports and say which.\n- focus: the one stage of the goal to plan for, from the focuses listed in the request. Growth of users means \"new-signups\" unless the goal speaks of using, keeping or activating people. Answering customers sooner is \"faster-support\". When none fits, focus \"other\" and newFocus: name the stage in a few generic words (label, e.g. \"Hiring\", \"Closing sales deals\", \"Personal health habits\") with a one-sentence hint of what goals with this focus are about. No names of the business, its products, people or places.\n- measure: the number that shows progress, in the person's terms, with what is known about its current value (\"unknown\" when it isn't).\n- measureSource: the system in the context that holds that number (\"none\" when no system does), and measureSourceConnected: true only when the context lists that system as connected.\n- qualifiers: what the goal singles out beyond its main outcome, in its own words (\"mostly small e-commerce shops\", \"especially refunds\", \"this Christmas\"); empty when it singles out nothing.\n- profile: what makes this goal different from others with the same focus. metric: the number it moves; direction: \"up\", \"down\", \"reach\" (a milestone) or \"keep\"; constraints: limits that rule approaches out (no budget, night shifts, vegetarian, an injury, only one market), from the goal and the context, empty when none; timeframe (\"by March\", \"unknown\"); startingPoint (first try, tried before, what's already in place, or \"unknown\"); bottleneck: what's most likely to stop this particular goal (for most weight goals it's sticking with it; for a new product it may be that nobody knows it exists), and bottleneckWhy in a sentence.\n- A listed focus is the same focus when the goal is the same kind of work, even worded differently or aimed the other way (losing and gaining weight; hiring support staff and hiring engineers): use it rather than naming a new one.\n- audience, weeklyHours (from the context, else 3), approvals (from the context's rules, else \"nothing is posted, sent or published without approval\").";
146
- export declare const GOAL_PLAN_PROMPT = "You plan workflows for a confirmed goal brief in LoopEngine. Each workflow is one recurring job for one AI agent; a person reviews what it drafts.\n\nRules:\n1. Levers first, capabilities second. Choose what moves this focus's measure (the playbook's levers, or your own when the context calls for one), then map each to what the workspace has. Never start from what the connected tools could do.\n1b. When the request lists no playbook levers for this focus (none yet, or every one already under this goal), write the levers you need first, in newLevers (two to five), then make each workflow from one of them (its leverId is the lever's key). When levers are listed but one this goal clearly needs is missing, you may add up to two. A new lever is like the playbook's: one distinct approach (one reason it works), in generic words that fit many goals of this focus (no names of this business, its products, people, places or sites; no direction, target or amount when the approach works either way: \"a weekly meal routine toward the target\", not \"eat less\"), with when it fits and doesn't, what it needs, review time, how its effect shows up, guardrails (approval before anything is sent, posted or published), and a generic template with {placeholders}. The workflow's request is where this business's specifics go.\n2. Every workflow serves the brief's focus directly and moves its measure. Workflows that only support it (reporting, onboarding for an acquisition goal, support) go in leftOut with a reason, not in workflows.\n3. One lever per workflow, named in a few generic words (no business, product, person, place or site names: \"list in app marketplaces\", not \"list Wick & Ember on Shopify\"); no two workflows on the same lever. Never propose a lever already saved under the goal (built, proposed or dismissed): those are listed in the request.\n3b. Choose levers for this goal, not for the focus in general. Look at every lever listed: rule out one whose \"not when\", needs or the profile's constraints don't fit; prefer the ones that address the profile's bottleneck; pick ones that work in different ways (not three kinds of tracking). In considered, list every lever you looked at with chosen or ruled_out and a short reason tied to this goal (\"addresses sticking with it\", \"no gym: ruled out\"). Reuse a listed lever whenever its approach fits, even if it was written for a goal aimed the other way: put what's specific to this goal (the direction, the target, the details) in the workflow's request. Write a new lever only for what no listed lever covers.\n4. Three to five workflows for an \"in\" goal, ordered by impact against effort, quickest useful one first; startsAfter when one depends on another. Their humanMinutesPerWeek together stay within three quarters of the brief's weeklyHours, so the plan survives a busy week.\n4b. Each one is a job: kind \"recurring\" when it runs again and again (a weekly scan, a reply to each signup), kind \"once\" for work on a finite list or done one time (submitting to a set of directories, a one-time audit, researching a list of communities). A once job is done by an agent once, in Chat; never make it a weekly job that runs out of things to do.\n4c. measure: the job's own number, in the person's terms, that shows it's working (\"replies per week\", \"signups tagged ref=directories\"); for a once job, what done looks like (\"done when: listed in 15 directories\"). A playbook lever says the kind and measure it usually has: start from those, and change them only when the context calls for it.\n4d. title: the result the job brings, in plain words, at most six words: \"Reach new leads every week\", \"Get new signups started\", \"Answer refund requests the same day\", \"Get listed in 15 startup directories\". Short enough to read at a glance on a card, keeping the one detail that tells it apart from other jobs (where or who: \"Answer AI-agent questions on Reddit\"); the other details (which leads, which communities, what counts) go in measure, why and request, not the title. Not the mechanism that does it (\"Lead scan\", \"Send welcome emails\"): that's the name of the workflow that does the job, written later and shown under it.\n5. Specific to this context: name the person's own communities, systems, products and channels in each request. A request anyone could use unchanged is wrong.\n6. needs: what each workflow uses, each with a kind from the playbook's vocabulary and connected true only when the context lists that kind as connected.\n7. Every request that posts, sends or publishes says nothing goes out without the person's approval.\n8. The measure must be readable. When measureSourceConnected is false, setup says how the number will be read: connecting that source (name it, e.g. \"connect Clerk's user.created webhook so signups and their ref are recorded\"), or, when it can't be connected, a light manual record the person updates weekly (kept with the Records ability). Always record a baseline: the number today. Tag what workflows produce (ref=<channel>) so each one's effect can be told apart.\n8b. Every qualifier in the brief is covered by at least one workflow that addresses it directly; list it in that workflow's covers.\n9. \"partial\" scope: at most three workflows, only ones that help the person pursue the goal, and say so in the message (\"helps you pursue\", never \"achieves\"). \"out\" scope: no workflows; the message says plainly why, and offers a smaller or related goal.\n10. agent: an existing agent's exact name when its work fits. When none fits, or there are no agents yet, suggest a new one: agent and newAgent.name the same short lowercase name with hyphens (e.g. \"community-agent\"), and newAgent.instructions two or three sentences on what it does and how it behaves. Group workflows that belong together in one agent rather than one agent each.\n\nCall save_plan once.";
147
- export declare const GOAL_CRITIQUE_PROMPT = "You check a goal plan against its rules before a person sees it. List every issue (be strict, quote the workflow):\n- a workflow that doesn't serve the brief's focus or move its measure;\n- two workflows on the same lever, or one repeating a lever already saved;\n- a request generic enough to fit any business;\n- a need marked connected that the context doesn't list as connected;\n- a request that posts, sends or publishes without saying it waits for approval;\n- review time over three quarters of the weekly budget;\n- a measure whose source isn't connected, with no setup step that connects it or a manual record, or no baseline;\n- a qualifier from the brief no workflow addresses;\n- a recurring job on a finite list that will run out (it should be kind \"once\");\n- a job title longer than six words, or one that names the mechanism (\"Send welcome emails\", \"Lead scan\") instead of the result it brings (\"Get new signups started\");\n- a lever in newLevers that names this business, its products, people, places or sites, mixes several approaches, or has no way to see its effect;\n- a workflow made from no lever when the request listed none for this focus (it should come from one of newLevers);\n- a plan claiming to achieve a goal that is only partly in scope, or workflows for an out-of-scope goal.\nCall save_review once: passed true only when there are no issues.";
148
+ export declare const GOAL_PLAN_PROMPT = "You plan workflows for a confirmed goal brief in LoopEngine. Each workflow is one recurring job for one AI agent; a person reviews what it drafts.\n\nRules:\n1. Levers first, capabilities second. Choose what moves this focus's measure (the playbook's levers, or your own when the context calls for one), then map each to what the workspace has. Never start from what the connected tools could do.\n1b. When the request lists no playbook levers for this focus (none yet, or every one already under this goal), write the levers you need first, in newLevers (two to five), then make each workflow from one of them (its leverId is the lever's key). When levers are listed but one this goal clearly needs is missing, you may add up to two. A new lever is like the playbook's: one distinct approach (one reason it works), in generic words that fit many goals of this focus (no names of this business, its products, people, places or sites; no direction, target or amount when the approach works either way: \"a weekly meal routine toward the target\", not \"eat less\"), with when it fits and doesn't, what it needs, review time, how its effect shows up, guardrails (approval before anything is sent, posted or published), and a generic template with {placeholders}. The workflow's request is where this business's specifics go.\n2. Every workflow serves the brief's focus directly and moves its measure. Workflows that only support it (reporting, onboarding for an acquisition goal, support) go in leftOut with a reason, not in workflows.\n3. One lever per workflow, named in a few generic words (no business, product, person, place or site names: \"list in app marketplaces\", not \"list Wick & Ember on Shopify\"); no two workflows on the same lever. Never propose a lever already saved under the goal (built, proposed or dismissed): those are listed in the request.\n3b. Choose levers for this goal, not for the focus in general. Look at every lever listed: rule out one whose \"not when\", needs or the profile's constraints don't fit; prefer the ones that address the profile's bottleneck; pick ones that work in different ways (not three kinds of tracking). In considered, list every lever you looked at with chosen or ruled_out and a short reason tied to this goal (\"addresses sticking with it\", \"no gym: ruled out\"). Reuse a listed lever whenever its approach fits, even if it was written for a goal aimed the other way: put what's specific to this goal (the direction, the target, the details) in the workflow's request. Write a new lever only for what no listed lever covers.\n4. Three to five workflows for an \"in\" goal, ordered by impact against effort, quickest useful one first; startsAfter when one depends on another. Their humanMinutesPerWeek together stay within three quarters of the brief's weeklyHours, so the plan survives a busy week.\n4b. Each one is a job: kind \"recurring\" when it runs again and again (a weekly scan, a reply to each signup), kind \"once\" for work on a finite list or done one time (submitting to a set of directories, a one-time audit, researching a list of communities). A once job is done by an agent once, in Chat; never make it a weekly job that runs out of things to do.\n4c. measure: the job's own number, in the person's terms, that shows it's working (\"replies per week\", \"signups tagged ref=directories\"); for a once job, what done looks like (\"done when: listed in 15 directories\"). A playbook lever says the kind and measure it usually has: start from those, and change them only when the context calls for it.\n4d. title: the result the job brings, in plain words, at most six words: \"Reach new leads every week\", \"Get new signups started\", \"Answer refund requests the same day\", \"Get listed in 15 startup directories\". Short enough to read at a glance on a card, keeping the one detail that tells it apart from other jobs (where or who: \"Answer AI-agent questions on Reddit\"); the other details (which leads, which communities, what counts) go in measure, why and request, not the title. Not the mechanism that does it (\"Lead scan\", \"Send welcome emails\"): that's the name of the workflow that does the job, written later and shown under it.\n5. Specific to this context: name the person's own communities, systems, products and channels in each request. A request anyone could use unchanged is wrong.\n6. needs: what each workflow uses, each with a kind from the playbook's vocabulary and connected true only when the context lists that kind as connected.\n7. Every request that posts, sends or publishes says nothing goes out without the person's approval.\n8. The measure must be readable. When measureSourceConnected is false, setup says how the number will be read: connecting that source (name it, e.g. \"connect Clerk's user.created webhook so signups and their ref are recorded\"), or, when it can't be connected, a light manual record the person updates weekly (kept with the Records ability). Always record a baseline: the number today. Tag what workflows produce (ref=<channel>) so each one's effect can be told apart.\n8b. setup: what the person does once before the jobs start, at most four steps, each one short sentence (about 20 words at most) saying the action, not the reasoning. When the request lists setup already on the goal, add only what those steps don't cover, usually nothing: never repeat or reword one (the baseline, the signup link, the manual record are said once).\n8b. Every qualifier in the brief is covered by at least one workflow that addresses it directly; list it in that workflow's covers.\n9. \"partial\" scope: at most three workflows, only ones that help the person pursue the goal, and say so in the message (\"helps you pursue\", never \"achieves\"). \"out\" scope: no workflows; the message says plainly why, and offers a smaller or related goal.\n10. agent: an existing agent's exact name when its work fits. When none fits, or there are no agents yet, suggest a new one: agent and newAgent.name the same short lowercase name with hyphens (e.g. \"community-agent\"), and newAgent.instructions two or three sentences on what it does and how it behaves. Group workflows that belong together in one agent rather than one agent each.\n\nCall save_plan once.";
149
+ export declare const GOAL_CRITIQUE_PROMPT = "You check a goal plan against its rules before a person sees it. List every issue (be strict, quote the workflow):\n- a workflow that doesn't serve the brief's focus or move its measure;\n- two workflows on the same lever, or one repeating a lever already saved;\n- a request generic enough to fit any business;\n- a need marked connected that the context doesn't list as connected;\n- a request that posts, sends or publishes without saying it waits for approval;\n- review time over three quarters of the weekly budget;\n- a measure whose source isn't connected, with no setup step (new or already on the goal) that connects it or a manual record, or no baseline;\n- more than four setup steps, a step longer than a sentence, or one that repeats or rewords a step already on the goal;\n- a qualifier from the brief no workflow addresses;\n- a recurring job on a finite list that will run out (it should be kind \"once\");\n- a job title longer than six words, or one that names the mechanism (\"Send welcome emails\", \"Lead scan\") instead of the result it brings (\"Get new signups started\");\n- a lever in newLevers that names this business, its products, people, places or sites, mixes several approaches, or has no way to see its effect;\n- a workflow made from no lever when the request listed none for this focus (it should come from one of newLevers);\n- a plan claiming to achieve a goal that is only partly in scope, or workflows for an out-of-scope goal.\nCall save_review once: passed true only when there are no issues.";
148
150
  /** A job a person added in their own words, shaped like a planned one. */
149
151
  export declare const GOAL_ADD_JOB_PROMPT = "A person adds a job of their own to a goal in LoopEngine, in their own words. Shape it into one job like a planner's, and judge it honestly; it's their business, so advise, don't lecture.\n\nShape it:\n- title: the result the job brings, in plain words, at most six words (\"Get weekly sales to the team\", \"Answer customer emails within an hour\"). When the person wrote a long or mechanism-style idea (\"send a weekly sales summary to the team every Monday\"), keep their meaning and the detail that sets it apart (where or who) in a short title, and put the details in measure and request; the mechanism becomes the workflow's name later.\n- kind (\"recurring\" when it repeats, \"once\" for finite work), measure (its own number, or for a once job what done looks like), why it moves the goal (mechanism), the agent (an existing agent's exact name when its work fits, else newAgent with a short name and two or three sentences of instructions), needs (connected only when the context lists it), humanMinutesPerWeek, and a request specific to this business that the agent can act on. Anything that posts, sends or publishes says nothing goes out without the person's approval.\n- lever: when it's one of the playbook levers listed, its id in leverId. When none fits, write one generic lever in newLever (one approach, no names of this business, its products, people, places or sites; when it fits and doesn't; what it needs; how its effect shows up; guardrails; a generic template) and put its key in leverId.\n\nJudge it, in verdict:\n- \"added\": it fits the goal and is safe.\n- \"changed\": a sound idea with risky details you changed (an approval added, volume limited, a platform's rules respected); say what you changed in note.\n- \"warned\": it's safe but unlikely to move the goal's measure, repeats a job already under the goal, or is unlikely to work; say why in note and give a better-aimed alternative.\n- \"refused\": it's deceptive, illegal or against a platform's rules (fake reviews or accounts, spam, buying followers, harvesting private data, impersonation, misleading claims) or could harm people. Don't shape it; say why in note, plainly and briefly, and give a legitimate alternative.\n\nWhen there is no goal (a job added on its own), judge it on its own: \"added\" when it suits this business and is safe; \"warned\" when it's unlikely to work or repeats a job already listed. Its mechanism is what the job gets done for the business, and it has no lever: leave leverId and newLever out.\n\nCall save_job once.";
150
152
  export interface ShapedJob {
@@ -31,6 +31,7 @@ Rules:
31
31
  6. needs: what each workflow uses, each with a kind from the playbook's vocabulary and connected true only when the context lists that kind as connected.
32
32
  7. Every request that posts, sends or publishes says nothing goes out without the person's approval.
33
33
  8. The measure must be readable. When measureSourceConnected is false, setup says how the number will be read: connecting that source (name it, e.g. "connect Clerk's user.created webhook so signups and their ref are recorded"), or, when it can't be connected, a light manual record the person updates weekly (kept with the Records ability). Always record a baseline: the number today. Tag what workflows produce (ref=<channel>) so each one's effect can be told apart.
34
+ 8b. setup: what the person does once before the jobs start, at most four steps, each one short sentence (about 20 words at most) saying the action, not the reasoning. When the request lists setup already on the goal, add only what those steps don't cover, usually nothing: never repeat or reword one (the baseline, the signup link, the manual record are said once).
34
35
  8b. Every qualifier in the brief is covered by at least one workflow that addresses it directly; list it in that workflow's covers.
35
36
  9. "partial" scope: at most three workflows, only ones that help the person pursue the goal, and say so in the message ("helps you pursue", never "achieves"). "out" scope: no workflows; the message says plainly why, and offers a smaller or related goal.
36
37
  10. agent: an existing agent's exact name when its work fits. When none fits, or there are no agents yet, suggest a new one: agent and newAgent.name the same short lowercase name with hyphens (e.g. "community-agent"), and newAgent.instructions two or three sentences on what it does and how it behaves. Group workflows that belong together in one agent rather than one agent each.
@@ -43,7 +44,8 @@ export const GOAL_CRITIQUE_PROMPT = `You check a goal plan against its rules bef
43
44
  - a need marked connected that the context doesn't list as connected;
44
45
  - a request that posts, sends or publishes without saying it waits for approval;
45
46
  - review time over three quarters of the weekly budget;
46
- - a measure whose source isn't connected, with no setup step that connects it or a manual record, or no baseline;
47
+ - a measure whose source isn't connected, with no setup step (new or already on the goal) that connects it or a manual record, or no baseline;
48
+ - more than four setup steps, a step longer than a sentence, or one that repeats or rewords a step already on the goal;
47
49
  - a qualifier from the brief no workflow addresses;
48
50
  - a recurring job on a finite list that will run out (it should be kind "once");
49
51
  - a job title longer than six words, or one that names the mechanism ("Send welcome emails", "Lead scan") instead of the result it brings ("Get new signups started");
@@ -109,7 +111,7 @@ const planTool = () => ({
109
111
  input_schema: {
110
112
  type: 'object',
111
113
  properties: {
112
- setup: { type: 'array', items: { type: 'string' } },
114
+ setup: { type: 'array', items: { type: 'string' }, description: 'at most four short steps, only ones not already on the goal' },
113
115
  workflows: {
114
116
  type: 'array',
115
117
  items: {
@@ -276,6 +278,11 @@ function leversText(focus, saved = []) {
276
278
  : 'Playbook levers: none for this focus yet. Write the levers this goal needs in newLevers (rule 1b), and make each workflow from one of them.';
277
279
  return 'Playbook levers for this focus (id: name; why; fits when; not when; needs; minutes a week):\n' + levers.slice(0, MAX_LEVERS_IN_PROMPT).map((l) => `- ${l.id}: ${l.name}. ${l.mechanism} Fits when: ${l.fitsWhen.join('; ')}. Not when: ${l.notWhen.join('; ')}. Needs: ${[...(l.needs.anyOf?.length ? [`one of ${l.needs.anyOf.join('/')}`] : []), ...(l.needs.plus ?? [])].join(' + ')}. About ${l.humanMinutesPerWeek} min/week. Usually ${l.kind === 'once' ? 'a once job' : 'a recurring job'}; its measure: ${l.measureLink}. Template: ${l.template}`).join('\n');
278
280
  }
281
+ function setupText(setup) {
282
+ if (!setup?.length)
283
+ return '';
284
+ return 'Setup already on this goal (don\'t repeat or reword these; add only what they don\'t cover):\n' + setup.map((s) => `- ${s}`).join('\n');
285
+ }
279
286
  function savedText(saved) {
280
287
  if (!saved?.length)
281
288
  return 'Already saved under this goal: nothing yet.';
@@ -451,13 +458,14 @@ export async function draftGoalPlan(modelCall, input, brief, issues = []) {
451
458
  briefText(brief),
452
459
  leversText(brief.focus, input.saved),
453
460
  savedText(input.saved),
461
+ setupText(input.setup),
454
462
  `The goal, as the person said it:\n${input.goal}`,
455
463
  issues.length ? `A check found these issues in your last plan; fix every one:\n${issues.map((i) => `- ${i}`).join('\n')}` : '',
456
464
  ].filter(Boolean).join('\n\n');
457
465
  return parsePlan(await callTool(modelCall, GOAL_PLAN_PROMPT, user, planTool()), brief.focus);
458
466
  }
459
467
  export async function critiqueGoalPlan(modelCall, input, brief, plan) {
460
- const user = [contextText(input.context), briefText(brief), savedText(input.saved), `The plan:\n${JSON.stringify(plan, null, 2)}`].join('\n\n');
468
+ const user = [contextText(input.context), briefText(brief), savedText(input.saved), setupText(input.setup), `The plan:\n${JSON.stringify(plan, null, 2)}`].join('\n\n');
461
469
  const raw = await callTool(modelCall, GOAL_CRITIQUE_PROMPT, user, REVIEW_TOOL);
462
470
  const issues = strings(raw.issues);
463
471
  return { passed: raw.passed === true && issues.length === 0, issues };
@@ -25,37 +25,51 @@
25
25
  const BRAND_MARK = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true">' +
26
26
  '<path d="M3 7a4 4 0 1 0 4-4" stroke="var(--on-accent)" stroke-width="1.8" stroke-linecap="round"/>' +
27
27
  '<path d="M7 1.2v3.6L9.2 3z" fill="var(--on-accent)"/></svg>';
28
- // Icons beside the sidebar's section heads: a target for Goals, a
29
- // briefcase for Jobs, a robot for Agents.
30
- const GOALS_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="10"/><circle cx="12" cy="12" r="6"/><circle cx="12" cy="12" r="2"/></svg>';
31
- const JOBS_ICON = '<svg class="le-nav-icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M13 13a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 6V5a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v1h2a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V9a3 3 0 0 1 3-3h2Zm2-1a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1H9V5Zm10 3a1 1 0 0 1 1 1v3.5a2.5 2.5 0 0 1-2.5 2.5H6a2 2 0 0 1-2-2V9a1 1 0 0 1 1-1h14ZM4 16.465c.588.34 1.271.535 2 .535h11.5c.925 0 1.785-.28 2.5-.758V18a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-1.535Z"/></svg>';
32
- // The robot is drawn smaller in its 24 box than the others: cropped to
33
- // its middle 18, it shows at the same size.
28
+ // A robot for Agents. It's drawn smaller in its 24 box than the other
29
+ // icons: cropped to its middle 18, it shows at the same size.
34
30
  const AGENTS_ICON = '<svg class="le-nav-icon" viewBox="3 3 18 18" fill="currentColor" aria-hidden="true"><path d="M11 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm3.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M12 5.5a1 1 0 0 1 1 1V7h4a3 3 0 0 1 3 3v3.5a5 5 0 0 1-5 5H9a5 5 0 0 1-5-5V10a3 3 0 0 1 3-3h4v-.5a1 1 0 0 1 1-1ZM7 9h10a1 1 0 0 1 1 1v3.5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V10a1 1 0 0 1 1-1Z"/></svg>';
35
31
  // Two linked steps going round, for Workflows.
36
32
  const WORKFLOWS_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="3" y="3" width="7" height="7" rx="1.5"/><rect x="14" y="14" width="7" height="7" rx="1.5"/><path d="M10 6.5h4a3.5 3.5 0 0 1 3.5 3.5v4"/><path d="M14 17.5h-4A3.5 3.5 0 0 1 6.5 14v-4"/></svg>';
37
33
  // An inbox tray, for the Inbox.
38
34
  const INBOX_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"><polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/></svg>';
35
+ // A gear, for Settings.
36
+ 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>';
37
+ // Two columns: the sections (Inbox, Agents, Workflows, Settings), and
38
+ // beside them what's in the current one. Goals and Jobs stay at /goals
39
+ // and /jobs, out of the menu: LoopEngine is about workflows. Pointing at
40
+ // another section shows its column instead, until the pointer leaves.
41
+ // Inbox and Home have no second column; pointing at a section there
42
+ // opens its column over the page.
39
43
  export const consoleSidebarHtml = `<aside class="le-sidebar" aria-label="Console navigation">
40
- <a class="le-brand" href="/"><span class="le-brand-mark">${BRAND_MARK}</span><span class="le-brand-name">LoopEngine</span></a>
41
- <div class="le-nav-label le-inbox-nav"><a class="le-nav-head" href="/inbox" data-le-nav-head="inbox">${INBOX_ICON}Inbox</a><span class="le-pill warn le-inbox-count" id="leInboxCount" hidden></span></div>
42
- <div class="le-nav-label"><a class="le-nav-head" href="/agents" data-le-nav-head="agents">${AGENTS_ICON}Agents</a><a href="/agents?new=1">+ New</a></div>
43
- <ul class="le-agent-list" id="leAgentList"></ul>
44
- <div class="le-nav-label"><a class="le-nav-head" href="/workflows" data-le-nav-head="workflows">${WORKFLOWS_ICON}Workflows</a><a href="/workflows/new">+ New</a></div>
45
- <ul class="le-agent-list le-goal-list" id="leWorkflowList"></ul>
46
- <div class="le-nav-group">Plan</div>
47
- <div class="le-nav-label"><a class="le-nav-head" href="/goals" data-le-nav-head="goals">${GOALS_ICON}Goals</a><a href="/goals?new=1" data-le-goal-new>+ New</a></div>
48
- <ul class="le-agent-list le-goal-list" id="leGoalList"></ul>
49
- <div class="le-nav-label"><a class="le-nav-head" href="/jobs" data-le-nav-head="jobs">${JOBS_ICON}Jobs</a><a href="/jobs?new=1" data-le-job-new>+ New</a></div>
50
- <ul class="le-agent-list le-goal-list" id="leJobList"></ul>
51
- <a class="le-find" href="/interview" data-le-nav="interview">Find your first agent</a>
52
- <nav class="le-foot" aria-label="Settings">
53
- <a href="/config?section=models" data-le-nav="models">Models</a>
54
- <a href="/config?section=apps" data-le-nav="apps">Apps</a>
55
- <a href="/config?section=abilities" data-le-nav="abilities">Abilities</a>
56
- <a href="/config?section=settings" data-le-nav="settings">Settings</a>
44
+ <nav class="le-rail" aria-label="Sections">
45
+ <a class="le-brand" href="/" title="Home"><span class="le-brand-mark">${BRAND_MARK}</span></a>
46
+ <a class="le-rail-item" href="/inbox" data-le-nav-head="inbox" data-le-section="inbox">${INBOX_ICON}<span>Inbox</span><span class="le-pill warn le-inbox-count" id="leInboxCount" hidden></span></a>
47
+ <a class="le-rail-item" href="/agents" data-le-nav-head="agents" data-le-section="agents">${AGENTS_ICON}<span>Agents</span></a>
48
+ <a class="le-rail-item" href="/workflows" data-le-nav-head="workflows" data-le-section="workflows">${WORKFLOWS_ICON}<span>Workflows</span></a>
49
+ <span class="le-rail-gap"></span>
50
+ <a class="le-rail-item" href="/config?section=settings" data-le-nav-head="settings" data-le-section="settings">${SETTINGS_ICON}<span>Settings</span></a>
57
51
  <div class="le-who" id="leWho" hidden></div>
58
52
  </nav>
53
+ <div class="le-panel" hidden>
54
+ <section class="le-pane" data-le-pane="agents">
55
+ <div class="le-pane-head"><a href="/agents">Agents</a><a class="le-pane-new" href="/agents?new=1">+ New</a></div>
56
+ <ul class="le-agent-list" id="leAgentList"></ul>
57
+ <a class="le-sub-link" href="/interview" data-le-nav="interview">Find your first agent</a>
58
+ </section>
59
+ <section class="le-pane" data-le-pane="workflows">
60
+ <div class="le-pane-head"><a href="/workflows">Workflows</a><a class="le-pane-new" href="/workflows/new">+ New</a></div>
61
+ <ul class="le-agent-list le-goal-list" id="leWorkflowList"></ul>
62
+ </section>
63
+ <section class="le-pane" data-le-pane="settings">
64
+ <div class="le-pane-head"><a href="/config?section=settings">Settings</a></div>
65
+ <nav class="le-settings-menu" aria-label="Settings">
66
+ <a href="/config?section=models" data-le-nav="models">Models</a>
67
+ <a href="/config?section=apps" data-le-nav="apps">Apps</a>
68
+ <a href="/config?section=abilities" data-le-nav="abilities">Abilities</a>
69
+ <a href="/config?section=settings" data-le-nav="settings">General settings</a>
70
+ </nav>
71
+ </section>
72
+ </div>
59
73
  </aside>`;
60
74
  export const consoleShellScript = `<script>
61
75
  (function () {
@@ -249,11 +263,11 @@ export const consoleShellScript = `<script>
249
263
  var currentAgent = page === 'agent-config' && q.get('tab') === 'workflows' ? q.get('agent') : null;
250
264
  var currentId = currentAgent ? q.get('workflow') : null;
251
265
  return cachedFetch('workflows', '/workflows/overview', function (data) {
252
- var list = (data.workflows || []).slice().sort(function (a, b) { return a.id.localeCompare(b.id); });
266
+ var list = (data.workflows || []).slice().sort(function (a, b) { return a.title.localeCompare(b.title); });
253
267
  workflowList.innerHTML = list.length ? list.map(function (w) {
254
268
  var on = w.agent === currentAgent && w.id === currentId;
255
269
  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"' : '') + '>' +
256
- '<span class="le-dot ' + (w.live ? 'tint' : 'pending') + '" aria-hidden="true"></span><span class="le-name le-slug">' + esc(w.id) + '</span></a></li>';
270
+ '<span class="le-dot ' + (w.live ? 'tint' : 'pending') + '" aria-hidden="true"></span><span class="le-name">' + esc(w.title) + '</span></a></li>';
257
271
  }).join('') : '<li class="le-agent-item"><span></span><span class="le-meta">No workflows yet</span><span></span></li>';
258
272
  });
259
273
  }
@@ -364,26 +378,65 @@ export const consoleShellScript = `<script>
364
378
 
365
379
  var section = params.get('section');
366
380
  var foot = page === 'config' ? (section === 'abilities' || section === 'gateways' ? 'abilities' : section === 'apps' ? 'apps' : section === 'settings' ? 'settings' : 'models') : page === 'interview' || page === 'workflows' ? page : '';
381
+ // The section this page is in, whose column shows beside the sections.
382
+ var sidebar = document.querySelector('.le-sidebar');
383
+ var panel = document.querySelector('.le-panel');
384
+ var section0 = page === 'goals' ? (location.pathname === '/jobs' ? 'jobs' : 'goals')
385
+ : page === 'agent-config' && params.get('tab') === 'workflows' && params.get('workflow') ? 'workflows'
386
+ : page === 'agents' || page === 'agent-config' || page === 'chat' || page === 'interview' ? 'agents'
387
+ : page === 'workflows' || page === 'workflows-overview' ? 'workflows'
388
+ : page === 'config' ? 'settings'
389
+ : page === 'inbox' ? 'inbox' : '';
390
+ var railItems = document.querySelectorAll('[data-le-section]');
391
+ for (var ri = 0; ri < railItems.length; ri++) {
392
+ if (railItems[ri].getAttribute('data-le-section') === section0) railItems[ri].classList.add('is-current');
393
+ }
394
+ function showPane(name, preview) {
395
+ if (!panel || markedInboxOnly) return;
396
+ var pane = name ? document.querySelector('[data-le-pane="' + name + '"]') : null;
397
+ if (!pane && preview) return;
398
+ var panes = document.querySelectorAll('[data-le-pane]');
399
+ for (var pi = 0; pi < panes.length; pi++) panes[pi].classList.toggle('is-shown', panes[pi] === pane);
400
+ panel.hidden = !pane;
401
+ // With no column of its own, the page gets one over it while pointing.
402
+ sidebar.classList.toggle('previewing', Boolean(pane) && name !== section0 && !document.querySelector('[data-le-pane="' + section0 + '"]'));
403
+ }
404
+ showPane(section0, false);
405
+ if (sidebar) {
406
+ for (var rj = 0; rj < railItems.length; rj++) {
407
+ railItems[rj].addEventListener('mouseenter', function (ev) { showPane(ev.currentTarget.getAttribute('data-le-section'), true); });
408
+ railItems[rj].addEventListener('focus', function (ev) { showPane(ev.currentTarget.getAttribute('data-le-section'), true); });
409
+ }
410
+ sidebar.addEventListener('mouseleave', function () { showPane(section0, false); });
411
+ }
412
+ var settingsHead = document.querySelector('[data-le-nav-head="settings"]');
413
+ if (settingsHead && page === 'config') settingsHead.setAttribute('aria-current', 'page');
367
414
  var footLinks = document.querySelectorAll('[data-le-nav]');
368
415
  for (var i = 0; i < footLinks.length; i++) {
369
416
  if (footLinks[i].getAttribute('data-le-nav') === foot) footLinks[i].setAttribute('aria-current', 'page');
370
417
  }
371
418
 
372
- // Who is signed in: the email and a link back to the dashboard when a
373
- // hosting router signs requests, otherwise how this server is protected.
419
+ // Who is signed in, at the foot of the sections: a round badge with
420
+ // their initial, and on pointing, the email and a link back to the
421
+ // dashboard when a hosting router signs requests, otherwise how this
422
+ // server is protected.
374
423
  var who = document.getElementById('leWho');
375
424
  if (who) {
376
425
  settings
377
426
  .then(function (s) {
378
427
  if (!s || !s.signIn) return;
379
428
  var si = s.signIn;
429
+ var card, initial;
380
430
  if (si.mode === 'hosted') {
381
431
  var roleName = si.role && si.role !== 'owner' ? si.role.charAt(0).toUpperCase() + si.role.slice(1) : '';
382
- who.innerHTML = '<span class="le-who-name" title="' + esc(si.email || '') + '">' + esc(si.email || 'Signed in') + (roleName ? ' (' + esc(roleName) + ')' : '') + '</span>' +
432
+ initial = (si.email || '?').charAt(0).toUpperCase();
433
+ card = '<span class="le-who-name">' + esc(si.email || 'Signed in') + (roleName ? ' (' + esc(roleName) + ')' : '') + '</span>' +
383
434
  (si.dashboardUrl ? '<a href="' + esc(si.dashboardUrl) + '">Dashboard</a>' : '');
384
435
  } else {
385
- who.innerHTML = '<span class="le-who-name">' + (si.mode === 'basic' ? 'Signed in with Basic Auth' : 'No sign-in configured') + '</span>';
436
+ initial = '?';
437
+ card = '<span class="le-who-name">' + (si.mode === 'basic' ? 'Signed in with Basic Auth' : 'No sign-in configured') + '</span>';
386
438
  }
439
+ who.innerHTML = '<button type="button" class="le-who-badge" aria-label="Account">' + esc(initial) + '</button><span class="le-who-card">' + card + '</span>';
387
440
  who.hidden = false;
388
441
  })
389
442
  .catch(function () {});
@@ -123,27 +123,37 @@ export const devUiCss = `
123
123
  .le-pill.accent { background: var(--accent-soft); color: var(--accent-ink); }
124
124
 
125
125
  /* ---------- app shell (web/console-shell.ts) ---------- */
126
- .le-app { display: grid; grid-template-columns: 240px minmax(0, 1fr); height: 100%; }
127
- .le-sidebar { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
128
- .le-brand { display: flex; align-items: center; gap: 8px; padding: 16px 16px 12px; text-decoration: none; color: var(--ink); }
129
- .le-brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
130
- .le-brand-name { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
131
- .le-nav-group { margin: 14px 16px 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
132
- .le-nav-label { padding: 10px 16px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); display: flex; justify-content: space-between; align-items: center; }
133
- .le-nav-label a { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 12px; text-decoration: none; }
134
- .le-nav-label a[aria-current="page"] { font-weight: 700; }
135
- .le-nav-label a.le-nav-head { display: inline-flex; align-items: center; gap: 7px; text-transform: uppercase; letter-spacing: 0.06em; font-size: 11.5px; font-weight: 600; color: inherit; }
126
+ .le-app { display: grid; grid-template-columns: auto minmax(0, 1fr); height: 100%; }
127
+ /* Two columns: the sections, and what's in the current one. */
128
+ .le-sidebar { position: relative; background: var(--sidebar); border-right: 1px solid var(--line); display: flex; min-height: 0; }
129
+ .le-rail { width: 76px; flex: none; display: flex; flex-direction: column; gap: 2px; padding: 12px 6px 10px; min-height: 0; }
130
+ .le-brand { display: grid; place-items: center; height: 36px; margin-bottom: 8px; text-decoration: none; }
131
+ .le-brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
132
+ .le-rail-item { position: relative; display: grid; justify-items: center; gap: 3px; padding: 8px 2px 7px; border-radius: 8px; color: var(--ink-muted); text-decoration: none; font-size: 11px; font-weight: 600; }
133
+ .le-rail-item .le-nav-icon { width: 19px; height: 19px; }
134
+ .le-rail-item:hover { background: var(--surface-2); color: var(--ink); }
135
+ .le-rail-item.is-current { background: var(--accent-soft); color: var(--accent-ink); }
136
+ .le-rail-item .le-inbox-count { position: absolute; top: 3px; right: 6px; margin: 0; padding: 0 6px; font-size: 10.5px; }
137
+ .le-inbox-count[hidden] { display: none; }
138
+ .le-rail-gap { flex: 1; }
136
139
  .le-nav-icon { width: 15px; height: 15px; flex-shrink: 0; }
137
- .le-nav-label a.le-nav-head:hover { color: var(--ink); }
138
- .le-nav-label a.le-nav-head[aria-current="page"] { color: var(--accent-ink); font-weight: 700; }
139
- .le-agent-list.le-goal-list { flex: 0 1 auto; max-height: 34vh; }
140
- .le-name.le-slug { font-family: var(--font-mono); font-size: 12.5px; }
140
+ .le-panel { width: 228px; flex: none; display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); padding-top: 14px; }
141
+ .le-panel[hidden] { display: none; }
142
+ .le-sidebar.previewing .le-panel { position: absolute; left: 100%; top: 0; bottom: 0; z-index: 30; background: var(--sidebar); border: 1px solid var(--line); border-width: 0 1px 0 0; box-shadow: 8px 0 24px rgba(0, 0, 0, .12); }
143
+ .le-pane { display: none; flex-direction: column; min-height: 0; flex: 1; }
144
+ .le-pane.is-shown { display: flex; }
145
+ .le-pane-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 16px 10px; }
146
+ .le-pane-head a { color: var(--ink); font-size: 15px; font-weight: 650; text-decoration: none; }
147
+ .le-pane-head a:hover { text-decoration: underline; }
148
+ .le-pane-head a.le-pane-new { font-size: 12.5px; font-weight: 600; color: var(--accent-ink); }
149
+ .le-pane-head a.le-pane-new[aria-current="page"] { text-decoration: underline; }
150
+ .le-pane .le-agent-list { max-height: none; }
141
151
  .le-goal-item .le-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
142
152
  .le-agent-list { list-style: none; margin: 0; padding: 0 8px; overflow-y: auto; flex: 0 1 auto; max-height: 40vh; min-height: 0; }
143
- /* The lists sit together at the top; the rest goes to the bottom. */
144
- .le-find { margin: auto 16px 10px; font-size: 12.5px; font-weight: 500; color: var(--accent-ink); text-decoration: none; }
145
- .le-find[aria-current="page"] { font-weight: 600; }
146
- .le-find + .le-find { margin-top: -4px; }
153
+ /* Find your first agent: one more item under Agents. */
154
+ .le-sub-link { margin: 2px 8px 0; padding: 5px 8px 5px 26px; flex: none; border-radius: 6px; font-size: 12.5px; font-weight: 500; color: var(--accent-ink); text-decoration: none; }
155
+ .le-sub-link:hover { background: var(--surface-2); }
156
+ .le-sub-link[aria-current="page"] { background: var(--accent-soft); font-weight: 600; }
147
157
  /* List items read smaller than their section's head. */
148
158
  .le-agent-item { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 12.5px; }
149
159
  .le-agent-item:hover { background: var(--surface-2); }
@@ -155,17 +165,19 @@ export const devUiCss = `
155
165
  .le-dot.tint { background: var(--accent); }
156
166
  .le-dot.pending { background: #E8B06A; }
157
167
  .le-inbox-count { margin-left: auto; font-size: 11px; padding: 0 7px; }
158
- .le-inbox-only .le-nav-group, .le-inbox-only .le-nav-label:not(.le-inbox-nav), .le-inbox-only .le-agent-list, .le-inbox-only .le-find, .le-inbox-only .le-foot > a { display: none; }
168
+ .le-inbox-only .le-rail-item:not([data-le-section="inbox"]), .le-inbox-only .le-panel { display: none; }
159
169
  .le-dot.idle { background: var(--ink-faint); }
160
- .le-foot { border-top: 1px solid var(--line); padding: 8px; display: grid; gap: 2px; }
161
- .le-foot a { padding: 6px 8px; border-radius: 6px; color: var(--ink-muted); text-decoration: none; font-size: 13px; }
162
- .le-foot a:hover { background: var(--surface-2); color: var(--ink); }
163
- .le-foot a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
164
- .le-who { padding: 10px 8px 4px; font-size: 12px; color: var(--ink-faint); display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
170
+ .le-settings-menu { display: grid; gap: 2px; padding: 0 8px; }
171
+ .le-settings-menu a { padding: 6px 10px; border-radius: 6px; color: var(--ink-muted); text-decoration: none; font-size: 13px; }
172
+ .le-settings-menu a:hover { background: var(--surface-2); color: var(--ink); }
173
+ .le-settings-menu a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
174
+ .le-who { position: relative; display: grid; place-items: center; padding-top: 8px; }
165
175
  .le-who[hidden] { display: none; }
176
+ .le-who-badge { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: default; }
177
+ .le-who-card { position: absolute; left: calc(100% - 4px); bottom: 0; z-index: 40; display: none; gap: 6px; min-width: 200px; max-width: 280px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); font-size: 12.5px; color: var(--ink-muted); }
178
+ .le-who:hover .le-who-card, .le-who:focus-within .le-who-card { display: grid; }
166
179
  .le-who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
167
- .le-foot .le-who a { padding: 0; flex: none; color: var(--accent-ink); }
168
- .le-foot .le-who a:hover { background: none; text-decoration: underline; }
180
+ .le-who-card a { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
169
181
  .le-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
170
182
  .le-scroll { flex: 1; min-height: 0; overflow-y: auto; }
171
183
  .le-page { padding: 24px; max-width: 1100px; display: grid; gap: 24px; }
@@ -197,8 +209,9 @@ export const devUiCss = `
197
209
  .le-empty { color: var(--ink-faint); padding: 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
198
210
  @media (max-width: 860px) {
199
211
  .le-app { grid-template-columns: minmax(0, 1fr); }
200
- .le-sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 24px rgba(0, 0, 0, .25); }
212
+ .le-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 24px rgba(0, 0, 0, .25); }
201
213
  .le-app.nav-open .le-sidebar { transform: none; }
214
+ .le-panel { width: 204px; }
202
215
  .le-menu-btn { display: block; }
203
216
  .le-head, .le-page { padding-left: 16px; padding-right: 16px; }
204
217
  }
@@ -236,6 +236,7 @@ function startPlanning(deps, goal) {
236
236
  goal: planning.goal,
237
237
  context,
238
238
  saved: planning.jobs.map((w) => ({ title: w.title, lever: w.lever, ...(w.leverId ? { leverId: w.leverId } : {}), state: w.state })),
239
+ ...(planning.setup.length ? { setup: planning.setup } : {}),
239
240
  ...(planning.focus ? { focus: planning.focus } : {}),
240
241
  });
241
242
  // A focus or levers the planner wrote, because the playbook had none
@@ -254,7 +255,7 @@ function startPlanning(deps, goal) {
254
255
  const updated = {
255
256
  ...latest,
256
257
  brief: plan.brief,
257
- setup: [...new Set([...latest.setup, ...plan.setup])],
258
+ setup: [...new Set([...latest.setup, ...plan.setup.slice(0, 4)])],
258
259
  message: plan.message,
259
260
  playbookVersion: plan.playbookVersion,
260
261
  status: 'ready',
@@ -131,6 +131,9 @@ const goalsPageTemplate = `<!doctype html>
131
131
  .gl-again { display: grid; gap: 6px; }
132
132
  .gl-again[hidden] { display: none; }
133
133
  .gl-setup { margin: 0; padding-left: 18px; font-size: 13.5px; display: grid; gap: 4px; }
134
+ .gl-setup-more { margin-top: 4px; font-size: 13px; }
135
+ .gl-setup-more summary { cursor: pointer; color: var(--accent-ink); font-weight: 600; }
136
+ .gl-setup-more .gl-setup { margin-top: 4px; }
134
137
  .gl-select { font: inherit; font-size: 13px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
135
138
  .gl-share { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; line-height: 1.45; }
136
139
  .gl-share input { margin-top: 2px; }
@@ -629,7 +632,8 @@ ${consoleShellScript}
629
632
  (g.message ? '<p class="gl-why">' + esc(g.message) + '</p>' : '') +
630
633
  (planning ? '<p class="gl-status">Suggesting jobs' + ELLIPSIS + (secs ? ' ' + secs + 's' : '') + ' It reads your workspace first; this takes about a minute.</p>' : '') +
631
634
  (g.status === 'failed' ? '<p class="error">' + esc(g.error || 'Planning failed.') + '</p>' : '') +
632
- (g.setup && g.setup.length ? '<div><strong style="font-size:13.5px">Before you start</strong><ol class="gl-setup">' + g.setup.map(function (s) { return '<li>' + esc(s) + '</li>'; }).join('') + '</ol></div>' : '') +
635
+ (g.setup && g.setup.length ? '<div><strong style="font-size:13.5px">Before you start</strong><ol class="gl-setup">' + g.setup.slice(0, 4).map(function (s) { return '<li>' + esc(s) + '</li>'; }).join('') + '</ol>' +
636
+ (g.setup.length > 4 ? '<details class="gl-setup-more"><summary>' + (g.setup.length - 4) + ' more</summary><ol class="gl-setup" start="5">' + g.setup.slice(4).map(function (s) { return '<li>' + esc(s) + '</li>'; }).join('') + '</ol></details>' : '') + '</div>' : '') +
633
637
  '</div>' +
634
638
  (state.justDiscarded ? '<div class="gl-discarded-note" data-discarded="' + esc(state.justDiscarded.id) + '"><span>Discarded <strong>' + esc(state.justDiscarded.title) + '</strong>. Why?</span>' +
635
639
  REASONS.map(function (r) { return '<button type="button" class="gl-btn plain" data-reason="' + r[0] + '">' + r[1] + '</button>'; }).join('') +
@@ -38,6 +38,8 @@ export const inboxPageHtml = `<!doctype html>
38
38
  .ib-empty { padding: 28px 16px; text-align: center; color: var(--ink-muted); font-size: 13.5px; }
39
39
  .ib-back { font-size: 13px; color: var(--accent-ink); text-decoration: none; font-weight: 600; }
40
40
  .ib-case-head h2 { margin: 4px 0 6px; font-size: 20px; letter-spacing: -0.01em; }
41
+ .ib-link { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
42
+ .ib-link:hover { text-decoration: underline; }
41
43
  .ib-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-muted); }
42
44
  .ib-card { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); padding: 14px 16px; display: grid; gap: 10px; }
43
45
  .ib-card h3 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-muted); }
@@ -243,12 +245,21 @@ ${renderMarkdownScript}
243
245
  }).join('') + '</div></div>';
244
246
  }
245
247
 
248
+ // The case's workflow and agent, each opening its page. An approver or
249
+ // viewer can open only the Inbox, so for them they're plain text.
250
+ function caseLinks(c) {
251
+ if (document.querySelector('.le-app.le-inbox-only')) return esc(c.workflowTitle) + DOT + esc(c.agent);
252
+ var agentUrl = '/agents/config?agent=' + encodeURIComponent(c.agent);
253
+ var wf = c.workflowId ? '<a class="ib-link" href="' + agentUrl + '&tab=workflows&workflow=' + encodeURIComponent(c.workflowId) + '">' + esc(c.workflowTitle) + '</a>' : esc(c.workflowTitle);
254
+ return wf + DOT + '<a class="ib-link" href="' + agentUrl + '">' + esc(c.agent) + '</a>';
255
+ }
256
+
246
257
  function renderCase(c) {
247
258
  var run = c.run;
248
259
  var status = run ? stateHtml({ waiting: c.pending.map(function (p) { return p.kind; }), status: run.status }) : stateHtml({ waiting: c.pending.map(function (p) { return p.kind; }), status: 'awaiting_approval' });
249
260
  page.innerHTML =
250
261
  '<a class="ib-back" href="' + pageUrl() + '">' + String.fromCharCode(8592) + ' Inbox</a>' +
251
- '<div class="ib-case-head"><h2>' + esc(c.title) + '</h2><div class="ib-chips">' + status + '<span>' + esc(c.workflowTitle) + DOT + esc(c.agent) + (run ? DOT + 'started ' + esc(when(run.started_at)) + (run.source ? ' by ' + esc(run.source === 'webhook' ? 'a webhook' : run.source === 'schedule' ? 'a schedule' : run.source === 'console' ? 'Run now' : run.source === 'api' ? 'an app' : run.source) : '') : '') + '</span></div></div>' +
262
+ '<div class="ib-case-head"><h2>' + esc(c.title) + '</h2><div class="ib-chips">' + status + '<span>' + caseLinks(c) + (run ? DOT + 'started ' + esc(when(run.started_at)) + (run.source ? ' by ' + esc(run.source === 'webhook' ? 'a webhook' : run.source === 'schedule' ? 'a schedule' : run.source === 'console' ? 'Run now' : run.source === 'api' ? 'an app' : run.source) : '') : '') + '</span></div></div>' +
252
263
  c.pending.map(pendingHtml).join('') +
253
264
  (run && run.params ? '<div class="ib-card"><h3>Inputs</h3>' + kvHtml(run.params) + '</div>' : '') +
254
265
  (c.steps.length ? '<div class="ib-card"><h3>What the agent did</h3><ol class="ib-steps">' + c.steps.map(stepHtml).join('') + '</ol></div>' : '') +
@@ -1,7 +1,6 @@
1
1
  // The console's front page: / and /workflows list every workflow in the
2
2
  // workspace with how it starts, how it's been running and what's waiting
3
3
  // in the Inbox (web/workflows-overview.ts behind /workflows/overview).
4
- // Goals and Jobs are the way in when there's nothing to automate yet.
5
4
  // Like the other console pages, its inline script avoids backslashes and
6
5
  // template placeholders, since it lives inside a template literal.
7
6
  import { devUiCss } from './dev-ui-styles.js';
@@ -28,7 +27,6 @@ export const workflowsOverviewPageHtml = `<!doctype html>
28
27
  .wo-head { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-muted); background: var(--surface); }
29
28
  .wo-head:hover { background: var(--surface); }
30
29
  .wo-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
31
- .wo-slug { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
32
30
  .wo-sub { font-size: 12.5px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
33
31
  .wo-runs { font-size: 13px; display: grid; gap: 2px; }
34
32
  .wo-side { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
@@ -45,8 +43,6 @@ export const workflowsOverviewPageHtml = `<!doctype html>
45
43
  .wo-way:hover { border-color: var(--accent); }
46
44
  .wo-way b { font-size: 14px; }
47
45
  .wo-way span { font-size: 12.5px; color: var(--ink-muted); }
48
- .wo-plan { border-radius: 12px; background: var(--surface); padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; font-size: 13.5px; }
49
- .wo-plan a { font-weight: 600; color: var(--accent-ink); text-decoration: none; }
50
46
  .hint { font-size: 12.5px; color: var(--ink-muted); }
51
47
  .error { font-size: 13px; color: var(--bad); margin: 0; }
52
48
  @media (max-width: 760px) { .wo-row { grid-template-columns: minmax(0, 1fr) auto; } .wo-row .wo-col-starts, .wo-row .wo-col-runs { display: none; } .wo-head { display: none; } }
@@ -95,8 +91,6 @@ ${consoleShellScript}
95
91
  }
96
92
  function plural(n, one, many) { return n + ' ' + (n === 1 ? one : many); }
97
93
 
98
- var PLAN = '<div class="wo-plan"><span>Not sure what to automate next? Say what you want to achieve, and LoopEngine suggests the jobs that move it.</span><a href="/goals?new=1">Start from a goal &rarr;</a></div>';
99
-
100
94
  function renderEmpty() {
101
95
  page.innerHTML =
102
96
  '<div class="wo-empty"><h2>No workflows yet</h2>' +
@@ -104,7 +98,6 @@ ${consoleShellScript}
104
98
  '<div class="wo-ways">' +
105
99
  '<a class="wo-way" href="/workflows/new"><b>Describe a workflow</b><span>Say what the agent should do in a sentence or two and review the plan.</span></a>' +
106
100
  '<a class="wo-way" href="/workflows/new#examples"><b>Start from an example</b><span>A ready-made workflow for a common task.</span></a>' +
107
- '<a class="wo-way" href="/goals?new=1"><b>Start from a goal</b><span>Not sure what to automate? Get jobs suggested for what you want to achieve.</span></a>' +
108
101
  '</div></div>';
109
102
  }
110
103
 
@@ -121,7 +114,7 @@ ${consoleShellScript}
121
114
  var rows = d.workflows.map(function (w) {
122
115
  var decided = w.approved + w.refused;
123
116
  return '<a class="wo-row" href="' + href(w) + '">' +
124
- '<span style="min-width:0"><div class="wo-title wo-slug" title="' + esc(w.title) + '">' + esc(w.id) + '</div><div class="wo-sub">' + esc(w.agentLabel) + '</div></span>' +
117
+ '<span style="min-width:0"><div class="wo-title">' + esc(w.title) + '</div><div class="wo-sub">' + esc(w.agentLabel) + '</div></span>' +
125
118
  '<span class="wo-col-starts wo-sub" title="' + esc(w.starts.join(', ')) + '">' + esc(w.starts.join(DOT)) + '</span>' +
126
119
  '<span class="wo-col-runs wo-runs"><span>' + plural(w.runsThisWeek, 'run', 'runs') + ' this week' + (w.failedThisWeek ? ', <span style="color:var(--bad)">' + w.failedThisWeek + ' failed</span>' : '') + '</span>' +
127
120
  '<span class="wo-sub">' + (w.lastRun ? 'Last ' + esc(ago(w.lastRun.at)) : 'Not run yet') + (decided ? DOT + w.approved + ' of ' + decided + ' approved' : '') + '</span></span>' +
@@ -129,8 +122,7 @@ ${consoleShellScript}
129
122
  '</a>';
130
123
  }).join('');
131
124
  page.innerHTML = stats +
132
- '<div class="wo-list"><div class="wo-row wo-head"><span>Workflow</span><span class="wo-col-starts">Starts</span><span class="wo-col-runs">Runs</span><span></span></div>' + rows + '</div>' +
133
- PLAN;
125
+ '<div class="wo-list"><div class="wo-row wo-head"><span>Workflow</span><span class="wo-col-starts">Starts</span><span class="wo-col-runs">Runs</span><span></span></div>' + rows + '</div>';
134
126
  }
135
127
 
136
128
  // The sidebar asks for the same list as the page opens: one request.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopengine",
3
- "version": "0.3.97",
3
+ "version": "0.3.99",
4
4
  "type": "module",
5
5
  "description": "Runtime for tool-using AI agents with a transparent ReAct loop.",
6
6
  "license": "MIT",