@adelin-io/cli 0.1.6 → 0.1.8

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/skill/SKILL.md CHANGED
@@ -70,6 +70,8 @@ These rules describe authored app code. Hosted HTML/CSS design artifacts follow
70
70
  carried over from a template or source site, and labels that do not fit the content. See
71
71
  [visual review](design/visual-review.md#before-saying-done).
72
72
 
73
+ Before changing an app, follow the [task-based memory workflow](authoring/app-memory.md#task-based-app-work). Start or resume its task, preserve the purpose, and checkpoint meaningful work and checks before finishing. App builds and image writes require an active task. Hosted turns and local app closing require a checkpoint covering the latest save.
74
+
73
75
  ## Where to find what
74
76
 
75
77
  | When you are… | Read |
@@ -1,12 +1,81 @@
1
1
  # Shared app memory
2
2
 
3
- Use `read_app_memory` and `mutate_app_memory` to keep useful working context with the
3
+ Use `read_app_memory`, `manage_app_task` and `mutate_app_memory` to keep useful working context with the
4
4
  app across hosted sessions, coding agents, workspaces and machines. Maintain it yourself
5
5
  as part of the work; the builder does not need memory controls or housekeeping approvals.
6
6
  The separate [accepted requirements guide](app-requirements.md) owns lasting accepted
7
7
  intent and its tools. Accepted requirements remain until corrected or removed; history
8
8
  expiry and consolidation never change the builder's accepted direction.
9
9
 
10
+ ## Task-based app work
11
+
12
+ Before making app changes, read current memory and accepted requirements, then use
13
+ `manage_app_task` to start a task. Define `goal` (the requested outcome), `why` (the
14
+ user's reason), `constraints` and `doneWhen` (observable finish criteria). Use explicit
15
+ user intent; do not invent a rationale or treat your implementation choices as accepted
16
+ requirements. When no constraints were specified, say so. Do this automatically without
17
+ asking the builder to approve memory housekeeping. Conversation and read-only inspection
18
+ alone do not require a task.
19
+
20
+ A task is one structured `work` entry in the same shared memory document. Its `text` is
21
+ JSON with `type: "app-task"` and `version: 1`. Read and parse it to recover purpose and
22
+ progress. Existing ordinary notes remain readable. There is one active task per app;
23
+ checkpoint and pause it before starting unrelated work. Resume the relevant paused task
24
+ instead of creating a duplicate. A fresh agent must compare its checkpoint with current
25
+ files and original save receipts before continuing.
26
+
27
+ Every nonempty authoritative app build, descriptor deletion, image upload and image save requires its explicit `task_id`,
28
+ checks that this intended task is active, and persists a new
29
+ `lastSave` token before compilation, source writes or saving an image into the app.
30
+ Image upload tickets validate the active task before any bytes are uploaded; image-only
31
+ builds still record a save attempt and return its task receipt. A token records an attempt, not a
32
+ successful save, build or preview. If memory persistence fails, no source from that build
33
+ is written. Partial or failed builds still need a checkpoint explaining the actual result.
34
+ Never claim a successful checkpoint merely because the source save succeeded.
35
+
36
+ After meaningful progress, a decision or a useful check, use action `checkpoint` with
37
+ `done`, `reason`, `checks`, `next` and `saveToken` equal to the task's current `lastSave`
38
+ (or null before any build). Wait until `pending` is null; a save in flight blocks
39
+ checkpointing, finishing and overlapping saves. Keep a cumulative concise account of work completed and the
40
+ important reasons for choices; replace obsolete details rather than appending every tool
41
+ call. Distinguish local edits, persisted files, build results and observed preview behavior.
42
+ Record unchecked platforms, failures and remaining uncertainties explicitly. Keep the
43
+ original goal, why, constraints and finish criteria with the checkpoint. Retain significant
44
+ accepted decisions separately using the accepted-requirements tools.
45
+
46
+ To complete, pause or abandon a task, first save a checkpoint covering the latest save
47
+ attempt, then call action `finish` with outcome `completed`, `paused` or `abandoned`.
48
+ Completion means the stated finish criteria are met; a paused task records what remains.
49
+ The service refuses finish without that current checkpoint. Hosted turn completion and
50
+ local `close_app` also require a current checkpoint, even if you do not call `finish`.
51
+ An uncheckpointed turn fails completion; continue the task to record the actual outcome.
52
+ Closing a disconnected or cancelled runtime still releases its lease and leaves the task
53
+ resumable. Resume only paused work;
54
+ completed and abandoned tasks stay history. Use action `remove` only on closed task history when capacity requires reduction. Reads, save-attempt tokens, pauses and resumes
55
+ do not renew retention. A changed checkpoint of meaningful progress may renew open work.
56
+ The existing capacity and 90-day expiry rules still apply. Active tasks reserve document
57
+ space for a full checkpoint and save coordination; ordinary notes cannot consume that
58
+ reserve. A capacity refusal can therefore occur before bytesUsed reaches maxBytes. Keep each serialized intent and checkpoint within 768 UTF-8 bytes, reserving room
59
+ inside the 2 KiB task entry for save coordination; do not silently drop its purpose or uncertainty.
60
+
61
+ If a crashed save leaves `pending`, inspect its original receipt and current files.
62
+ Use action `recover` with the checkpoint fields only after the original turn has completed
63
+ or its lease has lost write authority. The service checks this; a timeout or a new task
64
+ does not grant recovery. Record uncertain outcomes explicitly. Image commits also check
65
+ the original open turn and current pending save token, so a recovered or cancelled
66
+ attempt cannot later attach an image.
67
+
68
+ All task calls carry a fresh `operationId` and exact string `expectedRevision`. For
69
+ checkpoint, finish, resume, recover and remove, also include `task`: the exact parsed task snapshot from
70
+ the original read. Preserve the complete request, snapshot, revision and operation ID
71
+ on an uncertain response. This makes retry payloads stable even if newer notes now exist;
72
+ the recent receipt reports replay or conflict. At 256 recent normal receipts, storage
73
+ rotates the oldest half and advances the memory revision before any new mutation. The
74
+ caller must reread and retry with a new operation; an evicted old request cannot be
75
+ reapplied against its old revision. Notes are not evicted by receipt rotation. On a conflict or reconciliation-required
76
+ result, read current memory and reassess before making a new request. Generic memory
77
+ mutations cannot create, rewrite, consolidate or remove managed task entries.
78
+
10
79
  ## Read and reconcile before acting
11
80
 
12
81
  On app open, resume and before relevant action, read current app memory and accepted
@@ -58,6 +58,11 @@ came from.
58
58
 
59
59
  ## Finding and saving images
60
60
 
61
+ Start or resume the app task before image writes. Pass its `task_id` to
62
+ `create_asset_upload` and `save_attachment_as_asset`; upload tickets validate the task
63
+ before bytes are uploaded, and saving an image records a new task save token.
64
+ Checkpoint the latest token with the reason and checks, including for image-only work.
65
+
61
66
  - `list_assets` lists the saved images with their paths and sizes. Call it before you use a
62
67
  name; never guess one.
63
68
  - `view_asset` shows a saved image so you can check what it looks like.
@@ -111,13 +116,13 @@ image. Deleting a local file never deletes the saved asset.
111
116
  When the build refuses or fails to save an image, it returns `assets_not_saved` with the
112
117
  problem for each file and sends no source; fix the files and build again. A build saves
113
118
  at most 10 images and returns `assets_pending` when more are waiting; build again to save
114
- the rest. A storage-full refusal follows [Storage limits](#storage-limits).
119
+ the rest. An image-only build returns `assets_saved` and its latest task receipt. A storage-full refusal follows [Storage limits](#storage-limits).
115
120
 
116
121
  Without the CLI, upload an image file on disk yourself:
117
122
 
118
- 1. Call `create_asset_upload` with the file name, content type and size in bytes.
123
+ 1. Call `create_asset_upload` with `task_id`, the file name, content type and size in bytes.
119
124
  2. Run the returned `curl` command on the file. It uploads the bytes directly.
120
- 3. Call `save_attachment_as_asset` with the returned `attachmentId` and a name.
125
+ 3. Call `save_attachment_as_asset` with `task_id`, the returned `attachmentId` and a name.
121
126
  4. Import the image using the returned `assetPath`.
122
127
 
123
128
  Never put image bytes or base64 text in tool arguments.
@@ -20,19 +20,19 @@ The CLI stores sign-in per user in `adelin/auth.json` under the user config dire
20
20
 
21
21
  The CLI and background upload workers on the same host serialize every sign-in save, logout and token refresh through an exclusive loopback listener keyed by the canonical credential path. The listener exchanges no credential data, and the operating system releases it when its process exits or crashes. A second process reuses the rotated credential; logout waits for an active refresh, then removes only that server's sign-in so the refresh cannot recreate it. Another credential operation or an unrelated service occupying the same local port causes a wait with a 30-second deadline before a retry refusal. A loopback permission failure also refuses the operation without changing stored credentials.
22
22
 
23
- Local byte transfers and live-key access require a native loopback connection requesting `local-transfer` and `live-credentials`. The sign-in page names the unverified requester and offers separate unchecked approvals for private file transfers and saving live keys locally. A client name never authenticates its publisher. Live-key approval requires local-transfer approval and `live.manage` in at least one app the connection covers. These approvals belong to the current account, client and grant; removing or expiring consent denies subsequent sensitive actions.
23
+ Local byte transfers and live-key access require a native loopback connection requesting `local-transfer` and `live-credentials`. The sign-in page names the unverified requester and lists private file transfers among what approving allows, and offers separate approvals, off by default, for saving live keys locally and for changing prices and plans. A client name never authenticates its publisher. Live-key approval requires a connection with file transfers and `live.manage` in at least one app the connection covers. These approvals belong to the current account, client and grant; removing or expiring consent denies subsequent sensitive actions.
24
24
 
25
25
  `adelin logout` revokes the current connection and removes its local sign-in. `adelin logout --local-only` removes only the local sign-in; it does not revoke the app grant. Revoking the connection in account settings ends its app grants. Follow [private local output](#private-local-output) for deliberately written credential files, their handling and rotation.
26
26
 
27
27
  ## Choose and open an app
28
28
 
29
- At sign-in the builder chooses **All apps, including new ones** (the default) or **Only selected apps**. Apps you create are always usable by that connection. **Settings → Connected code agents → Manage apps** adds or removes apps and switches mode without signing in again. With all apps, the connection can do what the builder's current role allows in each app, checked on every call, so a role change narrows or widens it at once. With selected apps, each app keeps the capabilities approved for it, and the builder's current role can only narrow them. Live stream keys need a separate opt-in at sign-in. `connection_status` reports `scope` (`all_apps` or `selected`) and project setup state. When signed out, tools answer `SIGN_IN_REQUIRED`: tell the builder to run `adelin login`; the Adelin tools appear shortly after login without restarting the agent. While the stored sign-in still works, `adelin login` only reports that the builder is already signed in; `adelin login --force` signs in again to change what the connection may do.
29
+ At sign-in the builder chooses **All apps, including new ones** (the default) or **Only selected apps**. Apps you create are always usable by that connection. **Settings → Connected code agents → Manage apps** adds or removes apps and switches mode without signing in again. With all apps, the connection can do what the builder's current role allows in each app, checked on every call, so a role change narrows or widens it at once. With selected apps, each app keeps the capabilities approved for it, and the builder's current role can only narrow them. Live stream keys and pricing changes each need a separate opt-in at sign-in. `connection_status` reports `scope` (`all_apps` or `selected`) and project setup state. When signed out, tools answer `SIGN_IN_REQUIRED`: tell the builder to run `adelin login`; the Adelin tools appear shortly after login without restarting the agent. While the stored sign-in still works, `adelin login` only reports that the builder is already signed in; `adelin login --force` signs in again to change what the connection may do.
30
30
 
31
31
  Call `list_editable_apps` (`limit` 1–25, default 10, and `nextCursor` as `cursor`) or `select_app(app_id)` to choose an allowed app. `select_app` returns `app` or `APP_NOT_EDITABLE`. Arguments outside a tool's input schema, on any tool, return `{ok:false,error:{code:"INVALID_ARGUMENT",message}}` with `isError: true` and change nothing. The message names the first wrong field and what was expected, for example `mode is not accepted for entry.patch` or `payload.patch.title: expected string`, and never repeats the value sent; correct that field and call again. The `library_mutate` description lists each action's payload and which actions accept `mode`. To make a new app, follow [create an app](#create-an-app).
32
32
 
33
33
  ### Pricing and icons
34
34
 
35
- The access tools in [access.md](access.md) and `search_icons` from [icons.md](../design/icons.md) work over this connection. Each access tool takes `app_id`, needs no open edit session, and checks on every call that the connection covers the app and that the builder's current role may view pricing (`read_access`, `explain_access`, `check_access_change`) or manage it (`save_access_offer`, `set_access_coverage`, `set_access_level`, `archive_access_offer`). Replies are plain text, including refusals. `search_icons` takes no app.
35
+ The access tools in [access.md](access.md) and `search_icons` from [icons.md](../design/icons.md) work over this connection. Each access tool takes `app_id`, needs no open edit session, and checks on every call that the connection covers the app and that the builder's current role may view pricing (`read_access`, `explain_access`, `check_access_change`) or manage it (`save_access_offer`, `set_access_coverage`, `set_access_level`, `archive_access_offer`). Changing anything also needs **Manage prices and plans**, an opt-in at sign-in; without it those four tools answer `PRICING_NOT_ALLOWED` and change nothing, while the read tools keep working on a connection with file transfer. Tell the builder to run `adelin login --force` and turn it on; never retry around it. Replies are plain text, including refusals. `search_icons` takes no app.
36
36
 
37
37
  ### Create an app {#create-an-app}
38
38
 
@@ -55,7 +55,7 @@ For content inspection without editing, use the bounded library reads below. A l
55
55
  For opening, resuming, recording progress and correcting working context, follow the
56
56
  [shared app-memory guide](app-memory.md). `open_app` returns fresh accepted requirements
57
57
  and working memory even when reusing the local workspace. Use `read_app_requirements`,
58
- `update_app_requirements`, `read_app_memory` and `mutate_app_memory` through the same
58
+ `update_app_requirements`, `read_app_memory`, `manage_app_task` and `mutate_app_memory` through the same
59
59
  CLI-owned MCP connection; the CLI supplies current editing-session authority for writes.
60
60
 
61
61
  ## Check and build
@@ -859,7 +859,7 @@ The media library holds the app's uploaded video and audio files and its transco
859
859
  | `adelin media inspect` | `operation.inspect` | `library.view` | read-only |
860
860
  | `adelin media preview-page` | `preview.page` | `library.manage` | read-only |
861
861
 
862
- Upload commands require the explicit local-transfer approval described under [sign-in](#sign-in-and-credentials); a connection without it gets `ACCESS_DENIED`. `NOT_FOUND` never tells an unknown upload from one in another app. Removing the app or the approval makes the next call return `ACCESS_DENIED`. Invalid flags or arguments return `INVALID_ARGUMENT` naming the field before any request is sent. `RETRYABLE_CONFLICT` means another writer held the upload or the profiles for a moment. File-transfer commands retry the identical operation up to six times, waiting 2, 4, 8, 16 and 30 seconds; other media commands return the conflict for review. A failed asset cannot be completed again: `media complete` returns `UPLOAD_NOT_RESUMABLE` with reason `failed` or the canonical `abandoned` disposition, never an `uploaded` success.
862
+ Upload commands require the file-transfer access described under [sign-in](#sign-in-and-credentials); a connection without it gets `ACCESS_DENIED`. `NOT_FOUND` never tells an unknown upload from one in another app. Removing the app or the approval makes the next call return `ACCESS_DENIED`. Invalid flags or arguments return `INVALID_ARGUMENT` naming the field before any request is sent. `RETRYABLE_CONFLICT` means another writer held the upload or the profiles for a moment. File-transfer commands retry the identical operation up to six times, waiting 2, 4, 8, 16 and 30 seconds; other media commands return the conflict for review. A failed asset cannot be completed again: `media complete` returns `UPLOAD_NOT_RESUMABLE` with reason `failed` or the canonical `abandoned` disposition, never an `uploaded` success.
863
863
 
864
864
  Upload sessions belong to the authorized connection that started them. Use that connection to inspect a session, resume, sign parts, complete or cancel it; another connection receives `NOT_FOUND`. `media get` and `media status` remain authorized app reads. To cancel another connection's upload in an app you manage, use `media delete` with its preview and confirmation.
865
865
 
@@ -91,11 +91,15 @@ fold-posture support.
91
91
 
92
92
  ## Focus scrolling
93
93
 
94
- Vertical TV scroll views and virtualized lists park focused content 80 authoring
95
- units below the viewport top, clamped so the focused item fits and the page stays
96
- inside its scroll range. Moving sideways in a visible row keeps its vertical
97
- position. Horizontal lists reveal only the needed overflow; touch scrolling stays
98
- native. `ScrollView` and `FlashList` accept a `viewportOffset` override.
94
+ Vertical TV scroll views park focused content 80 authoring units below the viewport
95
+ top, clamped so the focused item fits and the page stays inside its scroll range.
96
+ Moving sideways in a visible row keeps its vertical
97
+ position. Native and web TV FlashLists align focus toward the leading edge when
98
+ moving right or down, and toward the trailing edge when moving left or up.
99
+ Reversals scroll at most two item lengths per move unless more movement is needed to reveal focus; content
100
+ boundaries limit every destination. Horizontal lists respect their leading content
101
+ padding and `scrollPaddingStart`. Touch scrolling stays native. `ScrollView` and
102
+ `FlashList` accept a vertical `viewportOffset` override.
99
103
 
100
104
  TV focus scrolling animates in the runtime. Repeated remote input retargets the
101
105
  current motion instead of starting competing animations. System reduced motion
@@ -121,7 +121,8 @@ function validateJournal(value, appId) {
121
121
  value.schema !== 1 || value.appId !== appId || !UUID.test(value.operationId) ||
122
122
  !SHA256.test(value.digest) || !value.request || typeof value.request !== 'object' ||
123
123
  Array.isArray(value.request) ||
124
- !exactKeys(value.request, ['app_id', 'lease_id', 'chat_session_id', 'epoch', 'operation_id', 'files']) ||
124
+ !exactKeys(value.request, ['app_id', 'lease_id', 'chat_session_id', 'epoch', 'operation_id', 'files', ...(value.request.task_id === undefined ? [] : ['task_id'])]) ||
125
+ value.request.task_id !== undefined && !UUID.test(value.request.task_id) ||
125
126
  value.request.app_id !== appId ||
126
127
  value.request.operation_id !== value.operationId ||
127
128
  !UUID.test(value.request.lease_id) || !UUID.test(value.request.chat_session_id) ||
@@ -187,7 +188,8 @@ function validatedTerminal(value, journal) {
187
188
  !['committed', 'mixed'].includes(value.state) ||
188
189
  value.operationId !== journal.operationId ||
189
190
  (value.appId !== undefined && value.appId !== journal.appId) ||
190
- Object.keys(value).some(key => !['state', 'operationId', 'appId', 'files', 'draftRevision', 'replay', 'previewUrl'].includes(key)) ||
191
+ Object.keys(value).some(key => !['state', 'operationId', 'appId', 'files', 'draftRevision', 'replay', 'previewUrl', 'task'].includes(key)) ||
192
+ value.task !== undefined && (!exactKeys(value.task, ['taskId', 'saveToken', 'settled']) || !UUID.test(value.task.taskId) || !UUID.test(value.task.saveToken) || typeof value.task.settled !== 'boolean' || journal.request.task_id !== undefined && value.task.taskId.toLowerCase() !== journal.request.task_id.toLowerCase()) ||
191
193
  value.previewUrl !== undefined && !isPreviewUrl(value.previewUrl) ||
192
194
  !Array.isArray(value.files) || value.files.length !== journal.submitted.length)
193
195
  refuse('Save result does not match the pending operation.');
@@ -273,7 +275,8 @@ function prepareSaveLocked(destination, appId, session, options) {
273
275
  if (files.length === 0) return { state: 'no_changes', appId };
274
276
  const operationId = randomUUID();
275
277
  const request = { app_id: appId, lease_id: session.leaseId,
276
- chat_session_id: session.chatSessionId, epoch: session.epoch, operation_id: operationId, files };
278
+ chat_session_id: session.chatSessionId, epoch: session.epoch, operation_id: operationId, files, ...(options.taskId ? { task_id: options.taskId } : {}) };
279
+ if (options.taskId !== undefined && !UUID.test(options.taskId)) refuse('Invalid app task id.');
277
280
  if (Buffer.byteLength(JSON.stringify(request), 'utf8') > MAX_REQUEST_BYTES)
278
281
  refuse('Serialized save request exceeds the HTTP body limit.');
279
282
  const journal = journalFor(appId, request);
@@ -409,7 +412,7 @@ function applySaveLocked(destination, appId, response, options) {
409
412
  }
410
413
  if (changedManifest) writeAtomic(root, MANIFEST, manifestText(manifest));
411
414
  const report = { schema: 1, appId, operationId: journal.operationId,
412
- state: 'settled', outcomes, ...(previewUrl === undefined ? {} : { previewUrl }) };
415
+ state: 'settled', outcomes, ...(terminal.task ? { task: terminal.task } : {}), ...(previewUrl === undefined ? {} : { previewUrl }) };
413
416
  writeAtomic(root, SAVE_OUTCOME, JSON.stringify(report) + '\n');
414
417
  const requestPath = assertSafeTarget(root, SAVE_REQUEST);
415
418
  if (lstatIfPresent(requestPath)) {