@studio-foundation/contracts 0.17.1 → 0.18.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.
package/dist/spawner.d.ts CHANGED
@@ -1,4 +1,17 @@
1
+ import type { StageStatus } from './stage';
1
2
  import type { TokenUsage } from './usage';
3
+ /**
4
+ * One stage of a child run, as the parent sees it. The flat `token_usage` says
5
+ * what a child cost; this says what bought it. Without it a caller pricing a
6
+ * fan-out assumes one call per item, under-counting every retried stage.
7
+ */
8
+ export interface ChildStageUsage {
9
+ stage: string;
10
+ status: StageStatus;
11
+ /** Attempts the stage's RALPH loop made. 0 for a stage that ran no agent. */
12
+ attempts: number;
13
+ token_usage?: TokenUsage;
14
+ }
2
15
  /**
3
16
  * Per-spawn execution overrides. In-process spawners honour them; a remote
4
17
  * spawner ignores them, because they name objects that live in this process.
@@ -29,6 +42,19 @@ export interface SpawnResult {
29
42
  output: unknown;
30
43
  /** What the child run spent, summed over its stages. Absent when unreported. */
31
44
  token_usage?: TokenUsage;
45
+ /** The per-stage breakdown behind `token_usage`. Absent when the spawner reports none. */
46
+ stages?: ChildStageUsage[];
47
+ }
48
+ /**
49
+ * A child run that reached a terminal non-success status. The calls it made were
50
+ * still billed, so the throw carries the same record a successful spawn returns.
51
+ */
52
+ export declare class ChildRunError extends Error {
53
+ run_id: string;
54
+ run_status: string;
55
+ stages: ChildStageUsage[];
56
+ token_usage?: TokenUsage | undefined;
57
+ constructor(message: string, run_id: string, run_status: string, stages: ChildStageUsage[], token_usage?: TokenUsage | undefined);
32
58
  }
33
59
  export interface RunSpawner {
34
60
  spawnAndWait(config: SpawnConfig): Promise<SpawnResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"spawner.d.ts","sourceRoot":"","sources":["../src/spawner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B;;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AC5B;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,gFAAgF;IAChF,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,0FAA0F;IAC1F,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED;;;GAGG;AACH,qBAAa,aAAc,SAAQ,KAAK;IAG7B,MAAM,EAAE,MAAM;IACd,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE,eAAe,EAAE;IACzB,WAAW,CAAC,EAAE,UAAU;gBAJ/B,OAAO,EAAE,MAAM,EACR,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,eAAe,EAAE,EACzB,WAAW,CAAC,EAAE,UAAU,YAAA;CAKlC;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CACzD"}
package/dist/spawner.js CHANGED
@@ -1,4 +1,21 @@
1
1
  // The abstraction that studio-run tool uses to launch child runs.
2
2
  // Implementations: DirectEngineSpawner (engine) and HttpApiSpawner (api).
3
- export {};
3
+ /**
4
+ * A child run that reached a terminal non-success status. The calls it made were
5
+ * still billed, so the throw carries the same record a successful spawn returns.
6
+ */
7
+ export class ChildRunError extends Error {
8
+ run_id;
9
+ run_status;
10
+ stages;
11
+ token_usage;
12
+ constructor(message, run_id, run_status, stages, token_usage) {
13
+ super(message);
14
+ this.run_id = run_id;
15
+ this.run_status = run_status;
16
+ this.stages = stages;
17
+ this.token_usage = token_usage;
18
+ this.name = 'ChildRunError';
19
+ }
20
+ }
4
21
  //# sourceMappingURL=spawner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spawner.js","sourceRoot":"","sources":["../src/spawner.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,0EAA0E"}
1
+ {"version":3,"file":"spawner.js","sourceRoot":"","sources":["../src/spawner.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,0EAA0E;AAsD1E;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAK;IAG7B;IACA;IACA;IACA;IALT,YACE,OAAe,EACR,MAAc,EACd,UAAkB,EAClB,MAAyB,EACzB,WAAwB;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QALR,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAQ;QAClB,WAAM,GAAN,MAAM,CAAmB;QACzB,gBAAW,GAAX,WAAW,CAAa;QAG/B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studio-foundation/contracts",
3
- "version": "0.17.1",
3
+ "version": "0.18.0",
4
4
  "description": "Shared TypeScript types and interfaces for Studio packages",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",