@floless/app 0.151.0 → 0.152.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +14426 -8494
- package/dist/skills/floless-app-knowledge/SKILL.md +25 -2
- package/dist/skills/floless-app-onboarding/SKILL.md +18 -1
- package/dist/skills/floless-app-report-issue/SKILL.md +10 -5
- package/dist/skills/floless-app-routines/SKILL.md +1 -1
- package/dist/skills/floless-app-routines/references/routines-api.md +14 -4
- package/dist/templates/revit-model.flo +6 -2
- package/dist/templates/tekla-parser.flo +6 -2
- package/dist/web/agents.js +146 -9
- package/dist/web/app.css +215 -19
- package/dist/web/app.js +53 -8
- package/dist/web/aware.js +852 -53
- package/dist/web/chat.css +98 -4
- package/dist/web/chat.js +550 -35
- package/dist/web/commands-shell.js +290 -20
- package/dist/web/connections.js +24 -6
- package/dist/web/flo-avatar.js +191 -0
- package/dist/web/flo.js +156 -0
- package/dist/web/guide.js +695 -57
- package/dist/web/index.html +58 -7
- package/dist/web/instructor.js +6 -1
- package/dist/web/local-discovery.js +35 -6
- package/dist/web/panels.js +2 -0
- package/dist/web/parser-setup-recovery.js +250 -0
- package/dist/web/tool-updates.js +330 -36
- package/dist/web/workspace-root-management.js +197 -0
- package/dist/web/workspaces.js +235 -15
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: floless-app-knowledge
|
|
3
3
|
description: This skill should be used when there is a pending floless `knowledge-organize` or `knowledge-adjust` request — the user pressed Organize on a floless.app project's Knowledge step, or asked to reshape that project's knowledge base. Also triggers on asks like "organize my project knowledge base", "compile the project wiki", "drain my knowledge-organize request", or "fold these shop standards into the project's knowledge". It teaches the host AI to claim the server-owned organize lock, project the enabled reference sources into that project's vault, compile a cross-linked LLM-wiki into the server-minted generation directory, and publish it — never writing the server-owned manifest, pointer, or lock.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.
|
|
5
|
+
version: 0.4.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Organize a project's Knowledge Base
|
|
@@ -101,6 +101,27 @@ and say so.
|
|
|
101
101
|
|
|
102
102
|
`POST …/start`. Keep `baseRevision`, `generationId`, and `wikiDir`.
|
|
103
103
|
|
|
104
|
+
**Say who is asking.** When the environment variable `FLOLESS_CHAT_ID` is set, you are running inside a FloLess
|
|
105
|
+
AI Chat conversation: send it back as the header `X-FloLess-Chat: <its value>` on `start` (bash
|
|
106
|
+
`-H "X-FloLess-Chat: $FLOLESS_CHAT_ID"`, PowerShell `-H "X-FloLess-Chat: $env:FLOLESS_CHAT_ID"`). It tells FloLess
|
|
107
|
+
the conversation you are working for, so organizing never waits for your own turn. In an outside terminal it is
|
|
108
|
+
not set — send no header.
|
|
109
|
+
|
|
110
|
+
**`start` can ask you to wait — that is not a failure.** Organizing never starts beside other work that is already
|
|
111
|
+
changing the project (another AI Chat conversation's turn, or a background request). Then `start` answers
|
|
112
|
+
`409` with one of these codes:
|
|
113
|
+
|
|
114
|
+
- `knowledge-organize-waiting` — tell the user once, in the response's own words (its `error`, e.g. "Waiting for
|
|
115
|
+
“Fix the grid” to finish changing Tower A…"). Wait `retryAfterMs` (15 s), then call the **same** `start` again,
|
|
116
|
+
with the same header. Keep going until it answers `200`. Do not call `fail`: nothing has started.
|
|
117
|
+
- `knowledge-organize-gave-up` — FloLess waited 30 minutes. Stop, and relay its `error` to the user as it is (it
|
|
118
|
+
says what happened and what to do). Do **not** call `fail`: nothing started, and the request stays queued so the
|
|
119
|
+
user can ask you to organize again later.
|
|
120
|
+
- `404` with `code: "not-found"` while you were waiting — the user cancelled the organize on the Knowledge step.
|
|
121
|
+
Stop and say so. Nothing to clean up.
|
|
122
|
+
|
|
123
|
+
Any other `409` (an organize already in progress) is unchanged: do not retry it in a loop.
|
|
124
|
+
|
|
104
125
|
### 2. Snapshot the source set
|
|
105
126
|
|
|
106
127
|
`GET <base>/api/projects/<projectId>/knowledge/status`. The rows the store just marked
|
|
@@ -229,7 +250,9 @@ curl -s $BASE/api/requests | jq '.requests[] | select(.type=="knowledge-organize
|
|
|
229
250
|
R=<requestId>
|
|
230
251
|
|
|
231
252
|
# 1. Claim the pass — returns baseRevision, generationId, wikiDir
|
|
232
|
-
|
|
253
|
+
# Inside FloLess AI Chat, say which conversation you are (FLOLESS_CHAT_ID is set there, not in a terminal).
|
|
254
|
+
# A 409 knowledge-organize-waiting means "try this same start again in retryAfterMs" — see step 1 above.
|
|
255
|
+
curl -s -X POST $BASE/api/projects/$P/knowledge/requests/$R/start ${FLOLESS_CHAT_ID:+-H "X-FloLess-Chat: $FLOLESS_CHAT_ID"}
|
|
233
256
|
|
|
234
257
|
# 2. Read the snapshot (rows now state:"organizing") and their blobs
|
|
235
258
|
curl -s $BASE/api/projects/$P/knowledge/status | jq '.manifest.sources'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: floless-app-onboarding
|
|
3
3
|
description: Onboards a person into FloLess and the AWARE runtime underneath it, in three modes. Guide mode (the main one) runs inside FloLess AI Chat as the built-in Guide, whose first turn carries a JSON block of facts FloLess collected (apps, running, recentFiles, accounts, floless) — it briefs the person on what they seem to work on, then onboards them from their own situation, offering every next move as a button (floless_suggest_next_move, floless_connection_propose) and changing nothing itself. Terminal mode is the re-runnable guided tour for an AI in an external terminal (AWARE first, then the FloLess surfaces). Instructor focused mode answers one queued guide request about a single control. Use it when the Guide conversation starts, and on asks like "what can FloLess do for me", "how do I", "onboard me", "get me started", "I'm new to FloLess or AWARE", "give me the guided tour", "walk me through floless.app", "what can AWARE do", "show me the agents", or "/floless-app-onboarding" - for the whole tour or one section.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.
|
|
5
|
+
version: 0.3.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Onboarding a person into FloLess + AWARE
|
|
@@ -117,6 +117,23 @@ workflow is created — want me to explain Compile and Run next?"
|
|
|
117
117
|
turning them on means: the `claude` CLI asks before every connector call; the `codex` CLI asks too,
|
|
118
118
|
except for a plugin tool that declares itself read-only.
|
|
119
119
|
|
|
120
|
+
### Morning briefing (a turn nobody is watching)
|
|
121
|
+
|
|
122
|
+
A person can turn on a **morning briefing**: off unless they choose it. At the time they set, FloLess takes
|
|
123
|
+
the same look under their sharing switches and sends it to this conversation as a turn titled **Morning
|
|
124
|
+
briefing**, with a frame that says it is the scheduled briefing. FloLess writes a line just before it
|
|
125
|
+
saying what it looked at; you do not need to repeat that.
|
|
126
|
+
|
|
127
|
+
- **Nobody is watching while you write it.** Ask nothing that needs an answer now, and expect anything
|
|
128
|
+
you ask permission for to be declined. Read only, as always.
|
|
129
|
+
- **Keep it short:** two to four lines on what they seem to be working on (what is open, what they
|
|
130
|
+
touched recently), then at most three next moves as buttons (`floless_suggest_next_move`, or
|
|
131
|
+
`floless_connection_propose` for a connection). Same kinds and fields as above, nothing else.
|
|
132
|
+
- If the facts are thin or a part could not be read, say so in one line rather than guessing.
|
|
133
|
+
- If the person later asks how to change it: the Guide conversation's settings in AI Chat hold the
|
|
134
|
+
**Morning briefing** switch, its time and days, and **Pause for a week**; turning the Guide off also
|
|
135
|
+
turns the briefing off. You cannot change any of it yourself — say where it is.
|
|
136
|
+
|
|
120
137
|
### Anytime questions
|
|
121
138
|
|
|
122
139
|
The person can come back to the Guide whenever they like ("Guide" in the ≡ menu, **Ask the Guide** on
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: floless-app-report-issue
|
|
3
3
|
description: File a diagnosed bug / idea / question from floless.app into the PRIVATE product log via the floless.io relay. Use when the user invokes /floless-app-report-issue, clicks "Report an issue" in the floless.app UI (a queued report or a copied prompt), or says "report this", "file a bug", "something broke in floless", "send feedback / a feature idea". It READS the live run evidence first (latest run trace, failing node + error, the .flo, exec code), offers a workaround grounded in the app's own command registry when another route exists, then composes a maintainer-ready report and sends it — always showing the exact text and confirming first. Read-only — it never re-runs a workflow node.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.2.
|
|
5
|
+
version: 0.2.2
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# floless.app — report an issue
|
|
@@ -109,10 +109,15 @@ digraph { "health + identify app" -> "read evidence (READ-ONLY)" -> "root-cause
|
|
|
109
109
|
-H 'Content-Type: application/json' \
|
|
110
110
|
-d '{"category":"bug","title":"…","body":"…","context":{ "appId":"…","appVersion":"…","awareVersion":"…","runId":"…","errorNodeId":"…" }}'
|
|
111
111
|
```
|
|
112
|
-
→ `{ "ok": true, "ref": "#123" }`.
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
→ `{ "ok": true, "ref": "#123" }`. When the inbox is down or unreachable, FloLess keeps the
|
|
113
|
+
report on this computer and sends it automatically later: `{ "ok": true, "queued": true }` (HTTP
|
|
114
|
+
202, no `ref` yet). Do NOT send it again — tell the user it is saved and will go out on its own.
|
|
115
|
+
Errors: `signed_out` (sign in), `rate_limited` (wait), `rejected` (the inbox would not take this
|
|
116
|
+
report as written — shorten or simplify it and send again) or `declined` (the inbox refused it —
|
|
117
|
+
update FloLess, then try again). `offline`/`unavailable` come back only if FloLess could not keep
|
|
118
|
+
the report — then try again later. Relay them plainly; the user's text is not lost.
|
|
119
|
+
7. **Report** the `ref` to the user (or that the report is saved and queued), plus any workaround you
|
|
120
|
+
already gave. Because the repo is private, there is no link to open — say so; the maintainer follows up.
|
|
116
121
|
|
|
117
122
|
### Local API
|
|
118
123
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: floless-app-routines
|
|
3
3
|
description: This skill should be used when the user wants to set up a floless.app workflow (.flo app) to run automatically — "routines" — either on a timer (schedule) or on a live event (trigger). Triggers on requests like "schedule tekla-bom-by-phase every weekday at 7am", "run this workflow every 2 hours", "run my BOM whenever the Tekla model changes", "watch the model and run X on each change", "set up a trigger routine", "list my routines", "disable the morning routine", "delete that routine". Covers the floless.app routines REST API (create / list / edit / enable-disable / delete / run-now), the schedule presets, the event-trigger kind, the confirm-first rule, and the runnable gate.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.1.
|
|
5
|
+
version: 0.1.6
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Setting up floless.app routines (automatic .flo runs)
|
|
@@ -24,7 +24,7 @@ a `trigger` binding and, in `GET /api/routines`, a live `session` snapshot (no `
|
|
|
24
24
|
"nextFireAt": "2026-05-29T05:00:00.000Z", // computed (UTC ISO); null when disabled/broken/trigger
|
|
25
25
|
"lastRun": { "at": "...", "status": "ok", "runId": "...", "durationMs": 42551 },
|
|
26
26
|
"history": [ /* most-recent 20 RunRecords */ ],
|
|
27
|
-
"broken": { "reason": "workflow
|
|
27
|
+
"broken": { "reason": "This workflow is no longer installed on this computer, …" }, // present only when the app is gone
|
|
28
28
|
"onResult": null // PHASE-2 reserved (AI handoff) — ignore in Phase 1
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -46,7 +46,7 @@ a `trigger` binding and, in `GET /api/routines`, a live `session` snapshot (no `
|
|
|
46
46
|
"error": null // stderr tail when state==="error"/"blocked", else null
|
|
47
47
|
},
|
|
48
48
|
"lastRun": null, "history": [],
|
|
49
|
-
"broken": { "reason": "workflow
|
|
49
|
+
"broken": { "reason": "This workflow is no longer installed on this computer, …" }, // app gone / no longer trigger-eligible / can't be read (see below)
|
|
50
50
|
"onResult": null
|
|
51
51
|
}
|
|
52
52
|
```
|
|
@@ -81,8 +81,18 @@ bounded by the ~1-minute scheduler tick. Supports `* , - /` and lists.
|
|
|
81
81
|
{ "at": "ISO", "status": "ok" | "failed" | "skipped", "reason": "…?", "runId": "…?", "durationMs": 0 }
|
|
82
82
|
```
|
|
83
83
|
- `ok` — the run completed and no node reported failure.
|
|
84
|
-
- `failed` — `aware app run` errored, or a node returned `{ ok:false }` (e.g. "No live Tekla model")
|
|
85
|
-
|
|
84
|
+
- `failed` — `aware app run` errored, or a node returned `{ ok:false }` (e.g. "No live Tekla model"), or the
|
|
85
|
+
installed workflow could not be read. Only a workflow that is really gone is "no longer installed" (the routine
|
|
86
|
+
is then `broken`; once it is back, publishing it, a ▶ run or a FloLess restart re-arms the routine); a workflow that is there but cannot be read (a damaged file, a disk or
|
|
87
|
+
permission error) fails that one fire and the routine stays on — a schedule keeps its next time, a trigger
|
|
88
|
+
stops listening, shows `broken` with that reason, and starts again by itself once the workflow reads — unless
|
|
89
|
+
the repair changed its source, which then shows "needs Compile" like any other edit.
|
|
90
|
+
- `skipped` — nothing ran: the app was not runnable at fire time (needs Compile / drift); a FloLess-owned
|
|
91
|
+
workflow was archived, needs compiling, was edited after it was last published, or its published copy is
|
|
92
|
+
missing or was changed outside FloLess; or its workspace folder was unavailable or is not the selected one.
|
|
93
|
+
`reason` says which, in a plain sentence with the next step (e.g. "This workflow was archived, so nothing ran.
|
|
94
|
+
Restore it from Archived on the Workflows page to run this routine again; …") — pass it on to the user as
|
|
95
|
+
written. A trigger routine shows the same sentence as its `broken.reason`.
|
|
86
96
|
|
|
87
97
|
## Endpoints
|
|
88
98
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
app: revit-model
|
|
2
|
-
version: 0.
|
|
2
|
+
version: 0.14.0
|
|
3
3
|
display-name: Revit model
|
|
4
4
|
publisher: floless
|
|
5
5
|
module: revit
|
|
@@ -12,6 +12,10 @@ description: |
|
|
|
12
12
|
v2 destination; AWARE returns signed source and display packages and never edits the Revit file.
|
|
13
13
|
exposes-as-agent: false
|
|
14
14
|
changelog:
|
|
15
|
+
- version: 0.14.0
|
|
16
|
+
summary: Keep authenticated Revit reads in the configured workspace
|
|
17
|
+
changes:
|
|
18
|
+
- "Fixed: the model reader uses the signed-in authority store configured by FloLess, including isolated workspaces and sandboxed installations."
|
|
15
19
|
- version: 0.13.0
|
|
16
20
|
summary: Keep Revit imports working beside Tekla Parser
|
|
17
21
|
changes:
|
|
@@ -92,7 +96,7 @@ inputs:
|
|
|
92
96
|
type: string
|
|
93
97
|
description: Installer-owned durable identity for this managed conversion attempt.
|
|
94
98
|
requires:
|
|
95
|
-
- model-reference-reader@0.8.
|
|
99
|
+
- model-reference-reader@0.8.1
|
|
96
100
|
layout: linear
|
|
97
101
|
nodes:
|
|
98
102
|
- id: read-snapshot
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
app: tekla-parser
|
|
2
|
-
version: 0.3.
|
|
2
|
+
version: 0.3.2
|
|
3
3
|
display-name: Tekla Parser
|
|
4
4
|
publisher: floless
|
|
5
5
|
module: tekla
|
|
@@ -12,6 +12,10 @@ description: |
|
|
|
12
12
|
never edited, saved, synchronized, or connected to a running Tekla application.
|
|
13
13
|
exposes-as-agent: false
|
|
14
14
|
changelog:
|
|
15
|
+
- version: 0.3.2
|
|
16
|
+
summary: Keep the shared model reader current
|
|
17
|
+
changes:
|
|
18
|
+
- "Fixed: use the same current model reader as Revit so opening one module does not downgrade the reader needed by the other."
|
|
15
19
|
- version: 0.3.1
|
|
16
20
|
summary: Give large models time to finish reading
|
|
17
21
|
changes:
|
|
@@ -43,7 +47,7 @@ inputs:
|
|
|
43
47
|
type: string
|
|
44
48
|
description: Installer-enrolled fingerprint of AWARE's model artifact signing key.
|
|
45
49
|
requires:
|
|
46
|
-
- model-reference-reader@0.8.
|
|
50
|
+
- model-reference-reader@0.8.1
|
|
47
51
|
layout: linear
|
|
48
52
|
nodes:
|
|
49
53
|
- id: read-snapshot
|
package/dist/web/agents.js
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
dirty: false,
|
|
28
28
|
banner: null, // { text, action?: { label, run } }
|
|
29
29
|
saving: false,
|
|
30
|
+
pausing: false, // #2062: a Pause/Resume is being saved
|
|
30
31
|
runs: [],
|
|
31
32
|
runsKey: null,
|
|
32
33
|
runsUnreadable: [],
|
|
@@ -362,8 +363,8 @@
|
|
|
362
363
|
const choice = await dialog({
|
|
363
364
|
title: `Archive “${state.agent.name}”?`,
|
|
364
365
|
sub: dirty
|
|
365
|
-
? 'It moves to Archived and can’t be run until you restore it. Past runs are kept, and runs already going keep going. You have unsaved changes: save them first, or archive without them.'
|
|
366
|
-
: 'It moves to Archived and can’t be run until you restore it. Past runs are kept, and runs already going keep going.',
|
|
366
|
+
? 'It moves to Archived and can’t be run until you restore it. Its routines stop starting it until then. Past runs are kept, and runs already going keep going. You have unsaved changes: save them first, or archive without them.'
|
|
367
|
+
: 'It moves to Archived and can’t be run until you restore it. Its routines stop starting it until then. Past runs are kept, and runs already going keep going.',
|
|
367
368
|
actions: dirty ? [
|
|
368
369
|
{ id: 'cancel', label: 'Cancel', commandId: 'shell.agents-archive-cancel' },
|
|
369
370
|
{ id: 'discard', label: 'Archive without changes', commandId: 'shell.agents-archive-discard' },
|
|
@@ -384,6 +385,47 @@
|
|
|
384
385
|
} catch (error) { state.banner = { text: error.message }; paint(); }
|
|
385
386
|
}
|
|
386
387
|
|
|
388
|
+
/**
|
|
389
|
+
* #2062: Pause is the agent's state, not an edit, so it never touches the draft: unsaved edits stay unsaved and
|
|
390
|
+
* still save (the server keeps the revision as it is).
|
|
391
|
+
*/
|
|
392
|
+
async function setPaused(paused) {
|
|
393
|
+
if (!state.agent || state.pausing) return;
|
|
394
|
+
const agentId = state.agent.agentId;
|
|
395
|
+
// The answer belongs to this agent: if the person opened another one meanwhile, it is not painted onto that page.
|
|
396
|
+
const stillHere = () => state.view === 'page' && state.agent?.agentId === agentId;
|
|
397
|
+
state.pausing = true; paint();
|
|
398
|
+
try {
|
|
399
|
+
const body = await api(`/api/chat/agents/${encodeURIComponent(agentId)}/pause`, { method: 'POST', body: { paused } });
|
|
400
|
+
if (stillHere()) { state.agent = { ...state.agent, pausedAt: body.agent.pausedAt }; state.banner = null; }
|
|
401
|
+
toast(paused ? 'Agent paused. Its routines won’t start it until you resume it.' : 'Agent resumed. Its routines run on their schedule again.', 'ok');
|
|
402
|
+
} catch (error) { if (stillHere()) state.banner = { text: error.message }; else toast(error.message, 'err'); }
|
|
403
|
+
state.pausing = false;
|
|
404
|
+
paint();
|
|
405
|
+
void loadAgents();
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* #2062: another page paused, resumed, archived or restored this agent — take its state. With unsaved edits the
|
|
410
|
+
* draft stays, and so does the revision it was opened at, so a save over a changed agent still asks first.
|
|
411
|
+
*/
|
|
412
|
+
async function refreshAgentState(agentId) {
|
|
413
|
+
if (!state.open) return;
|
|
414
|
+
if (state.view !== 'page' || state.agent?.agentId !== agentId) { if (state.view !== 'page') void loadAgents(); return; }
|
|
415
|
+
try {
|
|
416
|
+
const fresh = (await api(`/api/chat/agents/${encodeURIComponent(agentId)}`)).agent;
|
|
417
|
+
if (state.agent?.agentId !== agentId) return;
|
|
418
|
+
if (!state.dirty) { state.agent = fresh; state.draft = draftOf(fresh); }
|
|
419
|
+
else state.agent = { ...state.agent, pausedAt: fresh.pausedAt, archivedAt: fresh.archivedAt };
|
|
420
|
+
paint();
|
|
421
|
+
} catch (error) {
|
|
422
|
+
if (state.agent?.agentId !== agentId) return;
|
|
423
|
+
console.warn('[agents] could not read this agent again after it changed elsewhere:', error);
|
|
424
|
+
state.banner = { text: 'This agent was changed in another window and FloLess couldn’t read it again. Go back to all agents and open it again to see where it stands.' };
|
|
425
|
+
paint();
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
387
429
|
// ── run ──────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
388
430
|
|
|
389
431
|
function preferredProvider() {
|
|
@@ -468,8 +510,9 @@
|
|
|
468
510
|
busy = true; render();
|
|
469
511
|
try {
|
|
470
512
|
try { localStorage.setItem(LS_PROVIDER, provider); } catch { /* private mode */ }
|
|
513
|
+
// #2061: the sheet said this agent is already running and the person chose "Start another run".
|
|
471
514
|
const body = await api(`/api/chat/agents/${encodeURIComponent(state.agent.agentId)}/runs`, { method: 'POST',
|
|
472
|
-
body: { runKey: preview.runKey, previewToken: preview.previewToken, provider } });
|
|
515
|
+
body: { runKey: preview.runKey, previewToken: preview.previewToken, provider, ...(preview.alreadyRunning ? { confirmOverlap: true } : {}) } });
|
|
473
516
|
close();
|
|
474
517
|
// They start in the background (some may wait their turn), so this says what was set going, not what began.
|
|
475
518
|
const queued = body.run.targets.filter((t) => t.live !== 'skipped').length;
|
|
@@ -478,6 +521,9 @@
|
|
|
478
521
|
$surface.querySelector('#ag-runs-title')?.focus();
|
|
479
522
|
} catch (failure) {
|
|
480
523
|
if (failure.code === 'agent-run-preview-changed' && failure.body?.preview) { preview = failure.body.preview; error = failure.message; }
|
|
524
|
+
// #2061: a run of this agent started meanwhile — ask, with the sheet's own "Start another run".
|
|
525
|
+
// The server's own sentence is kept: it says whether the run is going or FloLess can't tell.
|
|
526
|
+
else if (failure.code === 'agent-run-overlap') { preview = { ...preview, alreadyRunning: { ...(preview.alreadyRunning || { startedAt: null }), message: failure.message } }; error = null; }
|
|
481
527
|
else error = failure.message;
|
|
482
528
|
busy = false; render();
|
|
483
529
|
}
|
|
@@ -491,6 +537,10 @@
|
|
|
491
537
|
if (!preview) { modal.append(el('div', { class: 'modal-actions' }, el('button', { type: 'button', text: 'Close', 'data-command-id': 'shell.agents-run-cancel', onclick: close }))); return; }
|
|
492
538
|
const nonProvider = preview.issues.filter((i) => i.kind !== 'provider');
|
|
493
539
|
for (const issue of nonProvider) modal.append(el('p', { class: 'ag-run-issue', text: issue.message }));
|
|
540
|
+
// #2062: Pause holds only the schedule; this run is by hand, so it goes ahead.
|
|
541
|
+
if (state.agent?.pausedAt && !state.agent.archivedAt) {
|
|
542
|
+
modal.append(el('p', { class: 'ag-note', id: 'ag-run-paused-note', text: 'This agent is paused, so its routines won’t start it. Running it now by hand still works.' }));
|
|
543
|
+
}
|
|
494
544
|
if (preview.conversations.length) {
|
|
495
545
|
const count = preview.conversations.length;
|
|
496
546
|
const head = preview.mode === 'compare'
|
|
@@ -505,6 +555,37 @@
|
|
|
505
555
|
if (skipped.length && preview.conversations.length) {
|
|
506
556
|
modal.append(el('div', { class: 'ag-run-skipped' }, skipped.map((item) => el('p', { text: item.reason }))));
|
|
507
557
|
}
|
|
558
|
+
// #2061: asked, never refused. Another piece of work changing a project: this part waits by itself (the default),
|
|
559
|
+
// or the person opens it or stops it. The same agent already running: start another only on a clear yes.
|
|
560
|
+
const busyItems = !nonProvider.length && Array.isArray(preview.busy) ? preview.busy : [];
|
|
561
|
+
if (busyItems.length) {
|
|
562
|
+
modal.append(el('div', { class: 'ag-run-skipped ag-run-busy', role: 'status' }, busyItems.map((row) => {
|
|
563
|
+
const knowledge = row.holder?.kind === 'knowledge';
|
|
564
|
+
const who = row.holder?.kind === 'chat' ? `“${row.holder.title}”` : (row.holder?.title || 'other work');
|
|
565
|
+
const line = el('p', { text: knowledge
|
|
566
|
+
? `FloLess is organizing ${row.label}’s knowledge. If you run now, this part waits and starts by itself when organizing finishes.`
|
|
567
|
+
: `${row.label} is being changed by ${who}. If you run now, this part waits and starts by itself when it’s free.` });
|
|
568
|
+
const links = el('span', { class: 'ag-run-busy-actions' });
|
|
569
|
+
const canOpen = knowledge ? Boolean(row.holder.projectId)
|
|
570
|
+
: row.holder?.kind === 'chat' ? Boolean(row.holder.owner && row.holder.chatId) : Boolean(row.holder?.requestId);
|
|
571
|
+
if (canOpen) links.append(el('button', { type: 'button', class: 'ag-link', text: 'Open it', 'data-command-id': `shell.agents-run-busy-open#${row.label}`,
|
|
572
|
+
'data-command-instance-label': row.label, onclick: () => { close(); void openBusyHolder(row.holder); } }));
|
|
573
|
+
// #2106: organizing is driven from outside FloLess, so it is never offered "Stop it".
|
|
574
|
+
if (canOpen && !row.holder.waiting && !knowledge) links.append(el('button', { type: 'button', class: 'ag-link ag-link-warn', text: 'Stop it', 'data-command-id': `shell.agents-run-busy-stop#${row.label}`,
|
|
575
|
+
'data-command-instance-label': row.label, onclick: async (event) => { event.currentTarget.disabled = true; await stopBusyHolder(row.holder); preview = null; render(); void load(); } }));
|
|
576
|
+
if (links.childNodes.length) line.append(' ', links);
|
|
577
|
+
return line;
|
|
578
|
+
})));
|
|
579
|
+
}
|
|
580
|
+
if (!nonProvider.length && preview.alreadyRunning) {
|
|
581
|
+
const since = preview.alreadyRunning.startedAt ? new Date(preview.alreadyRunning.startedAt) : null;
|
|
582
|
+
const when = since && !isNaN(since) ? ` (started ${since.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}, ${(() => { const m = Math.round((Date.now() - since) / 60000); return m < 1 ? 'just now' : `${m} min ago`; })()})` : '';
|
|
583
|
+
modal.append(el('div', { class: 'ag-run-skipped ag-run-overlap', role: 'alert' },
|
|
584
|
+
el('p', { text: preview.alreadyRunning.message
|
|
585
|
+
|| (preview.alreadyRunning.unknown
|
|
586
|
+
? `FloLess can’t tell whether the last run of “${state.agent.name}” has finished${when}. Start another run anyway?`
|
|
587
|
+
: `“${state.agent.name}” is already running${when}. Start another run anyway?`) })));
|
|
588
|
+
}
|
|
508
589
|
// The AI that answers.
|
|
509
590
|
const seg = el('div', { class: 'ag-seg', role: 'radiogroup', 'aria-label': 'Which AI runs this' });
|
|
510
591
|
for (const [value, label] of [['claude', 'Claude'], ['codex', 'Codex']]) {
|
|
@@ -535,11 +616,12 @@
|
|
|
535
616
|
}
|
|
536
617
|
} else {
|
|
537
618
|
actions.append(el('button', { type: 'button', class: 'primary', 'data-command-id': 'shell.agents-run-confirm',
|
|
538
|
-
disabled: busy || !preview.canRun, text: busy ? 'Starting…' : skipped.length ? 'Run on the rest' : 'Run', onclick: start,
|
|
619
|
+
disabled: busy || !preview.canRun, text: busy ? 'Starting…' : preview.alreadyRunning ? 'Start another run' : skipped.length ? 'Run on the rest' : 'Run', onclick: start,
|
|
539
620
|
'data-blocked-reason': busy ? 'Starting this run now.' : !preview.canRun ? (preview.providerMessage || preview.issues[0]?.message || 'This agent can’t run yet.') : null }));
|
|
540
621
|
}
|
|
541
622
|
modal.append(actions);
|
|
542
|
-
|
|
623
|
+
// A second run of the same agent is the riskier choice, so focus rests on Cancel then (#2061).
|
|
624
|
+
(preview.alreadyRunning ? actions.querySelector('button') : actions.querySelector('button.primary:not([disabled])') || actions.querySelector('button'))?.focus();
|
|
543
625
|
};
|
|
544
626
|
render();
|
|
545
627
|
await load();
|
|
@@ -579,6 +661,41 @@
|
|
|
579
661
|
await loadRuns();
|
|
580
662
|
}
|
|
581
663
|
|
|
664
|
+
/** #2106: a project's Knowledge step. A missing Workspaces bridge is said, never a silent no-op. */
|
|
665
|
+
async function openKnowledgeStepOf(projectId) {
|
|
666
|
+
const open = window.flolessWorkspaces?.openKnowledgeStep;
|
|
667
|
+
if (typeof open !== 'function') throw new Error('FloLess couldn’t open that project’s Knowledge step. Open it from Workspaces.');
|
|
668
|
+
await open(projectId);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/** #2061: show the work a busy project is held by — its conversation in its project, or its row in Requests. */
|
|
672
|
+
async function openBusyHolder(holder) {
|
|
673
|
+
// #2106: knowledge organizing shows on its project's Knowledge step.
|
|
674
|
+
if (holder?.kind === 'knowledge') {
|
|
675
|
+
if (!(await confirmLeave())) return;
|
|
676
|
+
try { await openKnowledgeStepOf(holder.projectId); }
|
|
677
|
+
catch (error) { toast(error?.message || 'FloLess couldn’t open that project’s Knowledge step. Open it from Workspaces.', 'warn'); }
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
if (holder?.kind === 'chat' && holder.owner && holder.chatId) { await openInProject({ owner: holder.owner, chatId: holder.chatId, label: holder.title }); return; }
|
|
681
|
+
if (holder?.requestId && typeof window.flolessBridge?.openRequest === 'function') await window.flolessBridge.openRequest(holder.requestId);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/** #2061: stop exactly the work the sheet named; work that already finished is said, never a different one stopped. */
|
|
685
|
+
async function stopBusyHolder(holder) {
|
|
686
|
+
if (holder?.kind === 'knowledge') return; // #2106: organizing is never stopped from here (no Stop it is offered)
|
|
687
|
+
try {
|
|
688
|
+
if (holder?.kind === 'chat' && holder.owner && holder.chatId) {
|
|
689
|
+
await api(`/api/chat/conversations/${encodeURIComponent(holder.chatId)}/stop`, { method: 'POST', body: { owner: holder.owner, expectTurnId: holder.turnId || undefined } });
|
|
690
|
+
} else if (holder?.requestId) {
|
|
691
|
+
await api(`/api/requests/${encodeURIComponent(holder.requestId)}/run/stop`, { method: 'POST', body: holder.leaseId ? { expectLeaseId: holder.leaseId } : {} });
|
|
692
|
+
}
|
|
693
|
+
toast(`Stopped ${holder?.kind === 'chat' ? `“${holder.title}”` : holder?.title || 'that work'}.`, 'ok');
|
|
694
|
+
} catch (error) {
|
|
695
|
+
toast(error?.code === 'stop-stale' ? 'That work had already finished, so nothing was stopped.' : error?.message || 'FloLess couldn’t stop that work.', 'warn');
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
582
699
|
async function openInProject(target) {
|
|
583
700
|
if (!(await confirmLeave())) return;
|
|
584
701
|
state.dirty = false;
|
|
@@ -663,7 +780,7 @@
|
|
|
663
780
|
wrap.append(el('div', { class: 'ws-grid' }, rows.map((agent) => el('div', { class: `ws-card wf-card ag-card${agent.archivedAt ? ' is-archived' : ''}`, role: 'button', tabindex: '0',
|
|
664
781
|
'data-ag-id': agent.agentId, 'data-command-id': `shell.agents-open#${agent.name}`, 'data-command-instance-label': agent.name },
|
|
665
782
|
el('div', { class: 'ws-body' }, el('div', { class: 'wf-card-text' },
|
|
666
|
-
el('span', { class: 'ws-kind wf-kind', text: agent.archivedAt ? 'Archived' : agent.mode === 'compare' && agent.scope.length > 1 ? 'Compares' : 'Agent' }),
|
|
783
|
+
el('span', { class: 'ws-kind wf-kind', text: agent.archivedAt ? 'Archived' : agent.pausedAt ? 'Paused' : agent.mode === 'compare' && agent.scope.length > 1 ? 'Compares' : 'Agent' }),
|
|
667
784
|
el('div', { class: 'ws-name', text: agent.name }),
|
|
668
785
|
el('div', { class: 'ws-meta', text: scopeSummary(agent) }),
|
|
669
786
|
el('div', { class: 'ws-meta wf-card-nodes', text: agent.lastRunAt ? `Last run ${agoText(agent.lastRunAt)}` : agent.lastRunUnreadable ? 'Last run unknown' : 'Never run' })))))));
|
|
@@ -677,6 +794,7 @@
|
|
|
677
794
|
function renderPage() {
|
|
678
795
|
const draft = state.draft;
|
|
679
796
|
const archived = Boolean(state.agent?.archivedAt);
|
|
797
|
+
const paused = Boolean(state.agent?.pausedAt);
|
|
680
798
|
const page = el('div', { class: 'ag-page' });
|
|
681
799
|
page.append(el('div', { class: 'ag-head' },
|
|
682
800
|
el('button', { type: 'button', class: 'ag-back', 'data-command-id': 'shell.agents-back', 'aria-label': 'Back to all agents', 'data-tip': 'Back to all agents', onclick: () => void openList() }, '‹ Agents'),
|
|
@@ -688,6 +806,12 @@
|
|
|
688
806
|
archived
|
|
689
807
|
? el('button', { type: 'button', class: 'primary', 'data-command-id': 'shell.agents-restore', text: 'Restore', onclick: () => void setArchived(false) })
|
|
690
808
|
: [
|
|
809
|
+
// #2062: Pause holds the agent's routines; a hand Run still works. One reversible click, so no confirm.
|
|
810
|
+
state.agent ? el('button', { type: 'button', class: 'ag-quiet', id: 'ag-pause', disabled: state.pausing,
|
|
811
|
+
'data-command-id': paused ? 'shell.agents-resume' : 'shell.agents-pause', text: paused ? 'Resume' : 'Pause',
|
|
812
|
+
'data-blocked-reason': state.pausing ? 'Saving this now.' : null,
|
|
813
|
+
'data-tip': paused ? 'Lets its routines start it on their schedule again' : 'Stops its routines from starting it on a schedule. Run… still works.',
|
|
814
|
+
onclick: () => void setPaused(!paused) }) : null,
|
|
691
815
|
state.agent ? el('button', { type: 'button', class: 'ag-quiet', 'data-command-id': 'shell.agents-archive', text: 'Archive', onclick: () => void setArchived(true) }) : null,
|
|
692
816
|
el('button', { type: 'button', id: 'ag-save', 'data-command-id': 'shell.agents-save', disabled: state.saving || (!state.dirty && Boolean(state.agent)),
|
|
693
817
|
'data-blocked-reason': state.saving ? 'Saving now.' : !state.dirty && state.agent ? 'Nothing has changed since you last saved.' : null,
|
|
@@ -704,7 +828,14 @@
|
|
|
704
828
|
page.append(el('div', { class: 'ag-banner', role: 'alert' }, el('span', { text: state.banner.text }),
|
|
705
829
|
state.banner.action ? el('button', { type: 'button', class: 'ag-link', 'data-command-id': state.banner.action.commandId, text: state.banner.action.label, onclick: state.banner.action.run }) : null));
|
|
706
830
|
}
|
|
707
|
-
if (archived)
|
|
831
|
+
if (archived) {
|
|
832
|
+
page.append(el('p', { class: 'ag-note', text: paused
|
|
833
|
+
? 'This agent is archived and paused. Restore it to change or run it; its routines stay paused until you resume it. Its past runs are below.'
|
|
834
|
+
: 'This agent is archived, so its routines don’t start it. Restore it to change or run it. Its past runs are below.' }));
|
|
835
|
+
} else if (paused) {
|
|
836
|
+
page.append(el('p', { class: 'ag-note', id: 'ag-paused-note', role: 'status',
|
|
837
|
+
text: 'Paused. Its routines won’t start it on a schedule until you resume it. Run… still works.' }));
|
|
838
|
+
}
|
|
708
839
|
|
|
709
840
|
// What it does
|
|
710
841
|
const count = el('div', { class: 'ag-count', id: 'ag-count', 'aria-live': 'polite' });
|
|
@@ -830,11 +961,13 @@
|
|
|
830
961
|
|
|
831
962
|
const LIVE_LABEL = {
|
|
832
963
|
waiting: 'Waiting', starting: 'Starting', working: 'Working', 'waiting-for-you': 'Waiting for you', 'needs-recovery': 'Needs you',
|
|
964
|
+
// #2105: it waited the full time for busy work, changed nothing, and stopped; "Start this one again" is the answer.
|
|
965
|
+
'needs-you': 'Needs you',
|
|
833
966
|
done: 'Done', 'failed-reply': 'Stopped with an error', stopped: 'Stopped', skipped: 'Skipped', failed: 'Didn’t start',
|
|
834
967
|
uncertain: 'Not sure it started', stale: 'Earlier workspace', archived: 'Archived', unreadable: 'Can’t open',
|
|
835
968
|
};
|
|
836
969
|
const LIVE_TONE = {
|
|
837
|
-
working: 'accent', starting: 'accent', 'waiting-for-you': 'warn', 'needs-recovery': 'warn', done: 'ok', 'failed-reply': 'err',
|
|
970
|
+
working: 'accent', starting: 'accent', 'waiting-for-you': 'warn', 'needs-recovery': 'warn', 'needs-you': 'warn', done: 'ok', 'failed-reply': 'err',
|
|
838
971
|
failed: 'warn', uncertain: 'warn', unreadable: 'warn',
|
|
839
972
|
};
|
|
840
973
|
|
|
@@ -863,7 +996,9 @@
|
|
|
863
996
|
}
|
|
864
997
|
for (const target of run.targets) {
|
|
865
998
|
const selected = state.selected?.runId === run.runId && state.selected?.index === target.index;
|
|
866
|
-
|
|
999
|
+
// #2060: a run from an earlier workspace folder keeps its conversation when this folder can still open it; the
|
|
1000
|
+
// server sends its id only then, and its message says plainly when it can't.
|
|
1001
|
+
const canOpen = Boolean(target.chatId) && !['skipped', 'unreadable'].includes(target.live);
|
|
867
1002
|
const row = el('div', { class: `ag-target${selected ? ' is-selected' : ''}`, 'aria-current': selected ? 'true' : null });
|
|
868
1003
|
const label = target.covers.length > 1 ? target.covers.join(' · ') : target.label;
|
|
869
1004
|
const info = el('div', { class: 'ag-target-info' },
|
|
@@ -954,6 +1089,8 @@
|
|
|
954
1089
|
refreshRuns() {
|
|
955
1090
|
if (state.open && state.view === 'page' && state.agent) void loadRuns();
|
|
956
1091
|
},
|
|
1092
|
+
/** #2062: an agent was paused, resumed, archived or restored (maybe in another tab). */
|
|
1093
|
+
refreshAgent(agentId) { void refreshAgentState(agentId); },
|
|
957
1094
|
/**
|
|
958
1095
|
* #2046: a Guide suggestion — a new agent's page with its name and instructions filled in. Nothing is saved until the
|
|
959
1096
|
* person reviews it and presses Save.
|