agentic-pi 0.2.4 → 0.2.6
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 +165 -2
- package/dist/args.d.ts +32 -0
- package/dist/args.js +52 -0
- package/dist/args.js.map +1 -1
- package/dist/extensions/skills/index.d.ts +83 -0
- package/dist/extensions/skills/index.js +84 -0
- package/dist/extensions/skills/index.js.map +1 -0
- package/dist/run.d.ts +53 -0
- package/dist/run.js +23 -0
- package/dist/run.js.map +1 -1
- package/dist/runner.js +59 -0
- package/dist/runner.js.map +1 -1
- package/dist/telemetry/config.d.ts +59 -0
- package/dist/telemetry/config.js +70 -0
- package/dist/telemetry/config.js.map +1 -0
- package/dist/telemetry/index.d.ts +49 -0
- package/dist/telemetry/index.js +45 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/mapper.d.ts +80 -0
- package/dist/telemetry/mapper.js +334 -0
- package/dist/telemetry/mapper.js.map +1 -0
- package/dist/telemetry/sdk.d.ts +13 -0
- package/dist/telemetry/sdk.js +147 -0
- package/dist/telemetry/sdk.js.map +1 -0
- package/dist/telemetry/semconv.d.ts +72 -0
- package/dist/telemetry/semconv.js +73 -0
- package/dist/telemetry/semconv.js.map +1 -0
- package/package.json +10 -1
package/README.md
CHANGED
|
@@ -293,6 +293,158 @@ built-in `find`/`grep`.
|
|
|
293
293
|
When disabled or unavailable, `status: "skipped"` carries a `reason` of
|
|
294
294
|
`disabled-by-flag` or `resolve-failed`.
|
|
295
295
|
|
|
296
|
+
### 10. Optional OpenTelemetry export via `--otel`
|
|
297
|
+
|
|
298
|
+
agentic-pi can export **traces and metrics** for its run to any OTLP-compatible
|
|
299
|
+
collector, using the standard OpenTelemetry JS SDK and the standard `OTEL_*`
|
|
300
|
+
environment variables. This is meant for orchestrators (e.g. lastlight) that
|
|
301
|
+
forward `OTEL_*` config into a sandboxed agentic-pi process so Pi's own activity
|
|
302
|
+
shows up in their observability stack.
|
|
303
|
+
|
|
304
|
+
**Off unless explicitly enabled.** Enablement precedence (highest first):
|
|
305
|
+
|
|
306
|
+
1. `--no-otel` → force-disabled (wins over everything).
|
|
307
|
+
2. `--otel` → enabled.
|
|
308
|
+
3. env `AGENTIC_PI_OTEL_ENABLED=1` (when neither flag is passed) → enabled.
|
|
309
|
+
4. otherwise → disabled.
|
|
310
|
+
|
|
311
|
+
A bare `OTEL_EXPORTER_OTLP_ENDPOINT` does **not** enable telemetry on its own —
|
|
312
|
+
enablement is always intentional. Configure the destination with the usual
|
|
313
|
+
`OTEL_EXPORTER_OTLP_ENDPOINT` / `OTEL_EXPORTER_OTLP_HEADERS` /
|
|
314
|
+
`OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` (etc.) variables, or `--otel-endpoint` as a
|
|
315
|
+
base-URL escape hatch.
|
|
316
|
+
|
|
317
|
+
**Span tree** (one-shot run → a short-lived root span is correct):
|
|
318
|
+
|
|
319
|
+
```
|
|
320
|
+
agentic_pi.session (root; gen_ai.conversation.id = sessionId)
|
|
321
|
+
└── agentic_pi.turn
|
|
322
|
+
├── chat <model> (per assistant message; tokens, cost, finish reason)
|
|
323
|
+
└── execute_tool <name> (per tool call; status, duration)
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
**Metrics**: `gen_ai.client.token.usage`, `gen_ai.client.operation.duration`,
|
|
327
|
+
`agentic_pi.cost.usd`, `agentic_pi.tool.duration`, `agentic_pi.tool.invocations`,
|
|
328
|
+
`agentic_pi.tool.failures`, `agentic_pi.turns`. Attribute names follow the OTEL
|
|
329
|
+
GenAI semantic conventions where stable, namespaced under `agentic_pi.*` otherwise.
|
|
330
|
+
|
|
331
|
+
**Metadata-only by default.** Raw prompt/message/tool-result content is **never**
|
|
332
|
+
exported unless you pass `--otel-include-content` (or set
|
|
333
|
+
`AGENTIC_PI_OTEL_INCLUDE_CONTENT=1`), in which case content is bounded and
|
|
334
|
+
truncated. Metric dimensions are always metadata (bounded cardinality).
|
|
335
|
+
|
|
336
|
+
**Trace correlation.** If a W3C `TRACEPARENT` env var is present, the session
|
|
337
|
+
span is parented to it, so a sandboxed agentic-pi run correlates with the
|
|
338
|
+
caller's trace across the process/container boundary.
|
|
339
|
+
|
|
340
|
+
**Safe by default.** Telemetry never affects the run's exit code, never writes to
|
|
341
|
+
stdout/stderr (SDK diagnostics route to the warning channel), and degrades to a
|
|
342
|
+
warning if the collector is unreachable. When requested, a final
|
|
343
|
+
`extension_status` event mirrors the others:
|
|
344
|
+
|
|
345
|
+
```jsonl
|
|
346
|
+
{"type":"extension_status","extension":"telemetry","status":"configured","includeContent":false,"sessionId":"…","timestamp":"…"}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
A silent default run (no `--otel`) emits no telemetry event at all.
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
# Export to a local collector (e.g. otel-desktop-viewer, Jaeger, Grafana Alloy)
|
|
353
|
+
echo "summarize the repo" | OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 \
|
|
354
|
+
node dist/cli.js run --model openai/gpt-5.4-nano --otel --no-session
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### 11. Agent skills (`SKILL.md`)
|
|
358
|
+
|
|
359
|
+
Pi natively implements the [Agent Skills standard](https://agentskills.io) — the
|
|
360
|
+
same `SKILL.md`-in-a-folder convention used by Claude Code and Codex — and
|
|
361
|
+
agentic-pi exposes it. A **skill** is a directory containing a `SKILL.md` with YAML
|
|
362
|
+
frontmatter (`name` + `description`) and freeform instructions, plus any helper
|
|
363
|
+
scripts/references it needs:
|
|
364
|
+
|
|
365
|
+
```
|
|
366
|
+
roll-dice/
|
|
367
|
+
└── SKILL.md
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
```markdown
|
|
371
|
+
---
|
|
372
|
+
name: roll-dice
|
|
373
|
+
description: Roll an N-sided die. Use when asked to roll a die or dice.
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
# Roll Dice
|
|
377
|
+
|
|
378
|
+
Run `echo $((RANDOM % <sides> + 1))`, replacing `<sides>` with the die size.
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
**Progressive disclosure.** At startup Pi scans the skill locations and puts only
|
|
382
|
+
each skill's `name` + `description` into the system prompt. When a task matches, the
|
|
383
|
+
agent `read`s the full `SKILL.md` on demand, then loads any referenced scripts/assets
|
|
384
|
+
by relative path. This keeps the prompt small while making many skills available.
|
|
385
|
+
|
|
386
|
+
**Default locations — already discovered, no flag needed.** Drop a skill into any of:
|
|
387
|
+
|
|
388
|
+
- Global: `~/.pi/agent/skills/`, `~/.agents/skills/`
|
|
389
|
+
- Project (cwd + ancestors to git root): `.pi/skills/`, `.agents/skills/`
|
|
390
|
+
- Packages: a `skills/` directory or `pi.skills` entry in a dependency's `package.json`
|
|
391
|
+
|
|
392
|
+
**Mapping an existing skills folder via `--skill`.** To use skills you already keep
|
|
393
|
+
elsewhere — e.g. your Claude Code skills, or a directory mounted into a CI container —
|
|
394
|
+
point at it with `--skill <path>` (repeatable; accepts a directory of skills or a
|
|
395
|
+
single skill). It's **additive even with `--no-skills`**:
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
# Map your Claude Code skills directory straight into the agent
|
|
399
|
+
echo "use the roll-dice skill to roll a d20" | node dist/cli.js run \
|
|
400
|
+
--model openai/gpt-5.4-nano --no-session --skill ~/.claude/skills
|
|
401
|
+
|
|
402
|
+
# Load ONLY an explicit folder; suppress all default discovery
|
|
403
|
+
... --no-skills --skill ./ci-skills
|
|
404
|
+
|
|
405
|
+
# Turn skills off entirely
|
|
406
|
+
... --no-skills
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
Programmatic callers pass `skillPaths: string[]` / `noSkills: boolean` to `run()`.
|
|
410
|
+
|
|
411
|
+
**Cross-harness reuse via settings.** Instead of a flag on every run, list skill
|
|
412
|
+
directories in a Pi `settings.json` (under the agent dir) so they always load:
|
|
413
|
+
|
|
414
|
+
```json
|
|
415
|
+
{
|
|
416
|
+
"skills": ["~/.claude/skills", "~/.codex/skills"]
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
**One-shot caveat.** agentic-pi has no interactive mode, so Pi's `/skill:name` slash
|
|
421
|
+
command doesn't apply here — skills are **model-invoked** from the catalog. If the
|
|
422
|
+
model doesn't pick up a skill on its own, name it in the prompt ("use the `roll-dice`
|
|
423
|
+
skill …") to nudge it to load the `SKILL.md`.
|
|
424
|
+
|
|
425
|
+
**Safe by default.** A `--skill` path that doesn't exist is dropped with a warning
|
|
426
|
+
rather than aborting the run. Skills are a Pi-native *resource* (fed to the resource
|
|
427
|
+
loader), not agentic-pi tools, so they don't appear in the `extension_status` events.
|
|
428
|
+
|
|
429
|
+
**Observability.** Pi emits no skill-specific event, and skill *usage* only shows up
|
|
430
|
+
indirectly — when the agent loads a skill it `read`s the `SKILL.md`, so it surfaces as
|
|
431
|
+
a normal `tool_execution_start`/`_end` whose `args.path` ends in `SKILL.md`. To make
|
|
432
|
+
*discovery* visible, agentic-pi synthesizes a single `skills_status` event at startup:
|
|
433
|
+
|
|
434
|
+
```jsonl
|
|
435
|
+
{"type":"skills_status","status":"configured","discovered":2,"skills":[{"name":"roll-dice","source":"/abs/roll-dice/SKILL.md","modelInvocable":true}],"mappedPaths":["/abs/skills"],"noSkills":false,"sessionId":"…","timestamp":"…"}
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
`status` is `default` (no flags), `configured` (`--skill` paths resolved), or
|
|
439
|
+
`disabled` (`--no-skills`). `modelInvocable` is `false` for skills that set
|
|
440
|
+
`disable-model-invocation: true` (present but never auto-loaded). The event is
|
|
441
|
+
**gated**: a default run that discovers no skills emits nothing, so the golden JSONL
|
|
442
|
+
fixtures stay byte-identical. Programmatic callers read the same data from
|
|
443
|
+
`result.skills`.
|
|
444
|
+
|
|
445
|
+
> **Security:** a skill can instruct the model to take any action and may bundle code
|
|
446
|
+
> the model runs. Only map skill directories you trust.
|
|
447
|
+
|
|
296
448
|
## When to use this
|
|
297
449
|
|
|
298
450
|
- You have an orchestrator that calls a coding agent once per workflow
|
|
@@ -357,7 +509,14 @@ GITHUB_TOKEN=ghp_…
|
|
|
357
509
|
| `--no-web-search` | Disable the web-search extension (no `web_search`/`web_fetch` tools). |
|
|
358
510
|
| `--no-file-search` | Disable the bundled FFF file-search extension; fall back to Pi's built-in `find`/`grep`. |
|
|
359
511
|
| `--file-search-mode <m>` | FFF mode: `override` (default) \| `tools-only` \| `tools-and-ui`. Overridden by the `PI_FFF_MODE` env var. See section 9. |
|
|
512
|
+
| `--skill <path>` | Load Agent Skills from `<path>` (a skills dir or a single skill). Repeatable; additive even with `--no-skills`. Maps e.g. `~/.claude/skills` into the agent. Default-location skills load without this. See section 11. |
|
|
513
|
+
| `--no-skills` | Disable Pi's default skill discovery. Explicit `--skill` paths still load. |
|
|
360
514
|
| `--web-search-max-calls <n>` | Cap combined `web_search` + `web_fetch` calls per run. Default: 30. |
|
|
515
|
+
| `--otel` | Enable OpenTelemetry traces + metrics export. Off by default. Requires an OTLP endpoint via `OTEL_EXPORTER_OTLP_ENDPOINT` (or `--otel-endpoint`). See section 10. |
|
|
516
|
+
| `--no-otel` | Force-disable OTEL even if `AGENTIC_PI_OTEL_ENABLED=1`. |
|
|
517
|
+
| `--otel-include-content` | Attach prompt/message/tool content to spans (bounded + truncated). Default: metadata-only. |
|
|
518
|
+
| `--otel-service-name <n>` | Override `OTEL_SERVICE_NAME` (default: `agentic-pi`). |
|
|
519
|
+
| `--otel-endpoint <url>` | Override `OTEL_EXPORTER_OTLP_ENDPOINT` base URL. |
|
|
361
520
|
|
|
362
521
|
Reads the prompt from stdin. Emits JSONL on stdout. Exits 0 on `agent_end`,
|
|
363
522
|
1 on fatal error.
|
|
@@ -370,6 +529,7 @@ Reads the prompt from stdin. Emits JSONL on stdout. Exits 0 on `agent_end`,
|
|
|
370
529
|
{"type":"extension_status","extension":"github","status":"configured","profile":"read","toolCount":18,"sessionId":"<uuid>","timestamp":"…"}
|
|
371
530
|
{"type":"extension_status","extension":"web-search","status":"configured","provider":"tavily","toolCount":2,"maxCalls":30,"sessionId":"<uuid>","timestamp":"…"}
|
|
372
531
|
{"type":"extension_status","extension":"file-search","status":"configured","mode":"override","toolCount":3,"sessionId":"<uuid>","timestamp":"…"}
|
|
532
|
+
{"type":"skills_status","status":"configured","discovered":1,"skills":[{"name":"roll-dice","source":"…/SKILL.md","modelInvocable":true}],"mappedPaths":["…"],"noSkills":false,"sessionId":"<uuid>","timestamp":"…"}
|
|
373
533
|
{"type":"agent_start","sessionId":"<uuid>","timestamp":"…"}
|
|
374
534
|
{"type":"turn_start","sessionId":"<uuid>","timestamp":"…"}
|
|
375
535
|
{"type":"message_start","message":{…},"sessionId":"<uuid>","timestamp":"…"}
|
|
@@ -383,8 +543,10 @@ Reads the prompt from stdin. Emits JSONL on stdout. Exits 0 on `agent_end`,
|
|
|
383
543
|
```
|
|
384
544
|
|
|
385
545
|
`extension_status` is emitted once at startup so downstream logs can confirm
|
|
386
|
-
the GitHub profile (and whether auth succeeded). `
|
|
387
|
-
|
|
546
|
+
the GitHub profile (and whether auth succeeded). `skills_status` is emitted once
|
|
547
|
+
at startup too, but **only** when skills were configured or discovered (section 11) —
|
|
548
|
+
a default run with no skills omits it entirely. `usage_snapshot` is always the last
|
|
549
|
+
line in a successful run.
|
|
388
550
|
|
|
389
551
|
## Programmatic usage
|
|
390
552
|
|
|
@@ -451,6 +613,7 @@ console.log(result.records.length); // full event log
|
|
|
451
613
|
| `github` | `{status, reason, profile, toolCount}` \| `undefined` | Mirror of the GitHub `extension_status` event. |
|
|
452
614
|
| `webSearch` | `{status, reason, provider, toolCount, maxCalls}` \| `undefined` | Mirror of the web-search `extension_status` event. |
|
|
453
615
|
| `fileSearch` | `{status, reason, mode, toolCount}` \| `undefined` | Mirror of the FFF file-search `extension_status` event. |
|
|
616
|
+
| `skills` | `{status, discovered, skills: {name, source, modelInvocable}[], mappedPaths, noSkills}` \| `undefined` | Mirror of the `skills_status` event. Absent when none configured/discovered (section 11). |
|
|
454
617
|
| `records` | `EmitterRecord[]` | Every JSONL record in order. Same shape that the CLI writes. |
|
|
455
618
|
| `warnings` | `string[]` | Warnings that would have gone to stderr in CLI mode. |
|
|
456
619
|
|
package/dist/args.d.ts
CHANGED
|
@@ -87,6 +87,38 @@ export interface RunConfig {
|
|
|
87
87
|
* the same names). Set via `--file-search-mode <override|tools-only|tools-and-ui>`.
|
|
88
88
|
*/
|
|
89
89
|
fileSearchMode?: "override" | "tools-only" | "tools-and-ui";
|
|
90
|
+
/**
|
|
91
|
+
* Extra Agent Skill paths to load, beyond Pi's default discovery
|
|
92
|
+
* (~/.pi/agent/skills, ~/.agents/skills, .pi/skills, .agents/skills,
|
|
93
|
+
* package skills/). Each entry is a directory of skills OR a single skill
|
|
94
|
+
* dir/file. Set via `--skill <path>` (repeatable). Additive even with
|
|
95
|
+
* --no-skills.
|
|
96
|
+
*/
|
|
97
|
+
skillPaths?: string[];
|
|
98
|
+
/**
|
|
99
|
+
* Disable Pi's default skill discovery. Explicit --skill paths still load.
|
|
100
|
+
* Set via `--no-skills`. Default: discovery enabled (Pi's default).
|
|
101
|
+
*/
|
|
102
|
+
noSkills?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* OpenTelemetry traces + metrics export. Tri-state:
|
|
105
|
+
* - `true` (`--otel`) → enabled.
|
|
106
|
+
* - `false` (`--no-otel`) → force-disabled (wins over env).
|
|
107
|
+
* - `undefined` (unset) → enabled iff env AGENTIC_PI_OTEL_ENABLED is truthy.
|
|
108
|
+
* Off by default. Requires an OTLP endpoint via OTEL_EXPORTER_OTLP_ENDPOINT
|
|
109
|
+
* (or `--otel-endpoint`). Standard OTEL_* env vars are honored by the SDK.
|
|
110
|
+
*/
|
|
111
|
+
otel?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Export raw prompt/message/tool content on spans (bounded + truncated).
|
|
114
|
+
* Default: false (metadata-only). Set via `--otel-include-content` or env
|
|
115
|
+
* AGENTIC_PI_OTEL_INCLUDE_CONTENT.
|
|
116
|
+
*/
|
|
117
|
+
otelIncludeContent?: boolean;
|
|
118
|
+
/** Override OTEL_SERVICE_NAME (default: "agentic-pi"). */
|
|
119
|
+
otelServiceName?: string;
|
|
120
|
+
/** Override OTEL_EXPORTER_OTLP_ENDPOINT (escape hatch; prefer the env var). */
|
|
121
|
+
otelEndpoint?: string;
|
|
90
122
|
}
|
|
91
123
|
export declare function printHelp(): void;
|
|
92
124
|
export declare function parseArgs(argv: string[]): RunConfig;
|
package/dist/args.js
CHANGED
|
@@ -48,6 +48,25 @@ Flags:
|
|
|
48
48
|
--file-search-mode <m> FFF mode: override | tools-only | tools-and-ui.
|
|
49
49
|
Default: override (FFF replaces built-in find/grep
|
|
50
50
|
under the same names). Overridden by PI_FFF_MODE env.
|
|
51
|
+
--skill <path> Load Agent Skills from <path> (a directory of
|
|
52
|
+
skills or a single skill). Repeatable. Additive
|
|
53
|
+
even with --no-skills. Maps e.g. ~/.claude/skills
|
|
54
|
+
into the agent. Skills in Pi's default locations
|
|
55
|
+
(.pi/skills, .agents/skills, ~/.pi/agent/skills)
|
|
56
|
+
are discovered automatically without this flag.
|
|
57
|
+
--no-skills Disable Pi's default skill discovery. Explicit
|
|
58
|
+
--skill paths still load.
|
|
59
|
+
--otel Enable OpenTelemetry traces + metrics export.
|
|
60
|
+
Off by default. Requires an OTLP endpoint via
|
|
61
|
+
OTEL_EXPORTER_OTLP_ENDPOINT (or --otel-endpoint).
|
|
62
|
+
Honors standard OTEL_* env vars. Can also be
|
|
63
|
+
enabled with AGENTIC_PI_OTEL_ENABLED=1.
|
|
64
|
+
--no-otel Force-disable OTEL even if AGENTIC_PI_OTEL_ENABLED
|
|
65
|
+
is set (highest precedence).
|
|
66
|
+
--otel-include-content Attach prompt/message/tool content to spans
|
|
67
|
+
(bounded + truncated). Default: metadata-only.
|
|
68
|
+
--otel-service-name <n> Override OTEL_SERVICE_NAME (default: agentic-pi).
|
|
69
|
+
--otel-endpoint <url> Override OTEL_EXPORTER_OTLP_ENDPOINT base URL.
|
|
51
70
|
--sandbox-image <name> Image to boot when --sandbox=gondolin. Values:
|
|
52
71
|
'default' (recommended) — bundled agentic-pi-dev image
|
|
53
72
|
with git/gh/node/python/rust baked in (auto-downloaded).
|
|
@@ -185,6 +204,16 @@ export function parseArgs(argv) {
|
|
|
185
204
|
case "--no-file-search":
|
|
186
205
|
config.fileSearch = false;
|
|
187
206
|
break;
|
|
207
|
+
case "--skill": {
|
|
208
|
+
const v = next().trim();
|
|
209
|
+
if (!v)
|
|
210
|
+
throw new Error("--skill requires a non-empty path");
|
|
211
|
+
config.skillPaths = [...(config.skillPaths ?? []), v];
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
case "--no-skills":
|
|
215
|
+
config.noSkills = true;
|
|
216
|
+
break;
|
|
188
217
|
case "--file-search-mode": {
|
|
189
218
|
const v = next();
|
|
190
219
|
if (v !== "override" && v !== "tools-only" && v !== "tools-and-ui") {
|
|
@@ -193,6 +222,29 @@ export function parseArgs(argv) {
|
|
|
193
222
|
config.fileSearchMode = v;
|
|
194
223
|
break;
|
|
195
224
|
}
|
|
225
|
+
case "--otel":
|
|
226
|
+
config.otel = true;
|
|
227
|
+
break;
|
|
228
|
+
case "--no-otel":
|
|
229
|
+
config.otel = false;
|
|
230
|
+
break;
|
|
231
|
+
case "--otel-include-content":
|
|
232
|
+
config.otelIncludeContent = true;
|
|
233
|
+
break;
|
|
234
|
+
case "--otel-service-name": {
|
|
235
|
+
const v = next().trim();
|
|
236
|
+
if (!v)
|
|
237
|
+
throw new Error("--otel-service-name requires a value");
|
|
238
|
+
config.otelServiceName = v;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
case "--otel-endpoint": {
|
|
242
|
+
const v = next().trim();
|
|
243
|
+
if (!v)
|
|
244
|
+
throw new Error("--otel-endpoint requires a value");
|
|
245
|
+
config.otelEndpoint = v;
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
196
248
|
case "-h":
|
|
197
249
|
case "--help":
|
|
198
250
|
printHelp();
|
package/dist/args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsHH,MAAM,UAAU,SAAS;IACvB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuEtB,CAAC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,MAAM,GAAc;QACxB,KAAK,EAAE,EAAE;QACT,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,SAAS,EAAE,KAAK;QAChB,cAAc,EAAE,KAAK;QACrB,0BAA0B,EAAE,KAAK;QACjC,OAAO,EAAE,MAAM;QACf,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,IAAI;KACjB,CAAC;IAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,IAAI,GAAG,GAAW,EAAE;YACxB,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,KAAK,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,GAAG,mBAAmB,CAAC,CAAC;YACrE,OAAO,CAAC,CAAC;QACX,CAAC,CAAC;QACF,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,SAAS,CAAC;YACf,KAAK,IAAI;gBACP,MAAM,CAAC,KAAK,GAAG,IAAI,EAAE,C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AAE,CAAC,IAAI,EAAE,CAAC;gBACxB,IAAI,CAAC,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;gBAChE,MAAM,CAAC,eAAe,GAAG,CAAC,CAAC;gBAC3B,MAAM;YACR,CAAC;YACD,KAAK,iBAAiB,CAAC,CAAC,CAAC;gBACvB,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;gBACxB,IAAI,CAAC,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;gBAC5D,MAAM,CAAC,YAAY,GAAG,CAAC,CAAC;gBACxB,MAAM;YACR,CAAC;YACD,KAAK,IAAI,CAAC;YACV,KAAK,QAAQ;gBACX,SAAS,EAAE,CAAC;gBACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB;gBACE,MAAM,IAAI,KAAK,CAAC,iBAAiB,GAAG,EAAE,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,uCAAuC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skills resource entry point.
|
|
3
|
+
*
|
|
4
|
+
* Pi implements the Agent Skills standard (https://agentskills.io) natively:
|
|
5
|
+
* a skill is a directory with a `SKILL.md` (frontmatter `name` + `description`
|
|
6
|
+
* + instructions). Pi's resource loader discovers skills from default
|
|
7
|
+
* locations (~/.pi/agent/skills, ~/.agents/skills, project .pi/skills,
|
|
8
|
+
* .agents/skills, and package `skills/` dirs) and surfaces them to the agent
|
|
9
|
+
* via progressive disclosure — only names/descriptions are always in context;
|
|
10
|
+
* the agent `read`s the full SKILL.md on demand.
|
|
11
|
+
*
|
|
12
|
+
* Unlike `github`/`web-search`, skills are NOT `customTools`. They're a
|
|
13
|
+
* Pi-native resource fed to `DefaultResourceLoader` via `additionalSkillPaths`
|
|
14
|
+
* / `noSkills` (the same channel file-search uses for `additionalExtensionPaths`).
|
|
15
|
+
* This module's only job is to normalize the operator's `--skill` paths
|
|
16
|
+
* (tilde + relative → absolute, drop missing ones) so the runner can hand
|
|
17
|
+
* them straight to the loader.
|
|
18
|
+
*
|
|
19
|
+
* Safe-by-default like every other extension: a path that doesn't exist is
|
|
20
|
+
* dropped with a warning rather than aborting the run.
|
|
21
|
+
*/
|
|
22
|
+
export interface SkillsConfig {
|
|
23
|
+
/**
|
|
24
|
+
* Extra skill paths from `--skill <path>` (repeatable). Each entry is a
|
|
25
|
+
* directory of skills OR a single skill directory/file. Additive even when
|
|
26
|
+
* `noSkills` is true.
|
|
27
|
+
*/
|
|
28
|
+
skillPaths?: string[];
|
|
29
|
+
/** When true, disable Pi's default skill discovery. Explicit paths still load. */
|
|
30
|
+
noSkills?: boolean;
|
|
31
|
+
/** Working directory, for resolving relative `--skill` paths. */
|
|
32
|
+
cwd: string;
|
|
33
|
+
/** Home directory for `~` expansion. Injectable for tests; default os.homedir(). */
|
|
34
|
+
home?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface SkillsResult {
|
|
37
|
+
/**
|
|
38
|
+
* - "default" — no flags; rely on Pi's default discovery.
|
|
39
|
+
* - "configured" — at least one explicit `--skill` path resolved.
|
|
40
|
+
* - "disabled" — `--no-skills` with no explicit paths that resolved.
|
|
41
|
+
*/
|
|
42
|
+
status: "default" | "configured" | "disabled";
|
|
43
|
+
/** Resolved, existence-checked absolute paths for `additionalSkillPaths`. */
|
|
44
|
+
additionalSkillPaths: string[];
|
|
45
|
+
/** Pass-through for `DefaultResourceLoader.noSkills`. */
|
|
46
|
+
noSkills: boolean;
|
|
47
|
+
/** Non-fatal issues (e.g. a `--skill` path that doesn't exist). */
|
|
48
|
+
warnings: string[];
|
|
49
|
+
}
|
|
50
|
+
/** One discovered skill, flattened for the `skills_status` JSONL event. */
|
|
51
|
+
export interface SkillSummary {
|
|
52
|
+
/** Skill name (from SKILL.md frontmatter). */
|
|
53
|
+
name: string;
|
|
54
|
+
/** Absolute path to the skill's SKILL.md. */
|
|
55
|
+
source: string;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the model can auto-invoke it. False when the skill set
|
|
58
|
+
* `disable-model-invocation: true` (hidden from the system prompt) — worth
|
|
59
|
+
* surfacing since such a skill is present but won't be picked up on its own.
|
|
60
|
+
*/
|
|
61
|
+
modelInvocable: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface SkillsStatusEvent {
|
|
64
|
+
type: "skills_status";
|
|
65
|
+
status: SkillsResult["status"];
|
|
66
|
+
/** Number of skills the resource loader actually discovered. */
|
|
67
|
+
discovered: number;
|
|
68
|
+
skills: SkillSummary[];
|
|
69
|
+
/** Operator-mapped `--skill` paths that resolved (echoed for observability). */
|
|
70
|
+
mappedPaths: string[];
|
|
71
|
+
noSkills: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Build the `skills_status` event, or null when it should be suppressed.
|
|
75
|
+
*
|
|
76
|
+
* Gated so a default run (no skill flags) in a clean environment (no skills
|
|
77
|
+
* discovered) emits nothing — keeping the golden `test/fixtures/*.jsonl`
|
|
78
|
+
* byte-identical (AGENTS.md rule #2). It surfaces only when the operator
|
|
79
|
+
* opted in via `--skill`/`--no-skills` (status !== "default") OR at least one
|
|
80
|
+
* skill was actually discovered.
|
|
81
|
+
*/
|
|
82
|
+
export declare function buildSkillsStatusEvent(result: SkillsResult, discovered: SkillSummary[]): SkillsStatusEvent | null;
|
|
83
|
+
export declare function loadSkillsExtension(config: SkillsConfig): SkillsResult;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skills resource entry point.
|
|
3
|
+
*
|
|
4
|
+
* Pi implements the Agent Skills standard (https://agentskills.io) natively:
|
|
5
|
+
* a skill is a directory with a `SKILL.md` (frontmatter `name` + `description`
|
|
6
|
+
* + instructions). Pi's resource loader discovers skills from default
|
|
7
|
+
* locations (~/.pi/agent/skills, ~/.agents/skills, project .pi/skills,
|
|
8
|
+
* .agents/skills, and package `skills/` dirs) and surfaces them to the agent
|
|
9
|
+
* via progressive disclosure — only names/descriptions are always in context;
|
|
10
|
+
* the agent `read`s the full SKILL.md on demand.
|
|
11
|
+
*
|
|
12
|
+
* Unlike `github`/`web-search`, skills are NOT `customTools`. They're a
|
|
13
|
+
* Pi-native resource fed to `DefaultResourceLoader` via `additionalSkillPaths`
|
|
14
|
+
* / `noSkills` (the same channel file-search uses for `additionalExtensionPaths`).
|
|
15
|
+
* This module's only job is to normalize the operator's `--skill` paths
|
|
16
|
+
* (tilde + relative → absolute, drop missing ones) so the runner can hand
|
|
17
|
+
* them straight to the loader.
|
|
18
|
+
*
|
|
19
|
+
* Safe-by-default like every other extension: a path that doesn't exist is
|
|
20
|
+
* dropped with a warning rather than aborting the run.
|
|
21
|
+
*/
|
|
22
|
+
import { existsSync } from "node:fs";
|
|
23
|
+
import { homedir } from "node:os";
|
|
24
|
+
import { isAbsolute, resolve } from "node:path";
|
|
25
|
+
/** Expand a leading `~` and resolve to an absolute path against `cwd`. */
|
|
26
|
+
function resolveSkillPath(raw, cwd, home) {
|
|
27
|
+
let p = raw;
|
|
28
|
+
if (p === "~") {
|
|
29
|
+
p = home;
|
|
30
|
+
}
|
|
31
|
+
else if (p.startsWith("~/")) {
|
|
32
|
+
p = resolve(home, p.slice(2));
|
|
33
|
+
}
|
|
34
|
+
return isAbsolute(p) ? p : resolve(cwd, p);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build the `skills_status` event, or null when it should be suppressed.
|
|
38
|
+
*
|
|
39
|
+
* Gated so a default run (no skill flags) in a clean environment (no skills
|
|
40
|
+
* discovered) emits nothing — keeping the golden `test/fixtures/*.jsonl`
|
|
41
|
+
* byte-identical (AGENTS.md rule #2). It surfaces only when the operator
|
|
42
|
+
* opted in via `--skill`/`--no-skills` (status !== "default") OR at least one
|
|
43
|
+
* skill was actually discovered.
|
|
44
|
+
*/
|
|
45
|
+
export function buildSkillsStatusEvent(result, discovered) {
|
|
46
|
+
if (result.status === "default" && discovered.length === 0)
|
|
47
|
+
return null;
|
|
48
|
+
return {
|
|
49
|
+
type: "skills_status",
|
|
50
|
+
status: result.status,
|
|
51
|
+
discovered: discovered.length,
|
|
52
|
+
skills: discovered,
|
|
53
|
+
mappedPaths: result.additionalSkillPaths,
|
|
54
|
+
noSkills: result.noSkills,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function loadSkillsExtension(config) {
|
|
58
|
+
const home = config.home ?? homedir();
|
|
59
|
+
const noSkills = config.noSkills === true;
|
|
60
|
+
const warnings = [];
|
|
61
|
+
const additionalSkillPaths = [];
|
|
62
|
+
for (const raw of config.skillPaths ?? []) {
|
|
63
|
+
const abs = resolveSkillPath(raw, config.cwd, home);
|
|
64
|
+
if (!existsSync(abs)) {
|
|
65
|
+
// Non-fatal: an operator pointed at a folder that isn't there. Drop it
|
|
66
|
+
// and warn rather than failing the run (safe-by-default).
|
|
67
|
+
warnings.push(`skill path not found, ignoring: ${raw}`);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
additionalSkillPaths.push(abs);
|
|
71
|
+
}
|
|
72
|
+
let status;
|
|
73
|
+
if (additionalSkillPaths.length > 0) {
|
|
74
|
+
status = "configured";
|
|
75
|
+
}
|
|
76
|
+
else if (noSkills) {
|
|
77
|
+
status = "disabled";
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
status = "default";
|
|
81
|
+
}
|
|
82
|
+
return { status, additionalSkillPaths, noSkills, warnings };
|
|
83
|
+
}
|
|
84
|
+
//# s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AAmB,CAAC,MAAoB;IACtD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,EAAE,CAAC;IACtC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC;IAC1C,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,oBAAoB,GAAa,EAAE,CAAC;IAE1C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,uEAAuE;YACvE,0DAA0D;YAC1D,QAAQ,CAAC,IAAI,CAAC,mCAAmC,GAAG,EAAE,CAAC,CAAC;YACxD,SAAS;QACX,CAAC;QACD,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,MAA8B,CAAC;IACnC,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,MAAM,GAAG,YAAY,CAAC;IACxB,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QACpB,MAAM,GAAG,UAAU,CAAC;IACtB,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAC9D,CAAC"}
|
package/dist/run.d.ts
CHANGED
|
@@ -101,6 +101,33 @@ export interface RunOptions {
|
|
|
101
101
|
* under the same names). The `PI_FFF_MODE` env var, if set, wins.
|
|
102
102
|
*/
|
|
103
103
|
fileSearchMode?: "override" | "tools-only" | "tools-and-ui";
|
|
104
|
+
/**
|
|
105
|
+
* Extra Agent Skill paths to load, beyond Pi's default discovery
|
|
106
|
+
* (`~/.pi/agent/skills`, `~/.agents/skills`, `.pi/skills`, `.agents/skills`,
|
|
107
|
+
* package `skills/`). Each entry is a directory of skills OR a single skill
|
|
108
|
+
* dir/file. Additive even with `noSkills`. Maps e.g. `~/.claude/skills` into
|
|
109
|
+
* the agent.
|
|
110
|
+
*/
|
|
111
|
+
skillPaths?: string[];
|
|
112
|
+
/**
|
|
113
|
+
* Disable Pi's default skill discovery. Explicit `skillPaths` still load.
|
|
114
|
+
* Default: discovery enabled (Pi's default).
|
|
115
|
+
*/
|
|
116
|
+
noSkills?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Enable OTEL traces + metrics export. Default: `false` (or env
|
|
119
|
+
* `AGENTIC_PI_OTEL_ENABLED=1`). `false` here force-disables. Requires an
|
|
120
|
+
* OTLP endpoint via `OTEL_EXPORTER_OTLP_ENDPOINT` or `otelEndpoint`.
|
|
121
|
+
* Standard `OTEL_*` env vars are honored by the SDK. Sandbox/env-driven
|
|
122
|
+
* callers can leave this unset and rely on `AGENTIC_PI_OTEL_ENABLED`.
|
|
123
|
+
*/
|
|
124
|
+
otel?: boolean;
|
|
125
|
+
/** Attach bounded raw content to spans. Default: `false` (metadata-only). */
|
|
126
|
+
otelIncludeContent?: boolean;
|
|
127
|
+
/** Override OTEL service name (default: "agentic-pi"). */
|
|
128
|
+
otelServiceName?: string;
|
|
129
|
+
/** Override the OTLP endpoint base URL (escape hatch; prefer the env var). */
|
|
130
|
+
otelEndpoint?: string;
|
|
104
131
|
/**
|
|
105
132
|
* Called for every emitted JSONL record in order. Same shape that the
|
|
106
133
|
* CLI writes to stdout, with `sessionId` and `timestamp` already injected.
|
|
@@ -188,6 +215,32 @@ export interface RunResult {
|
|
|
188
215
|
mode?: string;
|
|
189
216
|
toolCount: number;
|
|
190
217
|
};
|
|
218
|
+
/**
|
|
219
|
+
* Mirror of the `skills_status` line. Present only when skills were
|
|
220
|
+
* configured (`skillPaths`/`noSkills`) or at least one skill was discovered;
|
|
221
|
+
* absent on a default run with no skills (matching the gated event).
|
|
222
|
+
*/
|
|
223
|
+
skills?: {
|
|
224
|
+
status: "default" | "configured" | "disabled";
|
|
225
|
+
discovered: number;
|
|
226
|
+
skills: Array<{
|
|
227
|
+
name: string;
|
|
228
|
+
source: string;
|
|
229
|
+
modelInvocable: boolean;
|
|
230
|
+
}>;
|
|
231
|
+
mappedPaths: string[];
|
|
232
|
+
noSkills: boolean;
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Mirror of the telemetry `extension_status` line. Present only when OTEL
|
|
236
|
+
* was requested (enabled or explicitly disabled); absent on a default run.
|
|
237
|
+
*/
|
|
238
|
+
telemetry?: {
|
|
239
|
+
status: "configured" | "skipped";
|
|
240
|
+
reason?: string;
|
|
241
|
+
message?: string;
|
|
242
|
+
includeContent?: boolean;
|
|
243
|
+
};
|
|
191
244
|
/** Every JSONL record the run emitted, in order. */
|
|
192
245
|
records: EmitterRecord[];
|
|
193
246
|
/** Warnings that would have gone to stderr in CLI mode. */
|
package/dist/run.js
CHANGED
|
@@ -51,6 +51,12 @@ export async function run(options) {
|
|
|
51
51
|
webSearchMaxCalls: options.webSearchMaxCalls,
|
|
52
52
|
fileSearch: options.fileSearch ?? true,
|
|
53
53
|
fileSearchMode: options.fileSearchMode,
|
|
54
|
+
skillPaths: options.skillPaths,
|
|
55
|
+
noSkills: options.noSkills,
|
|
56
|
+
otel: options.otel,
|
|
57
|
+
otelIncludeContent: options.otelIncludeContent,
|
|
58
|
+
otelServiceName: options.otelServiceName,
|
|
59
|
+
otelEndpoint: options.otelEndpoint,
|
|
54
60
|
};
|
|
55
61
|
const collector = new CollectorSink(options.onEvent);
|
|
56
62
|
const sink = options.extraSink
|
|
@@ -117,6 +123,23 @@ function buildResult(exitCode, records, warnings) {
|
|
|
117
123
|
toolCount: r.toolCount ?? 0,
|
|
118
124
|
};
|
|
119
125
|
}
|
|
126
|
+
else if (r.extension === "telemetry") {
|
|
127
|
+
result.telemetry = {
|
|
128
|
+
status: r.status,
|
|
129
|
+
reason: r.reason,
|
|
130
|
+
message: r.message,
|
|
131
|
+
includeContent: r.includeContent,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
135
|
+
case "skills_status":
|
|
136
|
+
result.skills = {
|
|
137
|
+
status: r.status,
|
|
138
|
+
discovered: r.discovered ?? 0,
|
|
139
|
+
skills: r.skills ?? [],
|
|
140
|
+
mappedPaths: r.mappedPaths ?? [],
|
|
141
|
+
noSkills: r.noSkills ?? false,
|
|
142
|
+
};
|
|
120
143
|
break;
|
|
121
144
|
case "message_end": {
|
|
122
145
|
// Accumulate assistant text. Pi's message structure:
|
package/dist/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAWH,OAAO,EACL,aAAa,EACb,OAAO,GAGR,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAwB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAWH,OAAO,EACL,aAAa,EACb,OAAO,GAGR,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAwB,MAAM,aAAa,CAAC;AAuO5D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAmB;IAC3C,MAAM,MAAM,GAAc;QACxB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;QACjC,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,KAAK;QACrC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,cAAc,EAAE,OAAO,CAAC,cAAc,I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