zidane 7.0.14 → 7.0.16

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.
Files changed (124) hide show
  1. package/README.md +18 -9
  2. package/dist/{acp-CZpX91YE.js → acp-Bw2b_kka.js} +3 -3
  3. package/dist/{acp-CZpX91YE.js.map → acp-Bw2b_kka.js.map} +1 -1
  4. package/dist/acp-cli.js +4 -4
  5. package/dist/acp.d.ts +1 -1
  6. package/dist/acp.js +1 -1
  7. package/dist/{agent-B1jsFaDq.js → agent-B_uQo4f1.js} +649 -48
  8. package/dist/agent-B_uQo4f1.js.map +1 -0
  9. package/dist/agent.d.ts +1 -1
  10. package/dist/agent.js +1 -1
  11. package/dist/{anthropic-Da39cE-d.js → anthropic-QbHqqTkV.js} +2 -2
  12. package/dist/{anthropic-Da39cE-d.js.map → anthropic-QbHqqTkV.js.map} +1 -1
  13. package/dist/{approvals-S100xf1d.js → approvals-B9aIQJRQ.js} +287 -45
  14. package/dist/approvals-B9aIQJRQ.js.map +1 -0
  15. package/dist/artifacts-CV2hUKnL.js +112 -0
  16. package/dist/artifacts-CV2hUKnL.js.map +1 -0
  17. package/dist/{auth-DfEWnkC7.js → auth-plw6npda.js} +19 -7
  18. package/dist/auth-plw6npda.js.map +1 -0
  19. package/dist/chat/pure.d.ts +3 -3
  20. package/dist/chat/pure.js +1 -1
  21. package/dist/chat.d.ts +6 -6
  22. package/dist/chat.js +5 -5
  23. package/dist/contexts/daytona.d.ts +1 -1
  24. package/dist/contexts/e2b.d.ts +1 -1
  25. package/dist/daemon-cli.js +1 -1
  26. package/dist/eval.d.ts +1 -1
  27. package/dist/eval.js +1 -1
  28. package/dist/extensions.d.ts +2 -2
  29. package/dist/extensions.js +2 -2
  30. package/dist/headless.d.ts +1 -1
  31. package/dist/headless.js +2 -2
  32. package/dist/{index-DFGECPfm.d.ts → index-Dc_zYpEu.d.ts} +351 -2
  33. package/dist/index-Dc_zYpEu.d.ts.map +1 -0
  34. package/dist/{index-DP7xYXr9.d.ts → index-Df2CH6bn.d.ts} +92 -7
  35. package/dist/index-Df2CH6bn.d.ts.map +1 -0
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.js +7 -6
  38. package/dist/{ipc-BLLscoIl.js → ipc-T_pPnHkp.js} +2 -2
  39. package/dist/{ipc-BLLscoIl.js.map → ipc-T_pPnHkp.js.map} +1 -1
  40. package/dist/ipc.d.ts +54 -6
  41. package/dist/ipc.d.ts.map +1 -1
  42. package/dist/ipc.js +3 -3
  43. package/dist/mcp.d.ts +1 -1
  44. package/dist/{oauth-C4GvY_p1.js → oauth-EIBUuSDK.js} +2 -2
  45. package/dist/{oauth-C4GvY_p1.js.map → oauth-EIBUuSDK.js.map} +1 -1
  46. package/dist/output/stream-json.d.ts +1 -1
  47. package/dist/output/terminal.d.ts +1 -1
  48. package/dist/plugins.d.ts +1 -1
  49. package/dist/presets.d.ts +2 -2
  50. package/dist/presets.js +2 -2
  51. package/dist/providers/anthropic.d.ts +1 -1
  52. package/dist/providers/anthropic.js +1 -1
  53. package/dist/providers/arcee.d.ts +1 -1
  54. package/dist/providers/baseten.d.ts +1 -1
  55. package/dist/providers/cerebras.d.ts +1 -1
  56. package/dist/providers/local.d.ts +1 -1
  57. package/dist/providers/openai-compat.d.ts +1 -1
  58. package/dist/providers/openai.d.ts +1 -1
  59. package/dist/providers/openai.js +1 -1
  60. package/dist/providers/openrouter.d.ts +1 -1
  61. package/dist/providers/xai.d.ts +1 -1
  62. package/dist/providers/xai.js +2 -2
  63. package/dist/{providers-BYgyPb15.js → providers-CoK1rZ1p.js} +2 -2
  64. package/dist/{providers-BYgyPb15.js.map → providers-CoK1rZ1p.js.map} +1 -1
  65. package/dist/providers.d.ts +1 -1
  66. package/dist/providers.js +3 -3
  67. package/dist/restate.d.ts +1 -1
  68. package/dist/restate.js +1 -1
  69. package/dist/{server-C8gULJ0d.js → server-DXM8ZbGi.js} +64 -6
  70. package/dist/server-DXM8ZbGi.js.map +1 -0
  71. package/dist/session/sqlite.d.ts +1 -1
  72. package/dist/session/sqlite.d.ts.map +1 -1
  73. package/dist/session/sqlite.js +117 -1
  74. package/dist/session/sqlite.js.map +1 -1
  75. package/dist/{session-K3icbPH9.js → session-DPZnncaQ.js} +60 -1
  76. package/dist/session-DPZnncaQ.js.map +1 -0
  77. package/dist/session.d.ts +2 -2
  78. package/dist/session.js +3 -2
  79. package/dist/skills.d.ts +1 -1
  80. package/dist/{tool-formatters-C-s_-u0v.d.ts → tool-formatters-BgdOYAy9.d.ts} +2 -2
  81. package/dist/{tool-formatters-C-s_-u0v.d.ts.map → tool-formatters-BgdOYAy9.d.ts.map} +1 -1
  82. package/dist/tools/fetch-url.d.ts +1 -1
  83. package/dist/tools/web-search.d.ts +1 -1
  84. package/dist/tools.d.ts +2 -2
  85. package/dist/tools.js +2 -2
  86. package/dist/{transcript-anchors-D1ToF-EW.d.ts → transcript-anchors-CtnwuQJM.d.ts} +3 -3
  87. package/dist/transcript-anchors-CtnwuQJM.d.ts.map +1 -0
  88. package/dist/tui.d.ts +3 -3
  89. package/dist/tui.d.ts.map +1 -1
  90. package/dist/tui.js +576 -102
  91. package/dist/tui.js.map +1 -1
  92. package/dist/{turn-operations-CZLsNgw-.js → turn-operations-DkJ1R0p8.js} +4 -3
  93. package/dist/turn-operations-DkJ1R0p8.js.map +1 -0
  94. package/dist/{turn-operations-Bp5-BAki.d.ts → turn-operations-khAvr7KJ.d.ts} +5 -3
  95. package/dist/turn-operations-khAvr7KJ.d.ts.map +1 -0
  96. package/dist/types.d.ts +1 -1
  97. package/dist/{xai-DILdFGzN.js → xai-CazjStOK.js} +3 -3
  98. package/dist/{xai-DILdFGzN.js.map → xai-CazjStOK.js.map} +1 -1
  99. package/docs/ACP.md +6 -0
  100. package/docs/ARCHITECTURE.md +179 -356
  101. package/docs/ARTIFACTS.md +130 -0
  102. package/docs/CHAT.md +426 -1312
  103. package/docs/EXECUTION_CONTEXT.md +46 -19
  104. package/docs/EXTENSIONS.md +234 -584
  105. package/docs/HEADLESS.md +5 -0
  106. package/docs/INTERACTIONS.md +21 -22
  107. package/docs/IPC.md +318 -335
  108. package/docs/PLUGINS.md +2 -0
  109. package/docs/README.md +57 -0
  110. package/docs/RESTATE.md +199 -491
  111. package/docs/RUN_IN_BACKGROUND.md +107 -558
  112. package/docs/SKILL.md +171 -238
  113. package/docs/TUI.md +213 -591
  114. package/package.json +1 -1
  115. package/dist/agent-B1jsFaDq.js.map +0 -1
  116. package/dist/approvals-S100xf1d.js.map +0 -1
  117. package/dist/auth-DfEWnkC7.js.map +0 -1
  118. package/dist/index-DFGECPfm.d.ts.map +0 -1
  119. package/dist/index-DP7xYXr9.d.ts.map +0 -1
  120. package/dist/server-C8gULJ0d.js.map +0 -1
  121. package/dist/session-K3icbPH9.js.map +0 -1
  122. package/dist/transcript-anchors-D1ToF-EW.d.ts.map +0 -1
  123. package/dist/turn-operations-Bp5-BAki.d.ts.map +0 -1
  124. package/dist/turn-operations-CZLsNgw-.js.map +0 -1
@@ -0,0 +1,130 @@
1
+ # Session artifacts
2
+
3
+ An **artifact** is a durable, typed pointer to something a session produced outside its transcript: a pull request, a branch, a commit, a created file, a deployment, an issue. The session stores the locator and small metadata; the content stays where it lives.
4
+
5
+ - **Model / store:** `src/session/artifacts.ts`, `SessionStore` artifact methods in `src/session/index.ts`
6
+ - **Producers:** the `metadata.artifacts` tool-result namespace, lifted by `src/loop.ts`
7
+ - **Kinds:** `src/extensions/builtin-artifact-kinds.ts` + `ctx.registerArtifactKind`
8
+ - **Surfaces:** TUI `/artifacts` · GUI Artifacts modal · sessions-list badge · `#pr` completion
9
+ - **IPC:** `sessions.artifacts`, `artifacts.list` / `delete` / `upsert`; signals `artifact:recorded`, `artifact:changed`
10
+
11
+ Contents: [Model](#model) · [Producers](#producers) · [Storage](#storage) · [Extension API](#extension-api) · [Surfaces](#surfaces) · [IPC](#ipc) · [Lazy refresh](#lazy-refresh) · [Known gaps](#known-gaps)
12
+
13
+ ## Model
14
+
15
+ ```ts
16
+ interface SessionArtifact {
17
+ id: string // uuid, stable across upserts
18
+ sessionId: string
19
+ runId?: string // producing run (a subagent's own run id)
20
+ turnId?: string // producing loop turn — the transcript anchor
21
+ kind: string // open string: 'pull_request' | 'branch' | 'commit' | 'file' | '<ext>.<kind>'
22
+ uri: string // canonical locator: URL, file://<abs>, git:commit:<sha>, git:branch:<name>
23
+ label: string // human line; the rendering fallback
24
+ projectRoot?: string // where it landed (may differ from the session's root)
25
+ meta?: JsonValue // kind-specific, ≤ 16 KB
26
+ createdAt: number
27
+ updatedAt: number
28
+ }
29
+ ```
30
+
31
+ | Rule | Value |
32
+ |---|---|
33
+ | Identity | `(sessionId, kind, uri)`. Re-emitting upserts: keeps `id` / `runId` / `turnId` / `createdAt`, refreshes `label` / `meta` / `projectRoot` / `updatedAt`. |
34
+ | Cap | 200 per session. On overflow, `file` artifacts are evicted first, oldest first. |
35
+ | Bounds | `kind` `[\w.:-]+` ≤ 64 chars · `uri` ≤ 2048 · `label` ≤ 512 (clipped) · `meta` ≤ 16 KB (dropped, artifact kept). |
36
+ | `projectRoot` | Defaults to the session's root. `file` artifacts get the git root of the landed path when the execution runs on the host (`process` handle); docker/remote paths keep the session default. |
37
+ | Subagents | Land on the shared parent session under the child's `runId`. |
38
+ | Unknown kinds | Always render as `label` + `uri`. Rows are never dropped because a kind's extension is gone. |
39
+
40
+ Artifacts are **not** part of `SessionData`: `load()` / `save()` / export / compaction / ACP never see them.
41
+
42
+ ## Producers
43
+
44
+ All three paths converge on one channel — the reserved `artifacts` key of tool-result metadata — so bounds, normalization, and hooks are identical.
45
+
46
+ | Path | How |
47
+ |---|---|
48
+ | **Tool-result metadata** | Any `tool:transform` hook appends `SessionArtifactInput[]` to `ctx.metadata.artifacts`. After the tool settles, the loop normalizes each entry (`normalizeArtifactInput`), canonicalizes `file:` URIs against the execution cwd, and calls `session.addArtifact`. ≤ 50 entries per tool result. |
49
+ | **Built-in detectors** (`artifactsPreset`) | Keyed on the command or tool name, never on free text: `gh pr create` / `glab mr create` / `*create_pull_request` → `pull_request` · `git commit` → `commit` · `git switch -c` / `checkout -b` / `push -u` → `branch` · `write_file` that *creates* → `file`. Composed under every TUI / daemon / GUI profile; SDK users opt in with `composePresets(artifactsPreset, …)`. |
50
+ | **`record_artifact` tool** | Explicit path for what detection can't see: a PR opened from a background shell task, a deployment URL, an issue. Input `{ kind, uri, label?, meta? }`; the preset's detector reads the input and emits it. |
51
+
52
+ Emission is best-effort: a store failure never fails the tool call, and the persisted turn / wire payload are byte-identical with or without artifacts. Each stored artifact fires `artifact:recorded` (`child:artifact:recorded` when bubbled from a subagent).
53
+
54
+ ## Storage
55
+
56
+ `SessionStore` gains three **optional** methods; stores that omit them (file-map, remote, third-party) keep working and `Session.addArtifact` no-ops.
57
+
58
+ ```ts
59
+ upsertArtifact?(artifact: SessionArtifact): Promise<SessionArtifact | null> // null: unknown session
60
+ listArtifacts?(filter?: { sessionId?, projectRoot?: string | null, kind?, uri?, since?, limit? }): Promise<SessionArtifact[]>
61
+ deleteArtifact?(sessionId: string, artifactId: string): Promise<void>
62
+ ```
63
+
64
+ `Session` exposes `addArtifact(input, { runId?, turnId? })` and `listArtifacts(filter)`. `SessionMetaRow.artifactCount?` powers badges without a `load()`.
65
+
66
+ **SQLite:** an additive `artifacts` table (FK → `sessions` with `ON DELETE CASCADE`, unique `(session_id, kind, uri)`, indexes on session / project+kind / kind+uri). Created after `migrate()` with `CREATE TABLE IF NOT EXISTS`; `user_version` is unchanged (4), so older builds sharing the DB keep working. `projectRoot: null` in a filter selects untagged sessions; omitting it ignores the axis.
67
+
68
+ ## Extension API
69
+
70
+ ```ts
71
+ ctx.registerArtifactKind({
72
+ kind: 'coolify.deployment',
73
+ label: 'Deployment',
74
+ detect?: ({ tool, input, result, isError }) => ArtifactDetection | ArtifactDetection[] | undefined,
75
+ validateMeta?: (meta) => boolean, // failing → meta dropped, artifact kept (own detections only)
76
+ render?: (artifact) => { title, subtitle?, href?, status? },
77
+ resolve?: async (artifact) => ({ label?, meta? }), // lazy refresh, see below
78
+ })
79
+ ctx.tui.registerArtifactRenderer({ kind, renderDetail: artifact => <Pane /> }) // TUI detail pane
80
+ ctx.artifacts.list({ scope: 'session' | 'project' | 'all', kind?, since?, limit? })
81
+ ctx.artifacts.find(kind, uri) // reverse lookup across sessions
82
+ ctx.registerHook('artifact:recorded', ({ artifact, runId, turnId }) => …)
83
+ ```
84
+
85
+ - Kinds are a global namespace; first registration wins (logged). Built-ins use the same API and can be refined by an extension re-registering the kind.
86
+ - `detect` rides `tool:transform` and `child:tool:transform` but can only append to `metadata.artifacts`; it never changes what the model sees. A throwing detector emits nothing.
87
+ - `ctx.artifacts` is late-bound (like `ctx.sessions`): `[]` when detached or when the store lacks artifact support.
88
+ - Row presentation goes through `renderArtifactRow(artifact, registry)`: registry kind → built-in kind → `label` + `uri` fallback. A throwing `render` falls back.
89
+
90
+ Authoring example: [EXTENSIONS.md → Session artifacts](./EXTENSIONS.md#session-artifacts).
91
+
92
+ ## Surfaces
93
+
94
+ | Surface | Behavior |
95
+ |---|---|
96
+ | `/artifacts [project]` | TUI opens the modal; daemon / GUI hosts without a modal emit a markdown list. Session scope by default. |
97
+ | TUI modal (`ctrl+shift+a`) | Grouped by kind (built-ins first). `↵` open href (browser / editor) · `tab` session ↔ project · `c` copy locator · `d` remove. Re-queries on `artifact:recorded` / `artifact:changed`. Extension `renderDetail` mounts under the list in an error boundary. |
98
+ | GUI modal (`⌃⇧A`) | Same scopes; rows pre-rendered main-side (`artifacts:list` IPC) so the renderer stays node-free. Hover → copy / remove. |
99
+ | Sessions list | `N artifacts` badge from `artifactCount` (hidden at 0 or when the store doesn't report it). |
100
+ | `#` completion | Shares the trigger with chats. `#pr` / `#br` / `#file` rank by kind alias; selecting inserts the locator as plain text (no reference grammar). |
101
+
102
+ Reads are **daemon-authoritative** when a daemon is attached (`sessions.artifacts` / `artifacts.list`); the window's own store handle is used only in the local runtime or against a pre-artifact daemon.
103
+
104
+ ## IPC
105
+
106
+ | Method / signal | Purpose |
107
+ |---|---|
108
+ | `sessions.artifacts { sessionId, kind?, limit? }` | One session's artifacts, newest first |
109
+ | `artifacts.list { projectRoot?, kind?, uri?, since?, limit? }` | Cross-session query; `projectRoot: null` = untagged |
110
+ | `artifacts.delete { sessionId, artifactId }` | Remove; fans out `artifact:changed` |
111
+ | `artifacts.upsert { artifact }` | Lazy-refresh write-back; input re-normalized; fans out `artifact:changed` |
112
+ | `artifact:recorded { sessionId, artifact }` | The loop stored an artifact |
113
+ | `artifact:changed { sessionId, op: 'delete' \| 'upsert', artifactId, artifact? }` | Host-side mutation |
114
+
115
+ All additive: a pre-artifact daemon rejects the methods and clients treat that as empty.
116
+
117
+ ## Lazy refresh
118
+
119
+ `resolve()` is never polled. UIs call it once per focused row per open (`refreshArtifact(artifact, registry)`), persist the patched row through the store or `artifacts.upsert`, and the change signal re-converges other windows. The built-in `pull_request` resolver queries the GitHub API (bearer token from `GITHUB_TOKEN` / `GH_TOKEN` when set, 4 s timeout), writes `meta.state` (`open` / `draft` / `merged` / `closed`), `title`, `resolvedAt`, and skips terminal states and entries fresher than 5 minutes.
120
+
121
+ ## Known gaps
122
+
123
+ - **PR / commit / branch attribution.** Detected from shell output, these carry no local path, so `projectRoot` is the session's root; `cd ../other && gh pr create` files under the current project. Fix needs the execution cwd on the detect outcome plus `cd` parsing, or an `owner/repo` → checkout map.
124
+ - **Staleness.** `git commit --amend` records a second commit; deleted files/branches persist until removed (`d` / `×`).
125
+ - **Remote / file-map stores** don't implement artifacts (by design); everything degrades to empty.
126
+ - **Background shells.** Output that never reaches a tool result isn't detected; `record_artifact` is the model's escape hatch.
127
+
128
+ ## Tests
129
+
130
+ `test/session-artifacts.test.ts` (stores) · `test/loop-artifacts.test.ts` (lift + canonicalization) · `test/extensions/artifacts.test.ts` (kinds, detectors, `record_artifact`, `resolve`) · `test/chat/artifacts-view.test.ts` · `test/chat/completion-artifacts.test.ts` · `test/tui/artifacts-modal.test.tsx` · `test/tui-daemon-runtime.test.ts` · `test/ipc-daemon.test.ts` · GUI: `engine.artifacts.test.ts`, `ArtifactsProvider.test.tsx`.