ceulen 0.10.1 → 0.11.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/CHANGELOG.md +56 -0
- package/README.md +56 -1
- package/extensions/lib/plan-bridge.ts +18 -0
- package/extensions/lib/registry.ts +14 -0
- package/extensions/modules/a2a/index.ts +4 -2
- package/extensions/modules/attachments/configPanel.ts +91 -0
- package/extensions/modules/attachments/index.ts +274 -0
- package/extensions/modules/attachments/lib/clipboard-files.ts +80 -0
- package/extensions/modules/attachments/lib/pastes.ts +45 -0
- package/extensions/modules/attachments/lib/paths.ts +74 -0
- package/extensions/modules/attachments/lib/registry.ts +70 -0
- package/extensions/modules/attachments/lib/settings.ts +99 -0
- package/extensions/modules/attachments/lib/tray.ts +74 -0
- package/extensions/modules/attachments/test/configPanel.test.ts +122 -0
- package/extensions/modules/attachments/test/index.test.ts +870 -0
- package/extensions/modules/attachments/test/module.test.ts +53 -0
- package/extensions/modules/composer/test/module.test.ts +2 -2
- package/extensions/modules/config/index.ts +3 -0
- package/extensions/modules/config/test/renderTools.test.ts +1 -1
- package/extensions/modules/cron/configPanel.ts +103 -0
- package/extensions/modules/cron/index.ts +638 -0
- package/extensions/modules/cron/lib/jobs.ts +201 -0
- package/extensions/modules/cron/lib/schedule.ts +161 -0
- package/extensions/modules/cron/test/cwd-repro.test.ts +98 -0
- package/extensions/modules/cron/test/index.test.ts +859 -0
- package/extensions/modules/cron/test/schedule.test.ts +93 -0
- package/extensions/modules/munin/index.ts +3 -1
- package/extensions/modules/permission/index.ts +567 -0
- package/extensions/modules/permission/test/permission.test.ts +789 -0
- package/extensions/modules/plan/index.ts +5 -0
- package/extensions/modules/repair/index.ts +134 -3
- package/extensions/modules/repair/test/freshness.test.ts +169 -0
- package/extensions/modules/subagent/index.ts +38 -5
- package/extensions/modules/subagent/lib/runner.ts +348 -12
- package/extensions/modules/subagent/test/worktree.test.ts +230 -0
- package/extensions/modules/usage/index.ts +193 -71
- package/extensions/modules/usage/test/context.test.ts +160 -120
- package/extensions/modules/web/index.ts +3 -1
- package/extensions/modules/web/test/a11y.test.ts +1 -1
- package/package.json +2 -2
- package/skills/cron/SKILL.md +58 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,62 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.11.0 — 2026-10-07
|
|
6
|
+
|
|
7
|
+
- **Worktree sandbox hardening + multi-session repo safety** (subagent module;
|
|
8
|
+
OMP/Claude-Code mechanisms ported at ponytail scale — no new deps, no new
|
|
9
|
+
settings):
|
|
10
|
+
- **Per-repo lock** (`withRepoLock`, keyed by resolved repo root):
|
|
11
|
+
serializes the parent-mutating git calls — `worktree add`, `worktree
|
|
12
|
+
remove`, and the `git apply --3way` merge — which previously raced on
|
|
13
|
+
git's no-waiter O_EXCL locks when parallel children finished together.
|
|
14
|
+
- **Owner marker + GC sweep**: each sandbox records a sibling
|
|
15
|
+
`<id>.owner.json` (`{pid, id, createdAt}`, 0600) OUTSIDE the sandbox dir
|
|
16
|
+
so it can never leak into the captured diff (an in-sandbox marker made
|
|
17
|
+
two parallel merges add/add-conflict — caught by the live race test);
|
|
18
|
+
`sweepStaleWorktrees` runs fire-and-forget on `session_start` and removes
|
|
19
|
+
dead-owner sandboxes (registration-aware: `worktree remove` for
|
|
20
|
+
registered entries, `rm -rf` for CoW copies). `/subagent worktrees
|
|
21
|
+
[clean]` lists or forces the sweep.
|
|
22
|
+
- **`<repoRoot>/.pi-worktrees/.gitignore`** (content `*`) auto-created so
|
|
23
|
+
sandboxes never pollute the parent's `git status` or the untracked
|
|
24
|
+
baseline capture — no user-file edits.
|
|
25
|
+
- **CoW backend (darwin)**: `createWorktree` prefers a per-top-level-entry
|
|
26
|
+
`cp -cR` clone staged OUTSIDE the copied tree (sibling temp dir, skip
|
|
27
|
+
`.pi-worktrees`), then atomic-renames into place — BSD cp lacks GNU's
|
|
28
|
+
self-copy guard, and whole-tree copies would compound prior sandboxes.
|
|
29
|
+
The copy IS the working tree (uncommitted state, node_modules, .env come
|
|
30
|
+
free; the copied `.git` is fully independent). Any failure/EXDEV falls
|
|
31
|
+
back to the detached `git worktree add`. Linux is deliberately
|
|
32
|
+
worktree-only (`--reflink=auto` silently full-copies big trees).
|
|
33
|
+
- **Baseline carry** (git-worktree fallback): `captureParentBaseline`
|
|
34
|
+
composes the parent's WIP as PURE READS — `git diff --cached --binary` +
|
|
35
|
+
`git diff --binary` + per-untracked-file `git diff --no-index --binary
|
|
36
|
+
/dev/null <f>` — never `git add`/`stash create` on the parent (both
|
|
37
|
+
mutate it). 256 MiB cap (constant; OMP #8939 lesson). The child's delta
|
|
38
|
+
then 3-way-merges cleanly onto a parent holding the same baseline.
|
|
39
|
+
- **`.worktreeinclude`**: repo-root gitignore-style lines; matching
|
|
40
|
+
gitignored files (zero-dep glob matcher, 500-file cap) copied into
|
|
41
|
+
git-worktree sandboxes. Fail-open per file.
|
|
42
|
+
- **repair module — multi-session guards** (always-on, deterministic):
|
|
43
|
+
- **Conflict-marker footer**: full-file reads append a footer naming
|
|
44
|
+
detected `<<<<<<<`/`=======`/`>>>>>>>` blocks (OMP conflict-detect
|
|
45
|
+
workflow; zero extra I/O; `:conflicts` stays the explicit listing path).
|
|
46
|
+
- **Write freshness guard**: reads record each file's mtime (capped map);
|
|
47
|
+
a `write` to a file changed since this session last read it fails BEFORE
|
|
48
|
+
writing with a re-read-first error — no more blind clobbering of a
|
|
49
|
+
foreign session's edit. `apply_patch`/`str_replace_editor` refresh the
|
|
50
|
+
baseline via a `refreshMtime` seam; `edit` needs no guard (its
|
|
51
|
+
exact-match anchor already fails loudly).
|
|
52
|
+
- **README**: documents every module in the bundle (subagent, repair,
|
|
53
|
+
steering, zai, a2a, todo, rules, gh, attachments, cron, permission were
|
|
54
|
+
missing) — the subagent section leads with the multi-session safety work.
|
|
55
|
+
- Live-verified end to end on this machine: baseline carry through a real
|
|
56
|
+
`sandbox:"worktree"` child, GC sweep in a fresh headless `pi -p` session,
|
|
57
|
+
herdr-pane load, both repair guards through real wrapped tools, and a
|
|
58
|
+
concurrent two-child `merge:"3way"` race (both patches landed, no
|
|
59
|
+
conflicts, no lock leftovers). 23 new tests; suite at 2639 green.
|
|
60
|
+
|
|
5
61
|
## 0.10.1 — 2026-10-07
|
|
6
62
|
|
|
7
63
|
- **Windows fix**: extension load crashed with `ENOENT ... lstat 'D:\C:'` —
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**The Pi coding agent, fully dressed.**
|
|
4
4
|
|
|
5
|
-
One extension bundle that turns [Pi](https://github.com/earendil-works/pi) into a fully equipped coding agent: a router provider, a second-model reviewer, long-term memory, usage display, themes, and a central settings panel — one install, one command surface, most modules individually switchable.
|
|
5
|
+
One extension bundle that turns [Pi](https://github.com/earendil-works/pi) into a fully equipped coding agent: a router provider, a second-model reviewer, long-term memory, subagent delegation with multi-session repo safety, usage display, themes, and a central settings panel — one install, one command surface, most modules individually switchable.
|
|
6
6
|
|
|
7
7
|
Named for Ludolph van Ceulen, who computed π to 35 digits — they're carved on his tombstone.
|
|
8
8
|
|
|
@@ -75,6 +75,33 @@ Pick the input editor's look from `/config` → Appearance → Composer Shape: S
|
|
|
75
75
|
|
|
76
76
|
`/ponytail off|lite|full|ultra` switches an over-engineering discipline: simplest solution that works, stdlib first, no speculative abstraction. Also ships `/ponytail-review`, `/ponytail-audit`, `/ponytail-debt`, `/ponytail-gain` skills. Deactivate with `stop ponytail`.
|
|
77
77
|
|
|
78
|
+
### subagent — delegate work, safely
|
|
79
|
+
|
|
80
|
+
One `subagent` tool fans work out to specialized agents — `scout` (recon), `tester`, `worker`, `planner`, `reviewer` — in three modes: single, parallel (up to 8 tasks), or chained pipelines. Background tasks report liveness (`operation:"status"/"wait"/"cancel"`); when Pi runs inside herdr, tasks can delegate to visible interactive panes instead. Model tier and thinking effort are routed per task by the classifier module; `/subagent` manages roles, `/agent` inspects threads.
|
|
81
|
+
|
|
82
|
+
Multi-session repo safety (isolated children never clobber you or each other):
|
|
83
|
+
|
|
84
|
+
- **Worktree sandbox** — `sandbox:"worktree"` runs the child in a copy-on-write clone of your working tree (macOS `clonefile` — near-zero time and disk; carries your uncommitted changes, `node_modules`, and `.env` for free), falling back to a detached git worktree elsewhere. The child's changes come back as a patch; `merge:"3way"` applies it to your checkout with conflicts **reported, never silently resolved**.
|
|
85
|
+
- **Baseline carry** — on the worktree fallback the parent's uncommitted state is composed as pure reads (`git diff`/`--no-index`) and seeded into the sandbox, so children never work a stale tree and patches merge cleanly.
|
|
86
|
+
- **`.worktreeinclude`** — gitignore-style file listing copied into fresh worktrees (env files, configs).
|
|
87
|
+
- **Repo lock + GC** — parent-mutating git operations serialize per repo (no `index.lock` races between parallel children); crashed runs' sandboxes are swept on session start. `/subagent worktrees [clean]` lists or forces the sweep.
|
|
88
|
+
- **Write freshness guard** (repair module) — a `write` to a file another session changed since you last read it fails with a re-read-first error instead of clobbering.
|
|
89
|
+
- **Conflict footer** (repair module) — full-file reads surface unresolved `<<<<<<<` conflict markers automatically.
|
|
90
|
+
|
|
91
|
+
Config: `/config` → Tasks → Subagents (model pools, routing, timeouts).
|
|
92
|
+
|
|
93
|
+
### repair — tool-call hardening
|
|
94
|
+
|
|
95
|
+
Wraps the built-in read/write/edit/grep/find/ls/bash once each: schema argument repair, edit-mismatch trim-tolerant retry with `apply_patch` escalation, destructive-bash + guessed-path guards, and read path suffixes — `file.ts:50`, `:50-200`, `:50+150`, `:-60` (tail), comma-joined ranges, `:raw`, and `:conflicts` (list merge-conflict blocks). Registers `apply_patch` (Codex-style V4D diffs) and `str_replace_editor` as standalone tools. Config: `/config` → Tools → Repair.
|
|
96
|
+
|
|
97
|
+
### steering — model-family guidance
|
|
98
|
+
|
|
99
|
+
Provider-agnostic deepseek/glm family detection with first-tool hints, reasoning stripping, error categorization + recovery hints, and the ds-anchor two-phase bootstrap for DeepSeek minimal mode. `/steering` shows status.
|
|
100
|
+
|
|
101
|
+
### zai — Z.AI provider (GLM)
|
|
102
|
+
|
|
103
|
+
Registers a `zai-anthropic` provider serving GLM through Z.ai's Anthropic endpoint: explicit prompt caching, `speed:"fast"` serving tier, effort-based reasoning, a cross-process rate-limit throttle, and optional ZCode request signing. `/zai` = status; config in `/config` → Providers.
|
|
104
|
+
|
|
78
105
|
### ux — anti-slop UI discipline
|
|
79
106
|
|
|
80
107
|
`/ux off|lite|strict` injects a UI design method (tokens only, full interaction states, no AI-slop tells) for any UI work; `strict` blocks handoff until the deterministic `ux_audit` tool passes (APCA contrast, token, and state gates — no model needed). Ships the `ux-*` skills. Deactivate with `stop ux`.
|
|
@@ -90,6 +117,34 @@ Pick the input editor's look from `/config` → Appearance → Composer Shape: S
|
|
|
90
117
|
- Config: `/config` → Tools → **Web** — 16 provider rows (endpoints, keys, timeouts, Gemini cookie, image/chat providers). Written to the global `web` settings section and read per tool call, so saves apply without `/reload`; `BRAVE_API_KEY`, `SEARXNG_BASE_URL`, `FIRECRAWL_*`, `CRAWL4AI_*`, `GEMINI_WEB_*`, `ZAI_API_KEY`, `WEB_IMAGE_*`, `WEB_CHAT_*` env vars still win. Secrets are masked. Individual tools toggle from the same section.
|
|
91
118
|
- Static extraction uses vendored readability/turndown (no extra install); `jsdom` and `gemini-reverse` are the module's only runtime dependencies.
|
|
92
119
|
|
|
120
|
+
### a2a — Agent2Agent protocol
|
|
121
|
+
|
|
122
|
+
Talk to remote agents (Hermes, ADK, LangChain, CrewAI, any A2A peer): 7 outbound tools (`a2a_call` with async dispatch, `a2a_status`, `a2a_discover`, `a2a_list`, `a2a_history`, `a2a_orchestrate` fan-out, `a2a_peers`) and an opt-in inbound server that serves isolated child sessions. Discovery spans a local registry, mDNS, and a2a-switchboard gateways. `/a2a-help` for everything; config in `/config` → Tasks → A2A.
|
|
123
|
+
|
|
124
|
+
### todo — phased task board
|
|
125
|
+
|
|
126
|
+
One `todo` tool tracks an ordered phase list with `blockedBy` edges, auto-start, and a live TUI HUD; `/todo` prints the board. Follows the batch contract (call it alongside real work, never alone).
|
|
127
|
+
|
|
128
|
+
### rules — sticky rules + rulebook
|
|
129
|
+
|
|
130
|
+
`<dir>/.pi/RULES.md` files (walking to repo root, plus a user-level file) inject sticky rules into every request; `## name` sections with a `description:` line become an on-demand rulebook served by the `rule_get` tool. Edits apply without `/reload`; `/rules` = status.
|
|
131
|
+
|
|
132
|
+
### gh — GitHub (read-only)
|
|
133
|
+
|
|
134
|
+
One `github` tool over the `gh` CLI: `repo_view`, `file_read`, `pr_view`, `pr_diff`, issue/PR/code/commit/repo search with date qualifiers, and `run_watch` for Actions runs with failed-job log tails. Zero npm deps; fails open when `gh` is absent. Mutating flows stay with bash `gh` — which keeps the tool auto-allowed in plan mode.
|
|
135
|
+
|
|
136
|
+
### attachments — paste files into prompts
|
|
137
|
+
|
|
138
|
+
Pasting file paths (or big text) collapses to `[[attach:name]]` tokens with a tray widget; on submit they become real image parts, path chips, or inline file blocks. `alt+shift+v` pastes clipboard file references. Config: `/config` → Files → Attachments.
|
|
139
|
+
|
|
140
|
+
### cron — scheduled jobs
|
|
141
|
+
|
|
142
|
+
The `cron` tool + `/cron` manage recurring prompts in `<agentDir>/cron/jobs.json` (vixie-cron schedules, hand-rolled matcher — zero deps). Jobs fire as follow-up turns; pinned jobs run headless in their own Pi process. `/cron test` previews fire times; config in `/config` → Tasks → Cron.
|
|
143
|
+
|
|
144
|
+
### permission — config-driven tool permissions
|
|
145
|
+
|
|
146
|
+
Opt-in `permission` settings section: allow/ask/deny rules per tool with wildcards, an `external_directory` deny boundary, and a doom-loop guard on repeated identical calls. No section = no opinion. Headless asks fail closed; `--yolo`/`--auto` auto-approve.
|
|
147
|
+
|
|
93
148
|
### serena / fff / rtk — code navigation & search (bundled tools)
|
|
94
149
|
|
|
95
150
|
- **serena** — semantic code tools (find symbol, references, rename, diagnostics) via a persistent language-server worker
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Cross-module contract: the plan module publishes whether plan mode is
|
|
2
|
+
// currently active; the permission module reads it to stay silent while plan
|
|
3
|
+
// mode owns tool gating (otherwise both fire tool_call prompts on the same
|
|
4
|
+
// call — double prompting). Flag, not event chaining, so registration order
|
|
5
|
+
// never matters. Inert unless both modules are loaded: with plan disabled the
|
|
6
|
+
// flag simply never becomes true.
|
|
7
|
+
let planActive = false;
|
|
8
|
+
|
|
9
|
+
/** True while plan mode is on (plan module writes, permission module reads). */
|
|
10
|
+
export function isPlanActive(): boolean {
|
|
11
|
+
return planActive;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Publish the plan-mode state. Called by the plan module at every
|
|
15
|
+
* `planModeEnabled` assignment site (toggle, restore, exit-for-execution). */
|
|
16
|
+
export function setPlanActive(active: boolean): void {
|
|
17
|
+
planActive = active;
|
|
18
|
+
}
|
|
@@ -45,6 +45,11 @@ import { webConfig } from "../modules/web/configPanel.ts";
|
|
|
45
45
|
import ghModule from "../modules/gh/index.ts";
|
|
46
46
|
import { ghConfig } from "../modules/gh/configPanel.js";
|
|
47
47
|
import rulesModule from "../modules/rules/index.ts";
|
|
48
|
+
import attachmentsModule from "../modules/attachments/index.ts";
|
|
49
|
+
import { attachmentsConfig } from "../modules/attachments/configPanel.ts";
|
|
50
|
+
import cronModule from "../modules/cron/index.ts";
|
|
51
|
+
import { cronConfig } from "../modules/cron/configPanel.ts";
|
|
52
|
+
import permissionModule from "../modules/permission/index.ts";
|
|
48
53
|
import configModule from "../modules/config/index.ts";
|
|
49
54
|
|
|
50
55
|
/** A module's contribution to the central `/config` panel. */
|
|
@@ -132,6 +137,9 @@ export const MODULES: ModuleEntry[] = [
|
|
|
132
137
|
// child sessions reuse the host-only session guards in the module.
|
|
133
138
|
{ name: "a2a", category: "Tasks", describe: "A2A Protocol v1.0 peer: call remote agents (a2a_call…), be called by them (opt-in inbound server), local/mDNS/gateway discovery.", load: a2aModule, config: a2aConfig, tools: ["a2a_call", "a2a_status", "a2a_discover", "a2a_list", "a2a_history", "a2a_orchestrate", "a2a_peers"] },
|
|
134
139
|
{ name: "todo", category: "Tasks", describe: "Phased task board: the `todo` tool (init/start/done/block/unblock) with session persistence, blockers, an above-editor HUD, and a status-segment progress readout.", load: todoModule, config: todoConfig, tools: ["todo"] },
|
|
140
|
+
// Cron after todo: scheduled prompts into the live session (the clock-driven
|
|
141
|
+
// sibling of the task board). No before_agent_start → no ordering constraint.
|
|
142
|
+
{ name: "cron", category: "Tasks", describe: "Scheduled jobs firing prompts into the live session: add/remove/list/run/enable/disable/test/logs/export, headless pinned runs, crontab export.", load: cronModule, config: cronConfig, tools: ["cron"] },
|
|
135
143
|
// ── Tools ─────────────────────────────────────────────────────────────
|
|
136
144
|
// Repair first in the section: it wraps the built-in tools; serena/fff ride
|
|
137
145
|
// on top (no load-order dependency — hooks resolve at call time).
|
|
@@ -155,6 +163,9 @@ export const MODULES: ModuleEntry[] = [
|
|
|
155
163
|
"web_search", "web_extract", "web_map", "web_crawl", "web_screenshot", "web_pdf", "web_interact", "web_research", "web_image", "web_chat", "web_status", "web_a11y",
|
|
156
164
|
] },
|
|
157
165
|
{ name: "rules", category: "Context", describe: "Sticky RULES.md constraints carried in every request + a rulebook of on-demand rules served by rule_get. Nearest-first project walk over user-level.", load: rulesModule, tools: ["rule_get"] },
|
|
166
|
+
// Attachments: paste/drop files become real attachments. No tools/commands —
|
|
167
|
+
// input hook + widget + shortcut only; no load-order constraint.
|
|
168
|
+
{ name: "attachments", category: "Files", describe: "Real attachments from pasted/dropped files: [[attach:]] tokens + 📎 chips, image ImageContent parts, large-paste collapse, clipboard file paste.", load: attachmentsModule, config: attachmentsConfig },
|
|
158
169
|
// gh after web: same class of external-fetch tooling; fail-open on a missing
|
|
159
170
|
// gh binary (registers nothing until installed). Read-only ops only, so
|
|
160
171
|
// plan mode auto-allows it (plan-tools.ts READ_ONLY_TOOLS).
|
|
@@ -171,6 +182,9 @@ export const MODULES: ModuleEntry[] = [
|
|
|
171
182
|
{ name: "steering", category: "Model", describe: "Per-model-family steering (DeepSeek/GLM): first-tool hints, reasoning strip, leak cleaning, error recovery hints, DeepSeek guidance + v4-pro minimal-mode anchor.", load: steeringModule, config: steeringConfig, tools: ["think"] },
|
|
172
183
|
// ── Shell ──────────────────────────────────────────────────────────────
|
|
173
184
|
{ name: "rtk", category: "Shell", describe: "Route shell commands through RTK for token savings.", load: rtkModule },
|
|
185
|
+
// Permission after rtk: persistent allow/ask/deny gating. Inert until rules
|
|
186
|
+
// exist; defers to plan mode via the shared plan-bridge flag (order-free).
|
|
187
|
+
{ name: "permission", category: "Shell", describe: "Persistent allow/ask/deny permission rules per tool (wildcards, external-directory boundary, doom-loop guard) — opt-in via the `permission` settings section; inert until configured.", load: permissionModule },
|
|
174
188
|
// ── Plugins ────────────────────────────────────────────────────────────
|
|
175
189
|
// Config last: it owns /config and reads the contrib map. CORE: the panel is
|
|
176
190
|
// the only in-app way back from a misconfiguration — it can never be the
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { homedir } from "node:os";
|
|
16
|
-
import { chmodSync
|
|
16
|
+
import { chmodSync } from "node:fs";
|
|
17
17
|
import { join } from "node:path";
|
|
18
18
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
19
19
|
import { Type } from "typebox";
|
|
@@ -547,7 +547,9 @@ export default function a2aExtension(pi: ExtensionAPI): void {
|
|
|
547
547
|
// resources_discover — NOT via the package.json pi.skills manifest — so the
|
|
548
548
|
// kill-switch gates it too (web module pattern).
|
|
549
549
|
pi.on("resources_discover", () => {
|
|
550
|
-
|
|
550
|
+
// skillsRoot() is already a native absolute path (fileURLToPath) — no
|
|
551
|
+
// realpath needed; a throw here would kill the whole module load.
|
|
552
|
+
return { skillPaths: [join(skillsRoot(), "a2a")] };
|
|
551
553
|
});
|
|
552
554
|
|
|
553
555
|
pi.registerTool({
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* attachments' /config contribution — Files tab, Attachments section.
|
|
3
|
+
*
|
|
4
|
+
* Rows write the GLOBAL agent-dir settings.json `attachments` section
|
|
5
|
+
* (lib/settings.ts — the same file the module re-reads on session_start, so a
|
|
6
|
+
* save applies to the NEXT session without /reload; the paste-file shortcut
|
|
7
|
+
* additionally binds at module load and needs a full restart).
|
|
8
|
+
*/
|
|
9
|
+
import { row, type PanelGroup } from "../../lib/panel.js";
|
|
10
|
+
import type { ModuleConfig } from "../../lib/registry.js";
|
|
11
|
+
import { DEFAULTS, loadSettings, writeAttachmentsSection, type AttachmentsSettings } from "./lib/settings.js";
|
|
12
|
+
|
|
13
|
+
/** Build the attachments panel groups over a working copy (mutated by row
|
|
14
|
+
* setters). Exported for tests. */
|
|
15
|
+
export function buildAttachmentsGroups(cfg: AttachmentsSettings): PanelGroup[] {
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
key: "attachments",
|
|
19
|
+
label: "Attachments",
|
|
20
|
+
tab: "Files",
|
|
21
|
+
icon: "📎",
|
|
22
|
+
rows: [
|
|
23
|
+
row("attachments.inlineTextFiles", "Inline text files", "toggle", cfg.inlineTextFiles, (v) => {
|
|
24
|
+
cfg.inlineTextFiles = Boolean(v);
|
|
25
|
+
}, {
|
|
26
|
+
description: "Inline text-file paths as <file> content blocks instead of 📎 path chips — convenient, but re-read on every turn.",
|
|
27
|
+
defaultValue: DEFAULTS.inlineTextFiles,
|
|
28
|
+
}),
|
|
29
|
+
row("attachments.maxInlineBytes", "Max inline bytes", "number", cfg.maxInlineBytes, (v) => {
|
|
30
|
+
const n = Number(v);
|
|
31
|
+
if (Number.isFinite(n) && n > 0) cfg.maxInlineBytes = n;
|
|
32
|
+
}, {
|
|
33
|
+
description: "Size cap for text-file inlining (inline mode only). Larger files keep the 📎 path chip.",
|
|
34
|
+
defaultValue: DEFAULTS.maxInlineBytes,
|
|
35
|
+
}),
|
|
36
|
+
row("attachments.pasteFileShortcut", "Paste-file shortcut", "string", cfg.pasteFileShortcut, (v) => {
|
|
37
|
+
const s = String(v ?? "").trim();
|
|
38
|
+
if (s) cfg.pasteFileShortcut = s;
|
|
39
|
+
}, {
|
|
40
|
+
warning: "Takes effect after a full restart — the shortcut binds when the extension loads.",
|
|
41
|
+
description: "Keybinding for paste-file-from-clipboard (pi-tui KeyId grammar, e.g. alt+shift+v, ctrl+shift+v, f2).",
|
|
42
|
+
defaultValue: DEFAULTS.pasteFileShortcut,
|
|
43
|
+
}),
|
|
44
|
+
row("attachments.pasteCollapseLines", "Paste collapse lines", "number", cfg.pasteCollapseLines, (v) => {
|
|
45
|
+
const n = Number(v);
|
|
46
|
+
if (Number.isFinite(n) && n >= 0) cfg.pasteCollapseLines = n;
|
|
47
|
+
}, {
|
|
48
|
+
description: "Pastes with ≥ this many lines collapse to a paste file + one token. 0 disables.",
|
|
49
|
+
defaultValue: DEFAULTS.pasteCollapseLines,
|
|
50
|
+
}),
|
|
51
|
+
row("attachments.pasteCollapseChars", "Paste collapse chars", "number", cfg.pasteCollapseChars, (v) => {
|
|
52
|
+
const n = Number(v);
|
|
53
|
+
if (Number.isFinite(n) && n >= 0) cfg.pasteCollapseChars = n;
|
|
54
|
+
}, {
|
|
55
|
+
description: "Pastes with ≥ this many characters collapse even below the line threshold (minified JSON walls). 0 disables.",
|
|
56
|
+
defaultValue: DEFAULTS.pasteCollapseChars,
|
|
57
|
+
}),
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const OWNED_PREFIX = "attachments.";
|
|
64
|
+
|
|
65
|
+
/** attachments' ModuleConfig for the central /config panel. */
|
|
66
|
+
export function attachmentsConfig(): ModuleConfig {
|
|
67
|
+
const before = loadSettings();
|
|
68
|
+
const working: AttachmentsSettings = { ...before };
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
groups: () => buildAttachmentsGroups(working),
|
|
72
|
+
save: async (edited, ctx) => {
|
|
73
|
+
const FIELDS: (keyof AttachmentsSettings)[] = [
|
|
74
|
+
"inlineTextFiles", "maxInlineBytes", "pasteFileShortcut", "pasteCollapseLines", "pasteCollapseChars",
|
|
75
|
+
];
|
|
76
|
+
const patch: Partial<AttachmentsSettings> = {};
|
|
77
|
+
for (const key of edited) {
|
|
78
|
+
if (!key.startsWith(OWNED_PREFIX)) continue;
|
|
79
|
+
const field = key.slice(OWNED_PREFIX.length) as keyof AttachmentsSettings;
|
|
80
|
+
if (FIELDS.includes(field)) (patch as Record<string, unknown>)[field] = working[field];
|
|
81
|
+
}
|
|
82
|
+
if (!Object.keys(patch).length) return;
|
|
83
|
+
try {
|
|
84
|
+
const file = writeAttachmentsSection(patch);
|
|
85
|
+
ctx.ui.notify(`Attachments settings saved to ${file} — applies next session (shortcut: full restart).`, "info");
|
|
86
|
+
} catch (e) {
|
|
87
|
+
ctx.ui.notify(`Attachments save failed: ${e instanceof Error ? e.message : e}`, "error");
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pi-attachments — real attachments from pasted/dropped file paths.
|
|
3
|
+
*
|
|
4
|
+
* Drag-drop / clipboard-paste flow:
|
|
5
|
+
* 1. onTerminalInput intercepts path-only bracketed pastes BEFORE the editor:
|
|
6
|
+
* each existing regular file becomes an [[attach:name]] token and a 📎 chip
|
|
7
|
+
* list shows above the editor (widget); non-file paths (directories, typos)
|
|
8
|
+
* stay literal text, and an all-non-file payload passes through untouched.
|
|
9
|
+
* Large plain-text pastes (≥ pasteCollapseLines / pasteCollapseChars) are
|
|
10
|
+
* saved to <agentDir>/pastes/ and collapse to one [[attach:]] token.
|
|
11
|
+
* 2. On submit, the input hook resolves tokens:
|
|
12
|
+
* - images → 📎 path text + real ImageContent parts
|
|
13
|
+
* - text files → 📎 path text (default; model reads on demand via read)
|
|
14
|
+
* or <file> content blocks (inlineTextFiles opt-in)
|
|
15
|
+
* The user's chat line shows only the tidy 📎 chips.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { ExtensionAPI, InputEvent, TerminalInputHandler } from "@earendil-works/pi-coding-agent";
|
|
19
|
+
import { detectSupportedImageMimeTypeFromFile } from "@earendil-works/pi-coding-agent";
|
|
20
|
+
import { readFile, stat } from "node:fs/promises";
|
|
21
|
+
import { basename } from "node:path";
|
|
22
|
+
import { readClipboardFilePaths } from "./lib/clipboard-files";
|
|
23
|
+
import { absolutePathSpans, extractImagePaths, isFile } from "./lib/paths";
|
|
24
|
+
import { PASTE_NAME_RE, savePaste } from "./lib/pastes";
|
|
25
|
+
import { lookup, remember } from "./lib/registry";
|
|
26
|
+
import { DEFAULTS, isValidShortcut, loadSettings } from "./lib/settings";
|
|
27
|
+
import { AttachmentTray } from "./lib/tray";
|
|
28
|
+
|
|
29
|
+
const BRACKETED_PASTE = /^\x1b\[200~([\s\S]*?)\x1b\[201~$/;
|
|
30
|
+
|
|
31
|
+
/** Split on whitespace NOT preceded by a backslash, so "/a/with\\ space.png" stays one token. */
|
|
32
|
+
function splitPathTokens(payload: string): string[] {
|
|
33
|
+
return payload.trim().split(/(?<!\\)\s+/).filter(Boolean);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Paste payload is all path-like tokens (optionally escaped spaces)? */
|
|
37
|
+
function looksLikePathPayload(payload: string): boolean {
|
|
38
|
+
const tokens = splitPathTokens(payload);
|
|
39
|
+
return tokens.length > 0 && tokens.every((t) => /^(?:\/|[A-Za-z]:[\\/])/.test(t.replace(/\\ /g, " ")));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default function piAttachments(pi: ExtensionAPI): void {
|
|
43
|
+
// Re-read on session_start so settings.json edits apply without a full restart.
|
|
44
|
+
let settings = loadSettings();
|
|
45
|
+
const tray = new AttachmentTray();
|
|
46
|
+
let trayUi: { setWidget: (key: string, lines: string[]) => void } | undefined;
|
|
47
|
+
|
|
48
|
+
const updateWidget = () => {
|
|
49
|
+
trayUi?.setWidget("ceulen-attachments", tray.render());
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Captured at session_start — lets onPaste read the editor for prune-sync.
|
|
53
|
+
let editorText: (() => string) | undefined;
|
|
54
|
+
// Disposer returned by ui.onTerminalInput (SDK ≥0.87) — session_start fires
|
|
55
|
+
// once per session, so without disposing, listeners stack across sessions.
|
|
56
|
+
let detachPasteInput: (() => void) | undefined;
|
|
57
|
+
|
|
58
|
+
// 1. Intercept bracketed pastes BEFORE the editor:
|
|
59
|
+
// - path-only payloads → [[attach:]] tokens + chip widget (existing flow)
|
|
60
|
+
// - large plain-text payloads → paste file + one [[attach:]] token
|
|
61
|
+
// onTerminalInput fires for EVERY keystroke, so we also keep the chip
|
|
62
|
+
// list in sync for free: if the user deletes a [[attach:N]] token from
|
|
63
|
+
// the prompt, its chip disappears immediately (and the file is not sent).
|
|
64
|
+
const onPaste: TerminalInputHandler = (data) => {
|
|
65
|
+
if (tray.size > 0 && editorText) {
|
|
66
|
+
const before = tray.size;
|
|
67
|
+
tray.prune(editorText());
|
|
68
|
+
if (tray.size !== before) updateWidget();
|
|
69
|
+
}
|
|
70
|
+
const m = data.match(BRACKETED_PASTE);
|
|
71
|
+
if (!m) return undefined;
|
|
72
|
+
if (!looksLikePathPayload(m[1])) return collapseTextPaste(m[1]);
|
|
73
|
+
const tokens: string[] = [];
|
|
74
|
+
for (const raw of splitPathTokens(m[1])) {
|
|
75
|
+
const path = raw.replace(/\\ /g, " ");
|
|
76
|
+
if (!isFile(path)) {
|
|
77
|
+
// ponytail: directories/nonexistent paths stay literal text — the model
|
|
78
|
+
// reads or lists them itself; upgrade to 📁 chips if dir drops matter
|
|
79
|
+
tokens.push(raw);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const item = tray.add(path);
|
|
83
|
+
remember(item.name, item.path); // survive session restarts
|
|
84
|
+
tokens.push(item.token);
|
|
85
|
+
}
|
|
86
|
+
if (tokens.every((t) => !t.startsWith("[[attach:"))) return undefined;
|
|
87
|
+
updateWidget();
|
|
88
|
+
return { data: tokens.join(" ") };
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Large plain-text paste → paste file + token (Hermes-style collapse). Unlike
|
|
92
|
+
// Hermes, which re-inlines the full content at submit, the token resolves to
|
|
93
|
+
// a 📎 path — the paste stays isolated from the chat text and is read on demand.
|
|
94
|
+
const collapseTextPaste = (payload: string): { data: string } | undefined => {
|
|
95
|
+
const text = payload.replace(/\r\n?/g, "\n").replace(/^\n+|\n+$/g, "");
|
|
96
|
+
const lines = text.split("\n").length;
|
|
97
|
+
const linesHit = settings.pasteCollapseLines > 0 && lines >= settings.pasteCollapseLines;
|
|
98
|
+
const charsHit = settings.pasteCollapseChars > 0 && text.length >= settings.pasteCollapseChars;
|
|
99
|
+
if (!linesHit && !charsHit) return undefined;
|
|
100
|
+
if (editorText?.()?.startsWith("/")) return undefined; // slash-command args pass through
|
|
101
|
+
// pi-tui invokes onTerminalInput listeners without try/catch — a disk failure
|
|
102
|
+
// here (EACCES/ENOSPC/ENOTDIR) would crash the agent. Degrade gracefully:
|
|
103
|
+
// the paste passes through to the editor untouched.
|
|
104
|
+
try {
|
|
105
|
+
const pastePath = savePaste(text);
|
|
106
|
+
const item = tray.add(pastePath, `pasted text, ${lines} lines`);
|
|
107
|
+
remember(item.name, pastePath); // survive session restarts
|
|
108
|
+
updateWidget();
|
|
109
|
+
return { data: item.token };
|
|
110
|
+
} catch {
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
116
|
+
settings = loadSettings();
|
|
117
|
+
// The shortcut was registered at module load with factory-time settings —
|
|
118
|
+
// re-reading doesn't re-register, so an edited-but-valid shortcut is
|
|
119
|
+
// silently dead until restart. Say so instead of a silent no-op.
|
|
120
|
+
const notify = (msg: string) => {
|
|
121
|
+
try {
|
|
122
|
+
if (ctx?.ui?.notify) ctx.ui.notify(msg, "warning");
|
|
123
|
+
else console.warn(msg);
|
|
124
|
+
} catch { /* best-effort */ }
|
|
125
|
+
};
|
|
126
|
+
if (!isValidShortcut(settings.pasteFileShortcut)) {
|
|
127
|
+
notify(`attachments: pasteFileShortcut ${JSON.stringify(settings.pasteFileShortcut)} is not a valid keybinding (e.g. "${DEFAULTS.pasteFileShortcut}") — the paste-file shortcut will never trigger. Fix settings.json and restart Pi.`);
|
|
128
|
+
} else if (settings.pasteFileShortcut !== registeredShortcut) {
|
|
129
|
+
notify(`attachments: pasteFileShortcut changed to ${JSON.stringify(settings.pasteFileShortcut)} in settings.json, but ${JSON.stringify(registeredShortcut)} is active for this session — restart Pi to apply.`);
|
|
130
|
+
}
|
|
131
|
+
trayUi = ctx.ui;
|
|
132
|
+
editorText = (ctx.ui as any).getEditorText?.bind(ctx.ui);
|
|
133
|
+
detachPasteInput?.();
|
|
134
|
+
detachPasteInput = ctx.ui.onTerminalInput?.(onPaste);
|
|
135
|
+
updateWidget();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// 2. On submit: resolve [[attach:name]] tokens → real content.
|
|
139
|
+
pi.on("input", async (event: InputEvent, ctx) => {
|
|
140
|
+
if (event.source === "extension") return; // don't reprocess our own sends
|
|
141
|
+
|
|
142
|
+
// Prune tray items whose tokens the user deleted from the editor.
|
|
143
|
+
tray.prune(ctx?.ui?.getEditorText?.() ?? event.text ?? "");
|
|
144
|
+
|
|
145
|
+
const raw = event.text ?? "";
|
|
146
|
+
if (!raw.trim()) {
|
|
147
|
+
updateWidget();
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const images: Array<{ type: "image"; data: string; mimeType: string }> = [...(event.images ?? [])];
|
|
152
|
+
const attachedImages = new Set<string>(); // paths already attached via tokens
|
|
153
|
+
// All replacements are spans in `raw` coordinates (tokens + typed paths are
|
|
154
|
+
// disjoint by construction), applied right-to-left at the end — so generated
|
|
155
|
+
// blocks are never re-scanned (no nested <file> inlining).
|
|
156
|
+
const replacements: Array<{ start: number; end: number; block: string }> = [];
|
|
157
|
+
|
|
158
|
+
// a. Resolve [[attach:name]] tokens (tray first, then persistent registry).
|
|
159
|
+
// `]` in a basename is allowed when not followed by the closing `]]`
|
|
160
|
+
// (e.g. a dropped file named "we]ird.png").
|
|
161
|
+
const trayItems = tray.resolve(raw); // once per message — loop-invariant
|
|
162
|
+
for (const m of raw.matchAll(/\[\[attach:((?:[^\]]|\](?!\]))+)\]\]/g)) {
|
|
163
|
+
const token = m[0];
|
|
164
|
+
const name = m[1];
|
|
165
|
+
const start = m.index;
|
|
166
|
+
const trayItem = trayItems.find((i) => i.token === token);
|
|
167
|
+
const path = trayItem?.path ?? lookup(name);
|
|
168
|
+
if (!path) continue; // unknown token — leave as-is for the model
|
|
169
|
+
|
|
170
|
+
const mimeType = await detectSupportedImageMimeTypeFromFile(path).catch(() => null);
|
|
171
|
+
if (mimeType) {
|
|
172
|
+
if (!attachedImages.has(path)) {
|
|
173
|
+
// Distinct tokens may resolve to the same path (same file dropped twice) — attach once.
|
|
174
|
+
try {
|
|
175
|
+
const content = await readFile(path);
|
|
176
|
+
images.push({ type: "image", data: content.toString("base64"), mimeType });
|
|
177
|
+
attachedImages.add(path);
|
|
178
|
+
} catch {
|
|
179
|
+
ctx?.ui?.notify?.(`attachments: unreadable image ${path}; attached path only`, "warning");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
replacements.push({ start, end: start + token.length, block: `📎 ${path}` });
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Non-image: inline as <file> only when inlineTextFiles is on and size allows;
|
|
187
|
+
// otherwise resolve to a 📎 path the model reads on demand.
|
|
188
|
+
let block = `📎 ${path}`;
|
|
189
|
+
if (trayItem?.hint) block += ` (${trayItem.hint})`;
|
|
190
|
+
// Collapsed pastes keep read-on-demand even in inline mode — re-inlining
|
|
191
|
+
// would defeat the whole point of the collapse.
|
|
192
|
+
if (settings.inlineTextFiles && !trayItem?.hint && !PASTE_NAME_RE.test(basename(path))) {
|
|
193
|
+
try {
|
|
194
|
+
const s = await stat(path);
|
|
195
|
+
if (s.size <= settings.maxInlineBytes) {
|
|
196
|
+
const content = (await readFile(path, "utf-8")).replace(/^\uFEFF/, "").replace(/\n$/, "");
|
|
197
|
+
block = `<file name="${path}">\n${content}\n</file>`;
|
|
198
|
+
}
|
|
199
|
+
} catch {
|
|
200
|
+
/* keep 📎 path */
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
replacements.push({ start, end: start + token.length, block });
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// b. Existing image paths typed elsewhere in the message → attach too.
|
|
207
|
+
for (const p of extractImagePaths(raw)) {
|
|
208
|
+
if (attachedImages.has(p)) continue;
|
|
209
|
+
try {
|
|
210
|
+
const mimeType = await detectSupportedImageMimeTypeFromFile(p);
|
|
211
|
+
if (!mimeType) continue;
|
|
212
|
+
const content = await readFile(p);
|
|
213
|
+
images.push({ type: "image", data: content.toString("base64"), mimeType });
|
|
214
|
+
} catch {
|
|
215
|
+
/* unreadable file → skip */
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// c. Text-path inlining (opt-in old behavior): absolute text-file paths in
|
|
220
|
+
// the message → <file> blocks. One greedy regex pass yields disjoint
|
|
221
|
+
// spans that never overlap the token spans above.
|
|
222
|
+
if (settings.inlineTextFiles) {
|
|
223
|
+
for (const span of absolutePathSpans(raw)) {
|
|
224
|
+
try {
|
|
225
|
+
const s = await stat(span.path);
|
|
226
|
+
if (s.size > settings.maxInlineBytes) continue;
|
|
227
|
+
const content = (await readFile(span.path, "utf-8")).replace(/^\uFEFF/, "").replace(/\n$/, ""); // stripBom + trailing newline
|
|
228
|
+
replacements.push({ start: span.start, end: span.end, block: `<file name="${span.path}">\n${content}\n</file>` });
|
|
229
|
+
} catch {
|
|
230
|
+
/* unreadable file → skip */
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
let text = raw;
|
|
236
|
+
if (replacements.length) {
|
|
237
|
+
replacements.sort((a, b) => b.start - a.start);
|
|
238
|
+
for (const r of replacements) {
|
|
239
|
+
text = text.slice(0, r.start) + r.block + text.slice(r.end);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Message sent — chips are consumed; hide the widget. Also clear when no
|
|
244
|
+
// token survived into the submitted text (all hand-deleted): expansion
|
|
245
|
+
// produced no references, so keeping the tray would leave stale chips.
|
|
246
|
+
if (tray.size > 0 && (tray.expand(raw) !== raw || trayItems.length === 0)) tray.clear();
|
|
247
|
+
updateWidget();
|
|
248
|
+
|
|
249
|
+
if (text === raw && images.length === (event.images?.length ?? 0)) return;
|
|
250
|
+
return { action: "transform", text, images };
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
// 3. Clipboard file paste shortcut → queue into the tray as tokens.
|
|
254
|
+
// ponytail: settings string → KeyId cast; an invalid key never matches (warned at session_start) — and note the shortcut is registered HERE, at module load, so settings edits need a restart
|
|
255
|
+
const registeredShortcut = settings.pasteFileShortcut;
|
|
256
|
+
pi.registerShortcut(registeredShortcut as Parameters<ExtensionAPI["registerShortcut"]>[0], {
|
|
257
|
+
description: "Paste file(s) from clipboard as attachments",
|
|
258
|
+
handler: async (ctx) => {
|
|
259
|
+
// only existing regular files are attachable — Finder/Explorer folder copies pass through
|
|
260
|
+
const paths = (await readClipboardFilePaths()).filter(isFile);
|
|
261
|
+
if (paths.length === 0) {
|
|
262
|
+
ctx.ui.notify("No files in clipboard", "info");
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const tokens = paths.map((p) => {
|
|
266
|
+
const item = tray.add(p);
|
|
267
|
+
remember(item.name, item.path); // survive session restarts
|
|
268
|
+
return item.token;
|
|
269
|
+
});
|
|
270
|
+
ctx.ui.pasteToEditor(tokens.join(" "));
|
|
271
|
+
updateWidget();
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
}
|