@engenty/wizards-runtime 0.12.0 → 0.12.2
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/apps/runtime/dist/agents/space-agent.js +55 -0
- package/apps/runtime/dist/agents/studio-assistant.js +22 -11
- package/apps/runtime/dist/app.js +4 -2
- package/apps/runtime/dist/auth/account.js +3 -0
- package/apps/runtime/dist/db/live-triggers.js +13 -3
- package/apps/runtime/dist/db/migrations/tenant/0027_space_skill.sql +48 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +4120 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
- package/apps/runtime/dist/db/schema.js +31 -0
- package/apps/runtime/dist/docs/dev/skills.md +116 -0
- package/apps/runtime/dist/docs/user-guide/skills.md +85 -0
- package/apps/runtime/dist/engine/steps.js +10 -1
- package/apps/runtime/dist/env.js +2 -0
- package/apps/runtime/dist/features.js +11 -3
- package/apps/runtime/dist/harness/model.js +4 -0
- package/apps/runtime/dist/live/views.js +2 -0
- package/apps/runtime/dist/models.js +4 -0
- package/apps/runtime/dist/plugins/pro.js +26 -0
- package/apps/runtime/dist/prompts/goose.md +7 -0
- package/apps/runtime/dist/prompts/step.md +19 -1
- package/apps/runtime/dist/prompts/tools.md +33 -0
- package/apps/runtime/dist/routes/skills.js +84 -0
- package/apps/runtime/dist/routes/studio.js +12 -1
- package/apps/runtime/dist/services/assistant-chats.js +5 -2
- package/apps/runtime/dist/services/skills-registry.js +209 -0
- package/apps/runtime/dist/services/skills.js +478 -0
- package/apps/runtime/dist/sync/records.js +81 -1
- package/apps/runtime/dist/texts.js +39 -0
- package/apps/runtime/dist/tools/index.js +4 -2
- package/apps/runtime/dist/tools/net-guard.js +8 -4
- package/apps/runtime/dist/tools/skills.js +197 -0
- package/apps/web/dist/assets/{AboutDialog-BOJjBIYk.js → AboutDialog-CLgnoYTI.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-I9DEn_ra.js → ChangelogDialog-CKLgFL6r.js} +1 -1
- package/apps/web/dist/assets/CodeEditor-B3nto_26.js +2 -0
- package/apps/web/dist/assets/EditorPage-D9JDdAAI.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-C6DeATyk.js → FlowPreview-zJCtixSi.js} +1 -1
- package/apps/web/dist/assets/Marketplace-D4e0Oac9.js +2 -0
- package/apps/web/dist/assets/{NewWizardChannels-BrVFc6PV.js → NewWizardChannels-B4N7GIYh.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-Dl8sMR2e.js → NewWizardPage-Dpt0Mzk8.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-BN5IfLGL.js → OnboardingPage-CDoYVjRC.js} +1 -1
- package/apps/web/dist/assets/PreviewPane-DPB5nEd5.js +10 -0
- package/apps/web/dist/assets/ProjectPage-408YOoNa.js +10 -0
- package/apps/web/dist/assets/{PublicRunner-bAakEGwv.js → PublicRunner-BZ66xdRX.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-MBVPGEhw.js → ReadOnly-C9oGMkUB.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-Dq3AZwJS.js +2 -0
- package/apps/web/dist/assets/{SetupPage-CmTC9K8_.js → SetupPage-CP3lbyZc.js} +1 -1
- package/apps/web/dist/assets/{SharePage-D9_IxO3M.js → SharePage-DdMm1Y8K.js} +1 -1
- package/apps/web/dist/assets/SkillEditor-b5NMFB90.js +1 -0
- package/apps/web/dist/assets/changelog-82-DHogQ.js +1 -0
- package/apps/web/dist/assets/code-xml-Hx7YxCg0.js +1 -0
- package/apps/web/dist/assets/{dist-BwhPmMDu.js → dist-BdDd1FxP.js} +1 -1
- package/apps/web/dist/assets/dist-EBVTpvRr.js +10 -0
- package/apps/web/dist/assets/dist-GlRRx9Xl.js +1 -0
- package/apps/web/dist/assets/dist-H1UN89OA.js +1 -0
- package/apps/web/dist/assets/eye-BkMFLnYu.js +1 -0
- package/apps/web/dist/assets/i18n-CKKh3Pn0.js +55 -0
- package/apps/web/dist/assets/index-Cy2NHzAx.js +49 -0
- package/apps/web/dist/assets/index-wR_-1hfN.css +1 -0
- package/apps/web/dist/assets/json-CEsfHdlZ.js +1 -0
- package/apps/web/dist/assets/{lock-D1093O6-.js → lock-CGXM95Mi.js} +1 -1
- package/apps/web/dist/assets/markdown-5-I9_izp.js +29 -0
- package/apps/web/dist/assets/oss-credits-DpRWUPjD.js +1 -0
- package/apps/web/dist/assets/{phone-YeDiW-kN.js → phone-DMfwuh9V.js} +1 -1
- package/apps/web/dist/assets/{runners-DP0vYvTF.js → runners-D5qz6b_s.js} +1 -1
- package/apps/web/dist/assets/{session-Bio3Vaq1.js → session-DRy0k0nh.js} +1 -1
- package/apps/web/dist/assets/{theme-AlaEfdLQ.js → theme-DNPm6r4e.js} +2 -2
- package/apps/web/dist/assets/{ui-CU-cIuyK.js → ui-CwFQAfE-.js} +2 -2
- package/apps/web/dist/assets/{upload-DbWtEr1f.js → upload-DQJwLSGj.js} +1 -1
- package/apps/web/dist/assets/{useMutation-erJIov3t.js → useMutation-C20c2EH3.js} +1 -1
- package/apps/web/dist/assets/{volume-2-V1P9DYWO.js → volume-2-CC5qamYT.js} +1 -1
- package/apps/web/dist/index.html +9 -8
- package/apps/web/dist/mcp/flow.html +66 -66
- package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +3 -2
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +6 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +6 -0
- package/node_modules/@engenty/wizards-shared/dist/live.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +1 -0
- package/node_modules/@engenty/wizards-shared/dist/run.js +2 -0
- package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +165 -0
- package/node_modules/@engenty/wizards-shared/dist/skills.js +346 -0
- package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +4 -2
- package/node_modules/@engenty/wizards-shared/dist/sync.js +2 -1
- package/package.json +11 -11
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/CodeEditor-BgUofYLQ.js +0 -2
- package/apps/web/dist/assets/EditorPage-DEOxHFXn.js +0 -3
- package/apps/web/dist/assets/Marketplace-Dt7ktvc3.js +0 -2
- package/apps/web/dist/assets/PreviewPane-BDzDuTz1.js +0 -10
- package/apps/web/dist/assets/ProjectPage-BqkkyEpP.js +0 -1
- package/apps/web/dist/assets/SettingsPage-DDe1BC-3.js +0 -2
- package/apps/web/dist/assets/changelog-iTu1De5h.js +0 -1
- package/apps/web/dist/assets/dist-DVpDdhG9.js +0 -1
- package/apps/web/dist/assets/dist-DzdNG7Sf.js +0 -10
- package/apps/web/dist/assets/i18n-7CvqRUdn.js +0 -55
- package/apps/web/dist/assets/index-CNwXyMzH.js +0 -49
- package/apps/web/dist/assets/index-Dxwbli0m.css +0 -1
- package/apps/web/dist/assets/json-D2GVvTXK.js +0 -1
- package/apps/web/dist/assets/markdown-DwdMW7q0.js +0 -29
- package/apps/web/dist/assets/oss-credits-Da4KrYmP.js +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SKILL_MODES, SKILL_SOURCES, } from "@engenty/wizards-shared/skills";
|
|
1
2
|
import { sql } from "drizzle-orm";
|
|
2
3
|
import { blob, index, integer, primaryKey, real, sqliteTable, text, uniqueIndex, } from "drizzle-orm/sqlite-core";
|
|
3
4
|
const now = sql `(unixepoch() * 1000)`;
|
|
@@ -509,6 +510,36 @@ export const spaceItemCategory = sqliteTable("space_item_category", {
|
|
|
509
510
|
index("space_item_category_table").on(t.tableId),
|
|
510
511
|
index("space_item_category_file").on(t.fileId),
|
|
511
512
|
]);
|
|
513
|
+
// --- Skills -------------------------------------------------------------------------
|
|
514
|
+
// Instructions in the Agent Skills format the space's wizards follow (docs/plans/skills.md):
|
|
515
|
+
// always, or when a step reads one. Text only, the folder's files kept beside the instructions.
|
|
516
|
+
export const spaceSkill = sqliteTable("space_skill", {
|
|
517
|
+
id: text("id").primaryKey(),
|
|
518
|
+
tenantId: text("tenant_id").notNull(),
|
|
519
|
+
projectId: text("project_id")
|
|
520
|
+
.notNull()
|
|
521
|
+
.references(() => project.id, { onDelete: "cascade" }),
|
|
522
|
+
/** Its name in the format: lower case and hyphens, unique in the space. */
|
|
523
|
+
name: text("name").notNull(),
|
|
524
|
+
description: text("description").notNull(),
|
|
525
|
+
/** The Markdown after the front matter of its `SKILL.md`. */
|
|
526
|
+
body: text("body").notNull().default(""),
|
|
527
|
+
/** The rest of the front matter, kept as it came (`license`, `metadata` …). */
|
|
528
|
+
meta: text("meta", { mode: "json" }).$type().notNull().default({}),
|
|
529
|
+
/** The other files of its folder, by their path in it. */
|
|
530
|
+
files: text("files", { mode: "json" }).$type().notNull().default([]),
|
|
531
|
+
/** Files for its scripts only, their bytes in the blob store (files/blobs.ts). */
|
|
532
|
+
blobFiles: text("blob_files", { mode: "json" }).$type().notNull().default([]),
|
|
533
|
+
mode: text("mode", { enum: SKILL_MODES }).notNull().default("demand"),
|
|
534
|
+
/** Its scripts run in the sandbox of a step that has one: switched on by a person, never by default. */
|
|
535
|
+
runScripts: integer("run_scripts", { mode: "boolean" }).notNull().default(false),
|
|
536
|
+
source: text("source", { enum: SKILL_SOURCES }).notNull().default("own"),
|
|
537
|
+
/** skills.sh: `owner/repo/skill`, and the hash of what it had when added. */
|
|
538
|
+
origin: text("origin"),
|
|
539
|
+
originHash: text("origin_hash"),
|
|
540
|
+
createdAt: createdAt(),
|
|
541
|
+
updatedAt: updatedAt(),
|
|
542
|
+
}, (t) => [uniqueIndex("space_skill_name").on(t.projectId, t.name)]);
|
|
512
543
|
export const assistantChat = sqliteTable("assistant_chat", {
|
|
513
544
|
id: text("id").primaryKey(),
|
|
514
545
|
tenantId: text("tenant_id").notNull(),
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Skills
|
|
3
|
+
description: The skills of a space – the SKILL.md engenty wizards reads, its limits, the studio’s routes, the two tools a step reads skills with and how their scripts run in the sandbox.
|
|
4
|
+
version: 0.11.6
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
A space’s skills are instructions in the Agent Skills format that its AI steps follow. They sit
|
|
8
|
+
behind the `skills` switch, which is off by default. While it is off, every route below answers
|
|
9
|
+
404 and no step sees a skill.
|
|
10
|
+
|
|
11
|
+
## The format
|
|
12
|
+
|
|
13
|
+
A skill is a folder with a `SKILL.md`: front matter, then Markdown.
|
|
14
|
+
|
|
15
|
+
```markdown
|
|
16
|
+
---
|
|
17
|
+
name: brand-voice
|
|
18
|
+
description: How we write. Use it for every text a person reads.
|
|
19
|
+
license: MIT
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# Brand voice
|
|
23
|
+
|
|
24
|
+
Short sentences, first names, no exclamation marks. Examples in references/examples.md.
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- `name`: lower-case letters, digits and single hyphens, at most 64 characters, unique in the
|
|
28
|
+
space.
|
|
29
|
+
- `description`: at most 1024 characters. On demand, a step decides by it alone.
|
|
30
|
+
- Other keys (`license`, `metadata`, `allowed-tools` …) are kept as they came and written back
|
|
31
|
+
on download. engenty wizards reads the subset of YAML skills use: plain and quoted values,
|
|
32
|
+
block scalars (`|`, `>`), lists and one level of mapping.
|
|
33
|
+
- Every other file of the folder is kept by its path. Text a model reads (Markdown, code, data,
|
|
34
|
+
YAML, JSON) sits in the skill’s row while it fits. Any other file (a font, a template, an
|
|
35
|
+
`.xsd` schema), and text past the limits, is a file for scripts: its bytes go to the blob store
|
|
36
|
+
by their SHA-256 (`blob_files` holds path, hash and size), so a step that reads the space’s
|
|
37
|
+
skills never loads them. No model reads them. They sync by hash, as workspace files do.
|
|
38
|
+
|
|
39
|
+
| | At most |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `SKILL.md` | 100,000 bytes |
|
|
42
|
+
| Any other file | 256,000 bytes |
|
|
43
|
+
| A whole skill’s text | 1,000,000 bytes, 100 files |
|
|
44
|
+
| A file for scripts | 5,000,000 bytes |
|
|
45
|
+
| A skill’s files for scripts | 20,000,000 bytes, 200 files |
|
|
46
|
+
| Skills in a space | 100 |
|
|
47
|
+
| Skills always on | 5, their instructions 20,000 characters together |
|
|
48
|
+
| Skills on demand a step sees by name | 50 |
|
|
49
|
+
|
|
50
|
+
## In a step
|
|
51
|
+
|
|
52
|
+
Every AI step of the space’s wizards gets, after Brand and Knowledge:
|
|
53
|
+
|
|
54
|
+
- **The skills always on**, whole, under `# SKILLS THE SPACE ALWAYS USES`, each in
|
|
55
|
+
`<skill name="…">`. The step’s ground rules and its task come first.
|
|
56
|
+
- **The skills on demand**, by name and description, under `# SKILLS ON DEMAND`.
|
|
57
|
+
- Two tools:
|
|
58
|
+
- `skill_load { name }` answers the skill’s instructions and the paths of its files.
|
|
59
|
+
- `skill_read { name, path, from? }` answers one file, 30,000 characters at a time.
|
|
60
|
+
|
|
61
|
+
Without the sandbox, `skill_read`’s description says that scripts are text and nothing runs
|
|
62
|
+
them. A file for scripts answers that it isn’t text to read.
|
|
63
|
+
|
|
64
|
+
A step that writes HTML (a document, a dashboard) gets the skills always on, without tools. A
|
|
65
|
+
model that runs no tools (an on-device model) gets the skills always on alone. The run shows
|
|
66
|
+
“Reading the skill …” for each read. Goose gets the same two tools and a list of the space’s
|
|
67
|
+
skills.
|
|
68
|
+
|
|
69
|
+
## Scripts in the sandbox
|
|
70
|
+
|
|
71
|
+
`run_scripts` on a skill (`runScripts` in the API and the sync record) is off for every new
|
|
72
|
+
skill, from skills.sh too, and for a copy. A person switches it on in the studio. skills.sh
|
|
73
|
+
skills are unchecked third-party code, and the Docker sandbox has open internet access.
|
|
74
|
+
|
|
75
|
+
A step whose `tools` include `sandbox`, on a server where the sandbox is on, then:
|
|
76
|
+
|
|
77
|
+
- reads under the skills a line naming the skills whose scripts run (`skills.scripts` in
|
|
78
|
+
`prompts/step.md`);
|
|
79
|
+
- writes the skill’s folder to `skills/<name>/` in the sandbox’s working directory (`/sandbox`)
|
|
80
|
+
when `skill_load` loads it: `SKILL.md`, the text files and the files for scripts. The folder is
|
|
81
|
+
removed first and written once per run and version of the skill, eight files at a time;
|
|
82
|
+
- gets `folder` and a `scripts` note in `skill_load`’s answer, which says to run the scripts with
|
|
83
|
+
`run_command` from the working directory (`python3 skills/pdf/scripts/fill.py`) and to install
|
|
84
|
+
what they import first.
|
|
85
|
+
|
|
86
|
+
If the folder can’t be written, `skill_load` still answers the instructions, and the note says
|
|
87
|
+
the scripts can’t run in this step. A skill with `run_scripts` off, a step without the sandbox,
|
|
88
|
+
and Goose get the text alone. The code is in `apps/runtime/src/tools/skills.ts`.
|
|
89
|
+
|
|
90
|
+
## Routes
|
|
91
|
+
|
|
92
|
+
Under `/api/studio`, signed in as for the studio:
|
|
93
|
+
|
|
94
|
+
| Route | What it does |
|
|
95
|
+
| --- | --- |
|
|
96
|
+
| `GET /projects/:id/skills` | The space’s skills, without their content |
|
|
97
|
+
| `POST /projects/:id/skills` | A new skill: `{ name, description, body?, mode? }` |
|
|
98
|
+
| `POST /projects/:id/skills/upload` | A `SKILL.md`, `.zip` or `.skill` in the form field `file` |
|
|
99
|
+
| `GET /projects/:id/skills/registry?q=` | A search on skills.sh |
|
|
100
|
+
| `GET /projects/:id/skills/registry/preview?ref=` | A skill of skills.sh read whole: `owner/repo/skill` |
|
|
101
|
+
| `POST /projects/:id/skills/registry` | Adds one: `{ ref, mode? }` |
|
|
102
|
+
| `GET`, `PATCH`, `DELETE /skills/:id` | One skill. `PATCH` takes `name`, `description`, `body`, `meta`, `files`, `mode`, `runScripts`, or the whole `skillMd` |
|
|
103
|
+
| `POST /skills/:id/copy` | A copy as the space’s own skill |
|
|
104
|
+
| `GET /skills/:id/zip` | The skill’s folder as a zip |
|
|
105
|
+
| `GET`, `POST /skills/:id/update` | What skills.sh has now, and taking it: `{ hash }` |
|
|
106
|
+
|
|
107
|
+
`mode` is `always`, `demand` or `off`. A skill from skills.sh changes its `mode` and
|
|
108
|
+
`runScripts` only. Its content changes with an update. An upload takes up to 32 MB.
|
|
109
|
+
|
|
110
|
+
## skills.sh
|
|
111
|
+
|
|
112
|
+
The runtime searches `https://skills.sh/api/search` and reads a skill from
|
|
113
|
+
`https://skills.sh/r/<owner>/<repo>/<skill>`, which hands out the `SKILL.md` and the text files
|
|
114
|
+
of its folder; it leaves out fonts and pictures. `SKILLS_REGISTRY_URL` points elsewhere, for tests or a mirror. A skill from an owner
|
|
115
|
+
on skills.sh’s official list counts as from an official source. The list is in
|
|
116
|
+
`packages/shared/src/skills.ts`.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Skills
|
|
3
|
+
description: Instructions your wizards work by – always, or when a wizard needs one. Add them from skills.sh, upload them or write your own.
|
|
4
|
+
version: 0.11.6
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
A skill is a set of instructions your wizards work by: how you write, what a quote must hold, how
|
|
8
|
+
to handle a PDF. You find them under **Sources › Skills**. Skills are not switched on for
|
|
9
|
+
everyone yet.
|
|
10
|
+
|
|
11
|
+
A skill is a folder in the open Agent Skills format: a `SKILL.md` with a name, a description and
|
|
12
|
+
the instructions, and any text files the instructions point to. The same skill works in Claude,
|
|
13
|
+
Codex and other tools.
|
|
14
|
+
|
|
15
|
+
## When a skill applies
|
|
16
|
+
|
|
17
|
+
Each skill has one of three settings:
|
|
18
|
+
|
|
19
|
+
- **Always on.** Every AI step of every wizard in the space follows it. Use it for rules that
|
|
20
|
+
always hold, such as your tone or what you never promise. It costs tokens on every run, so at
|
|
21
|
+
most 5 skills can be always on, with 20,000 characters together.
|
|
22
|
+
- **On demand.** A wizard sees the skill’s name and description, and reads the skill when the
|
|
23
|
+
description fits its task. The description decides, so write it as “what it is for and when it
|
|
24
|
+
is needed”.
|
|
25
|
+
- **Off.** The skill stays in the space, and no wizard sees it.
|
|
26
|
+
|
|
27
|
+
A wizard reads a file of a skill when the skill’s instructions point to it. Goose sees the
|
|
28
|
+
space’s skills too and reads them when they help.
|
|
29
|
+
|
|
30
|
+
## Add a skill
|
|
31
|
+
|
|
32
|
+
“Add” offers three ways, and the search in the middle of the page finds skills both in your space
|
|
33
|
+
and on skills.sh:
|
|
34
|
+
|
|
35
|
+
- **From skills.sh.** Search the open directory of skills. Skills from organizations that skills.sh
|
|
36
|
+
lists as official show “official source”, and the search shows only those until you switch
|
|
37
|
+
“Official sources only” off. Every other skill shows “not checked”. You see each skill whole
|
|
38
|
+
before you add it: its instructions and its files.
|
|
39
|
+
- **Write a skill.** Give it a name (lower-case letters, digits and hyphens) and a description,
|
|
40
|
+
then write the instructions.
|
|
41
|
+
- **Upload.** Drop a `SKILL.md`, a `.zip` or a `.skill` file on the page. A zip brings the folder
|
|
42
|
+
of its `SKILL.md` along.
|
|
43
|
+
|
|
44
|
+
A wizard reads a skill’s text files: instructions, references, examples, scripts. Other files,
|
|
45
|
+
such as fonts, templates or pictures, come along for the skill’s scripts, and the page shows them
|
|
46
|
+
as “for scripts”. skills.sh hands out text files only, so a skill that needs fonts or templates
|
|
47
|
+
comes as a zip upload.
|
|
48
|
+
|
|
49
|
+
## Run a skill’s scripts
|
|
50
|
+
|
|
51
|
+
Some skills bring scripts in Python or JavaScript, such as one that fills a PDF form. A script
|
|
52
|
+
runs only when you switch on **Run scripts** on the skill’s page. Every skill starts with it off,
|
|
53
|
+
also one from skills.sh.
|
|
54
|
+
|
|
55
|
+
With it on, an AI step that has the sandbox puts the skill’s folder there when it loads the skill,
|
|
56
|
+
and runs the scripts the instructions call for. A step without the sandbox, or a computer where
|
|
57
|
+
the sandbox is off, keeps the scripts as text.
|
|
58
|
+
|
|
59
|
+
The sandbox is connected to the internet. Read the scripts of a skill nobody checked before you
|
|
60
|
+
switch them on: one you uploaded, or one from a source skills.sh doesn’t list as official. The
|
|
61
|
+
page says so beside the switch.
|
|
62
|
+
|
|
63
|
+
## Edit a skill
|
|
64
|
+
|
|
65
|
+
Your own skills save as you type. The name and the description stand at the top. “Code” shows
|
|
66
|
+
the whole `SKILL.md`, “Preview” shows the instructions as they read. A file opens in a dialog.
|
|
67
|
+
|
|
68
|
+
A skill from skills.sh stays as it came. When skills.sh has a newer version, the skill’s page
|
|
69
|
+
says so, and you see the changes before you take them (“View changes”). To change it yourself,
|
|
70
|
+
copy it as your own skill.
|
|
71
|
+
|
|
72
|
+
“Download as .zip” gives you the skill’s folder, for another tool or another space.
|
|
73
|
+
|
|
74
|
+
## Limits
|
|
75
|
+
|
|
76
|
+
| | At most |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| `SKILL.md` | 100 KB |
|
|
79
|
+
| Any other file | 256 KB |
|
|
80
|
+
| A whole skill | 1 MB of text in 100 files |
|
|
81
|
+
| Files for scripts | 5 MB each, 20 MB and 200 files per skill |
|
|
82
|
+
| Skills in a space | 100 |
|
|
83
|
+
| Skills always on | 5, with 20,000 characters together |
|
|
84
|
+
|
|
85
|
+
Skills come along with the [two-way sync](./cloud-sync.md) like the rest of the space.
|
|
@@ -10,13 +10,15 @@ import { extFor, loadAsset, loadAssetText } from "../files/storage.js";
|
|
|
10
10
|
import { snapshotHtmlImages } from "../files/web-images.js";
|
|
11
11
|
import { generateImageMedia, generateSpeechMedia, generateVideoMedia, } from "../media/generate.js";
|
|
12
12
|
import { markMedia } from "../media/marking.js";
|
|
13
|
-
import { agentModel, attachTools, costOf, isHarnessVendor, textModel, totalUsage, } from "../models.js";
|
|
13
|
+
import { agentModel, attachTools, costOf, isHarnessVendor, takesTools, textModel, totalUsage, } from "../models.js";
|
|
14
14
|
import { runMotionGraphicsStep } from "../motion-graphics/step.js";
|
|
15
15
|
import { prompt } from "../prompts.js";
|
|
16
16
|
import { contentPolicy } from "../safety.js";
|
|
17
|
+
import { sandboxCapabilities } from "../sandbox/index.js";
|
|
17
18
|
import { knowledgeBlock } from "../services/knowledge.js";
|
|
18
19
|
import { buildStepTools } from "../tools/index.js";
|
|
19
20
|
import { callPluginTool, spaceContextOf } from "../tools/plugin.js";
|
|
21
|
+
import { skillsBlock, skillsOf } from "../tools/skills.js";
|
|
20
22
|
import { personUploads } from "../tools/store.js";
|
|
21
23
|
import { runWidgetStep } from "../widgets/step.js";
|
|
22
24
|
import { decide } from "./decide.js";
|
|
@@ -497,6 +499,11 @@ export async function runAgentStep(step, ctx) {
|
|
|
497
499
|
brandBlock(ctx),
|
|
498
500
|
// Knowledge: what the space holds for its wizards, and how to find and read it.
|
|
499
501
|
await knowledgeBlock(ctx.project.id),
|
|
502
|
+
// Skills: always on whole, on demand by name and description (docs/plans/skills.md).
|
|
503
|
+
skillsBlock(await skillsOf(ctx), {
|
|
504
|
+
tools: takesTools(resolved),
|
|
505
|
+
sandbox: step.tools.includes("sandbox") && sandboxCapabilities() !== null,
|
|
506
|
+
}),
|
|
500
507
|
// What the space's plugins hold for its wizards: a wiki, questions and answers.
|
|
501
508
|
...(await spaceContextOf(ctx)).blocks,
|
|
502
509
|
formatHint,
|
|
@@ -750,6 +757,8 @@ async function writeHtml(step, ctx, kind) {
|
|
|
750
757
|
groundRules(ctx),
|
|
751
758
|
`Today is ${today(ctx)}.`,
|
|
752
759
|
brandBlock(ctx),
|
|
760
|
+
// The skills always on hold for what a step writes, a document too.
|
|
761
|
+
skillsBlock(await skillsOf(ctx), { tools: false }),
|
|
753
762
|
guide,
|
|
754
763
|
// What plugins hold for the space's look: a UI library, say.
|
|
755
764
|
...(await spaceContextOf(ctx)).html,
|
package/apps/runtime/dist/env.js
CHANGED
|
@@ -110,6 +110,8 @@ export const env = {
|
|
|
110
110
|
/** More host names this server answers under, besides APP_URL's and the loopback names. */
|
|
111
111
|
allowedHosts: list("ALLOWED_HOSTS"),
|
|
112
112
|
dataDir,
|
|
113
|
+
/** The `.features` file to read instead of the install's or the checkout's (features.ts); the tests' own. */
|
|
114
|
+
featuresFile: str("FEATURES_FILE"),
|
|
113
115
|
/** The control database; empty = a libSQL file in the data folder. */
|
|
114
116
|
databaseUrl: str("DATABASE_URL", ""),
|
|
115
117
|
databaseAuthToken: str("DATABASE_AUTH_TOKEN"),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
3
|
import { declaredByPlugin, defaultFeatures, FEATURES, featureOn, parseFeatures, resolveFeatures, } from "@engenty/wizards-shared/features";
|
|
4
4
|
import { accountOverview } from "./auth/account.js";
|
|
5
5
|
import { isCheckout, layout, packageRoot } from "./cli/home.js";
|
|
@@ -17,13 +17,17 @@ import { currentTenantOrNull } from "./tenants/tenant.js";
|
|
|
17
17
|
* 3. what the Manage-App says — for the organization of a cloud runtime, for the linked account of a
|
|
18
18
|
* local one; a plan's switches and what an admin set for the organization or for everyone
|
|
19
19
|
* 4. the `.features` file of this install (`~/.engenty/wizards/.features`; a checkout reads
|
|
20
|
-
* the repo root's, a cloud runtime its data folder's
|
|
20
|
+
* the repo root's, a cloud runtime its data folder's; FEATURES_FILE names another, as the
|
|
21
|
+
* tests do) — this machine's word is the last
|
|
21
22
|
*
|
|
22
23
|
* The file is read on every call, so a change counts at once. Nothing here is documented
|
|
23
24
|
* outside the code.
|
|
24
25
|
*/
|
|
25
|
-
/** The `.features` file this runtime reads: the install's, the checkout's root, or the data folder's. */
|
|
26
|
+
/** The `.features` file this runtime reads: FEATURES_FILE, the install's, the checkout's root, or the data folder's. */
|
|
26
27
|
export function featuresFile() {
|
|
28
|
+
if (env.featuresFile) {
|
|
29
|
+
return resolve(env.featuresFile);
|
|
30
|
+
}
|
|
27
31
|
if (managed) {
|
|
28
32
|
return join(env.dataDir, ".features");
|
|
29
33
|
}
|
|
@@ -86,6 +90,10 @@ export async function remoteFeatures() {
|
|
|
86
90
|
accountCache = { at: Date.now(), value: overview?.tenant.features ?? null };
|
|
87
91
|
return accountCache.value;
|
|
88
92
|
}
|
|
93
|
+
/** Asks the Manage-App again on the next look, after the account was checked on request. */
|
|
94
|
+
export function forgetAccountFeatures() {
|
|
95
|
+
accountCache = null;
|
|
96
|
+
}
|
|
89
97
|
/** The switches for the tenant at hand, with what the Manage-App says fetched. */
|
|
90
98
|
export async function currentFeatures() {
|
|
91
99
|
return features(await remoteFeatures());
|
|
@@ -77,6 +77,10 @@ export class HarnessModel {
|
|
|
77
77
|
nativeSchema = false;
|
|
78
78
|
/** Whether the client runs a call's tools (over the bridge); else they are left out, with a warning. */
|
|
79
79
|
usesTools = true;
|
|
80
|
+
/** The same, for whoever builds the call: a step tells such a client no tools exist. */
|
|
81
|
+
get takesTools() {
|
|
82
|
+
return this.usesTools;
|
|
83
|
+
}
|
|
80
84
|
/** Whether the client searches the web with a tool of its own, tools of the call or not. */
|
|
81
85
|
searchesWeb = true;
|
|
82
86
|
effort;
|
|
@@ -116,6 +116,8 @@ const ITEM_VIEWS = {
|
|
|
116
116
|
const row = await db.query.projectFile.findFirst({ where: eq(schema.projectFile.id, x.item) });
|
|
117
117
|
return row ? fileView(row) : null;
|
|
118
118
|
},
|
|
119
|
+
// The studio asks for the space's skills again: a list of names, no view of its own.
|
|
120
|
+
skill: null,
|
|
119
121
|
connector: async (r, x) => {
|
|
120
122
|
if (!x.projectId) {
|
|
121
123
|
return null;
|
|
@@ -547,6 +547,10 @@ export function attachTools(resolved, tools, ignorable = false) {
|
|
|
547
547
|
resolved.model.attach(tools, ignorable);
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
|
+
/** Whether the model can call tools: an installed client that runs none cannot. */
|
|
551
|
+
export function takesTools(resolved) {
|
|
552
|
+
return !(resolved.model instanceof HarnessModel) || resolved.model.takesTools;
|
|
553
|
+
}
|
|
550
554
|
/** Gemini image models of the gateway are chat models answering with image files. */
|
|
551
555
|
export function isChatImageModel(ref) {
|
|
552
556
|
return ref.includes("gemini") && ref.includes("image");
|
|
@@ -140,6 +140,32 @@ export async function refreshPro() {
|
|
|
140
140
|
console.error("[pro modules]", lastError);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
+
let following = null;
|
|
144
|
+
let followedAt = 0;
|
|
145
|
+
/**
|
|
146
|
+
* What the account says of its plan as it answers anyway (GET /v1/me, about once a minute while
|
|
147
|
+
* the sync runs): when the plan or its modules differ from what was confirmed, the modules are
|
|
148
|
+
* asked for again, so a plan an admin changed takes effect here within minutes. A Manage-App that
|
|
149
|
+
* sends no modules leaves the plan alone to tell. A check that failed waits ten minutes.
|
|
150
|
+
*/
|
|
151
|
+
export function followPlan(tenant) {
|
|
152
|
+
if (managed || following || (lastError && Date.now() - followedAt < 600_000)) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const confirmed = currentEntitlement();
|
|
156
|
+
const sorted = (ids) => [...ids].sort().join();
|
|
157
|
+
const changed = !confirmed ||
|
|
158
|
+
confirmed.tenantId !== tenant.id ||
|
|
159
|
+
(tenant.plan !== undefined && tenant.plan.id !== confirmed.plan?.id) ||
|
|
160
|
+
(tenant.modules !== undefined && sorted(tenant.modules) !== sorted(confirmed.modules));
|
|
161
|
+
if (!changed) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
followedAt = Date.now();
|
|
165
|
+
following = refreshPro().finally(() => {
|
|
166
|
+
following = null;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
143
169
|
let timer = null;
|
|
144
170
|
/** Checks at start, then once a day while the runtime runs; a check that failed, within the hour. */
|
|
145
171
|
export function startProChecks() {
|
|
@@ -101,6 +101,13 @@ The space "${name}" is read-only here: nothing of it can be changed in this stud
|
|
|
101
101
|
<!-- section: turn.knowledge -->
|
|
102
102
|
The person talks to you from Knowledge: they want the wizards to know something.
|
|
103
103
|
|
|
104
|
+
<!-- section: turn.skills -->
|
|
105
|
+
<!-- Before the space's skills, one "- name (mode): description" line each. -->
|
|
106
|
+
Skills of the space (Sources → Skills): instructions its wizards follow, always (in every AI step) or on demand (a step reads one when it fits). You read them with skill_load; the person writes, adds and switches them on the Skills page, you have no tools to change them.
|
|
107
|
+
|
|
108
|
+
<!-- section: turn.skills_empty -->
|
|
109
|
+
The person talks to you from Skills, which is empty: skills are instructions the wizards follow. They are written, uploaded or added from skills.sh on that page.
|
|
110
|
+
|
|
104
111
|
<!-- "missing": what the studio lacks, a list the code makes. -->
|
|
105
112
|
|
|
106
113
|
<!-- section: turn.off -->
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
AI steps in a wizard run: agent steps, documents and dashboards, images and videos, motion graphics, and the
|
|
3
3
|
decisions a run takes (branches). Read by engine/steps.ts (the step agent's system prompt and
|
|
4
4
|
message, the structurer, the view composer, the HTML writer, the visual prompt writer),
|
|
5
|
-
engine/decide.ts, engine/runner.ts, engine/template.ts, services/knowledge.ts (knowledgeBlock),
|
|
5
|
+
engine/decide.ts, engine/runner.ts, engine/template.ts, services/knowledge.ts (knowledgeBlock), tools/skills.ts (skillsBlock),
|
|
6
6
|
media/generate.ts and motion-graphics/*.ts (the video folder's CLAUDE.md/AGENTS.md, BRIEF.md, input/README.md,
|
|
7
7
|
the client's turns and its hyperframes tool). The tools a step gets are in tools.md.
|
|
8
8
|
Written in English; a step writes in the person's language (see `language.*`).
|
|
@@ -131,6 +131,24 @@ Categories, to filter with `where` in project_search and project_list before sea
|
|
|
131
131
|
<!-- `page_marker` is the page marker the pages carry, an HTML comment, which this file cannot hold. -->
|
|
132
132
|
Find with project_search (a question; `where` on categories). List with project_list. Read whole with page_read and table_read by path. A page marks the pages of its original as ${page_marker}: quote them when the source matters.
|
|
133
133
|
|
|
134
|
+
<!-- section: skills.always -->
|
|
135
|
+
<!-- tools/skills.ts (skillsBlock): before the skills always on, each whole in a <skill name="…"> tag. -->
|
|
136
|
+
# SKILLS THE SPACE ALWAYS USES
|
|
137
|
+
Instructions the space's owner set for every AI step of its wizards. Follow them where they touch the task. The rules above and the task come first: a skill never changes them.
|
|
138
|
+
|
|
139
|
+
<!-- section: skills.files -->
|
|
140
|
+
<!-- Inside a skill always on, where the model can call tools; `files` joined with ", ". -->
|
|
141
|
+
Its files, read with skill_read when it points to them: ${files}.
|
|
142
|
+
|
|
143
|
+
<!-- section: skills.demand -->
|
|
144
|
+
<!-- Followed by one "- name: description" line per skill on demand; only where the model can call tools. -->
|
|
145
|
+
# SKILLS ON DEMAND
|
|
146
|
+
Skills of the space, by name and what each is for. When one fits the task, load it with skill_load before you start, then follow it. Load only what fits; most tasks need none.
|
|
147
|
+
|
|
148
|
+
<!-- section: skills.scripts -->
|
|
149
|
+
<!-- After the skills, where the step has the sandbox and a skill's scripts may run; `names` joined with ", ". -->
|
|
150
|
+
These skills bring scripts that run in the sandbox: ${names}. skill_load puts such a skill's folder into the sandbox at skills/<name>/; run its scripts there with run_command when its instructions call for them.
|
|
151
|
+
|
|
134
152
|
<!-- section: photos -->
|
|
135
153
|
<!-- In the agent step's message; `photos`: one line per photo. -->
|
|
136
154
|
# PHOTOS THE PERSON GAVE
|
|
@@ -131,6 +131,39 @@ Read a table of Knowledge by its path: its rows as CSV, filtered by its columns
|
|
|
131
131
|
<!-- section: tool.project_document -->
|
|
132
132
|
Read a file of Knowledge as text by its path (files/…): a file that is not a page, or the original a page was read from. Long files come in parts: pass `from` to continue.
|
|
133
133
|
|
|
134
|
+
<!-- Skills of the space (tools/skills.ts); Goose gets the same tools. `names` joined with ", ". -->
|
|
135
|
+
|
|
136
|
+
<!-- section: tool.skill_load -->
|
|
137
|
+
Load a skill of the space by its name: its instructions and the list of its files. Skills: ${names}.
|
|
138
|
+
|
|
139
|
+
<!-- section: tool.skill_read -->
|
|
140
|
+
Read a file of a skill by its path, as skill_load lists it: a reference, an example, a template.
|
|
141
|
+
|
|
142
|
+
<!-- section: tool.skill_read.text_only -->
|
|
143
|
+
<!-- After tool.skill_read where no skill's scripts run in this step (no sandbox, or none switched on). -->
|
|
144
|
+
Scripts are text to read here; nothing runs them.
|
|
145
|
+
|
|
146
|
+
<!-- section: note.skill_unknown -->
|
|
147
|
+
No skill "${name}". Skills: ${names}.
|
|
148
|
+
|
|
149
|
+
<!-- `files` joined with ", ", or "none". -->
|
|
150
|
+
<!-- section: note.skill_no_file -->
|
|
151
|
+
No file "${path}" in ${skill}. Its files: ${files}.
|
|
152
|
+
|
|
153
|
+
<!-- In skill_load's answer for a skill whose scripts may run, in a step with the sandbox. `folder`: skills/<name>. -->
|
|
154
|
+
<!-- section: note.skill_folder -->
|
|
155
|
+
This skill's folder is in the sandbox at ${folder}: its SKILL.md and every file. Run its scripts with run_command from the working directory, e.g. python3 ${folder}/scripts/<file>.py, and install what they import first (pip install, npm install). Write what you make outside ${folder}.
|
|
156
|
+
|
|
157
|
+
<!-- section: note.skill_folder_failed -->
|
|
158
|
+
This skill's folder could not be put into the sandbox (${error}): its scripts can't run in this step. Follow its instructions without them.
|
|
159
|
+
|
|
160
|
+
<!-- A file of a skill that is not text: a font, a template, a schema. -->
|
|
161
|
+
<!-- section: note.skill_blob -->
|
|
162
|
+
${path} is a file for the skill's scripts, not text to read.
|
|
163
|
+
|
|
164
|
+
<!-- section: note.skill_more -->
|
|
165
|
+
${rest} characters more: pass from=${from}
|
|
166
|
+
|
|
134
167
|
<!-- Mail (tools/mail.ts) -->
|
|
135
168
|
|
|
136
169
|
<!-- section: note.mail_not_connected -->
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { note } from "@engenty/wizards-shared/run";
|
|
2
|
+
import { SKILL_LIMITS, SKILL_MODES, SKILL_REF } from "@engenty/wizards-shared/skills";
|
|
3
|
+
import { Hono } from "hono";
|
|
4
|
+
import { bodyLimit } from "hono/body-limit";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { ServiceError } from "../services/errors.js";
|
|
7
|
+
import { copySkill, createSkill, deleteSkill, getSkill, listSkills, skillZip, updateSkill, uploadSkill, } from "../services/skills.js";
|
|
8
|
+
import { addRegistrySkill, applySkillUpdate, previewSkill, searchSkills, skillUpdate, } from "../services/skills-registry.js";
|
|
9
|
+
import { say } from "./lang.js";
|
|
10
|
+
const fileSchema = z.object({
|
|
11
|
+
path: z.string().min(1).max(200),
|
|
12
|
+
text: z.string().max(SKILL_LIMITS.file),
|
|
13
|
+
});
|
|
14
|
+
const patchSchema = z.object({
|
|
15
|
+
name: z.string().max(200).optional(),
|
|
16
|
+
description: z.string().max(4000).optional(),
|
|
17
|
+
body: z.string().max(SKILL_LIMITS.skillMd).optional(),
|
|
18
|
+
meta: z.record(z.string(), z.unknown()).optional(),
|
|
19
|
+
files: z.array(fileSchema).max(SKILL_LIMITS.files).optional(),
|
|
20
|
+
skillMd: z.string().max(SKILL_LIMITS.skillMd).optional(),
|
|
21
|
+
mode: z.enum(SKILL_MODES).optional(),
|
|
22
|
+
runScripts: z.boolean().optional(),
|
|
23
|
+
});
|
|
24
|
+
// A skill is 1 MB of text and 20 MB of files for scripts at most; a zip of one, a few more.
|
|
25
|
+
const uploadLimit = bodyLimit({
|
|
26
|
+
maxSize: 32 * 1024 * 1024,
|
|
27
|
+
onError: (c) => c.json({ error: say(c, "tooLarge"), code: "too_large" }, 413),
|
|
28
|
+
});
|
|
29
|
+
export const skillRoutes = new Hono()
|
|
30
|
+
.get("/projects/:id/skills", async (c) => c.json(await listSkills(c.get("user").id, c.req.param("id"))))
|
|
31
|
+
.post("/projects/:id/skills", async (c) => {
|
|
32
|
+
const body = z
|
|
33
|
+
.object({
|
|
34
|
+
name: z.string().max(200),
|
|
35
|
+
description: z.string().max(4000),
|
|
36
|
+
body: z.string().max(SKILL_LIMITS.skillMd).optional(),
|
|
37
|
+
mode: z.enum(SKILL_MODES).optional(),
|
|
38
|
+
})
|
|
39
|
+
.parse(await c.req.json());
|
|
40
|
+
return c.json(await createSkill(c.get("user").id, c.req.param("id"), body));
|
|
41
|
+
})
|
|
42
|
+
.post("/projects/:id/skills/upload", uploadLimit, async (c) => {
|
|
43
|
+
const file = (await c.req.formData()).get("file");
|
|
44
|
+
if (!(file instanceof File)) {
|
|
45
|
+
throw new ServiceError("invalid", note("chooseFile"));
|
|
46
|
+
}
|
|
47
|
+
return c.json(await uploadSkill(c.get("user").id, c.req.param("id"), {
|
|
48
|
+
name: file.name,
|
|
49
|
+
data: new Uint8Array(await file.arrayBuffer()),
|
|
50
|
+
}));
|
|
51
|
+
})
|
|
52
|
+
.get("/projects/:id/skills/registry", async (c) => c.json(await searchSkills(c.get("user").id, c.req.param("id"), c.req.query("q") ?? "")))
|
|
53
|
+
.get("/projects/:id/skills/registry/preview", async (c) => {
|
|
54
|
+
const ref = z.string().regex(SKILL_REF).parse(c.req.query("ref"));
|
|
55
|
+
return c.json(await previewSkill(c.get("user").id, c.req.param("id"), ref));
|
|
56
|
+
})
|
|
57
|
+
.post("/projects/:id/skills/registry", async (c) => {
|
|
58
|
+
const body = z
|
|
59
|
+
.object({ ref: z.string().regex(SKILL_REF), mode: z.enum(SKILL_MODES).optional() })
|
|
60
|
+
.parse(await c.req.json());
|
|
61
|
+
return c.json(await addRegistrySkill(c.get("user").id, c.req.param("id"), body));
|
|
62
|
+
})
|
|
63
|
+
.get("/skills/:id", async (c) => c.json(await getSkill(c.get("user").id, c.req.param("id"))))
|
|
64
|
+
.patch("/skills/:id", async (c) => {
|
|
65
|
+
const body = patchSchema.parse(await c.req.json());
|
|
66
|
+
return c.json({ ok: true, ...(await updateSkill(c.get("user").id, c.req.param("id"), body)) });
|
|
67
|
+
})
|
|
68
|
+
.delete("/skills/:id", async (c) => {
|
|
69
|
+
await deleteSkill(c.get("user").id, c.req.param("id"));
|
|
70
|
+
return c.json({ ok: true });
|
|
71
|
+
})
|
|
72
|
+
.post("/skills/:id/copy", async (c) => c.json(await copySkill(c.get("user").id, c.req.param("id"))))
|
|
73
|
+
.get("/skills/:id/zip", async (c) => {
|
|
74
|
+
const zip = await skillZip(c.get("user").id, c.req.param("id"));
|
|
75
|
+
return c.body(zip.data, 200, {
|
|
76
|
+
"content-type": "application/zip",
|
|
77
|
+
"content-disposition": `attachment; filename="${zip.name}"`,
|
|
78
|
+
});
|
|
79
|
+
})
|
|
80
|
+
.get("/skills/:id/update", async (c) => c.json(await skillUpdate(c.get("user").id, c.req.param("id"))))
|
|
81
|
+
.post("/skills/:id/update", async (c) => {
|
|
82
|
+
const { hash } = z.object({ hash: z.string().max(100) }).parse(await c.req.json());
|
|
83
|
+
return c.json(await applySkillUpdate(c.get("user").id, c.req.param("id"), hash));
|
|
84
|
+
});
|
|
@@ -27,7 +27,7 @@ import { balanceCredits, canSpend } from "../credits/credits.js";
|
|
|
27
27
|
import { estimateRun } from "../credits/estimate.js";
|
|
28
28
|
import { missingModels, stepsWithoutModel } from "../engine/requirements.js";
|
|
29
29
|
import { env } from "../env.js";
|
|
30
|
-
import { feature, features } from "../features.js";
|
|
30
|
+
import { feature, features, forgetAccountFeatures } from "../features.js";
|
|
31
31
|
import { appleStatus } from "../harness/apple.js";
|
|
32
32
|
import { freshAuth, loginEnv } from "../harness/env.js";
|
|
33
33
|
import { detectHarness, detectHarnesses, HARNESS_IDS, harness, installSpec, } from "../harness/index.js";
|
|
@@ -313,6 +313,8 @@ export const studio = new Hono()
|
|
|
313
313
|
/** The organization the account's space belongs to, as the Manage-App names it. */
|
|
314
314
|
organization: overview?.tenant.name ?? null,
|
|
315
315
|
organizationId: linked.tenantId,
|
|
316
|
+
/** The organization's plan; null while the Manage-App has not answered. */
|
|
317
|
+
plan: overview?.tenant.plan ?? null,
|
|
316
318
|
/** The person's organizations, to switch to another; one alone means nothing to switch. */
|
|
317
319
|
organizations: overview?.tenants ?? [],
|
|
318
320
|
credits: overview?.tenant.balanceCredits ?? null,
|
|
@@ -1888,6 +1890,15 @@ export const studio = new Hono()
|
|
|
1888
1890
|
throw new ServiceError("refused", note("switchChangesWaiting", { spaces: stuck.map((x) => `“${x.name}”`) }), { reason: "changes_waiting" });
|
|
1889
1891
|
}
|
|
1890
1892
|
return c.json({ url: await startLink({ organization }) });
|
|
1893
|
+
})
|
|
1894
|
+
// Asks the account again now: its plan, its switches and the Pro modules the plan includes.
|
|
1895
|
+
.post("/account/refresh", async (c) => {
|
|
1896
|
+
if (managed) {
|
|
1897
|
+
return c.notFound();
|
|
1898
|
+
}
|
|
1899
|
+
forgetAccountFeatures();
|
|
1900
|
+
await refreshPro();
|
|
1901
|
+
return c.json({ ok: true });
|
|
1891
1902
|
})
|
|
1892
1903
|
.delete("/account", async (c) => {
|
|
1893
1904
|
if (managed) {
|
|
@@ -14,7 +14,11 @@ import { trigramQuery } from "./project-index.js";
|
|
|
14
14
|
* space. "New chat" closes it at once and writes its dense summary meanwhile; every turn of the
|
|
15
15
|
* next one carries the summaries of the last chats, and older ones are found with `searchChats`.
|
|
16
16
|
*/
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Messages of the open chat kept as they are when it is folded; older ones live in its running
|
|
19
|
+
* summary. A turn sends every message not folded yet (at most FOLD_AFTER and the new one), so
|
|
20
|
+
* each turn's prompt starts with the one before until the next fold, and the cache holds.
|
|
21
|
+
*/
|
|
18
22
|
export const TURN_MESSAGES = 12;
|
|
19
23
|
/** Unfolded messages beyond this are folded into the running summary after a turn. */
|
|
20
24
|
const FOLD_AFTER = 24;
|
|
@@ -89,7 +93,6 @@ export async function turnHistory(user, chat) {
|
|
|
89
93
|
messages: all
|
|
90
94
|
.slice(chat.folded)
|
|
91
95
|
.filter((m) => m.content.trim())
|
|
92
|
-
.slice(-TURN_MESSAGES)
|
|
93
96
|
.map(({ role, content }) => ({ role, content })),
|
|
94
97
|
running: chat.summary,
|
|
95
98
|
earlier: earlier
|