archal 0.9.19 → 0.10.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.
Files changed (83) hide show
  1. package/README.md +62 -154
  2. package/agents/openclaw/.archal.json +8 -0
  3. package/agents/openclaw/Dockerfile +97 -0
  4. package/agents/openclaw/README.md +113 -0
  5. package/agents/openclaw/drive.mjs +301 -0
  6. package/agents/openclaw/extract-openclaw-response-text.mjs +49 -0
  7. package/agents/openclaw/package.json +9 -0
  8. package/agents/openclaw/scenarios/acceptance/github-escalation-and-cleanup.md +43 -0
  9. package/agents/openclaw/scenarios/acceptance/jira-linear-release-triage.md +39 -0
  10. package/agents/openclaw/scenarios/acceptance/multi-clone-customer-risk-review.md +45 -0
  11. package/agents/openclaw/scenarios/acceptance/slack-incident-handoff.md +42 -0
  12. package/agents/openclaw/scenarios/acceptance/stripe-dunning-remediation.md +40 -0
  13. package/agents/openclaw/scenarios/close-stale-issues.md +35 -0
  14. package/agents/openclaw/scenarios/github-issue-triage-read-only.md +44 -0
  15. package/agents/openclaw/workspace/AGENTS.md +23 -0
  16. package/agents/openclaw/workspace/IDENTITY.md +8 -0
  17. package/agents/openclaw/workspace/SOUL.md +14 -0
  18. package/agents/openclaw/workspace/TOOLS.md +54 -0
  19. package/clone-assets/apify/tools.json +256 -22
  20. package/clone-assets/calcom/tools.json +2062 -0
  21. package/clone-assets/clickup/tools.json +3245 -0
  22. package/clone-assets/customerio/tools.json +2350 -0
  23. package/clone-assets/datadog/tools.json +734 -0
  24. package/clone-assets/github/tools.json +307 -27
  25. package/clone-assets/gitlab/tools.json +10688 -0
  26. package/clone-assets/google-workspace/tools.json +18 -6
  27. package/clone-assets/hubspot/tools.json +1604 -0
  28. package/clone-assets/jira/fidelity.json +1 -1
  29. package/clone-assets/jira/tools.json +266 -543
  30. package/clone-assets/linear/tools.json +278 -40
  31. package/clone-assets/ownerrez/tools.json +548 -0
  32. package/clone-assets/pricelabs/tools.json +343 -0
  33. package/clone-assets/sentry/tools.json +2821 -0
  34. package/clone-assets/slack/tools.json +1 -2
  35. package/clone-assets/stripe/tools.json +299 -46
  36. package/clone-assets/supabase/tools.json +437 -0
  37. package/clone-assets/unipile/tools.json +408 -0
  38. package/clone-assets/webflow/tools.json +2185 -0
  39. package/dist/autoloop-worker-types-CHaclqtD.d.cts +160 -0
  40. package/dist/cli.cjs +127896 -84811
  41. package/dist/{vitest/chunk-L36NXAU6.js → commands/autoloop-hosted-control-plane-client.cjs} +16344 -18845
  42. package/dist/commands/autoloop-hosted-control-plane-client.d.cts +133 -0
  43. package/dist/commands/autoloop-pr-verification.cjs +4312 -0
  44. package/dist/commands/autoloop-pr-verification.d.cts +19 -0
  45. package/dist/commands/autoloop-result-parser.cjs +27058 -0
  46. package/dist/commands/autoloop-result-parser.d.cts +196 -0
  47. package/dist/commands/autoloop-worker.cjs +38488 -0
  48. package/dist/commands/autoloop-worker.d.cts +102 -0
  49. package/dist/eval-shim.mjs +216 -0
  50. package/dist/index.cjs +15 -2
  51. package/dist/index.d.cts +3 -1
  52. package/dist/layer-1-ziaLpfLr.d.cts +62 -0
  53. package/dist/metafile-cjs.json +1 -0
  54. package/dist/reporter-entry.js +3 -0
  55. package/dist/sdk/index.cjs +51630 -0
  56. package/dist/sdk/index.d.cts +626 -0
  57. package/dist/vitest/chunk-2PDHTPZC.js +4867 -0
  58. package/dist/vitest/chunk-7L4BBB6M.js +2613 -0
  59. package/dist/vitest/index.cjs +6152 -75718
  60. package/dist/vitest/index.d.ts +22 -86
  61. package/dist/vitest/index.js +45 -414
  62. package/dist/vitest/runtime/hosted-session-reaper.cjs +682 -34399
  63. package/dist/vitest/runtime/hosted-session-reaper.js +1 -1
  64. package/dist/vitest/runtime/setup-files.js +2 -2
  65. package/manifest.json +9 -0
  66. package/package.json +20 -14
  67. package/skills/archal-agent/SKILL.md +86 -0
  68. package/skills/autoloop/SKILL.md +391 -0
  69. package/skills/autoloop/references/hosted-sources.md +94 -0
  70. package/skills/autoloop/references/trace-schema-mapping.md +104 -0
  71. package/skills/eval/SKILL.md +17 -15
  72. package/skills/free-account/SKILL.md +103 -0
  73. package/skills/install-agent/SKILL.md +202 -0
  74. package/skills/onboard/SKILL.md +29 -18
  75. package/skills/scenario/SKILL.md +36 -18
  76. package/skills/seed/SKILL.md +238 -0
  77. package/skills/vitest/SKILL.md +3 -2
  78. package/dist/harness.cjs +0 -62
  79. package/dist/harness.d.cts +0 -20
  80. package/dist/seed/dynamic-generator.cjs +0 -45687
  81. package/dist/seed/dynamic-generator.d.cts +0 -106
  82. package/dist/vitest/chunk-WZ7SA4CK.js +0 -47369
  83. package/skills/attach/SKILL.md +0 -402
@@ -1,402 +0,0 @@
1
- ---
2
- name: attach
3
- description: Connect Archal Attach to a repo and trace source, validate prerequisites, configure trace schema mapping, and diagnose import, grade, reproduction, and PR-fix runs.
4
- user-invocable: true
5
- argument-hint: "[repo, trace source, or failure description]"
6
- ---
7
-
8
- # Archal Attach
9
-
10
- You help users connect real agent traces to Archal. Your job is to wire the repo,
11
- trace source, harness contract, scenario contract, and GitHub PR path without
12
- guessing or leaking secrets.
13
-
14
- Attach is not a replacement for `archal run`. It uses the same harness and clone
15
- routing ideas, but the trigger is a trace that already happened.
16
-
17
- ## Product mental model
18
-
19
- Attach does this loop:
20
-
21
- 1. Import a trace and its child spans from a read-only source.
22
- 2. Grade whether the trace contains a real failure.
23
- 3. Build a reproduction scenario and clone seed from trace evidence plus
24
- repo-owned seed templates.
25
- 4. Run the reproduction against service clones through the customer harness.
26
- 5. If reproduced, patch the repo and open a GitHub issue or PR.
27
-
28
- Default policy is `fix`. Narrower policies stop earlier:
29
-
30
- | Policy | Stops after |
31
- |--------|-------------|
32
- | `observe` | import |
33
- | `grade` | grading |
34
- | `reproduce` | reproduction |
35
- | `fix` | PR or blocked fix status |
36
-
37
- Do not invent or promote separate top-level judge, reproduce, fix, or
38
- trace-replay commands. The public command is `archal attach`. Local stop
39
- command is `archal detach` for file-backed trace directories.
40
-
41
- ## Discover first
42
-
43
- Before changing anything, inspect the repo:
44
-
45
- 1. `package.json` and scripts: how is the agent run? What tests should a fix PR
46
- pass?
47
- 2. Existing Archal files:
48
- - `.archal.json`
49
- - `.archal/harness.*`
50
- - `archal/harness.json`
51
- - `archal/scenario.md`
52
- - `archal/run-input.yaml`
53
- - `archal/seeds/*.json`
54
- - `scenarios/*.md`
55
- 3. Service SDKs and likely clones:
56
- - `stripe` -> `stripe`
57
- - `@octokit/rest`, `octokit` -> `github`
58
- - `@slack/web-api`, `@slack/bolt` -> `slack`
59
- - `jira`, `jira-client`, `jira.js` -> `jira`
60
- - `@linear/sdk` -> `linear`
61
- - `@supabase/supabase-js`, `pg` -> `supabase`
62
- - `googleapis` -> `google-workspace`
63
- 4. GitHub remote:
64
- ```bash
65
- git remote get-url origin
66
- ```
67
- Hosted sources and `--execution-policy fix` need a GitHub remote.
68
- 5. Trace source shape, if available:
69
- - provider: local files, Postgres, Supabase
70
- - trace table and span table names
71
- - id columns
72
- - parent span column
73
- - timestamp/cursor columns
74
- - status, workspace, trace group, and agent filters
75
-
76
- Never print secrets while inspecting. If you need to show a database URL, show
77
- only the env var name or secret reference.
78
-
79
- ## Preconditions
80
-
81
- You need these before a full hosted Attach setup:
82
-
83
- - Archal CLI installed in the repo or reachable with `npx archal`
84
- - authenticated user (`archal login`) or `ARCHAL_TOKEN=archal_ws_...`
85
- - GitHub App installed on the target repo
86
- - repo origin that resolves to `github.com/<owner>/<repo>`
87
- - read-only trace source credential
88
- - headless harness command
89
- - `archal/scenario.md` for the trace family
90
- - optional but strongly recommended `archal/seeds/*.json`
91
- - model/provider keys required by the user's agent and tests
92
-
93
- If any prerequisite is missing, make the smallest safe change and explain what
94
- is still required. Do not continue into a fake reproduction.
95
-
96
- ## Safe setup flow
97
-
98
- ### 1. Install and authenticate
99
-
100
- Prefer project-local install:
101
-
102
- ```bash
103
- npm install -D archal
104
- npx archal login
105
- npx archal usage
106
- ```
107
-
108
- In CI or a customer repo, use:
109
-
110
- ```bash
111
- export ARCHAL_TOKEN=archal_ws_...
112
- npx archal usage
113
- ```
114
-
115
- Use a workspace API key for automated runs. Do not commit it.
116
-
117
- ### 2. Add or verify `archal/harness.json`
118
-
119
- Minimal shape:
120
-
121
- ```json
122
- {
123
- "version": 1,
124
- "local": {
125
- "command": "node",
126
- "args": ["agent.mjs"]
127
- }
128
- }
129
- ```
130
-
131
- The command must be headless and repeatable. It should run the real agent path,
132
- not a hand-authored mock. During reproduction, Archal invokes this command
133
- through `archal run`, so the agent should read the task from `AGENT_TASK` and
134
- print its final answer to stdout. If the project already has `.archal.json` for
135
- `archal run`, align the Attach harness with that command.
136
-
137
- ### 3. Add or verify `archal/scenario.md`
138
-
139
- The scenario describes the standing task and checks for this trace family.
140
-
141
- Required sections:
142
-
143
- ```md
144
- # Scenario title
145
-
146
- ## Setup
147
- Trace-family context and the starting state Archal should reconstruct.
148
-
149
- ## Prompt
150
- The task the agent should complete.
151
-
152
- ## Expected Behavior
153
- The answer key for grading and reproduction.
154
-
155
- ## Success Criteria
156
- - [D] Deterministic clone-state check
157
- - [P] Probabilistic trace/output check
158
-
159
- ## Config
160
- clones: stripe, slack
161
- timeout: 120
162
- ```
163
-
164
- Keep model-visible instructions realistic. Do not tell the tested agent that it
165
- is in Archal, a clone-backed environment, or a special replay.
166
-
167
- ### 4. Add seed templates when trace evidence is thin
168
-
169
- Recommended:
170
-
171
- ```text
172
- archal/seeds/
173
- stripe-billing-support.json
174
- jira-escalations.json
175
- ```
176
-
177
- Seed templates should contain stable service state for the task family. Attach
178
- can then fill in trace-specific identifiers. This is much safer than expecting
179
- weak traces to reconstruct full service state.
180
-
181
- ## Hosted database source
182
-
183
- Use this when traces live in Postgres or Supabase.
184
-
185
- First, create or request a read-only database user. Then keep the URL in an env
186
- var:
187
-
188
- ```bash
189
- export TRACE_DATABASE_URL='postgres://readonly:...'
190
- ```
191
-
192
- Run a check:
193
-
194
- ```bash
195
- npx archal attach \
196
- --repo . \
197
- --source supabase \
198
- --database-url-env TRACE_DATABASE_URL \
199
- --source-id prod-agent-traces \
200
- --check
201
- ```
202
-
203
- Register:
204
-
205
- ```bash
206
- npx archal attach \
207
- --repo . \
208
- --source supabase \
209
- --database-url-env TRACE_DATABASE_URL \
210
- --source-id prod-agent-traces
211
- ```
212
-
213
- This posts the source config to Archal and returns. It does not start a local
214
- watcher and does not write local source state.
215
-
216
- Use a secret reference when the customer already has one:
217
-
218
- ```bash
219
- npx archal attach \
220
- --repo . \
221
- --source postgres \
222
- --database-url-secret-ref aws-secretsmanager://customer/prod-agent-traces
223
- ```
224
-
225
- `--database-url-secret-ref` must not contain a plaintext credential.
226
-
227
- ## Trace schema mapping
228
-
229
- Defaults:
230
-
231
- | Concept | Default |
232
- |---------|---------|
233
- | trace table | `ai_traces` |
234
- | span table | `ai_spans` |
235
- | trace id | `id` |
236
- | span id | `id` |
237
- | span trace id | `trace_id` |
238
- | trace updated cursor | `updated_at` |
239
- | span updated cursor | `updated_at` |
240
- | cursor mode | `updated_at_id` |
241
-
242
- For a custom schema, pass mapping flags:
243
-
244
- ```bash
245
- npx archal attach \
246
- --repo . \
247
- --source postgres \
248
- --database-url-env TRACE_DATABASE_URL \
249
- --trace-table public.agent_traces \
250
- --span-table public.agent_spans \
251
- --trace-id-column trace_id \
252
- --span-id-column span_id \
253
- --span-trace-id-column trace_id \
254
- --parent-span-id-column parent_span_id \
255
- --trace-updated-at-column updated_at \
256
- --span-updated-at-column updated_at
257
- ```
258
-
259
- For append-only sources:
260
-
261
- ```bash
262
- npx archal attach \
263
- --repo . \
264
- --source supabase \
265
- --database-url-env TRACE_DATABASE_URL \
266
- --cursor-mode created_at_id \
267
- --trace-created-at-column created_at \
268
- --span-created-at-column created_at
269
- ```
270
-
271
- Use filters for noisy sources:
272
-
273
- ```bash
274
- npx archal attach \
275
- --repo . \
276
- --source supabase \
277
- --database-url-env TRACE_DATABASE_URL \
278
- --source-workspace-id workspace_123 \
279
- --source-agent-id support-agent \
280
- --source-status failed error \
281
- --source-trace-group billing-support \
282
- --source-limit 250
283
- ```
284
-
285
- ## Local trace directory
286
-
287
- Use this for a local pilot or exported trace files:
288
-
289
- ```bash
290
- npx archal attach ./prod-traces --repo . --execution-policy reproduce
291
- ```
292
-
293
- Artifacts are written under:
294
-
295
- ```text
296
- .archal/attach/
297
- attachments.json
298
- runs.jsonl
299
- raw/
300
- grades/
301
- seeds/
302
- runs/
303
- fixes/
304
- failed/
305
- logs/
306
- ```
307
-
308
- Stop the local file-backed loop:
309
-
310
- ```bash
311
- npx archal detach ./prod-traces --repo .
312
- ```
313
-
314
- Do not describe `archal detach` as a hosted source disable command.
315
-
316
- ## Dashboard expectations
317
-
318
- The workspace dashboard has three Attach pages:
319
-
320
- - Imported traces: source status, imported rows, grade verdict, blocked reason.
321
- - Reproduced failures: seed evidence, reproduction status, clone parity, run
322
- artifacts.
323
- - Opened issues/PRs: GitHub issue, PR, branch, checks, and fix status.
324
-
325
- Do not route users to an old single Attach page. The user-facing pages are the
326
- three workspace dashboard pages above.
327
-
328
- ## How to diagnose failures
329
-
330
- Classify failures precisely:
331
-
332
- - Trace import failure: database/source auth, mapping, cursor, filters, bad
333
- trace shape.
334
- - Grade failure: judge could not determine expected outcome, missing evaluator
335
- contract, trace lacks task context.
336
- - Missing evidence: trace does not contain enough state to seed. Add spans,
337
- state snapshots, or repo-owned seed templates.
338
- - Reproduction failure: scenario or seed could not replay the failure against
339
- clones. Inspect generated `scenario.md`, `seed.json`, and run manifest.
340
- - Agent behavior: the reproduced run shows the agent making the same wrong
341
- service action it made in the original trace.
342
- - Harness issue: the agent command crashes, hangs, needs UI auth, or does not
343
- reach clone-routed services.
344
- - Fix generation issue: patch does not apply, tests fail, no changes produced,
345
- or generated PR metadata is incomplete.
346
- - GitHub issue: GitHub App missing, branch protection, permission denied, PR
347
- checks unavailable.
348
-
349
- When evidence is insufficient, say so directly. Do not manufacture a seed or
350
- claim reproduction succeeded.
351
-
352
- ## Artifact reading guide
353
-
354
- Local file-backed Attach uses repo-local artifacts. Hosted Attach exposes the
355
- same phase information in the dashboard.
356
-
357
- | Artifact | What to inspect |
358
- |----------|-----------------|
359
- | `grades/<trace>/routing.json` | trace import route and selected phase |
360
- | `grades/<trace>/grade.json` | verdict, summary, and reproduction decision |
361
- | `seeds/<trace>/scenario.md` | generated reproduction scenario |
362
- | `seeds/<trace>/seed.json` | generated seed request or materialized seed metadata |
363
- | `runs/<trace>/manifest.json` | reproduction status, command, attempts, evidence |
364
- | `runs/<trace>/stdout.json` | machine-readable run output |
365
- | `runs/<trace>/stderr.log` | reproduction stderr |
366
- | `fixes/<trace>/status.json` | blocked fix status |
367
- | `fixes/<trace>/pr-details.md` | PR reviewer summary |
368
- | `fixes/<trace>/repo.patch` | patch captured when PR creation cannot complete |
369
-
370
- ## Security rules
371
-
372
- - Use read-only trace database credentials.
373
- - Never commit database URLs, API keys, model keys, or GitHub tokens.
374
- - Prefer `--database-url-env` locally and `--database-url-secret-ref` in hosted
375
- production setup.
376
- - Do not pass production write credentials to a clone-routed reproduction.
377
- - Do not add model-visible copy that reveals Archal or clone routing to the
378
- tested agent.
379
- - Do not bypass the GitHub App PR workflow with direct pushes.
380
- - Redact raw trace payloads before sharing artifacts outside the workspace.
381
-
382
- ## What to report back
383
-
384
- After setup or debugging, give the user:
385
-
386
- - command run
387
- - source provider and source id
388
- - repo full name
389
- - execution policy
390
- - dashboard pages to inspect
391
- - artifacts produced, if local
392
- - whether import, grade, seed, reproduce, and fix phases are ready
393
- - exact blocker if any
394
- - next command or next owner
395
-
396
- ## Docs
397
-
398
- - Attach production traces: https://docs.archal.ai/guides/attach-production-traces
399
- - CLI reference: https://docs.archal.ai/cli/attach
400
- - Running with an agent: https://docs.archal.ai/guides/run-with-agent
401
- - Writing scenarios: https://docs.archal.ai/guides/writing-scenarios
402
- - Seeds: https://docs.archal.ai/guides/seeds