@coltonkirsten/a12s 0.4.0 → 0.4.1

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/dist/a12s.js CHANGED
@@ -469,6 +469,7 @@ function agentComputerOf(ev) {
469
469
  function wanted(names, ev) {
470
470
  if (!names) return true;
471
471
  if (ev.type === "fleet.changed") return (ev.data?.names ?? []).some((n) => names.has(n));
472
+ if (ev.type === "service.phase") return names.has(ev.data?.service);
472
473
  return names.has(agentComputerOf(ev));
473
474
  }
474
475
  var EventStream = class {
@@ -492,6 +492,8 @@ function wanted(names, ev) {
492
492
  return true;
493
493
  if (ev.type === "fleet.changed")
494
494
  return (ev.data?.names ?? []).some((n) => names.has(n));
495
+ if (ev.type === "service.phase")
496
+ return names.has(ev.data?.service);
495
497
  return names.has(agentComputerOf(ev));
496
498
  }
497
499
  /** Events of one or more Computers, merged in arrival order. Iterate it with `for await`. */
@@ -92,6 +92,14 @@ export interface Change {
92
92
  when: "now" | "idle" | (string & {});
93
93
  /** The top-level spec fields that differ, for an update. */
94
94
  fields?: string[];
95
+ /** Every leaf that differs, for an update, with its value before and after (absent where the field is). */
96
+ diff?: FieldDiff[];
97
+ }
98
+ /** One leaf of a spec that differs: `path` is dotted field names ("grants.send"); lists and values are leaves. */
99
+ export interface FieldDiff {
100
+ path: string;
101
+ before?: unknown;
102
+ after?: unknown;
95
103
  }
96
104
  export interface FleetResponse {
97
105
  version: number;
@@ -398,6 +406,15 @@ export interface PhaseData {
398
406
  phase: Phase;
399
407
  error?: Failure;
400
408
  }
409
+ /** A Service's phase, health or restart count changed. */
410
+ export interface ServicePhaseData {
411
+ service: string;
412
+ phase: Phase;
413
+ /** "ok", or why the last health check failed. */
414
+ health?: string;
415
+ restarts: number;
416
+ error?: Failure;
417
+ }
401
418
  export interface ToolStartedData {
402
419
  id: string;
403
420
  /** MCP tools are named `mcp__<server>__<tool>`, e.g. `mcp__a12s__send`. */
@@ -468,10 +485,14 @@ export type EgressDeniedEvent = Ev<"egress.denied", EgressDeniedData>;
468
485
  export type FleetChangedEvent = Ev<"fleet.changed", FleetChangedData>;
469
486
  /** Made by the Controller, on the fleet-wide stream only. */
470
487
  export type PhaseEvent = Ev<"agent_computer.phase", PhaseData>;
488
+ /** Made by the Controller, on the fleet-wide stream only, after any change to the agent computer's inbox (a burst is one event). */
489
+ export type InboxChangedEvent = Ev<"inbox.changed", InboxSummary>;
490
+ /** Made by the Controller, on the fleet-wide stream only; `agentComputer` is empty, the Service is in `data`. */
491
+ export type ServicePhaseEvent = Ev<"service.phase", ServicePhaseData>;
471
492
  /** Made by the SDK, never journaled: the stream could not resume from its cursor and events were lost. */
472
493
  export type GapEvent = Ev<"gap", GapData>;
473
494
  /** One event of an agent computer's journal, or the Controller's own on the fleet-wide stream. Narrow on `type` to get typed `data`. */
474
- export type A12sEvent = TurnStartedEvent | TurnDispatchedEvent | TextDeltaEvent | ToolStartedEvent | ToolFinishedEvent | PermissionEvent | DiagnosticEvent | TurnFinishedEvent | SessionChangedEvent | ResumeFailedEvent | LifecycleEvent | HarnessRestartedEvent | ContinuationAbandonedEvent | TurnRefusedEvent | InboxDiscardedEvent | EgressDeniedEvent | FleetChangedEvent | PhaseEvent | GapEvent;
495
+ export type A12sEvent = TurnStartedEvent | TurnDispatchedEvent | TextDeltaEvent | ToolStartedEvent | ToolFinishedEvent | PermissionEvent | DiagnosticEvent | TurnFinishedEvent | SessionChangedEvent | ResumeFailedEvent | LifecycleEvent | HarnessRestartedEvent | ContinuationAbandonedEvent | TurnRefusedEvent | InboxDiscardedEvent | EgressDeniedEvent | FleetChangedEvent | PhaseEvent | InboxChangedEvent | ServicePhaseEvent | GapEvent;
475
496
  export type EventType = A12sEvent["type"];
476
497
  /** One tool call in a Turn. A `send` to another Computer is `mcp__a12s__send` with `input.body`. */
477
498
  export interface ToolCall {
@@ -530,6 +551,8 @@ export interface CredentialInfo {
530
551
  name: string;
531
552
  set: boolean;
532
553
  usedBy?: string[];
554
+ /** When the value last changed (RFC 3339); absent if unknown. */
555
+ updatedAt?: string;
533
556
  }
534
557
  export interface CredentialsResponse {
535
558
  credentials: CredentialInfo[];
@@ -540,6 +563,8 @@ export interface Token {
540
563
  computers: string[];
541
564
  prefix?: string;
542
565
  createdAt: string;
566
+ /** When it last authenticated (RFC 3339, recorded at most once a minute); absent if never. */
567
+ lastUsedAt?: string;
543
568
  secret?: string;
544
569
  }
545
570
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coltonkirsten/a12s",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "TypeScript client for a12s: send work to agent Computers, stream their events and Turns, in Node or the browser",
5
5
  "license": "MIT",
6
6
  "type": "module",