@boxxy/model 0.1.7 → 0.1.9
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/index.d.ts +1 -1
- package/dist/ports/types.d.ts +12 -0
- package/package.json +2 -2
- package/src/index.ts +2 -0
- package/src/ports/types.ts +19 -2
- package/src/rows/spawn-request-schema.ts +10 -0
package/dist/index.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export type { AcceptanceInput, BuildCloseOut, BuildInput, CloseOut, CloseOutAnsw
|
|
|
58
58
|
export type { Claim } from './dispatch/types.ts';
|
|
59
59
|
export type { AnyNewFact, EntityRef, FactEnvelope, FactType, NewFact, OutboxFact, RelationPayload, WorkFacts, } from './facts/types.ts';
|
|
60
60
|
export type { Admission, AdmissionGrant, AdmissionName, Decision, Fault, Filter, Frame, FrameItem, FrameValues, Gate, GateName, Hold, Lift, Limit, LimitFill, Pick, PlanContext, Pool, PropagationLine, SeatRef, SeatRelease, SeatTake, Signal, SignalKey, SignalName, Snapshot, StartPick, View, ViewName, Wait, WaitReason, Waiver, WaiverName, Wake, WakePick, } from './planning/types.ts';
|
|
61
|
-
export type { ApplyResult, Attention, CallerProof, CapacityBackoff, ClaimStore, Clock, FactSink, ForgetOutcome, Forge, GitSource, HoldNotice, ItemDetailRows, ItemFilter, NewId, NoticeOutcome, Notifier, OutboxReader, PepysAnswer, PepysReader, SinkAnswer, PullRequestReading, RowWrite, SessionFault, SessionReading, SpawnRequest, StartOutcome, StopOutcome, StoreChange, StoreReader, StoreTx, SuspendOutcome, TableName, Tables, WakeSource, WorkerKind, } from './ports/types.ts';
|
|
61
|
+
export type { ApplyResult, Attention, CallerProof, CapacityBackoff, ClaimStore, Clock, FactSink, ForgetOutcome, Forge, GitSource, HoldNotice, ItemDetailRows, ItemFilter, NewId, NoticeOutcome, Notifier, OutboxReader, PepysAnswer, PepysReader, SinkAnswer, PullRequestReading, RowWrite, RunnerFault, SessionFault, SessionReading, SpawnRequest, StartOutcome, StopOutcome, StoreChange, StoreReader, StoreTx, SuspendOutcome, TableName, Tables, WakeSource, WorkerKind, WorkerRefusal, } from './ports/types.ts';
|
|
62
62
|
export type { CostToLand, StageTime } from './reports/types.ts';
|
|
63
63
|
export type { OutboxStatus } from './reports/outbox-status.ts';
|
|
64
64
|
export type { ItemSetRows, ItemWithLevers } from './items/types.ts';
|
package/dist/ports/types.d.ts
CHANGED
|
@@ -204,6 +204,9 @@ export type Attention = 'working' | 'needs-input' | 'turn-ended';
|
|
|
204
204
|
export interface GitSource {
|
|
205
205
|
readonly url: string;
|
|
206
206
|
readonly ref: string;
|
|
207
|
+
readonly credentialRef?: {
|
|
208
|
+
readonly name: string;
|
|
209
|
+
};
|
|
207
210
|
}
|
|
208
211
|
export type SpawnRequest = SpawnRequestFields & ({
|
|
209
212
|
readonly cwd: string;
|
|
@@ -248,6 +251,15 @@ export interface SessionFault {
|
|
|
248
251
|
readonly attempt: AttemptId;
|
|
249
252
|
readonly holder: AttemptId;
|
|
250
253
|
}
|
|
254
|
+
export interface WorkerRefusal {
|
|
255
|
+
readonly kind: 'fault';
|
|
256
|
+
readonly fault: 'spawn-refused' | 'wake-refused';
|
|
257
|
+
readonly attempt: AttemptId;
|
|
258
|
+
readonly item: ItemId;
|
|
259
|
+
readonly cause: 'capacity' | 'other';
|
|
260
|
+
readonly reason: string;
|
|
261
|
+
}
|
|
262
|
+
export type RunnerFault = SessionFault | WorkerRefusal;
|
|
251
263
|
export type SinkAnswer = {
|
|
252
264
|
readonly kind: 'stored';
|
|
253
265
|
} | {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boxxy/model",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "The types that boxxy's packages share",
|
|
5
5
|
"homepage": "https://github.com/zgeoff/boxxy/tree/main/libs/model#readme",
|
|
6
6
|
"bugs": "https://github.com/zgeoff/boxxy/issues",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typecheck": "tsrs --noEmit"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@boxxy/content-hash": "0.1.
|
|
34
|
+
"@boxxy/content-hash": "0.1.9",
|
|
35
35
|
"tiny-invariant": "1.3.3",
|
|
36
36
|
"zod": "4.6.7"
|
|
37
37
|
},
|
package/src/index.ts
CHANGED
|
@@ -236,6 +236,7 @@ export type {
|
|
|
236
236
|
SinkAnswer,
|
|
237
237
|
PullRequestReading,
|
|
238
238
|
RowWrite,
|
|
239
|
+
RunnerFault,
|
|
239
240
|
SessionFault,
|
|
240
241
|
SessionReading,
|
|
241
242
|
SpawnRequest,
|
|
@@ -249,6 +250,7 @@ export type {
|
|
|
249
250
|
Tables,
|
|
250
251
|
WakeSource,
|
|
251
252
|
WorkerKind,
|
|
253
|
+
WorkerRefusal,
|
|
252
254
|
} from './ports/types.ts';
|
|
253
255
|
|
|
254
256
|
export type { CostToLand, StageTime } from './reports/types.ts';
|
package/src/ports/types.ts
CHANGED
|
@@ -305,11 +305,13 @@ export type SessionReading =
|
|
|
305
305
|
|
|
306
306
|
export type Attention = 'working' | 'needs-input' | 'turn-ended';
|
|
307
307
|
|
|
308
|
-
// A git repository that atc clones
|
|
309
|
-
//
|
|
308
|
+
// A git repository that atc clones for the session. The atc daemon clones it before the session
|
|
309
|
+
// exists, so a private repository needs `credentialRef`: the name of the daemon's environment
|
|
310
|
+
// variable that holds a clone token. The name is no secret; boxxy never reads the token.
|
|
310
311
|
export interface GitSource {
|
|
311
312
|
readonly url: string;
|
|
312
313
|
readonly ref: string;
|
|
314
|
+
readonly credentialRef?: { readonly name: string };
|
|
313
315
|
}
|
|
314
316
|
|
|
315
317
|
// Exactly one of the two: `cwd`, the repo's folder on a target on the atc daemon's own host, or
|
|
@@ -370,6 +372,21 @@ export interface SessionFault {
|
|
|
370
372
|
readonly holder: AttemptId;
|
|
371
373
|
}
|
|
372
374
|
|
|
375
|
+
// A spawn or a wake that the worker refused. A refused spawn settles the attempt as `no-capacity`
|
|
376
|
+
// or `spawn-refused`; a refused wake sleeps the attempt again for capacity, and otherwise leaves it
|
|
377
|
+
// `waking` for the next reading. The runner logs the worker's reason, which no fact carries.
|
|
378
|
+
export interface WorkerRefusal {
|
|
379
|
+
readonly kind: 'fault';
|
|
380
|
+
readonly fault: 'spawn-refused' | 'wake-refused';
|
|
381
|
+
readonly attempt: AttemptId;
|
|
382
|
+
readonly item: ItemId;
|
|
383
|
+
readonly cause: 'capacity' | 'other';
|
|
384
|
+
readonly reason: string;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// What a claim or a reading returns for the runner to log.
|
|
388
|
+
export type RunnerFault = SessionFault | WorkerRefusal;
|
|
389
|
+
|
|
373
390
|
// What one batch sent to the sink got back. `retry` may or may not have stored the batch.
|
|
374
391
|
export type SinkAnswer =
|
|
375
392
|
| { readonly kind: 'stored' }
|
|
@@ -14,6 +14,16 @@ export const gitSourceSchema: z.ZodType<GitSource> = z.strictObject({
|
|
|
14
14
|
.min(1)
|
|
15
15
|
.max(255)
|
|
16
16
|
.refine((ref) => !ref.startsWith('-'), 'a git source ref must not start with -'),
|
|
17
|
+
|
|
18
|
+
// atc's own rule for the name of an environment variable
|
|
19
|
+
credentialRef: z
|
|
20
|
+
.strictObject({
|
|
21
|
+
name: z
|
|
22
|
+
.string()
|
|
23
|
+
.max(255)
|
|
24
|
+
.regex(/^[A-Za-z_]\w*$/u, 'a credentialRef names an environment variable'),
|
|
25
|
+
})
|
|
26
|
+
.exactOptional(),
|
|
17
27
|
});
|
|
18
28
|
|
|
19
29
|
const spawnRequestFields = z.strictObject({
|