@ai-ecoverse/slicc-agent 7.23.0 → 7.24.0

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/README.md CHANGED
@@ -164,7 +164,7 @@ The first provider is AWS Bedrock with a Bedrock API key as the bearer token; th
164
164
 
165
165
  ### In slicc-spectrum
166
166
 
167
- `@ai-ecoverse/slicc-spectrum` is an optional peer dependency, `^1.112.0 || ^2.0.0`. 1.112.0 makes an approval verdict's `decision` optional, which the agent no longer sends. 1.102.0 types a guest tool approval's `args` and `argsTruncated`, and 1.103.0 shows a device sign-in's `signIn` code and link in Settings. 1.107.0 heads the budget with its provider: the tray's `budget.provider` and the Monitor vital's `provider` and `window` (older releases ignore them). 1.94.0 is the first release with the provider picker (`providers()`, `remove`, `vaultName`, `customBase`, a field's `options` and `value`); 1.94.1 shows a field with `options` as an `sp-picker` on its `value`; 1.95.0 shows a `blocked` provider in the picker as unpickable with “Needs the SLICC extension or CLI”; 1.96.0 registers an MCP token's server URL (`Account.url`) with the vault itself, after a “Connect to {url}?” confirm, and offers Reconnect when the URL moves; and 1.98.0 saves a field's value as its `vaultSetting` on the vault record (`VaultPort.settings`, V3). `test/integration/settings-ui.test.mjs` checks each in a real `<slicc-settings>`: Bedrock's region picker on the stored region, a blocked provider that can't be picked until a CORS-free route appears, the moved note once `mcp.json` points a connected server elsewhere, and that adding Cloudflare Workers AI or Azure (by resource name) puts the key with its tenant fields as the record's vault `settings` (`CLOUDFLARE_ACCOUNT_ID`, `AZURE_OPENAI_RESOURCE_NAME`).
167
+ `@ai-ecoverse/slicc-spectrum` is an optional peer dependency, `^2.4.1`. 2.4.1 is the first release with a capture approval (`CaptureApproval`), which the agent's approvals list sends. 1.112.0 makes an approval verdict's `decision` optional, which the agent no longer sends. 1.102.0 types a guest tool approval's `args` and `argsTruncated`, and 1.103.0 shows a device sign-in's `signIn` code and link in Settings. 1.107.0 heads the budget with its provider: the tray's `budget.provider` and the Monitor vital's `provider` and `window` (older releases ignore them). 1.94.0 is the first release with the provider picker (`providers()`, `remove`, `vaultName`, `customBase`, a field's `options` and `value`); 1.94.1 shows a field with `options` as an `sp-picker` on its `value`; 1.95.0 shows a `blocked` provider in the picker as unpickable with “Needs the SLICC extension or CLI”; 1.96.0 registers an MCP token's server URL (`Account.url`) with the vault itself, after a “Connect to {url}?” confirm, and offers Reconnect when the URL moves; and 1.98.0 saves a field's value as its `vaultSetting` on the vault record (`VaultPort.settings`, V3). `test/integration/settings-ui.test.mjs` checks each in a real `<slicc-settings>`: Bedrock's region picker on the stored region, a blocked provider that can't be picked until a CORS-free route appears, the moved note once `mcp.json` points a connected server elsewhere, and that adding Cloudflare Workers AI or Azure (by resource name) puts the key with its tenant fields as the record's vault `settings` (`CLOUDFLARE_ACCOUNT_ID`, `AZURE_OPENAI_RESOURCE_NAME`).
168
168
 
169
169
  `@ai-ecoverse/slicc-agent/spectrum` turns an `AgentConnection` into slicc-spectrum's `AgentPort`, so `<slicc-app>` shows the real agent:
170
170
 
@@ -181,7 +181,7 @@ The adapter keeps the replicated transcript and maps it on every update. User, a
181
181
 
182
182
  **Older messages.** An agent's view is durable's window, its newest 50 to 100 entries, approval verdicts and other entries the chat doesn't show included, so by itself it holds only the last few turns. The adapter keeps each agent's whole transcript in a pi-durable `ConversationTranscript` instead: every view merges into it, so messages the window drops stay, and a window that jumps ahead (a reconnect, a burst) leaves a gap the adapter fills at once, from its newest side, up to 40 pages (4,000 entries) per gap. A bigger jump keeps only the newest entries, contiguous, and the rest comes back through `older()`, so a gap never downloads a whole conversation. `older(agentId, before)` loads earlier pages of 100 entries through `AgentControl.entries` until at least one message older than the message `before` appears, or the conversation starts, and resolves the messages before `before` (before the first message when `before` is unknown); `messages(agentId)` holds them from then on, and the change emits `messages`. An empty answer means the start is reached, and `hasOlder(agentId)` says whether there is more. Concurrent calls share one load, an agent's older answers never count as unread, a notice stays after the last committed message it followed (not after a reply still streaming, a queued input or a retry, whose ids change), and a new conversation (New chat, a rewind's fork) starts a new transcript. `AgentControl.entries({ agentId, conversation, minEntryId?, maxEntryId?, order?, limit? })` answers `{ conversation, entries, more }`: a page of the agent's fork-aware history (`Conversation.entries()`), at most 200 entries, slimmed like the views (large images become thumbnails; a page waits at most 2 s for its own thumbnails, then answers with a placeholder), and an empty page when `conversation` is no longer the agent's. Owner, control and view-only seats have it. A view-only seat's `image` answers the full image of an entry only while the entry is in a current view, or when that seat itself read it through `entries` and the entry is still in that agent's current conversation (checked again on each call, so a page read before a rewind or a new chat, or by another seat, grants nothing); guests see only their window, and so does an adapter on an older agent whose control service doesn't offer `entries` (`connection.history` is `true` only when it does; `older()` then answers `[]` and `hasOlder()` `false`).
183
183
 
184
- Each cone's active conversation is in the session document `slicc.agents` (the root until the first rewind). The host's transcript follows it across forks. Rewinding is refused while the cone itself is running or has queued input, because a fork starts with an empty inbox, but never because its scoops are busy (see Cones and scoops). A background compaction still running on the old branch finishes there. A fork also starts with fresh `pi.usage`. Credential and model errors lead with a plain sentence ("Bedrock rejected the API key.", "This model isn't available with the current account.") and keep the provider's raw error as `detail`, which spectrum (≥ 1.11.0) shows underneath. `busy()` and `queue()` read durable's live and inbox documents. Steering is the default (#4): a send or a steer goes out with `whenBusy: 'steer'`, so while a run is going it joins after the current tool round, and a `queue` send is a follow-up. User messages carry `delivered` from the host's deliveries; entries the host didn't record (from before a reload) count as steered when they follow a tool result. Cones and scoops are below; the freezer and questions come later. Licks show as spectrum's lick cards (below). slicc-spectrum is an optional peer dependency (`^1.112.0 || ^2.0.0`, the lowest whose monitor, tray, panel, guest seat, guest approval (with `args` and `argsTruncated`, and a verdict without `decision`) and profile import types match the agent's; `npm run typecheck` fails on anything older), used for types only, so package managers don't install it next to the agent.
184
+ Each cone's active conversation is in the session document `slicc.agents` (the root until the first rewind). The host's transcript follows it across forks. Rewinding is refused while the cone itself is running or has queued input, because a fork starts with an empty inbox, but never because its scoops are busy (see Cones and scoops). A background compaction still running on the old branch finishes there. A fork also starts with fresh `pi.usage`. Credential and model errors lead with a plain sentence ("Bedrock rejected the API key.", "This model isn't available with the current account.") and keep the provider's raw error as `detail`, which spectrum (≥ 1.11.0) shows underneath. `busy()` and `queue()` read durable's live and inbox documents. Steering is the default (#4): a send or a steer goes out with `whenBusy: 'steer'`, so while a run is going it joins after the current tool round, and a `queue` send is a follow-up. User messages carry `delivered` from the host's deliveries; entries the host didn't record (from before a reload) count as steered when they follow a tool result. Cones and scoops are below; the freezer and questions come later. Licks show as spectrum's lick cards (below). slicc-spectrum is an optional peer dependency (`^2.4.1`, the lowest whose monitor, tray, panel, guest seat, guest and capture approval (with `args` and `argsTruncated`, and a verdict without `decision`) and profile import types match the agent's; `npm run typecheck` fails on anything older), used for types only, so package managers don't install it next to the agent.
185
185
 
186
186
  Each agent in `list()` has a real `contextFill` and `unread`:
187
187
  - **`contextFill`** is the context the agent uses, as a share of its model's `contextWindow` from the settings' model list. The tokens are those of the newest assistant's usage after the active head, counted the way pi-ai's `calculateContextTokens` does (`totalTokens`, or input, output and both cache counts). Aborted and failed turns don't count. After a compaction, the kept turns' usage no longer counts. Until the next turn reports its usage, the fill is estimated the way pi does it, at four characters a token, over the summary and the kept entries (without the system prompt and tools). An unknown model also reads 0. The Monitor's "Fullest context" and its context alerts use the same functions (`src/context.ts`).
@@ -747,7 +747,7 @@ Every approval, of a guest's prompt, of a tool call in a run a guest started, of
747
747
  - **Lifetime:** an item waits 5 minutes unless its requester sets `expiresAt`, then settles `unanswered`. Pending guest items survive a reload of the worker; pending `sudo` and `capture` items are withdrawn (`restart`), because a reload ends the kernel's processes and the page's request. The document keeps every pending item and the last 100 settled ones.
748
748
  - **In the worker,** `AgentHost.approvals` has `request(draft, ctx)`, `decide(id, answer, reason, by, ctx)` (`by` is a `DecidedBy`, or `{ by, device }` to record the deciding device), `settled(id, ctx)` (resolves when the item leaves `pending`), `withdraw(id, reason, ctx)` and `withdrawSeat(seat, ctx)`, which withdraws a revoked seat's pending items.
749
749
  - **Over the link,** `AgentTranscript.approvals` replicates the items, and `AgentControl.decide(id, decision, reason, ctx)` answers one, for every owner device: the owner's pages and followers with or without Control, all with the same powers. `decidedBy` comes from the link's seat (`owner` for the owner's pages, `follower` for the others), and is only a record of who answered. A guest never gets `decide`.
750
- - **In spectrum** (1.112 on, which shows approvals in `<slicc-approvals>` with Always allow when `always` is true, as notices without `decide`, and the verdict's level), `createAgentModel` returns `approvals`, an `ApprovalsAdapter` for `SliccModel.approvals`. `list()` has the pending `user` items, oldest first, as spectrum's `Approval`s, with the cone's name as `agentName` and the item's own `always`, so a guest approval offers Always allow only when the policy did when it was asked. Every approval carries the judge's `verdict` once it lands, as `{ level?, aligned?, reason }` (spectrum 1.112 on shows the level; `aligned` is `true` at P over 0.8, or the chat model's answer), `judging: true` while the check runs and `verdictError` when there is none. Its `always` is the item's, so Always allow shows up only when a level 1 verdict offers it. `decide(id, decision, reason?)` rejects with the agent's message, and `ended` reports `answered`, `expired` or `withdrawn` for an item that left without this tab's decision. Every owner device's adapter has `decide`; a guest connection's doesn't. So a notice instead of a dialog shows only where nothing can answer. A `guest-tool` approval also carries `args`, the call's arguments pretty-printed as JSON (two-space indent), so spectrum can show them uncut when `summary` is empty. The worker runs every string in the arguments through the secrets scrub before it files the item, so `summary`, `detail.arguments` and `args` show a secret as its placeholder; the seat's Always rules still match the call's own arguments. `args` is capped at 64 KiB (65,536 UTF-16 code units, `ARGS_LENGTH`, never splitting a surrogate pair): longer arguments are sent as that prefix with `argsTruncated: true`, and spectrum must then offer only Deny and Always deny, never Allow, because the end wasn't seen.
750
+ - **In spectrum** (1.112 on, which shows approvals in `<slicc-approvals>` with Always allow when `always` is true, as notices without `decide`, and the verdict's level), `createAgentModel` returns `approvals`, an `ApprovalsAdapter` for `SliccModel.approvals`. `list()` has the pending `user` items, oldest first, as spectrum's `Approval`s, with the cone's name as `agentName` and the item's own `always`, so a guest approval offers Always allow only when the policy did when it was asked. Every approval carries the judge's `verdict` once it lands, as `{ level?, aligned?, reason }` (spectrum 1.112 on shows the level; `aligned` is `true` at P over 0.8, or the chat model's answer), `judging: true` while the check runs and `verdictError` when there is none. Its `always` is the item's, so Always allow shows up only when a level 1 verdict offers it. `decide(id, decision, reason?)` rejects with the agent's message, and `ended` reports `answered`, `expired` or `withdrawn` for an item that left without this tab's decision. Every owner device's adapter has `decide`; a guest connection's doesn't. So a notice instead of a dialog shows only where nothing can answer. A `capture` item is a `CaptureApproval`, with the guest items' `agentId`, `agentName`, `always` and verdict fields and the item's `detail` as it is (`what`, `mode`, `seconds?`, `system?`, `microphone?`, `device?`, `program`), which spectrum 2.4.1 on shows as its capture line. A `guest-tool` approval also carries `args`, the call's arguments pretty-printed as JSON (two-space indent), so spectrum can show them uncut when `summary` is empty. The worker runs every string in the arguments through the secrets scrub before it files the item, so `summary`, `detail.arguments` and `args` show a secret as its placeholder; the seat's Always rules still match the call's own arguments. `args` is capped at 64 KiB (65,536 UTF-16 code units, `ARGS_LENGTH`, never splitting a surrogate pair): longer arguments are sent as that prefix with `argsTruncated: true`, and spectrum must then offer only Deny and Always deny, never Allow, because the end wasn't seen.
751
751
  - **Kernel sudo:** `AgentOwner.approve(req, { signal, where? })` from `startAgent` takes slicc-kernel's sudo request as it comes to the kernel's `approve` hook and resolves `once`, `always` or `deny`. bios hands its hook to it while the agent runs, and to its own dialog otherwise. It rejects with `code: 'EAGAIN'` before anything is recorded when the agent can't take the request (released, restarting, or an older worker) or when the request's `kind` isn't `sudo`, such as a program's secret `ask`, so that's when to fall back; any other rejection is a deny. The request goes through `slicc.agent.sudo`, a service only the owner's pages get, and becomes a `sudo` item on the `user` tier with the kernel's `expiresAt`:
752
752
  - **Requester** comes from the kernel's process tag: `{ kind: 'agent', agentId }` is the cone or scoop by its name, `{ kind: 'user', where }` is the kernel user with `where` (`terminal:…` reads "a terminal", `follower:<device>` the `where` the page passes, such as "on Pat's phone", or "a linked device", with the device id kept as `requester.device`), and anything else is the kernel user alone.
753
753
  - **Detail:** the command as the kernel resolved it (`path` and the arguments, shell-quoted), `target`, `cwd`, `alwaysScope: 'cwd'` when `req.always === true`, since the kernel's Always writes a rule for that directory, and the kernel's facts for the judge: `stdin` (`tty`, `none`, `pipe` or `file`), `rootOnly` (for each path on the line, whether only root can change it) and `writable` (`req.always`, whether the kernel can record the line). Requests without them still work; `req.always: false` or `writable: false` means no Always.
@@ -764,7 +764,7 @@ Every approval, of a guest's prompt, of a tool call in a run a guest started, of
764
764
  - **Answers:** `approved` resolves its answer, and a judge's rejection resolves `{ answer: 'deny', message: 'capture: denied by the approval judge: <reason>' }`. Any other deny for a seat that only the `recent` set brought in, or for a seat that has ended or been revoked, resolves `{ answer: 'deny', message: "capture: a guest's job or crontab line is still running" }`. Anything else is `deny`.
765
765
  - **Always** records a narrow rule on the seat, `alwaysCaptures: [{ approval, what, mode, by, at }]`, shown on `GuestSeat` and removed by `AgentControl.guestAlwaysForget(seat, approval)` or with the seat. A later capture of the same `what` and `mode` from that seat resolves `always` without an item while `guests.always.tools` is on; anything else is asked.
766
766
  - **Ends:** when bios aborts `signal`, or the page's link closes, the item is withdrawn (`aborted`).
767
- - **In spectrum,** capture items are left out of `list()` until spectrum renders them; the judge and the other tiers still answer them, and `decide` still takes them.
767
+ - **In spectrum** (2.4.1 on), a capture item that waits for a person is listed like a guest tool call, as a `CaptureApproval` (see In spectrum above), so it shows in the same approvals dialog.
768
768
  - **With the host's own approvals:** bios has its own `approvals` port for sudo, and a page that spreads `{ ...bios, ...createAgentModel(connection) }` would lose it. Pass that port in instead, as `createAgentModel(connection, { approvals: biosPort })`. The returned port then lists both sets, oldest first, sends `decide` to whichever port listed the id, and passes on both ports' `approvals` and `ended` events. It has `decide` when either side can answer; asked for an item its owner can't answer, it rejects with "This request can't be answered in this tab." Without the option, it lists only the agent's items.
769
769
  - **Secret requests** (a program's `ask` on `/dev/sealed`, such as `fnox set NAME --ask` or `sealed ask NAME`) are bios's approvals of kind `secret`, and only a person answers them. They come in through `approvals: biosPort` and go out unchanged: the adapter lists them with the rest, oldest first, sends their `decide` (Deny, which cancels the vault's request) to bios, and passes on bios's `ended`. The value is typed, and a reveal allowed, only in the vault's own frame inside the dialog, so neither the agent nor the page sees it. They are never items in `slicc.approvals`, so the judge never gives them a verdict or an answer, whatever `sudo.approver` says, and `AgentOwner.approve` refuses them with `EAGAIN`.
770
770
 
@@ -72,6 +72,7 @@ function shown(item, agentName) {
72
72
  always: item.always,
73
73
  ...verdictOf(item)
74
74
  };
75
+ if (item.kind === "capture") return { ...guest, kind: "capture", detail: { ...item.detail } };
75
76
  if (item.kind === "guest-tool")
76
77
  return {
77
78
  ...guest,
@@ -88,7 +89,7 @@ function shown(item, agentName) {
88
89
  };
89
90
  }
90
91
  const NOT_HERE = "This request can't be answered in this tab.";
91
- const asked = (item) => item.kind !== "capture" && item.state === "pending" && item.tier === "user";
92
+ const asked = (item) => item.state === "pending" && item.tier === "user";
92
93
  class ApprovalsAdapter extends Emitter {
93
94
  #connection;
94
95
  #host;
@@ -120,7 +121,7 @@ class ApprovalsAdapter extends Emitter {
120
121
  const names = new Map(
121
122
  (this.#connection.agents?.value?.agents ?? []).map((agent) => [agent.id, agent.name])
122
123
  );
123
- return this.#items().filter(asked).filter((item) => !this.#mine.has(item.id)).sort((a, b) => a.createdAt - b.createdAt).map((item) => shown(item, names.get(item.agentId)));
124
+ return this.#items().filter((item) => asked(item) && !this.#mine.has(item.id)).sort((a, b) => a.createdAt - b.createdAt).map((item) => shown(item, names.get(item.agentId)));
124
125
  }
125
126
  #changed() {
126
127
  const items = new Map(this.#items().map((item) => [item.id, item]));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/spectrum/approvals-port.ts"],
4
- "sourcesContent": ["import type {\n Approval,\n ApprovalDecision,\n ApprovalEnd,\n ApprovalRequester,\n ApprovalsEvents,\n ApprovalsPort,\n GuestToolApproval,\n} from '@ai-ecoverse/slicc-spectrum/ui';\nimport { BACKGROUND_CONTEXT } from '@earendil-works/chord/context';\nimport { fits } from '../approvals/aligned.ts';\nimport type { CaptureApproval, Approval as Recorded } from '../approvals/record.ts';\nimport type { AgentConnection } from '../client.ts';\nimport { Emitter } from './emitter.ts';\n\nconst ENDS: Record<string, ApprovalEnd> = {\n approved: 'answered',\n rejected: 'answered',\n unanswered: 'expired',\n withdrawn: 'withdrawn',\n};\n\nexport const ARGS_LENGTH = 65_536;\n\nfunction pretty(text: string): string {\n try {\n return JSON.stringify(JSON.parse(text), null, 2);\n } catch {\n return text;\n }\n}\n\nfunction argsOf(text: string | undefined): Pick<GuestToolApproval, 'args' | 'argsTruncated'> {\n if (text === undefined) return {};\n const args = pretty(text);\n if (args.length <= ARGS_LENGTH) return { args };\n const end = /[\\uD800-\\uDBFF]/.test(args[ARGS_LENGTH - 1] as string)\n ? ARGS_LENGTH - 1\n : ARGS_LENGTH;\n return { args: args.slice(0, end), argsTruncated: true };\n}\n\nfunction requesterOf(item: Recorded): ApprovalRequester {\n const { kind, name, agentId, where } = item.requester;\n return {\n kind,\n name,\n ...(agentId ? { agentId } : {}),\n ...(where ? { where } : {}),\n };\n}\n\nfunction verdictOf(item: Recorded) {\n const { verdict, judging, verdictError } = item;\n return {\n ...(verdict\n ? {\n verdict: {\n ...(verdict.level ? { level: verdict.level } : {}),\n ...(verdict.aligned === undefined ? {} : { aligned: fits(verdict.aligned) }),\n reason: verdict.reason,\n },\n }\n : {}),\n ...(judging ? { judging: true } : {}),\n ...(verdictError ? { verdictError } : {}),\n };\n}\n\ntype Item = Exclude<Recorded, CaptureApproval>;\n\nexport function shown(item: Item, agentName: string | undefined): Approval {\n const base = {\n id: item.id,\n requester: requesterOf(item),\n createdAt: item.createdAt,\n expiresAt: item.expiresAt,\n };\n if (item.kind === 'sudo') {\n const { command, target, cwd, alwaysScope } = item.detail;\n return {\n ...base,\n kind: 'sudo',\n command,\n ...(target ? { target } : {}),\n ...(cwd ? { cwd } : {}),\n always: item.always,\n ...(alwaysScope ? { alwaysScope } : {}),\n ...verdictOf(item),\n };\n }\n const guest = {\n ...base,\n agentId: item.agentId,\n ...(agentName ? { agentName } : {}),\n always: item.always,\n ...verdictOf(item),\n };\n if (item.kind === 'guest-tool')\n return {\n ...guest,\n kind: 'guest-tool',\n tool: item.detail.tool,\n summary: item.detail.summary,\n ...argsOf(item.detail.arguments),\n };\n return {\n ...guest,\n kind: 'guest-message',\n text: item.detail.text,\n ...(item.detail.attachments.length\n ? { attachments: item.detail.attachments.map((file) => ({ ...file })) }\n : {}),\n };\n}\n\nexport type HostApprovals = ApprovalsPort;\n\nexport const NOT_HERE = \"This request can't be answered in this tab.\";\n\nconst asked = (item: Recorded): item is Item =>\n item.kind !== 'capture' && item.state === 'pending' && item.tier === 'user';\n\nexport class ApprovalsAdapter extends Emitter<ApprovalsEvents> implements ApprovalsPort {\n readonly #connection: AgentConnection;\n readonly #host: HostApprovals | undefined;\n readonly #ours: boolean;\n readonly #mine = new Set<string>();\n readonly #deciding = new Set<string>();\n #listed = new Set<string>();\n readonly decide?: (id: string, decision: ApprovalDecision, reason?: string) => Promise<void>;\n\n constructor(connection: AgentConnection, host?: HostApprovals) {\n super();\n this.#connection = connection;\n this.#host = host;\n this.#ours = !connection.guest;\n if (this.#ours || host?.decide) this.decide = (...args) => this.#route(...args);\n this.#listed = new Set(this.#agent().map((approval) => approval.id));\n connection.approvals?.subscribe(() => this.#changed());\n host?.on('approvals', () => this.emit('approvals', this.list()));\n host?.on('ended', (detail) => this.emit('ended', detail));\n }\n\n #items(): readonly Recorded[] {\n return this.#connection.approvals?.value ?? [];\n }\n\n list(): readonly Approval[] {\n return [...(this.#host?.list() ?? []), ...this.#agent()].sort(\n (a, b) => a.createdAt - b.createdAt\n );\n }\n\n #agent(): readonly Approval[] {\n const names = new Map(\n (this.#connection.agents?.value?.agents ?? []).map((agent) => [agent.id, agent.name])\n );\n return this.#items()\n .filter(asked)\n .filter((item) => !this.#mine.has(item.id))\n .sort((a, b) => a.createdAt - b.createdAt)\n .map((item) => shown(item, names.get(item.agentId)));\n }\n\n #changed(): void {\n const items = new Map(this.#items().map((item) => [item.id, item]));\n const listed = this.#agent();\n const now = new Set(listed.map((approval) => approval.id));\n for (const id of this.#listed) {\n if (now.has(id) || this.#mine.has(id) || this.#deciding.has(id)) continue;\n const state = items.get(id)?.state;\n this.emit('ended', { id, reason: (state && ENDS[state]) || 'answered' });\n }\n for (const id of this.#mine) {\n const item = items.get(id);\n if (!item || !asked(item)) this.#mine.delete(id);\n }\n this.#listed = now;\n this.emit('approvals', this.list());\n }\n\n #route(id: string, decision: ApprovalDecision, reason?: string): Promise<void> {\n const host = this.#host;\n if (host?.list().some((approval) => approval.id === id)) {\n if (!host.decide) return Promise.reject(new Error(NOT_HERE));\n return host.decide(id, decision, reason);\n }\n if (!this.#ours) return Promise.reject(new Error(NOT_HERE));\n return this.#decide(id, decision, reason);\n }\n\n async #decide(id: string, decision: ApprovalDecision, reason?: string): Promise<void> {\n this.#deciding.add(id);\n try {\n const answer = await this.#connection.control.decide(\n id,\n decision,\n reason ?? null,\n BACKGROUND_CONTEXT\n );\n if (!answer.done) throw new Error(answer.error);\n this.#mine.add(id);\n } finally {\n this.#deciding.delete(id);\n }\n this.#changed();\n }\n}\n"],
5
- "mappings": "AASA,SAAS,0BAA0B;AACnC,SAAS,YAAY;AAGrB,SAAS,eAAe;AAExB,MAAM,OAAoC;AAAA,EACxC,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AACb;AAEO,MAAM,cAAc;AAE3B,SAAS,OAAO,MAAsB;AACpC,MAAI;AACF,WAAO,KAAK,UAAU,KAAK,MAAM,IAAI,GAAG,MAAM,CAAC;AAAA,EACjD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,OAAO,MAA6E;AAC3F,MAAI,SAAS,OAAW,QAAO,CAAC;AAChC,QAAM,OAAO,OAAO,IAAI;AACxB,MAAI,KAAK,UAAU,YAAa,QAAO,EAAE,KAAK;AAC9C,QAAM,MAAM,kBAAkB,KAAK,KAAK,cAAc,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/ui';\nimport { BACKGROUND_CONTEXT } from '@earendil-works/chord/context';\nimport { fits } from '../approvals/aligned.ts';\nimport type { Approval as Item } from '../approvals/record.ts';\nimport type { AgentConnection } from '../client.ts';\nimport { Emitter } from './emitter.ts';\n\nconst ENDS: Record<string, ApprovalEnd> = {\n approved: 'answered',\n rejected: 'answered',\n unanswered: 'expired',\n withdrawn: 'withdrawn',\n};\n\nexport const ARGS_LENGTH = 65_536;\n\nfunction pretty(text: string): string {\n try {\n return JSON.stringify(JSON.parse(text), null, 2);\n } catch {\n return text;\n }\n}\n\nfunction argsOf(text: string | undefined): Pick<GuestToolApproval, 'args' | 'argsTruncated'> {\n if (text === undefined) return {};\n const args = pretty(text);\n if (args.length <= ARGS_LENGTH) return { args };\n const end = /[\\uD800-\\uDBFF]/.test(args[ARGS_LENGTH - 1] as string)\n ? ARGS_LENGTH - 1\n : ARGS_LENGTH;\n return { args: args.slice(0, end), argsTruncated: true };\n}\n\nfunction requesterOf(item: Item): ApprovalRequester {\n const { kind, name, agentId, where } = item.requester;\n return {\n kind,\n name,\n ...(agentId ? { agentId } : {}),\n ...(where ? { where } : {}),\n };\n}\n\nfunction verdictOf(item: Item) {\n const { verdict, judging, verdictError } = item;\n return {\n ...(verdict\n ? {\n verdict: {\n ...(verdict.level ? { level: verdict.level } : {}),\n ...(verdict.aligned === undefined ? {} : { aligned: fits(verdict.aligned) }),\n reason: verdict.reason,\n },\n }\n : {}),\n ...(judging ? { judging: true } : {}),\n ...(verdictError ? { verdictError } : {}),\n };\n}\n\nexport function shown(item: Item, agentName: string | undefined): Approval {\n const base = {\n id: item.id,\n requester: requesterOf(item),\n createdAt: item.createdAt,\n expiresAt: item.expiresAt,\n };\n if (item.kind === 'sudo') {\n const { command, target, cwd, alwaysScope } = item.detail;\n return {\n ...base,\n kind: 'sudo',\n command,\n ...(target ? { target } : {}),\n ...(cwd ? { cwd } : {}),\n always: item.always,\n ...(alwaysScope ? { alwaysScope } : {}),\n ...verdictOf(item),\n };\n }\n const guest = {\n ...base,\n agentId: item.agentId,\n ...(agentName ? { agentName } : {}),\n always: item.always,\n ...verdictOf(item),\n };\n if (item.kind === 'capture') return { ...guest, kind: 'capture', detail: { ...item.detail } };\n if (item.kind === 'guest-tool')\n return {\n ...guest,\n kind: 'guest-tool',\n tool: item.detail.tool,\n summary: item.detail.summary,\n ...argsOf(item.detail.arguments),\n };\n return {\n ...guest,\n kind: 'guest-message',\n text: item.detail.text,\n ...(item.detail.attachments.length\n ? { attachments: item.detail.attachments.map((file) => ({ ...file })) }\n : {}),\n };\n}\n\nexport type HostApprovals = ApprovalsPort;\n\nexport const NOT_HERE = \"This request can't be answered in this tab.\";\n\nconst asked = (item: Item) => item.state === 'pending' && item.tier === 'user';\n\nexport class ApprovalsAdapter extends Emitter<ApprovalsEvents> implements ApprovalsPort {\n readonly #connection: AgentConnection;\n readonly #host: HostApprovals | undefined;\n readonly #ours: boolean;\n readonly #mine = new Set<string>();\n readonly #deciding = new Set<string>();\n #listed = new Set<string>();\n readonly decide?: (id: string, decision: ApprovalDecision, reason?: string) => Promise<void>;\n\n constructor(connection: AgentConnection, host?: HostApprovals) {\n super();\n this.#connection = connection;\n this.#host = host;\n this.#ours = !connection.guest;\n if (this.#ours || host?.decide) this.decide = (...args) => this.#route(...args);\n this.#listed = new Set(this.#agent().map((approval) => approval.id));\n connection.approvals?.subscribe(() => this.#changed());\n host?.on('approvals', () => this.emit('approvals', this.list()));\n host?.on('ended', (detail) => this.emit('ended', detail));\n }\n\n #items(): readonly Item[] {\n return this.#connection.approvals?.value ?? [];\n }\n\n list(): readonly Approval[] {\n return [...(this.#host?.list() ?? []), ...this.#agent()].sort(\n (a, b) => a.createdAt - b.createdAt\n );\n }\n\n #agent(): readonly Approval[] {\n const names = new Map(\n (this.#connection.agents?.value?.agents ?? []).map((agent) => [agent.id, agent.name])\n );\n return this.#items()\n .filter((item) => asked(item) && !this.#mine.has(item.id))\n .sort((a, b) => a.createdAt - b.createdAt)\n .map((item) => shown(item, names.get(item.agentId)));\n }\n\n #changed(): void {\n const items = new Map(this.#items().map((item) => [item.id, item]));\n const listed = this.#agent();\n const now = new Set(listed.map((approval) => approval.id));\n for (const id of this.#listed) {\n if (now.has(id) || this.#mine.has(id) || this.#deciding.has(id)) continue;\n const state = items.get(id)?.state;\n this.emit('ended', { id, reason: (state && ENDS[state]) || 'answered' });\n }\n for (const id of this.#mine) {\n const item = items.get(id);\n if (!item || !asked(item)) this.#mine.delete(id);\n }\n this.#listed = now;\n this.emit('approvals', this.list());\n }\n\n #route(id: string, decision: ApprovalDecision, reason?: string): Promise<void> {\n const host = this.#host;\n if (host?.list().some((approval) => approval.id === id)) {\n if (!host.decide) return Promise.reject(new Error(NOT_HERE));\n return host.decide(id, decision, reason);\n }\n if (!this.#ours) return Promise.reject(new Error(NOT_HERE));\n return this.#decide(id, decision, reason);\n }\n\n async #decide(id: string, decision: ApprovalDecision, reason?: string): Promise<void> {\n this.#deciding.add(id);\n try {\n const answer = await this.#connection.control.decide(\n id,\n decision,\n reason ?? null,\n BACKGROUND_CONTEXT\n );\n if (!answer.done) throw new Error(answer.error);\n this.#mine.add(id);\n } finally {\n this.#deciding.delete(id);\n }\n this.#changed();\n }\n}\n"],
5
+ "mappings": "AASA,SAAS,0BAA0B;AACnC,SAAS,YAAY;AAGrB,SAAS,eAAe;AAExB,MAAM,OAAoC;AAAA,EACxC,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AACb;AAEO,MAAM,cAAc;AAE3B,SAAS,OAAO,MAAsB;AACpC,MAAI;AACF,WAAO,KAAK,UAAU,KAAK,MAAM,IAAI,GAAG,MAAM,CAAC;AAAA,EACjD,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,OAAO,MAA6E;AAC3F,MAAI,SAAS,OAAW,QAAO,CAAC;AAChC,QAAM,OAAO,OAAO,IAAI;AACxB,MAAI,KAAK,UAAU,YAAa,QAAO,EAAE,KAAK;AAC9C,QAAM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
  }
@@ -1,9 +1,8 @@
1
1
  import type { Approval, ApprovalDecision, ApprovalsEvents, ApprovalsPort } from '@ai-ecoverse/slicc-spectrum/ui';
2
- import type { CaptureApproval, Approval as Recorded } from '../approvals/record.ts';
2
+ import type { Approval as Item } from '../approvals/record.ts';
3
3
  import type { AgentConnection } from '../client.ts';
4
4
  import { Emitter } from './emitter.ts';
5
5
  export declare const ARGS_LENGTH = 65536;
6
- type Item = Exclude<Recorded, CaptureApproval>;
7
6
  export declare function shown(item: Item, agentName: string | undefined): Approval;
8
7
  export type HostApprovals = ApprovalsPort;
9
8
  export declare const NOT_HERE = "This request can't be answered in this tab.";
@@ -13,4 +12,3 @@ export declare class ApprovalsAdapter extends Emitter<ApprovalsEvents> implement
13
12
  constructor(connection: AgentConnection, host?: HostApprovals);
14
13
  list(): readonly Approval[];
15
14
  }
16
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-agent",
3
- "version": "7.23.0",
3
+ "version": "7.24.0",
4
4
  "description": "SLICC's agent core on pi durable: an agent worker, session storage, remoting and pi extensions",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -76,7 +76,7 @@
76
76
  "@ai-ecoverse/slicc-kernel": "1.176.1",
77
77
  "@ai-ecoverse/slicc-scrub": "1.1.0",
78
78
  "@ai-ecoverse/slicc-shared-web": "2.13.10",
79
- "@ai-ecoverse/slicc-spectrum": "2.5.0",
79
+ "@ai-ecoverse/slicc-spectrum": "2.6.0",
80
80
  "@ai-ecoverse/wasi-fnox": "1.45.0-2",
81
81
  "@ai-ecoverse/wasm-bash": "5.3.0-23",
82
82
  "@ai-ecoverse/wasm-coreutils": "9.12.0-15",
@@ -112,7 +112,7 @@
112
112
  },
113
113
  "peerDependencies": {
114
114
  "@ai-ecoverse/slicc-kernel": ">=1.172.2 <2",
115
- "@ai-ecoverse/slicc-spectrum": "^1.112.0 || ^2.0.0"
115
+ "@ai-ecoverse/slicc-spectrum": "^2.4.1"
116
116
  },
117
117
  "peerDependenciesMeta": {
118
118
  "@ai-ecoverse/slicc-spectrum": {