@contraagent/api 0.6.1 → 0.7.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/schema.d.ts CHANGED
@@ -160,6 +160,26 @@ export type paths = {
160
160
  patch?: never;
161
161
  trace?: never;
162
162
  };
163
+ "/api/runs/{run}/forecast": {
164
+ parameters: {
165
+ query?: never;
166
+ header?: never;
167
+ path?: never;
168
+ cookie?: never;
169
+ };
170
+ /**
171
+ * Api Forecast
172
+ * @description The tasks the run is expected to create and has not yet, from the run of the same flow that finished last before it started; a display only.
173
+ */
174
+ get: operations["api_forecast_api_runs__run__forecast_get"];
175
+ put?: never;
176
+ post?: never;
177
+ delete?: never;
178
+ options?: never;
179
+ head?: never;
180
+ patch?: never;
181
+ trace?: never;
182
+ };
163
183
  "/api/runs/{run}/definitions": {
164
184
  parameters: {
165
185
  query?: never;
@@ -607,14 +627,17 @@ export type components = {
607
627
  executor?: "agent" | "python";
608
628
  /**
609
629
  * Params
610
- * @description the task's params that are strings, numbers or booleans; an earlier task's output is one of `inputs`
630
+ * @description the task's params that are strings, numbers or booleans
611
631
  */
612
632
  params?: {
613
633
  [key: string]: string | number | boolean;
614
634
  };
615
635
  /** Outputs */
616
636
  outputs?: components["schemas"]["ContractSpec"][];
617
- /** Inputs */
637
+ /**
638
+ * Inputs
639
+ * @description its input contracts (`InputContract`, from a `TaskAdapter` of the engine), checked before it starts
640
+ */
618
641
  inputs?: components["schemas"]["ContractSpec"][];
619
642
  } & {
620
643
  [key: string]: unknown;
@@ -789,8 +812,8 @@ export type components = {
789
812
  * DeferralCause
790
813
  * @description Why a task was deferred, as data (`Deferral.cause`). `cause`: `deadline`,
791
814
  * `grace_window` (past the deadline's grace window), `cannot_finish` (`need_s`, `left_s`),
792
- * `dependency_not_queued`, `dependency_deferred` (a task whose output it reads was
793
- * deferred: `dependency`), `rest` (the credential of every hop it could take rests:
815
+ * `dependency_not_queued`, `dependency_deferred` (written by releases before 0.7: a task
816
+ * whose output it read was deferred, `dependency`), `rest` (the credential of every hop it could take rests:
794
817
  * `rests`), or a runner's own name. A field a cause does not have is left unset, and
795
818
  * `deferred.jsonl` records only the fields set.
796
819
  */
@@ -820,7 +843,7 @@ export type components = {
820
843
  rests?: components["schemas"]["SkippedHop"][];
821
844
  /**
822
845
  * Dependency
823
- * @description `dependency_deferred`: the key of the deferred task whose output it reads
846
+ * @description `dependency_deferred` (releases before 0.7): the key of the deferred task whose output it read
824
847
  */
825
848
  dependency?: string | null;
826
849
  };
@@ -838,7 +861,10 @@ export type components = {
838
861
  } & {
839
862
  [key: string]: unknown;
840
863
  };
841
- /** DownstreamTask */
864
+ /**
865
+ * DownstreamTask
866
+ * @description A later task: one given from this task, waiting for it, or created from it.
867
+ */
842
868
  DownstreamTask: {
843
869
  /** Key */
844
870
  key: string;
@@ -851,6 +877,11 @@ export type components = {
851
877
  * @enum {string}
852
878
  */
853
879
  executor: "agent" | "python";
880
+ /**
881
+ * Lineage
882
+ * @description how it is joined to this task, in the order `given_from`, `after`, `created_from`
883
+ */
884
+ lineage?: ("given_from" | "after" | "created_from")[];
854
885
  };
855
886
  /**
856
887
  * DroppedRoute
@@ -1018,8 +1049,129 @@ export type components = {
1018
1049
  * @description `<type>: <message>` of what it raised (or what cancelling it raised); else null
1019
1050
  */
1020
1051
  error?: string | null;
1052
+ /** @description for one that raised: where the exception left its own code (mostly the `await` that failed), its file as `flow` gives it; else null */
1053
+ raised_at?: components["schemas"]["Frame"] | null;
1054
+ /**
1055
+ * Raised By
1056
+ * @description for one that raised: the key of the failed task the exception is, the same in every flow call it passes through; null for an exception of flow code's own
1057
+ */
1058
+ raised_by?: string | null;
1021
1059
  /** @description its own deadline, for a flow call started through `time_box`; else null */
1022
1060
  time_box?: components["schemas"]["TimeBoxRecord"] | null;
1061
+ /**
1062
+ * Unawaited
1063
+ * @description for a top flow call that ended: the keys of the tasks created in it or in the flow calls it started that nothing awaited, waited for with `after=` or returned; they ran all the same
1064
+ */
1065
+ unawaited?: string[];
1066
+ };
1067
+ /**
1068
+ * Forecast
1069
+ * @description The tasks the run is expected to create and has not yet, with their wall time and
1070
+ * cost, from the run of the same flow that finished last before it started (`run.json`
1071
+ * `flow`). A display only: the schedule never reads it, and a run that creates fewer or
1072
+ * more tasks than the earlier run is no error.
1073
+ */
1074
+ Forecast: {
1075
+ /**
1076
+ * Flow
1077
+ * @description `module.qualname` of the run's top flow (`run.json` `flow`); empty for a run of an earlier release
1078
+ */
1079
+ flow: string;
1080
+ /**
1081
+ * Earlier Run
1082
+ * @description the run it reads; empty when no run of the same flow finished before this one started
1083
+ */
1084
+ earlier_run: string;
1085
+ /**
1086
+ * Earlier Finished At
1087
+ * @description when the earlier run finished, ISO 8601; empty when there is none
1088
+ */
1089
+ earlier_finished_at: string;
1090
+ /**
1091
+ * Entries
1092
+ * @description by tail key, in the order the earlier run created the first task of each
1093
+ */
1094
+ entries: components["schemas"]["ForecastEntry"][];
1095
+ /**
1096
+ * Remaining
1097
+ * @description the entries' `remaining`, summed
1098
+ */
1099
+ remaining: number;
1100
+ /**
1101
+ * Wall S
1102
+ * @description the entries' `wall_s`, summed
1103
+ */
1104
+ wall_s: number;
1105
+ /**
1106
+ * Cost Usd
1107
+ * @description the entries' `cost_usd`, summed; null when none has one
1108
+ */
1109
+ cost_usd: number | null;
1110
+ };
1111
+ /**
1112
+ * ForecastEntry
1113
+ * @description The tasks of one tail key in the earlier run the forecast reads, and how many of them
1114
+ * this run has created. A tail key is the flow path's function names, the kind, and the
1115
+ * passes of the loops around it, each capped at 3.
1116
+ */
1117
+ ForecastEntry: {
1118
+ /**
1119
+ * Kind
1120
+ * @description the kind of the earlier run's first task of it
1121
+ */
1122
+ kind: string;
1123
+ /**
1124
+ * Group
1125
+ * @description the group its kind is drawn in (`PlanGroup.id`)
1126
+ */
1127
+ group: string;
1128
+ /**
1129
+ * Flow
1130
+ * @description the function names of its flow path, outermost first
1131
+ */
1132
+ flow: string[];
1133
+ /**
1134
+ * Passes
1135
+ * @description the passes of the loops around it, outermost first, each capped at 3 (3: the third pass and later); null for a loop whose pass was not recorded
1136
+ */
1137
+ passes: (number | null)[];
1138
+ /**
1139
+ * Expected
1140
+ * @description the tasks of it the earlier run created
1141
+ */
1142
+ expected: number;
1143
+ /**
1144
+ * Created
1145
+ * @description the tasks of it this run has created
1146
+ */
1147
+ created: number;
1148
+ /**
1149
+ * Remaining
1150
+ * @description `expected` less `created`, never below 0
1151
+ */
1152
+ remaining: number;
1153
+ /**
1154
+ * Wall S
1155
+ * @description the wall time of the `remaining` tasks, at the earlier run's mean per task (every attempt counted)
1156
+ */
1157
+ wall_s: number;
1158
+ /**
1159
+ * Cost Usd
1160
+ * @description the cost of the `remaining` tasks in USD, at the earlier run's mean per task; null when the earlier run reported none
1161
+ */
1162
+ cost_usd: number | null;
1163
+ };
1164
+ /**
1165
+ * ForecastMessage
1166
+ * @description The forecast, sent when it changed: a task the run creates takes one off it.
1167
+ */
1168
+ ForecastMessage: {
1169
+ /**
1170
+ * Event
1171
+ * @constant
1172
+ */
1173
+ event: "forecast";
1174
+ data: components["schemas"]["Forecast"];
1023
1175
  };
1024
1176
  /**
1025
1177
  * Frame
@@ -1370,7 +1522,7 @@ export type components = {
1370
1522
  * Stop
1371
1523
  * @enum {string}
1372
1524
  */
1373
- stop: "completed" | "timeout" | "max_turns" | "budget" | "context_budget" | "stalled" | "auth_failed" | "api_error" | "rate_limited" | "refused" | "aborted" | "denied" | "error" | "no_output" | "launch_failed" | "invalid_output" | "invalid_input" | "credential_mismatch" | "skipped" | "partial";
1525
+ stop: "completed" | "timeout" | "max_turns" | "budget" | "context_budget" | "stalled" | "auth_failed" | "api_error" | "rate_limited" | "refused" | "aborted" | "denied" | "error" | "no_output" | "launch_failed" | "invalid_output" | "invalid_input" | "credential_mismatch" | "skipped" | "partial" | "cancelled";
1374
1526
  /** Ok */
1375
1527
  ok: boolean;
1376
1528
  /**
@@ -1408,6 +1560,12 @@ export type components = {
1408
1560
  unread_events?: {
1409
1561
  [key: string]: number;
1410
1562
  };
1563
+ /**
1564
+ * Usage Unknown
1565
+ * @default
1566
+ * @enum {string}
1567
+ */
1568
+ usage_unknown?: "" | "calls" | "tokens";
1411
1569
  changes?: components["schemas"]["Changes"] | null;
1412
1570
  /** Context Budget */
1413
1571
  context_budget?: number | null;
@@ -1421,6 +1579,10 @@ export type components = {
1421
1579
  * @default
1422
1580
  */
1423
1581
  fingerprint?: string;
1582
+ /** Fingerprint Parts */
1583
+ fingerprint_parts?: {
1584
+ [key: string]: string;
1585
+ };
1424
1586
  /**
1425
1587
  * Outside
1426
1588
  * @default
@@ -1431,6 +1593,11 @@ export type components = {
1431
1593
  * @default
1432
1594
  */
1433
1595
  rerun?: string;
1596
+ /**
1597
+ * Output Of After
1598
+ * @default
1599
+ */
1600
+ output_of_after?: string;
1434
1601
  /** Flow Call */
1435
1602
  flow_call?: string | null;
1436
1603
  /**
@@ -1895,6 +2062,11 @@ export type components = {
1895
2062
  skipped: number;
1896
2063
  /** Blocked */
1897
2064
  blocked: number;
2065
+ /**
2066
+ * Cancelled
2067
+ * @default 0
2068
+ */
2069
+ cancelled?: number;
1898
2070
  };
1899
2071
  /** PlanMessage */
1900
2072
  PlanMessage: {
@@ -1945,7 +2117,7 @@ export type components = {
1945
2117
  priority?: number;
1946
2118
  /**
1947
2119
  * Credential
1948
- * @description the credential its task call names (`credential=`), which every route of its kind ran it as; empty when it names none, or a run-wide override outranks it
2120
+ * @description the credential its call options name (`.options(credential=)`), which every route of its kind ran it as; empty when it names none, or a run-wide override outranks it
1949
2121
  * @default
1950
2122
  */
1951
2123
  credential?: string;
@@ -1962,7 +2134,7 @@ export type components = {
1962
2134
  flow?: components["schemas"]["Frame"][];
1963
2135
  /**
1964
2136
  * Created From
1965
- * @description keys whose results its flow call had received when it created it
2137
+ * @description keys of the results that reached its flow call between that flow call's previous resume and the one in which it created the task
1966
2138
  */
1967
2139
  created_from?: string[];
1968
2140
  /**
@@ -1970,6 +2142,18 @@ export type components = {
1970
2142
  * @description the id of the flow call that created it; null for a task with no origin
1971
2143
  */
1972
2144
  flow_call?: string | null;
2145
+ /**
2146
+ * Given From
2147
+ * @description keys of the tasks whose outputs it was given in its params: an output, or one item of an output that is a list, whose JSON is a value of its params; shown only, never part of its fingerprint
2148
+ */
2149
+ given_from?: string[];
2150
+ /**
2151
+ * Input Files
2152
+ * @description the input files among its params, as its task call hashed them: `param` (its place in the params, `notes/0`), `path` and `sha256`; absent when it has none
2153
+ */
2154
+ input_files?: {
2155
+ [key: string]: string;
2156
+ }[];
1973
2157
  /**
1974
2158
  * Base Kind
1975
2159
  * @description an implementation kind's base kind (`agent_task(implementations=)`), its group unless `groups` lists it; else empty
@@ -1980,7 +2164,7 @@ export type components = {
1980
2164
  * State
1981
2165
  * @enum {string}
1982
2166
  */
1983
- state: "pending" | "running" | "done" | "partial" | "failed" | "skipped" | "blocked";
2167
+ state: "pending" | "running" | "done" | "partial" | "failed" | "skipped" | "blocked" | "cancelled";
1984
2168
  /**
1985
2169
  * Level
1986
2170
  * @description depth in the dependency graph, 0 for a task that waits for nothing
@@ -2257,7 +2441,7 @@ export type components = {
2257
2441
  * RunEvent
2258
2442
  * @description One message of /events?run=
2259
2443
  */
2260
- RunEvent: components["schemas"]["JournalMessage"] | components["schemas"]["ProcsMessage"] | components["schemas"]["PlanMessage"] | components["schemas"]["OutputsMessage"] | components["schemas"]["CursorMessage"] | components["schemas"]["PanelMessage"] | components["schemas"]["ReadyMessage"];
2444
+ RunEvent: components["schemas"]["JournalMessage"] | components["schemas"]["ProcsMessage"] | components["schemas"]["PlanMessage"] | components["schemas"]["OutputsMessage"] | components["schemas"]["ForecastMessage"] | components["schemas"]["CursorMessage"] | components["schemas"]["PanelMessage"] | components["schemas"]["ReadyMessage"];
2261
2445
  /**
2262
2446
  * RunSummary
2263
2447
  * @description One run directory, as the run picker lists it.
@@ -2688,7 +2872,8 @@ export type components = {
2688
2872
  * @description A run's tasks (not attempts) by how they ended. `not_started`: refused for
2689
2873
  * an input, or waiting behind a task that failed; `running`: running now (in a
2690
2874
  * live run); `waiting`: queued in a live run; `not_run`: deferred, or queued in a
2691
- * run that is no longer live (it will not run).
2875
+ * run that is no longer live (it will not run); `cancelled`: cancelled once no flow
2876
+ * call waited for it (called with `.options(cancellable=True)`).
2692
2877
  */
2693
2878
  TaskCounts: {
2694
2879
  /** Total */
@@ -2719,6 +2904,11 @@ export type components = {
2719
2904
  not_run?: number;
2720
2905
  /** Skipped */
2721
2906
  skipped: number;
2907
+ /**
2908
+ * Cancelled
2909
+ * @default 0
2910
+ */
2911
+ cancelled?: number;
2722
2912
  };
2723
2913
  /**
2724
2914
  * TaskDefinition
@@ -2858,8 +3048,16 @@ export type components = {
2858
3048
  params: {
2859
3049
  [key: string]: unknown;
2860
3050
  };
2861
- /** Inputs */
3051
+ /**
3052
+ * Inputs
3053
+ * @description its input contracts (`ContractRecord.inputs`)
3054
+ */
2862
3055
  inputs: components["schemas"]["ContractSpec"][];
3056
+ /**
3057
+ * Input Files
3058
+ * @description the input files among its params
3059
+ */
3060
+ input_files?: components["schemas"]["TaskInputFile"][];
2863
3061
  /** Outputs */
2864
3062
  outputs: components["schemas"]["ContractSpec"][];
2865
3063
  /**
@@ -2872,6 +3070,42 @@ export type components = {
2872
3070
  /** Downstream */
2873
3071
  downstream: components["schemas"]["DownstreamTask"][];
2874
3072
  };
3073
+ /**
3074
+ * TaskInputFile
3075
+ * @description An input file among the task's params (`plan.jsonl` `input_files`): its place in the
3076
+ * params, its path and the SHA-256 of its content taken at the task call, the task whose
3077
+ * output file it is, and its check as the task was about to start.
3078
+ */
3079
+ TaskInputFile: {
3080
+ /**
3081
+ * Param
3082
+ * @description its place in the params: the param's name, then a list's index or a field's name (`notes/0`)
3083
+ */
3084
+ param: string;
3085
+ /**
3086
+ * Path
3087
+ * @description as the params hold it: relative to the run's working directory, or absolute for an output file outside it
3088
+ */
3089
+ path: string;
3090
+ /** Sha256 */
3091
+ sha256: string;
3092
+ /**
3093
+ * Writer
3094
+ * @description the key of the task it was given from whose output file it is; null for another file
3095
+ */
3096
+ writer?: string | null;
3097
+ /**
3098
+ * Check
3099
+ * @enum {string}
3100
+ */
3101
+ check: "passed" | "refused" | "not_checked";
3102
+ /**
3103
+ * Reason
3104
+ * @description for one `refused`: why, as the refusal names it; else empty
3105
+ * @default
3106
+ */
3107
+ reason?: string;
3108
+ };
2875
3109
  /**
2876
3110
  * TaskLaunch
2877
3111
  * @description A live launch of the task (a child process, or an in-process marker with empty plugin/model/role/cmd).
@@ -3604,7 +3838,10 @@ export type components = {
3604
3838
  /** Inflight */
3605
3839
  inflight: string[];
3606
3840
  };
3607
- /** UpstreamTask */
3841
+ /**
3842
+ * UpstreamTask
3843
+ * @description An earlier task: one this task was given from, waits for, or was created from.
3844
+ */
3608
3845
  UpstreamTask: {
3609
3846
  /** Key */
3610
3847
  key: string;
@@ -3619,6 +3856,11 @@ export type components = {
3619
3856
  executor: "agent" | "python";
3620
3857
  /** Outputs */
3621
3858
  outputs: components["schemas"]["ContractSpec"][];
3859
+ /**
3860
+ * Lineage
3861
+ * @description how this task is joined to it, in the order `given_from`, `after`, `created_from`
3862
+ */
3863
+ lineage?: ("given_from" | "after" | "created_from")[];
3622
3864
  };
3623
3865
  /** ValidationError */
3624
3866
  ValidationError: {
@@ -3896,6 +4138,37 @@ export interface operations {
3896
4138
  };
3897
4139
  };
3898
4140
  };
4141
+ api_forecast_api_runs__run__forecast_get: {
4142
+ parameters: {
4143
+ query?: never;
4144
+ header?: never;
4145
+ path: {
4146
+ run: string;
4147
+ };
4148
+ cookie?: never;
4149
+ };
4150
+ requestBody?: never;
4151
+ responses: {
4152
+ /** @description Successful Response */
4153
+ 200: {
4154
+ headers: {
4155
+ [name: string]: unknown;
4156
+ };
4157
+ content: {
4158
+ "application/json": components["schemas"]["Forecast"];
4159
+ };
4160
+ };
4161
+ /** @description Validation Error */
4162
+ 422: {
4163
+ headers: {
4164
+ [name: string]: unknown;
4165
+ };
4166
+ content: {
4167
+ "application/json": components["schemas"]["HTTPValidationError"];
4168
+ };
4169
+ };
4170
+ };
4171
+ };
3899
4172
  api_definitions_api_runs__run__definitions_get: {
3900
4173
  parameters: {
3901
4174
  query?: never;