@dynamicagents/plugins 0.11.1 → 0.13.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 (134) hide show
  1. package/README.md +59 -79
  2. package/dist/browser/index.d.ts +0 -2
  3. package/dist/browser/index.js +21 -27
  4. package/dist/claude-code/cards.d.ts +53 -0
  5. package/dist/claude-code/cards.js +272 -0
  6. package/dist/claude-code/config.d.ts +73 -31
  7. package/dist/claude-code/config.js +0 -2
  8. package/dist/claude-code/credentials.d.ts +21 -9
  9. package/dist/claude-code/credentials.js +43 -9
  10. package/dist/claude-code/egress.d.ts +15 -14
  11. package/dist/claude-code/egress.js +51 -14
  12. package/dist/claude-code/events.d.ts +153 -9
  13. package/dist/claude-code/events.js +289 -58
  14. package/dist/claude-code/github.d.ts +39 -0
  15. package/dist/claude-code/github.js +82 -0
  16. package/dist/claude-code/index.d.ts +24 -80
  17. package/dist/claude-code/index.js +19 -234
  18. package/dist/claude-code/model.d.ts +152 -0
  19. package/dist/claude-code/model.js +342 -0
  20. package/dist/claude-code/run.d.ts +283 -92
  21. package/dist/claude-code/run.js +620 -114
  22. package/dist/claude-code/session.d.ts +131 -0
  23. package/dist/claude-code/session.js +285 -0
  24. package/dist/claude-code/spec.d.ts +46 -0
  25. package/dist/claude-code/spec.js +83 -0
  26. package/dist/claude-code/verified.d.ts +15 -0
  27. package/dist/claude-code/verified.js +15 -0
  28. package/dist/computer/context.d.ts +19 -0
  29. package/dist/computer/context.js +222 -0
  30. package/dist/computer/file-lock.d.ts +5 -0
  31. package/dist/computer/file-lock.js +40 -0
  32. package/dist/computer/gate.d.ts +12 -12
  33. package/dist/computer/gate.js +12 -12
  34. package/dist/computer/index.d.ts +57 -255
  35. package/dist/computer/index.js +98 -1039
  36. package/dist/computer/paths.d.ts +47 -22
  37. package/dist/computer/paths.js +64 -49
  38. package/dist/computer/proxy.d.ts +45 -0
  39. package/dist/computer/proxy.js +234 -0
  40. package/dist/computer/render.d.ts +27 -38
  41. package/dist/computer/render.js +32 -65
  42. package/dist/computer/tools-exec.d.ts +3 -0
  43. package/dist/computer/tools-exec.js +268 -0
  44. package/dist/computer/tools-file.d.ts +12 -0
  45. package/dist/computer/tools-file.js +64 -0
  46. package/dist/computer/tools-grep.d.ts +3 -0
  47. package/dist/computer/tools-grep.js +129 -0
  48. package/dist/repo/checkout.d.ts +35 -6
  49. package/dist/repo/checkout.js +64 -6
  50. package/dist/repo/context.d.ts +135 -0
  51. package/dist/repo/context.js +582 -0
  52. package/dist/repo/index.d.ts +79 -57
  53. package/dist/repo/index.js +118 -1112
  54. package/dist/repo/tools-checks.d.ts +3 -0
  55. package/dist/repo/tools-checks.js +112 -0
  56. package/dist/repo/tools-clone.d.ts +4 -0
  57. package/dist/repo/tools-clone.js +192 -0
  58. package/dist/repo/tools-pr.d.ts +14 -0
  59. package/dist/repo/tools-pr.js +196 -0
  60. package/dist/repo/tools-review.d.ts +12 -0
  61. package/dist/repo/tools-review.js +393 -0
  62. package/dist/repo/tools-worktree.d.ts +4 -0
  63. package/dist/repo/tools-worktree.js +305 -0
  64. package/dist/repo/tools-worktrees.d.ts +12 -0
  65. package/dist/repo/tools-worktrees.js +48 -0
  66. package/dist/repo/url.d.ts +2 -2
  67. package/dist/repo/url.js +7 -7
  68. package/dist/scratch/index.d.ts +4 -4
  69. package/dist/scratch/index.js +12 -11
  70. package/dist/{computer → workspace}/advisory.d.ts +33 -20
  71. package/dist/{computer → workspace}/advisory.js +32 -7
  72. package/dist/workspace/ca-trust.d.ts +95 -0
  73. package/dist/workspace/ca-trust.js +312 -0
  74. package/dist/workspace/container-deps.d.ts +54 -0
  75. package/dist/workspace/container-deps.js +224 -0
  76. package/dist/workspace/container-fault.d.ts +38 -0
  77. package/dist/workspace/container-fault.js +73 -0
  78. package/dist/workspace/exec.d.ts +94 -0
  79. package/dist/workspace/exec.js +153 -0
  80. package/dist/workspace/format.d.ts +36 -0
  81. package/dist/workspace/format.js +57 -0
  82. package/dist/workspace/git-host.d.ts +79 -0
  83. package/dist/workspace/git-host.js +226 -0
  84. package/dist/workspace/git-identity.d.ts +57 -0
  85. package/dist/workspace/git-identity.js +147 -0
  86. package/dist/workspace/index.d.ts +43 -47
  87. package/dist/workspace/index.js +52 -112
  88. package/dist/workspace/install-job.d.ts +121 -0
  89. package/dist/workspace/install-job.js +866 -0
  90. package/dist/{computer → workspace}/install.d.ts +15 -19
  91. package/dist/{computer → workspace}/install.js +8 -11
  92. package/dist/workspace/object.d.ts +502 -0
  93. package/dist/workspace/object.js +1427 -0
  94. package/dist/workspace/open.d.ts +95 -0
  95. package/dist/workspace/open.js +63 -0
  96. package/dist/workspace/read.d.ts +16 -0
  97. package/dist/workspace/read.js +22 -0
  98. package/dist/workspace/shell.d.ts +45 -0
  99. package/dist/workspace/shell.js +80 -0
  100. package/dist/workspace/sync.d.ts +111 -0
  101. package/dist/workspace/sync.js +124 -0
  102. package/dist/workspace/wake.d.ts +19 -0
  103. package/dist/workspace/wake.js +10 -0
  104. package/package.json +28 -42
  105. package/dist/arc-agi/analysis.d.ts +0 -336
  106. package/dist/arc-agi/analysis.js +0 -829
  107. package/dist/arc-agi/client.d.ts +0 -82
  108. package/dist/arc-agi/client.js +0 -113
  109. package/dist/arc-agi/game-tools.d.ts +0 -25
  110. package/dist/arc-agi/game-tools.js +0 -26
  111. package/dist/arc-agi/index.d.ts +0 -42
  112. package/dist/arc-agi/index.js +0 -175
  113. package/dist/arc-agi/main-agent.d.ts +0 -27
  114. package/dist/arc-agi/main-agent.js +0 -65
  115. package/dist/arc-agi/recipe.d.ts +0 -51
  116. package/dist/arc-agi/recipe.js +0 -100
  117. package/dist/arc-agi/scorecard.d.ts +0 -118
  118. package/dist/arc-agi/scorecard.js +0 -163
  119. package/dist/arc-agi/soul.d.ts +0 -40
  120. package/dist/arc-agi/soul.js +0 -90
  121. package/dist/arc-agi/store.d.ts +0 -154
  122. package/dist/arc-agi/store.js +0 -216
  123. package/dist/arc-agi/tools.d.ts +0 -36
  124. package/dist/arc-agi/tools.js +0 -576
  125. package/dist/arc-agi/types.d.ts +0 -212
  126. package/dist/arc-agi/types.js +0 -19
  127. package/dist/claude-code/recipe.d.ts +0 -53
  128. package/dist/claude-code/recipe.js +0 -100
  129. package/dist/computer/read.d.ts +0 -137
  130. package/dist/computer/read.js +0 -203
  131. package/dist/recall/index.d.ts +0 -99
  132. package/dist/recall/index.js +0 -171
  133. package/dist/triage/index.d.ts +0 -355
  134. package/dist/triage/index.js +0 -302
@@ -1,4 +1,4 @@
1
- import type { ProgressEvent } from "@dynamicagents/core/subtasks";
1
+ import type { NoteData } from "@dynamicagents/core/subagent";
2
2
  /** What a `result` line carries, of the fields anything here reads. */
3
3
  export interface ClaudeCodeResult {
4
4
  /** `success`, or one of the `error_*` subtypes. */
@@ -16,6 +16,23 @@ export interface ClaudeCodeResult {
16
16
  /** How many inner subagents the run spawned — advisory, for the logs. */
17
17
  subagentsSpawned?: number;
18
18
  permissionDenials: number;
19
+ /**
20
+ * The answer of a session launched with a JSON Schema: the input of its
21
+ * `StructuredOutput` call, which `text` then holds as a JSON string. Absent
22
+ * for any other session, and for one that never made the call.
23
+ */
24
+ structured?: unknown;
25
+ /**
26
+ * What the CLI says went wrong, when it reports an error rather than an
27
+ * answer.
28
+ *
29
+ * The only account there is of a refused resume: a `--resume` naming a
30
+ * conversation the config directory does not hold ends in a `result` line with
31
+ * no `text` at all, and `No conversation found with session ID: …` here. A
32
+ * caller that reports such a run as a failed session rather than as "not
33
+ * resumable" is reporting the one thing it was handed to say.
34
+ */
35
+ errors?: string[];
19
36
  }
20
37
  /**
21
38
  * Token counts, flattened.
@@ -32,14 +49,86 @@ export interface ClaudeCodeUsage {
32
49
  cacheRead: number;
33
50
  cacheWrite: number;
34
51
  }
52
+ /**
53
+ * What the client knows about the subscription bucket it is drawing on.
54
+ *
55
+ * The one thing on this stream that is about the *deployment* rather than the
56
+ * run. This plugin's entry point describes the 5-hour and weekly limits as
57
+ * routed around rather than predicted, because the gateway only learns a bucket
58
+ * is empty when Anthropic refuses a request — this is the client saying so in
59
+ * advance, on every session.
60
+ *
61
+ * `resetsAt` is **seconds**, not milliseconds, which is the one field here it is
62
+ * possible to get silently wrong: a value handed to `Date` unconverted lands in
63
+ * January 1970, and a credential marked spent until then reads as usable.
64
+ */
65
+ export interface RateLimitInfo {
66
+ /**
67
+ * {@link RATE_LIMIT_OK} on a healthy bucket. Any other value is
68
+ * **unclassified** — no consumer should read one as exhaustion.
69
+ */
70
+ status: string;
71
+ /** Unix **seconds** at which this bucket refills. */
72
+ resetsAt?: number;
73
+ /** Which bucket — `five_hour`, and the weekly one. */
74
+ rateLimitType?: string;
75
+ /** Whether spend beyond the bucket is permitted, and why not. */
76
+ overageStatus?: string;
77
+ overageDisabledReason?: string;
78
+ }
35
79
  export type ClaudeCodeEvent = {
36
80
  kind: "init";
37
81
  sessionId: string;
38
82
  model?: string;
39
- } | {
40
- kind: "assistant";
83
+ cwd?: string;
84
+ permissionMode?: string;
85
+ }
86
+ /**
87
+ * The subscription bucket, as the client sees it. Carried rather than acted
88
+ * on here — {@link describe} decides what a reader is told, and the caller
89
+ * decides what the credential pool is told.
90
+ */
91
+ | {
92
+ kind: "rateLimit";
93
+ info: RateLimitInfo;
94
+ }
95
+ /** One `text` block of an assistant message, verbatim — it is markdown. */
96
+ | {
97
+ kind: "text";
41
98
  text: string;
42
- tools: string[];
99
+ }
100
+ /**
101
+ * One `thinking` block, as how long it took — never what it said. A block can
102
+ * run to thousands of tokens of private reasoning; a reader is told that the
103
+ * model thought, and for how long, the way the CLI itself says it.
104
+ *
105
+ * `durationMs` is measured, never inferred: see
106
+ * {@link ParsedStream.thinkingFrom} for where it starts, and it is absent
107
+ * whenever that cannot be trusted. `messageId` is the API message the block
108
+ * belongs to — a message can carry more than one.
109
+ */
110
+ | {
111
+ kind: "thinking";
112
+ messageId?: string;
113
+ durationMs?: number;
114
+ } | {
115
+ kind: "toolUse";
116
+ id: string;
117
+ name: string;
118
+ input: unknown;
119
+ }
120
+ /**
121
+ * One `tool_result` block of a `user` line: a tool's answer going back to
122
+ * the model. `structured` is the line's `tool_use_result` — the tool's own
123
+ * record of what it did, richer than the text the model reads — and is read
124
+ * only when the line carries a single result, since it is not per block.
125
+ */
126
+ | {
127
+ kind: "toolResult";
128
+ id: string;
129
+ isError: boolean;
130
+ content: string;
131
+ structured?: unknown;
43
132
  } | {
44
133
  kind: "retry";
45
134
  detail: string;
@@ -88,7 +177,46 @@ export interface ParsedStream {
88
177
  sample?: string;
89
178
  /** Lines dropped for carrying `parent_tool_use_id`. See {@link parseStream}. */
90
179
  nested: number;
180
+ /**
181
+ * When the pending thinking block began streaming, on the caller's clock:
182
+ * the `now` of the read that brought its first `system/thinking_tokens`
183
+ * line.
184
+ *
185
+ * That line is the one sign on the stream that thinking is under way. The
186
+ * CLI prints it as the block's text arrives, so it comes after everything
187
+ * that is not thinking: request setup, the wait for a first token, an API
188
+ * retry's back-off, a compaction. The line before a block — the tool result
189
+ * it answers — comes before all of those, and timing from it is how a minute
190
+ * of retries reads as a minute of thought. The token line carries no time of
191
+ * its own, which is why the caller's clock stamps it.
192
+ *
193
+ * Cleared by every line that carries a `timestamp`, so a start belongs to
194
+ * the block that follows the last message and never to work before it. Handed
195
+ * back with `carry`, for the same reason, and kept on the caller's cursor.
196
+ */
197
+ thinkingFrom?: number;
198
+ }
199
+ /** What {@link parseStream} times a thinking block against. */
200
+ export interface ParseClock {
201
+ /** When this read arrived, in epoch milliseconds. */
202
+ now: number;
203
+ /** {@link ParsedStream.thinkingFrom} from the previous read. */
204
+ thinkingFrom?: number;
91
205
  }
206
+ /**
207
+ * How far a thinking line's arrival may be from its own `timestamp` for the
208
+ * block to be timed.
209
+ *
210
+ * Both ends of a block are timed by when they arrive, which is only the truth
211
+ * while the drain reads live. A drain that re-attached after a cut is handed
212
+ * what was printed meanwhile in one burst, and its arrival times are the
213
+ * replay's — so a block whose line arrived far from when the CLI stamped it
214
+ * reads "Thought", with no time. Locally a line arrives 5–31 ms after its
215
+ * stamp; a re-attach has been measured at about a second. A container clock
216
+ * this far from the Worker's degrades every block to no time, rather than to a
217
+ * wrong one.
218
+ */
219
+ export declare const LIVE_SLACK_MS = 5000;
92
220
  /**
93
221
  * Parse whatever has arrived so far into complete events plus a carry.
94
222
  *
@@ -102,21 +230,37 @@ export interface ParsedStream {
102
230
  * the filter.
103
231
  *
104
232
  * `result` and `init` are never nested and are read unconditionally.
233
+ *
234
+ * `clock` is when this read arrived, and the pending thinking block's start
235
+ * from the previous read — see {@link ParsedStream.thinkingFrom}. Without it no
236
+ * block is timed.
237
+ */
238
+ export declare function parseStream(buffer: string, clock?: ParseClock): ParsedStream;
239
+ /**
240
+ * The status a healthy bucket reports, and the only one ever observed.
241
+ *
242
+ * **Every other value is unclassified, not a refusal.** Nothing here knows what
243
+ * a non-`allowed` status means, and the one place that decides whether a
244
+ * credential is spent — `readRateLimitEvent` in this package's `credentials.ts`
245
+ * — recognises none of them, deliberately: retiring a working credential on a
246
+ * guess is the expensive half of that trade. What an unrecognised status earns
247
+ * is a note and a log, so somebody can name it.
105
248
  */
106
- export declare function parseStream(buffer: string): ParsedStream;
249
+ export declare const RATE_LIMIT_OK = "allowed";
107
250
  /**
108
- * Turn events into progress notes the parent can post.
251
+ * Turn events into progress notes for the parent's transcript.
109
252
  *
110
253
  * **`from` is the number of notes already emitted for this run, and the key is
111
254
  * derived from it.** Not from the note's content, not from a clock, and not from
112
255
  * the Claude Code `uuid` — from position alone.
113
256
  *
114
- * The reason is replay. A chunk that dies mid-drain is retried by the Workflow,
115
- * the re-attach replays the tail, and the same assistant turn is parsed twice. A
257
+ * The reason is replay. A drain that dies mid-stream is resumed from the last
258
+ * stored sequence, whatever arrived after it is read again, and the same
259
+ * assistant turn is parsed twice. A
116
260
  * content-derived key would make two identical notes collide *by luck* (and two
117
261
  * genuinely repeated notes — "Running tests" twice — collide wrongly). A
118
262
  * clock-derived key would never collide, so every replay would re-post
119
263
  * everything. Position is the only choice that dedupes exactly the events that
120
264
  * are the same event.
121
265
  */
122
- export declare function toProgress(events: readonly ClaudeCodeEvent[], from: number): ProgressEvent[];
266
+ export declare function toProgress(events: readonly ClaudeCodeEvent[], from: number): NoteData[];