@hivemagnus/ardent 3.1.3 → 3.2.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 (79) hide show
  1. package/README.md +504 -16
  2. package/dist/a2a-client.d.ts +26 -4
  3. package/dist/a2a-client.js +91 -23
  4. package/dist/a2a-push-inbox.d.ts +2 -0
  5. package/dist/a2a-push-inbox.js +7 -0
  6. package/dist/a2a-push.d.ts +1 -1
  7. package/dist/a2a-push.js +26 -18
  8. package/dist/a2a-server.d.ts +17 -0
  9. package/dist/a2a-server.js +91 -14
  10. package/dist/a2a.d.ts +19 -1
  11. package/dist/a2a.js +197 -27
  12. package/dist/api.d.ts +2 -0
  13. package/dist/api.js +160 -22
  14. package/dist/artifact-manifests.d.ts +344 -5
  15. package/dist/artifact-manifests.js +413 -20
  16. package/dist/artifact-transfer.d.ts +113 -0
  17. package/dist/artifact-transfer.js +517 -0
  18. package/dist/artifacts.d.ts +86 -0
  19. package/dist/artifacts.js +249 -1
  20. package/dist/backend-events.d.ts +2 -1
  21. package/dist/backend-events.js +1 -1
  22. package/dist/channel-catchup.d.ts +67 -0
  23. package/dist/channel-catchup.js +108 -0
  24. package/dist/channels.d.ts +35 -0
  25. package/dist/channels.js +152 -4
  26. package/dist/cli.js +28 -3
  27. package/dist/codex-protocol.d.ts +22 -0
  28. package/dist/codex-protocol.js +19 -0
  29. package/dist/codex.d.ts +32 -3
  30. package/dist/codex.js +91 -17
  31. package/dist/config.d.ts +25 -2
  32. package/dist/config.js +41 -4
  33. package/dist/development.d.ts +6 -6
  34. package/dist/execution-state.d.ts +245 -0
  35. package/dist/execution-state.js +236 -0
  36. package/dist/execution.d.ts +135 -0
  37. package/dist/execution.js +178 -0
  38. package/dist/index.d.ts +7 -4
  39. package/dist/index.js +5 -3
  40. package/dist/job-engine.d.ts +2 -1
  41. package/dist/job-engine.js +33 -4
  42. package/dist/lineage.d.ts +106 -0
  43. package/dist/lineage.js +145 -0
  44. package/dist/llamacpp.d.ts +32 -2
  45. package/dist/llamacpp.js +69 -33
  46. package/dist/mattermost.d.ts +8 -0
  47. package/dist/mattermost.js +250 -36
  48. package/dist/mission-tools.js +41 -5
  49. package/dist/missions.d.ts +5 -1
  50. package/dist/missions.js +10 -5
  51. package/dist/plugin-evidence.js +2 -1
  52. package/dist/plugin-sdk.d.ts +3 -0
  53. package/dist/plugin-sdk.js +3 -0
  54. package/dist/plugins.d.ts +108 -2
  55. package/dist/plugins.js +131 -1
  56. package/dist/preview.d.ts +1 -0
  57. package/dist/preview.js +4 -1
  58. package/dist/recovery.d.ts +155 -0
  59. package/dist/recovery.js +216 -0
  60. package/dist/research.d.ts +1 -1
  61. package/dist/retry.d.ts +143 -0
  62. package/dist/retry.js +127 -0
  63. package/dist/runtime.d.ts +56 -4
  64. package/dist/runtime.js +727 -125
  65. package/dist/store.d.ts +62 -7
  66. package/dist/store.js +86 -15
  67. package/dist/team-artifacts.d.ts +130 -112
  68. package/dist/team-artifacts.js +123 -151
  69. package/dist/team-child.d.ts +4 -1
  70. package/dist/team-child.js +21 -2
  71. package/dist/team-contract.d.ts +1 -1
  72. package/dist/telegram.d.ts +2 -0
  73. package/dist/telegram.js +83 -47
  74. package/dist/tool-scheduler.d.ts +84 -0
  75. package/dist/tool-scheduler.js +226 -0
  76. package/dist/tools.d.ts +78 -4
  77. package/dist/tools.js +34 -7
  78. package/package.json +16 -9
  79. package/profiles/assistant/config.yaml +2 -1
@@ -1,6 +1,57 @@
1
1
  import { z } from 'zod';
2
- import { type ArtifactStore } from './artifacts.js';
2
+ import { type ArtifactInspector, type ArtifactSource, type ArtifactStore } from './artifacts.js';
3
3
  import type { TaskStore } from './store.js';
4
+ /**
5
+ * Manifest 1.0, as peers exchange it over the v1 (single-response) team
6
+ * transfer. Its size bound is that transfer's 2 MiB limit.
7
+ */
8
+ export declare const TeamArtifactManifestSchema: z.ZodObject<{
9
+ schema_version: z.ZodLiteral<"1.0">;
10
+ revision: z.ZodNumber;
11
+ source_revision: z.ZodString;
12
+ visibility: z.ZodEnum<{
13
+ private: "private";
14
+ gm: "gm";
15
+ player: "player";
16
+ }>;
17
+ license: z.ZodString;
18
+ preview: z.ZodObject<{
19
+ mode: z.ZodEnum<{
20
+ none: "none";
21
+ inline: "inline";
22
+ thumbnail: "thumbnail";
23
+ download_only: "download_only";
24
+ }>;
25
+ mime: z.ZodString;
26
+ }, z.core.$strict>;
27
+ supersedes_sha256: z.ZodNullable<z.ZodString>;
28
+ acceptance_status: z.ZodEnum<{
29
+ rejected: "rejected";
30
+ partial: "partial";
31
+ unreviewed: "unreviewed";
32
+ approved: "approved";
33
+ }>;
34
+ name: z.ZodString;
35
+ mime: z.ZodString;
36
+ sha256: z.ZodString;
37
+ size: z.ZodNumber;
38
+ created_at: z.ZodNumber;
39
+ expires_at: z.ZodNumber;
40
+ provenance: z.ZodObject<{
41
+ producer: z.ZodString;
42
+ source_id: z.ZodString;
43
+ producer_task_id: z.ZodString;
44
+ lineage: z.ZodArray<z.ZodObject<{
45
+ producer: z.ZodString;
46
+ source_id: z.ZodString;
47
+ }, z.core.$strict>>;
48
+ }, z.core.$strict>;
49
+ recovery: z.ZodObject<{
50
+ on_expiry: z.ZodLiteral<"request_verified_reexport">;
51
+ }, z.core.$strict>;
52
+ artifact_id: z.ZodString;
53
+ }, z.core.$strict>;
54
+ export type TeamArtifactManifest = z.infer<typeof TeamArtifactManifestSchema>;
4
55
  /** Media types an agent may register, with the bytes each must start with (binary) or the text it must hold. */
5
56
  export declare const ARTIFACT_MIME_TYPES: {
6
57
  readonly 'text/markdown': "text";
@@ -51,8 +102,8 @@ export declare const ArtifactManifestSchema: z.ZodObject<{
51
102
  }, z.core.$strict>;
52
103
  supersedes_sha256: z.ZodNullable<z.ZodString>;
53
104
  acceptance_status: z.ZodEnum<{
54
- partial: "partial";
55
105
  rejected: "rejected";
106
+ partial: "partial";
56
107
  unreviewed: "unreviewed";
57
108
  approved: "approved";
58
109
  }>;
@@ -102,8 +153,8 @@ export declare const ArtifactRecordSchema: z.ZodObject<{
102
153
  }, z.core.$strict>;
103
154
  supersedes_sha256: z.ZodNullable<z.ZodString>;
104
155
  acceptance_status: z.ZodEnum<{
105
- partial: "partial";
106
156
  rejected: "rejected";
157
+ partial: "partial";
107
158
  unreviewed: "unreviewed";
108
159
  approved: "approved";
109
160
  }>;
@@ -129,8 +180,214 @@ export declare const ArtifactRecordSchema: z.ZodObject<{
129
180
  }, z.core.$strict>;
130
181
  }, z.core.$strict>;
131
182
  export type ArtifactRecord = z.infer<typeof ArtifactRecordSchema>;
183
+ /** Execution ancestry of an artifact: attribution only, never an authority. */
184
+ export declare const ArtifactExecutionSchema: z.ZodObject<{
185
+ root: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
186
+ task: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
187
+ step: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
188
+ }, z.core.$strict>;
189
+ export type ArtifactExecution = z.infer<typeof ArtifactExecutionSchema>;
190
+ export declare const RenditionRoleSchema: z.ZodEnum<{
191
+ preview: "preview";
192
+ original: "original";
193
+ model_input: "model_input";
194
+ }>;
195
+ /** How a rendition was derived from its original. */
196
+ export declare const ArtifactTransformSchema: z.ZodObject<{
197
+ name: z.ZodString;
198
+ version: z.ZodString;
199
+ params: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
200
+ }, z.core.$strict>;
201
+ export type ArtifactTransform = z.infer<typeof ArtifactTransformSchema>;
202
+ export declare const ArtifactRenditionInfoSchema: z.ZodObject<{
203
+ role: z.ZodEnum<{
204
+ preview: "preview";
205
+ original: "original";
206
+ model_input: "model_input";
207
+ }>;
208
+ of_sha256: z.ZodString;
209
+ purpose: z.ZodString;
210
+ transform: z.ZodObject<{
211
+ name: z.ZodString;
212
+ version: z.ZodString;
213
+ params: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
214
+ }, z.core.$strict>;
215
+ }, z.core.$strict>;
216
+ /**
217
+ * Manifest 1.1: a strict superset of 1.0 that may name the original a
218
+ * rendition derives from and the execution that produced it. It is as
219
+ * immutable as 1.0 and is shown only to transfer-v2 consumers.
220
+ */
221
+ export declare const ArtifactManifest11Schema: z.ZodObject<{
222
+ revision: z.ZodNumber;
223
+ source_revision: z.ZodString;
224
+ visibility: z.ZodEnum<{
225
+ private: "private";
226
+ gm: "gm";
227
+ player: "player";
228
+ }>;
229
+ license: z.ZodString;
230
+ preview: z.ZodObject<{
231
+ mode: z.ZodEnum<{
232
+ none: "none";
233
+ inline: "inline";
234
+ thumbnail: "thumbnail";
235
+ download_only: "download_only";
236
+ }>;
237
+ mime: z.ZodString;
238
+ }, z.core.$strict>;
239
+ supersedes_sha256: z.ZodNullable<z.ZodString>;
240
+ acceptance_status: z.ZodEnum<{
241
+ rejected: "rejected";
242
+ partial: "partial";
243
+ unreviewed: "unreviewed";
244
+ approved: "approved";
245
+ }>;
246
+ name: z.ZodString;
247
+ mime: z.ZodString;
248
+ sha256: z.ZodString;
249
+ created_at: z.ZodNumber;
250
+ expires_at: z.ZodNumber;
251
+ recovery: z.ZodObject<{
252
+ on_expiry: z.ZodLiteral<"request_verified_reexport">;
253
+ }, z.core.$strict>;
254
+ artifact_id: z.ZodString;
255
+ size: z.ZodNumber;
256
+ schema_version: z.ZodLiteral<"1.1">;
257
+ provenance: z.ZodObject<{
258
+ producer: z.ZodString;
259
+ source_id: z.ZodString;
260
+ producer_task_id: z.ZodString;
261
+ lineage: z.ZodArray<z.ZodObject<{
262
+ producer: z.ZodString;
263
+ source_id: z.ZodString;
264
+ }, z.core.$strict>>;
265
+ execution: z.ZodOptional<z.ZodObject<{
266
+ root: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
267
+ task: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
268
+ step: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
269
+ }, z.core.$strict>>;
270
+ }, z.core.$strict>;
271
+ rendition: z.ZodOptional<z.ZodObject<{
272
+ role: z.ZodEnum<{
273
+ preview: "preview";
274
+ original: "original";
275
+ model_input: "model_input";
276
+ }>;
277
+ of_sha256: z.ZodString;
278
+ purpose: z.ZodString;
279
+ transform: z.ZodObject<{
280
+ name: z.ZodString;
281
+ version: z.ZodString;
282
+ params: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
283
+ }, z.core.$strict>;
284
+ }, z.core.$strict>>;
285
+ }, z.core.$strict>;
286
+ export type ArtifactManifest11 = z.infer<typeof ArtifactManifest11Schema>;
287
+ /** A manifest 1.1 record, as transfer-v2 routes return it. */
288
+ export declare const ArtifactRecordV2Schema: z.ZodObject<{
289
+ task_id: z.ZodString;
290
+ superseded_by_sha256: z.ZodNullable<z.ZodString>;
291
+ manifest: z.ZodObject<{
292
+ revision: z.ZodNumber;
293
+ source_revision: z.ZodString;
294
+ visibility: z.ZodEnum<{
295
+ private: "private";
296
+ gm: "gm";
297
+ player: "player";
298
+ }>;
299
+ license: z.ZodString;
300
+ preview: z.ZodObject<{
301
+ mode: z.ZodEnum<{
302
+ none: "none";
303
+ inline: "inline";
304
+ thumbnail: "thumbnail";
305
+ download_only: "download_only";
306
+ }>;
307
+ mime: z.ZodString;
308
+ }, z.core.$strict>;
309
+ supersedes_sha256: z.ZodNullable<z.ZodString>;
310
+ acceptance_status: z.ZodEnum<{
311
+ rejected: "rejected";
312
+ partial: "partial";
313
+ unreviewed: "unreviewed";
314
+ approved: "approved";
315
+ }>;
316
+ name: z.ZodString;
317
+ mime: z.ZodString;
318
+ sha256: z.ZodString;
319
+ created_at: z.ZodNumber;
320
+ expires_at: z.ZodNumber;
321
+ recovery: z.ZodObject<{
322
+ on_expiry: z.ZodLiteral<"request_verified_reexport">;
323
+ }, z.core.$strict>;
324
+ artifact_id: z.ZodString;
325
+ size: z.ZodNumber;
326
+ schema_version: z.ZodLiteral<"1.1">;
327
+ provenance: z.ZodObject<{
328
+ producer: z.ZodString;
329
+ source_id: z.ZodString;
330
+ producer_task_id: z.ZodString;
331
+ lineage: z.ZodArray<z.ZodObject<{
332
+ producer: z.ZodString;
333
+ source_id: z.ZodString;
334
+ }, z.core.$strict>>;
335
+ execution: z.ZodOptional<z.ZodObject<{
336
+ root: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
337
+ task: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
338
+ step: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
339
+ }, z.core.$strict>>;
340
+ }, z.core.$strict>;
341
+ rendition: z.ZodOptional<z.ZodObject<{
342
+ role: z.ZodEnum<{
343
+ preview: "preview";
344
+ original: "original";
345
+ model_input: "model_input";
346
+ }>;
347
+ of_sha256: z.ZodString;
348
+ purpose: z.ZodString;
349
+ transform: z.ZodObject<{
350
+ name: z.ZodString;
351
+ version: z.ZodString;
352
+ params: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
353
+ }, z.core.$strict>;
354
+ }, z.core.$strict>>;
355
+ }, z.core.$strict>;
356
+ }, z.core.$strict>;
357
+ export type ArtifactRecordV2 = z.infer<typeof ArtifactRecordV2Schema>;
358
+ /** One available form of an artifact (the HiveCommon `Rendition` shape plus its purpose). */
359
+ export declare const ArtifactRenditionSchema: z.ZodObject<{
360
+ sha256: z.ZodString;
361
+ role: z.ZodEnum<{
362
+ preview: "preview";
363
+ original: "original";
364
+ model_input: "model_input";
365
+ }>;
366
+ mime: z.ZodString;
367
+ size: z.ZodNumber;
368
+ purpose: z.ZodString;
369
+ width: z.ZodOptional<z.ZodNumber>;
370
+ height: z.ZodOptional<z.ZodNumber>;
371
+ has_alpha: z.ZodOptional<z.ZodBoolean>;
372
+ }, z.core.$strict>;
373
+ export type ArtifactRendition = z.infer<typeof ArtifactRenditionSchema>;
374
+ /** The 1.0 view of a stored manifest: the fields 1.1 added are left out. A 1.0 manifest is returned as it is. */
375
+ export declare function manifestV10(manifest: ArtifactManifest | ArtifactManifest11): ArtifactManifest;
376
+ /** The 1.1 view of a stored manifest. A 1.0 manifest needs none of the optional 1.1 fields. */
377
+ export declare function manifestV11(manifest: ArtifactManifest | ArtifactManifest11): ArtifactManifest11;
132
378
  /** Reject bytes that are not what their declared media type says. Text must be valid UTF-8. */
133
379
  export declare function checkArtifactContent(mime: ArtifactMime, bytes: Uint8Array): void;
380
+ /**
381
+ * Check streamed bytes against their declared media type as they arrive, with
382
+ * the same rules as `checkArtifactContent`, without holding binary content.
383
+ */
384
+ export declare function artifactContentInspector(mime: ArtifactMime): ArtifactInspector;
385
+ /** Width, height and transparency of a PNG from its IHDR chunk, when the header is well formed. */
386
+ export declare function pngInfo(head: Uint8Array): {
387
+ width: number;
388
+ height: number;
389
+ has_alpha: boolean;
390
+ } | undefined;
134
391
  /**
135
392
  * Registered artifacts with their manifests. A manifest is an immutable producer
136
393
  * record; a later artifact may revise (supersede) an earlier one by digest.
@@ -141,9 +398,23 @@ export declare class ArtifactManifests {
141
398
  readonly artifacts: ArtifactStore;
142
399
  readonly producer: string;
143
400
  constructor(store: TaskStore, artifacts: ArtifactStore, producer: string);
401
+ /**
402
+ * The artifact a task registered under a tool-call idempotency key, as 1.0.
403
+ * `artifact_write` and `document_render` use it to stay idempotent and to
404
+ * reconcile an interrupted call from the manifest row.
405
+ */
406
+ registeredFor(taskId: string, idempotencyKey: string): ArtifactRecord | undefined;
407
+ /**
408
+ * The execution provenance of an artifact a task produces: the task's root,
409
+ * the task, and, while the task runs, the model step it is in. Undefined
410
+ * for a task with no recorded execution context. Attribution only.
411
+ */
412
+ executionProvenance(taskId: string): ArtifactExecution | undefined;
144
413
  /**
145
414
  * Store bytes for a task and record their manifest and an `artifact_registered`
146
415
  * journal event. `revisesSha256` must name a current registered artifact.
416
+ * When the task has an execution context the stored manifest is 1.1 with
417
+ * `provenance.execution`; the returned record, like every 1.0 view, is 1.0.
147
418
  */
148
419
  register(input: {
149
420
  taskId: string;
@@ -153,7 +424,64 @@ export declare class ArtifactManifests {
153
424
  source: string;
154
425
  revisesSha256?: string | undefined;
155
426
  ttlSeconds?: number | undefined;
427
+ execution?: ArtifactExecution | undefined;
428
+ idempotencyKey?: string | undefined;
156
429
  }): Promise<ArtifactRecord>;
430
+ /**
431
+ * Stream bytes into the store for a task and record a manifest 1.1 for them.
432
+ * The content check, size bound and any expected digest are applied while the
433
+ * bytes arrive; a refusal stores nothing. `execution` is attribution only;
434
+ * without it, the task's own execution provenance is recorded when it has one.
435
+ */
436
+ registerStream(input: {
437
+ taskId: string;
438
+ name: string;
439
+ mime: ArtifactMime;
440
+ stream: ArtifactSource;
441
+ source: string;
442
+ expectedSha256?: string | undefined;
443
+ expectedSize?: number | undefined;
444
+ revisesSha256?: string | undefined;
445
+ ttlSeconds?: number | undefined;
446
+ execution?: ArtifactExecution | undefined;
447
+ signal?: AbortSignal | undefined;
448
+ }): Promise<ArtifactRecordV2>;
449
+ /**
450
+ * Register a preview or model-input rendition of a current original. The
451
+ * rendition is a separate artifact with its own digest and a manifest 1.1
452
+ * that names the original; the original is never changed. Registering the
453
+ * same bytes for the same original again returns the existing record.
454
+ */
455
+ registerRendition(input: {
456
+ originalSha256: string;
457
+ role: 'preview' | 'model_input';
458
+ purpose: string;
459
+ transform: ArtifactTransform;
460
+ mime: ArtifactMime;
461
+ bytes?: Uint8Array | undefined;
462
+ stream?: ArtifactSource | undefined;
463
+ name?: string | undefined;
464
+ width?: number | undefined;
465
+ height?: number | undefined;
466
+ has_alpha?: boolean | undefined;
467
+ producer?: string | undefined;
468
+ signal?: AbortSignal | undefined;
469
+ }): Promise<ArtifactRecordV2>;
470
+ /**
471
+ * Record a manifest 1.1 for bytes already in the store, received from a peer.
472
+ * The peer's manifest supplies name, media type, revision and provenance; the
473
+ * local record adds the peer hop to the lineage and does not expire.
474
+ */
475
+ registerImported(input: {
476
+ taskId: string;
477
+ peer: string;
478
+ remoteTaskId: string;
479
+ manifest: ArtifactManifest11;
480
+ /** A stable local manifest ID; registering the same ID again returns the existing record. */
481
+ artifactId?: string | undefined;
482
+ /** Runs in the registering transaction, for example to settle the import that produced the bytes. */
483
+ onRegistered?: (() => void) | undefined;
484
+ }): Promise<ArtifactRecordV2>;
157
485
  /**
158
486
  * Delete the bytes of artifacts whose every manifest has expired, unless a
159
487
  * task outside preview still refers to the digest in its journal.
@@ -162,8 +490,19 @@ export declare class ArtifactManifests {
162
490
  deleted: string[];
163
491
  retained: string[];
164
492
  }>;
165
- /** Current (unexpired) manifests a task registered, oldest first. */
493
+ /**
494
+ * Current (unexpired) manifests a task registered, oldest first, as 1.0.
495
+ * Renditions are listed with their original (`renditions`), not here.
496
+ */
166
497
  forTask(taskId: string, limit?: number): ArtifactRecord[];
167
- /** The newest current manifest for a digest. */
498
+ /** The newest current manifest for a digest, as 1.0. */
168
499
  manifest(sha256: string): ArtifactRecord | undefined;
500
+ /** The newest current manifest for a digest, as 1.1 (for transfer-v2 consumers). */
501
+ manifestV2(sha256: string): ArtifactRecordV2 | undefined;
502
+ /**
503
+ * Every current form of an artifact, the original first: given an original or
504
+ * any of its renditions, the same list. Undefined when the digest has no
505
+ * current manifest.
506
+ */
507
+ renditions(sha256: string): Promise<ArtifactRendition[] | undefined>;
169
508
  }