@toon-protocol/rig 4.6.0 → 4.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/index.d.ts CHANGED
@@ -424,8 +424,10 @@ interface FetchRemoteStateOptions {
424
424
  timeoutMs?: number;
425
425
  /**
426
426
  * Git-SHA → Arweave txId resolver used by {@link RemoteState.resolveMissing}.
427
- * Defaults to the shared GraphQL resolver from @toon-protocol/arweave;
428
- * injectable for tests.
427
+ * Defaults to the shared GraphQL resolver from @toon-protocol/arweave,
428
+ * which asks `arweave.net` — so every command that takes a gateway passes
429
+ * one bound to it instead (`../git-sha-resolver.ts`, #183). Injectable for
430
+ * tests.
429
431
  */
430
432
  resolveSha?: (sha: string, repo: string) => Promise<string | null>;
431
433
  /** WebSocket constructor override (defaults to the global WebSocket). */
@@ -1674,6 +1676,13 @@ declare const CI_MANUAL_TRIGGER_KIND = 9840;
1674
1676
  declare const CI_JOB_RESULT_KIND = 9841;
1675
1677
  declare const CI_WORKFLOW_RESULT_KIND = 9842;
1676
1678
  declare const CI_WORKFLOW_PROGRESS_KIND = 39842;
1679
+ /**
1680
+ * rig's NIP-C1 EXTENSION kind (ADR-0002, docs/specs/nip-c1-live-log-tail.md):
1681
+ * the live log tail of a run in flight. Not in the vendored spec — the number
1682
+ * is rig's choice, offered upstream to ngit-ci, and renumbering it is a deploy
1683
+ * rather than a migration because the event holds no durable data.
1684
+ */
1685
+ declare const CI_LIVE_LOG_TAIL_KIND = 39841;
1677
1686
  /** The one runner family rig supports (`W` tag / `R` prefix). */
1678
1687
  declare const CI_RUNNER_FAMILY = "act";
1679
1688
  /** The `software` tag name rig advertises under. */
@@ -1681,6 +1690,35 @@ declare const CI_SOFTWARE = "rig";
1681
1690
  /** NIP-40 bound on Advertisement + Progress lifetime (seconds). */
1682
1691
  declare const CI_MAX_ADVERTISEMENT_TTL: number;
1683
1692
  declare const CI_MAX_PROGRESS_TTL: number;
1693
+ /** The same NIP-40 bound on a Live Log Tail (seconds). */
1694
+ declare const CI_MAX_LIVE_LOG_TAIL_TTL: number;
1695
+ /**
1696
+ * How often a run in flight republishes its tail. Fixed — a fixed interval is
1697
+ * what makes the worst case budgetable — and expressed in milliseconds because
1698
+ * both consumers (the coordinator's scheduler seam and `estimateRunCost`'s run
1699
+ * timeout) work in milliseconds.
1700
+ */
1701
+ declare const CI_LIVE_LOG_TAIL_INTERVAL_MS = 10000;
1702
+ /**
1703
+ * Bytes of tail one live job gets by default: deliberately far more than the
1704
+ * 4 KiB that rides in a Job Result, because the relay fee ignores event size
1705
+ * and the difference between one screen and several is the difference between
1706
+ * "is it alive" and "what is it doing".
1707
+ */
1708
+ declare const CI_LIVE_LOG_TAIL_JOB_BYTES: number;
1709
+ /**
1710
+ * Ceiling on the tail bytes ONE event may carry, so a run with many live jobs
1711
+ * stays relay-safe. Beyond it the budget is divided evenly — see
1712
+ * {@link liveLogTailBudget}.
1713
+ */
1714
+ declare const CI_LIVE_LOG_TAIL_MAX_BYTES: number;
1715
+ /**
1716
+ * The distinguished key naming the runner channel in a coordinator's per-job
1717
+ * buffers. It is not a job id and can never collide with one (a workflow job id
1718
+ * matches `[A-Za-z_][A-Za-z0-9_-]*`), and it never appears in the wire event's
1719
+ * `jobs` array — the runner channel has its own `runner` slot.
1720
+ */
1721
+ declare const CI_RUNNER_CHANNEL_KEY = "~runner";
1684
1722
  type CiConclusion = 'success' | 'failure' | 'neutral' | 'cancelled' | 'skipped' | 'timed_out' | 'startup_failure';
1685
1723
  declare function isCiConclusion(value: string): value is CiConclusion;
1686
1724
  type CiProgressStatus = 'queued' | 'in_progress' | 'concluded';
@@ -1981,6 +2019,76 @@ interface CiWorkflowProgress {
1981
2019
  }
1982
2020
  declare function buildCiWorkflowProgress(input: CiWorkflowProgressInput, createdAt?: number): UnsignedEvent;
1983
2021
  declare function parseCiWorkflowProgress(ev: NostrEvent): CiWorkflowProgress | null;
2022
+ /** One unfinished job's recent output. */
2023
+ interface CiLiveLogTailJob {
2024
+ /** Job id as declared in the workflow file. */
2025
+ job: string;
2026
+ /** The most recent output, sliced from the END of the redacted log. */
2027
+ tail: string;
2028
+ /** Bytes of that job's output preceding `tail`. */
2029
+ omitted: number;
2030
+ }
2031
+ /** The runner channel: the runner's own account of the run, never a job. */
2032
+ interface CiLiveLogTailChannel {
2033
+ tail: string;
2034
+ omitted: number;
2035
+ }
2036
+ interface CiLiveLogTailInput {
2037
+ trigger: CiTriggerContext;
2038
+ /** The run's Workflow Progress `d`. */
2039
+ runId: string;
2040
+ /** Every unfinished job; a job drops out once its Job Result is published. */
2041
+ jobs: CiLiveLogTailJob[];
2042
+ runner?: CiLiveLogTailChannel;
2043
+ /** NIP-40 expiration: > created_at, ≤ created_at + 30 min. */
2044
+ expiresAt: number;
2045
+ }
2046
+ interface CiLiveLogTail {
2047
+ eventId: string;
2048
+ pubkey: string;
2049
+ createdAt: number;
2050
+ trigger: CiTriggerContext;
2051
+ runId: string;
2052
+ jobs: CiLiveLogTailJob[];
2053
+ runner?: CiLiveLogTailChannel;
2054
+ expiresAt: number;
2055
+ }
2056
+ /**
2057
+ * Bytes of tail each live entry gets when `entries` of them share one event:
2058
+ * the per-job default until that many entries would breach the per-event
2059
+ * ceiling, then the ceiling divided evenly. Entries are unfinished jobs PLUS
2060
+ * the runner channel when it has output — everything that occupies bytes in
2061
+ * the event.
2062
+ */
2063
+ declare function liveLogTailBudget(entries: number): number;
2064
+ /**
2065
+ * Worst-case number of Live Log Tail events a run of at most `runTimeoutMs`
2066
+ * can publish: one per cadence tick plus the closing replacement. This is what
2067
+ * the coordinator must be able to afford BEFORE it starts the run — there is
2068
+ * no best-effort mode, because a stream that silently stops is
2069
+ * indistinguishable to a viewer from a stalled job.
2070
+ */
2071
+ declare function liveLogTailEventBudget(runTimeoutMs: number): number;
2072
+ /**
2073
+ * Take the last `maxBytes` UTF-8 bytes of `text`, reporting how many bytes
2074
+ * precede them. The slice never splits a multi-byte character, and `omitted`
2075
+ * counts BYTES (what a reader comparing against the job log's size needs), not
2076
+ * characters. Callers slice REDACTED output — never the reverse (ADR-0002).
2077
+ */
2078
+ declare function sliceLogTail(text: string, maxBytes: number): {
2079
+ tail: string;
2080
+ omitted: number;
2081
+ };
2082
+ declare function buildCiLiveLogTail(input: CiLiveLogTailInput, createdAt?: number): UnsignedEvent;
2083
+ /**
2084
+ * Parse a Live Log Tail. Unknown fields — anywhere in the content, and unknown
2085
+ * tags — are ignored, so a later rig may add to the shape without breaking a
2086
+ * client; anything the shape does NOT allow (bad JSON, a jobs entry without a
2087
+ * job id, a duplicated job, a runner channel smuggled in as a job, an
2088
+ * expiration beyond the 30-minute bound) is `null` rather than a throw or a
2089
+ * half-populated result.
2090
+ */
2091
+ declare function parseCiLiveLogTail(ev: NostrEvent): CiLiveLogTail | null;
1984
2092
 
1985
2093
  /**
1986
2094
  * Repository Secret Update payloads (rig#125): the NIP-44 v2 ciphertext a
@@ -2172,7 +2280,12 @@ interface RunnerRequest {
2172
2280
  env?: Record<string, string>;
2173
2281
  /** Wall-clock budget for the whole run; exceeding it concludes `timed_out`. */
2174
2282
  timeoutMs: number;
2175
- /** Streaming log sink (per job). */
2283
+ /**
2284
+ * Streaming log sink, called with a job id as output is produced. Output
2285
+ * the runner attributes to no job — its own account of executing the run —
2286
+ * goes to the RUNNER CHANNEL: the reserved key `CI_RUNNER_CHANNEL_KEY`
2287
+ * exported by ./nip-c1-events.ts, which no workflow job id can equal.
2288
+ */
2176
2289
  onLog?: (jobId: string, chunk: string) => void;
2177
2290
  /** Cancels the run (concludes `cancelled`). */
2178
2291
  signal?: AbortSignal;
@@ -2519,4 +2632,4 @@ declare const NGIT_STATUS_NGIT_TARGET: NostrEvent;
2519
2632
  /** Every captured event, flattened — for the id/signature verification test. */
2520
2633
  declare const ALL_NGIT_FIXTURE_EVENTS: NostrEvent[];
2521
2634
 
2522
- export { ALL_NGIT_FIXTURE_EVENTS, type AnnouncementEdits, type BuildIncrementOfferOptions, type BuildNarrationOptions, type BuildResultEventOptions, CI_ADVERTISEMENT_KIND, CI_JOB_RESULT_KIND, CI_MANUAL_TRIGGER_KIND, CI_MAX_ADVERTISEMENT_TTL, CI_MAX_PROGRESS_TTL, CI_RUNNER_FAMILY, CI_SECRET_UPDATE_KIND, CI_SERVICE_REQUEST_KIND, CI_SERVICE_STOP_KIND, CI_SOFTWARE, CI_TRUST_ORDER, CI_WORKFLOW_PROGRESS_KIND, CI_WORKFLOW_RESULT_KIND, type CiAdmissionPolicy, type CiAdvertisement, type CiAdvertisementInput, type CiArtifact, type CiBillingPolicy, type CiConclusion, type CiExecutionPolicy, type CiJobQuote, type CiJobResult, type CiJobResultInput, type CiManualTrigger, type CiPrContext, type CiProgressStatus, type CiProvenance, type CiSecretUpdate, type CiSecretUpdateArgs, type CiStatusJob, type CiStatusReport, type CiStatusRun, type CiStatusSummary, type CiTriggerContext, type CiTriggerReason, type CiTrustLevel, type CiWorkflowProgress, type CiWorkflowProgressInput, type CiWorkflowRef, type CiWorkflowResult, type CiWorkflowResultInput, type ClosureResult, type CollectRepoObjectsOptions, type CollectRepoObjectsResult, DEFAULT_CONCURRENCY, type DeriveTrustLevelArgs, type DiscoveredWorkflow, type DownloadOptions, type DownloadResult, EARLIEST_UNIQUE_COMMIT_MARKER, type EncryptedArtifact, type EncryptedArtifactRef, type ExecuteFactoryJobOptions, type ExecutePushOptions, type ExistingAnnouncement, FACTORY_JOB_FEEDBACK_KIND, FACTORY_JOB_REQUEST_KIND, FACTORY_JOB_RESULT_KIND, type FactoryJobExecution, type FactoryJobHooks, type FactoryJobOutcome, type FactoryJobRequest, type FactoryJobWork, type FactoryMilestone, type FactoryTicket, FakeRunner, type FakeRunnerScript, FeeRates, type FetchLike, type FetchRemoteStateOptions, type FetchedObject, type GateCheck, type GateResult, type GatewayFetchOptions, type GitCommentRequest, GitError, type GitErrorEnvelope, type GitEstimateRequest, type GitEstimateResponse, type GitEventResponse, type GitFeeEstimate, type GitIssueRequest, GitObjectType, type GitPatchRequest, type GitPlannedObject, type GitPublishReceipt, type GitPushRequest, type GitPushResponse, type GitRef, type GitRefUpdate, type GitRepoAddr, GitRepoReader, type GitStatusRequest, type GitStatusValue, type GitUploadStep, type IncrementSpec, type JobDeliveryPort, MAX_SECRET_CIPHERTEXT_BYTES, MAX_SECRET_NAMES, MAX_SECRET_PLAINTEXT_BYTES, MAX_SECRET_VALUE_BYTES, type MissingObject, NGIT_ANNOUNCEMENT_WYRD, NGIT_ANNOUNCEMENT_WYRD_CAPTURED_AT, NGIT_ANNOUNCEMENT_WYRD_EVENT_ID, NGIT_ANNOUNCEMENT_WYRD_RELAY, NGIT_COMMENT_THREAD_CAPTURED_AT, NGIT_COMMENT_THREAD_COMMENTS, NGIT_COMMENT_THREAD_COMMENT_EVENT_IDS, NGIT_COMMENT_THREAD_NESTED_REPLY_ID, NGIT_COMMENT_THREAD_NESTED_REPLY_PARENT_ID, NGIT_COMMENT_THREAD_RELAY, NGIT_COMMENT_THREAD_ROOT, NGIT_COMMENT_THREAD_ROOT_EVENT_ID, NGIT_STATE_NGIT, NGIT_STATE_NGIT_CAPTURED_AT, NGIT_STATE_NGIT_EVENT_ID, NGIT_STATE_NGIT_RELAY, NGIT_STATUS_NGIT, NGIT_STATUS_NGIT_CAPTURED_AT, NGIT_STATUS_NGIT_EVENT_ID, NGIT_STATUS_NGIT_RELAY, NGIT_STATUS_NGIT_TARGET, NGIT_STATUS_NGIT_TARGET_EVENT_ID, NonFastForwardError, type NostrEvent, type NostrFilter, ObjectIntegrityError, type ObjectStat, type ObjectWithPath, ObjectWriteMismatchError, type OfferedIncrement, type OversizeObject, OversizeObjectsError, PayoutPointer, type PlanPushOptions, type PlannedObject, PublishReceipt, Publisher, type PushFeeEstimate, type PushPlan, type PushResult, RELAYS_TAG, RESERVED_SECRET_NAMES, type ReadGitObject, type ReadObjectsResult, type RefFilters, type RefUpdate, type RefUpdateKind, type RejectedRefUpdate, type RelayEvent, type RemoteState, type RepoAddress, type RepoRefs, type Runner, type RunnerArtifact, type RunnerJobResult, type RunnerRequest, type RunnerRunResult, SECRET_NAME_RE, type SecretInventory, type SecretInventoryEntry, type SecretUpdatePlaintext, type SelectServiceRequestsOptions, type SelectedServiceRequests, type ServiceControl, type StatObjectsResult, UnsignedEvent, type UploadStepResult, WEB_TAG, WORKFLOW_DIRS, type WebSocketFactory, type WebSocketLike, type WorkflowJob, type WorkflowTriggers, amendRepoAnnouncement, applySecretUpdate, assembleCiStatus, assertSecretUpdateShape, buildCiAdvertisement, buildCiJobResult, buildCiManualTrigger, buildCiSecretUpdate, buildCiServiceRequest, buildCiServiceStop, buildCiWorkflowProgress, buildCiWorkflowResult, buildIncrementOfferEvent, buildNarrationEvent, buildQuoteEvent, buildRepoAnnouncement, buildResultEvent, collectRepoObjects, commonTriggerTags, controlOrder, decryptSecretUpdate, defaultFakeRunResult, deriveTrustLevel, discoverWorkflows, downloadGitObjects, effectiveSecrets, encryptSecretUpdate, executeFactoryJob, executePush, fetchRemoteState, fetchTxBytes, gatePassed, generateSecretsKey, hexToNpub, isCiConclusion, isCiTrustLevel, isSafeRefname, matchesPullRequest, matchesPush, missingObjectsMessage, npubToHex, ownerToHex, parseCiAdvertisement, parseCiJobResult, parseCiManualTrigger, parseCiSecretUpdate, parseCiServiceControl, parseCiTriggerContext, parseCiWorkflowProgress, parseCiWorkflowResult, parseFactoryJobRequest, parseRepoAddress, parseWorkflow, planFactoryJob, planPush, queryRelay, refMatchesPatterns, referencedShas, repoAddress, selectServiceRequests, serializeEventReceipt, serializeFeeEstimate, serializePushPlan, serializePushResult, setHeadSymref, sha256Hex, trustAtLeast, updateRef, validateSecretUpdate, verifyObjectBody, walkClosure, writeGitObject, writeGitObjects };
2635
+ export { ALL_NGIT_FIXTURE_EVENTS, type AnnouncementEdits, type BuildIncrementOfferOptions, type BuildNarrationOptions, type BuildResultEventOptions, CI_ADVERTISEMENT_KIND, CI_JOB_RESULT_KIND, CI_LIVE_LOG_TAIL_INTERVAL_MS, CI_LIVE_LOG_TAIL_JOB_BYTES, CI_LIVE_LOG_TAIL_KIND, CI_LIVE_LOG_TAIL_MAX_BYTES, CI_MANUAL_TRIGGER_KIND, CI_MAX_ADVERTISEMENT_TTL, CI_MAX_LIVE_LOG_TAIL_TTL, CI_MAX_PROGRESS_TTL, CI_RUNNER_CHANNEL_KEY, CI_RUNNER_FAMILY, CI_SECRET_UPDATE_KIND, CI_SERVICE_REQUEST_KIND, CI_SERVICE_STOP_KIND, CI_SOFTWARE, CI_TRUST_ORDER, CI_WORKFLOW_PROGRESS_KIND, CI_WORKFLOW_RESULT_KIND, type CiAdmissionPolicy, type CiAdvertisement, type CiAdvertisementInput, type CiArtifact, type CiBillingPolicy, type CiConclusion, type CiExecutionPolicy, type CiJobQuote, type CiJobResult, type CiJobResultInput, type CiLiveLogTail, type CiLiveLogTailChannel, type CiLiveLogTailInput, type CiLiveLogTailJob, type CiManualTrigger, type CiPrContext, type CiProgressStatus, type CiProvenance, type CiSecretUpdate, type CiSecretUpdateArgs, type CiStatusJob, type CiStatusReport, type CiStatusRun, type CiStatusSummary, type CiTriggerContext, type CiTriggerReason, type CiTrustLevel, type CiWorkflowProgress, type CiWorkflowProgressInput, type CiWorkflowRef, type CiWorkflowResult, type CiWorkflowResultInput, type ClosureResult, type CollectRepoObjectsOptions, type CollectRepoObjectsResult, DEFAULT_CONCURRENCY, type DeriveTrustLevelArgs, type DiscoveredWorkflow, type DownloadOptions, type DownloadResult, EARLIEST_UNIQUE_COMMIT_MARKER, type EncryptedArtifact, type EncryptedArtifactRef, type ExecuteFactoryJobOptions, type ExecutePushOptions, type ExistingAnnouncement, FACTORY_JOB_FEEDBACK_KIND, FACTORY_JOB_REQUEST_KIND, FACTORY_JOB_RESULT_KIND, type FactoryJobExecution, type FactoryJobHooks, type FactoryJobOutcome, type FactoryJobRequest, type FactoryJobWork, type FactoryMilestone, type FactoryTicket, FakeRunner, type FakeRunnerScript, FeeRates, type FetchLike, type FetchRemoteStateOptions, type FetchedObject, type GateCheck, type GateResult, type GatewayFetchOptions, type GitCommentRequest, GitError, type GitErrorEnvelope, type GitEstimateRequest, type GitEstimateResponse, type GitEventResponse, type GitFeeEstimate, type GitIssueRequest, GitObjectType, type GitPatchRequest, type GitPlannedObject, type GitPublishReceipt, type GitPushRequest, type GitPushResponse, type GitRef, type GitRefUpdate, type GitRepoAddr, GitRepoReader, type GitStatusRequest, type GitStatusValue, type GitUploadStep, type IncrementSpec, type JobDeliveryPort, MAX_SECRET_CIPHERTEXT_BYTES, MAX_SECRET_NAMES, MAX_SECRET_PLAINTEXT_BYTES, MAX_SECRET_VALUE_BYTES, type MissingObject, NGIT_ANNOUNCEMENT_WYRD, NGIT_ANNOUNCEMENT_WYRD_CAPTURED_AT, NGIT_ANNOUNCEMENT_WYRD_EVENT_ID, NGIT_ANNOUNCEMENT_WYRD_RELAY, NGIT_COMMENT_THREAD_CAPTURED_AT, NGIT_COMMENT_THREAD_COMMENTS, NGIT_COMMENT_THREAD_COMMENT_EVENT_IDS, NGIT_COMMENT_THREAD_NESTED_REPLY_ID, NGIT_COMMENT_THREAD_NESTED_REPLY_PARENT_ID, NGIT_COMMENT_THREAD_RELAY, NGIT_COMMENT_THREAD_ROOT, NGIT_COMMENT_THREAD_ROOT_EVENT_ID, NGIT_STATE_NGIT, NGIT_STATE_NGIT_CAPTURED_AT, NGIT_STATE_NGIT_EVENT_ID, NGIT_STATE_NGIT_RELAY, NGIT_STATUS_NGIT, NGIT_STATUS_NGIT_CAPTURED_AT, NGIT_STATUS_NGIT_EVENT_ID, NGIT_STATUS_NGIT_RELAY, NGIT_STATUS_NGIT_TARGET, NGIT_STATUS_NGIT_TARGET_EVENT_ID, NonFastForwardError, type NostrEvent, type NostrFilter, ObjectIntegrityError, type ObjectStat, type ObjectWithPath, ObjectWriteMismatchError, type OfferedIncrement, type OversizeObject, OversizeObjectsError, PayoutPointer, type PlanPushOptions, type PlannedObject, PublishReceipt, Publisher, type PushFeeEstimate, type PushPlan, type PushResult, RELAYS_TAG, RESERVED_SECRET_NAMES, type ReadGitObject, type ReadObjectsResult, type RefFilters, type RefUpdate, type RefUpdateKind, type RejectedRefUpdate, type RelayEvent, type RemoteState, type RepoAddress, type RepoRefs, type Runner, type RunnerArtifact, type RunnerJobResult, type RunnerRequest, type RunnerRunResult, SECRET_NAME_RE, type SecretInventory, type SecretInventoryEntry, type SecretUpdatePlaintext, type SelectServiceRequestsOptions, type SelectedServiceRequests, type ServiceControl, type StatObjectsResult, UnsignedEvent, type UploadStepResult, WEB_TAG, WORKFLOW_DIRS, type WebSocketFactory, type WebSocketLike, type WorkflowJob, type WorkflowTriggers, amendRepoAnnouncement, applySecretUpdate, assembleCiStatus, assertSecretUpdateShape, buildCiAdvertisement, buildCiJobResult, buildCiLiveLogTail, buildCiManualTrigger, buildCiSecretUpdate, buildCiServiceRequest, buildCiServiceStop, buildCiWorkflowProgress, buildCiWorkflowResult, buildIncrementOfferEvent, buildNarrationEvent, buildQuoteEvent, buildRepoAnnouncement, buildResultEvent, collectRepoObjects, commonTriggerTags, controlOrder, decryptSecretUpdate, defaultFakeRunResult, deriveTrustLevel, discoverWorkflows, downloadGitObjects, effectiveSecrets, encryptSecretUpdate, executeFactoryJob, executePush, fetchRemoteState, fetchTxBytes, gatePassed, generateSecretsKey, hexToNpub, isCiConclusion, isCiTrustLevel, isSafeRefname, liveLogTailBudget, liveLogTailEventBudget, matchesPullRequest, matchesPush, missingObjectsMessage, npubToHex, ownerToHex, parseCiAdvertisement, parseCiJobResult, parseCiLiveLogTail, parseCiManualTrigger, parseCiSecretUpdate, parseCiServiceControl, parseCiTriggerContext, parseCiWorkflowProgress, parseCiWorkflowResult, parseFactoryJobRequest, parseRepoAddress, parseWorkflow, planFactoryJob, planPush, queryRelay, refMatchesPatterns, referencedShas, repoAddress, selectServiceRequests, serializeEventReceipt, serializeFeeEstimate, serializePushPlan, serializePushResult, setHeadSymref, sha256Hex, sliceLogTail, trustAtLeast, updateRef, validateSecretUpdate, verifyObjectBody, walkClosure, writeGitObject, writeGitObjects };
package/dist/index.js CHANGED
@@ -1,9 +1,15 @@
1
1
  import {
2
2
  CI_ADVERTISEMENT_KIND,
3
3
  CI_JOB_RESULT_KIND,
4
+ CI_LIVE_LOG_TAIL_INTERVAL_MS,
5
+ CI_LIVE_LOG_TAIL_JOB_BYTES,
6
+ CI_LIVE_LOG_TAIL_KIND,
7
+ CI_LIVE_LOG_TAIL_MAX_BYTES,
4
8
  CI_MANUAL_TRIGGER_KIND,
5
9
  CI_MAX_ADVERTISEMENT_TTL,
10
+ CI_MAX_LIVE_LOG_TAIL_TTL,
6
11
  CI_MAX_PROGRESS_TTL,
12
+ CI_RUNNER_CHANNEL_KEY,
7
13
  CI_RUNNER_FAMILY,
8
14
  CI_SECRET_UPDATE_KIND,
9
15
  CI_SERVICE_REQUEST_KIND,
@@ -36,6 +42,7 @@ import {
36
42
  assertSecretUpdateShape,
37
43
  buildCiAdvertisement,
38
44
  buildCiJobResult,
45
+ buildCiLiveLogTail,
39
46
  buildCiManualTrigger,
40
47
  buildCiSecretUpdate,
41
48
  buildCiServiceRequest,
@@ -64,6 +71,8 @@ import {
64
71
  isCiConclusion,
65
72
  isCiTrustLevel,
66
73
  isSafeRefname,
74
+ liveLogTailBudget,
75
+ liveLogTailEventBudget,
67
76
  matchesPullRequest,
68
77
  matchesPush,
69
78
  missingObjectsMessage,
@@ -71,6 +80,7 @@ import {
71
80
  ownerToHex,
72
81
  parseCiAdvertisement,
73
82
  parseCiJobResult,
83
+ parseCiLiveLogTail,
74
84
  parseCiManualTrigger,
75
85
  parseCiSecretUpdate,
76
86
  parseCiServiceControl,
@@ -90,6 +100,7 @@ import {
90
100
  serializePushResult,
91
101
  setHeadSymref,
92
102
  sha256Hex,
103
+ sliceLogTail,
93
104
  trustAtLeast,
94
105
  updateRef,
95
106
  validateSecretUpdate,
@@ -97,7 +108,7 @@ import {
97
108
  walkClosure,
98
109
  writeGitObject,
99
110
  writeGitObjects
100
- } from "./chunk-DCGV6ALH.js";
111
+ } from "./chunk-3IVO2MSZ.js";
101
112
  import {
102
113
  COMMENT_KIND,
103
114
  LEGACY_COMMENT_KIND,
@@ -117,7 +128,7 @@ import {
117
128
  parseMaintainers,
118
129
  parsePayout,
119
130
  queryRelay
120
- } from "./chunk-JBFBD7HV.js";
131
+ } from "./chunk-S3KKQ4IC.js";
121
132
  import "./chunk-U5A7MHBP.js";
122
133
 
123
134
  // src/factory-job-gate.ts
@@ -426,10 +437,21 @@ var FakeRunner = class {
426
437
  /** Every request, in call order. */
427
438
  requests = [];
428
439
  async run(request) {
429
- this.requests.push(request);
430
- const result = await this.script(request);
431
- if (request.onLog) {
432
- for (const job of result.jobs) request.onLog(job.jobId, job.log);
440
+ const sink = request.onLog;
441
+ const streamed = /* @__PURE__ */ new Set();
442
+ const scripted = sink ? {
443
+ ...request,
444
+ onLog: (jobId, chunk) => {
445
+ streamed.add(jobId);
446
+ sink(jobId, chunk);
447
+ }
448
+ } : request;
449
+ this.requests.push(scripted);
450
+ const result = await this.script(scripted);
451
+ if (sink) {
452
+ for (const job of result.jobs) {
453
+ if (!streamed.has(job.jobId)) sink(job.jobId, job.log);
454
+ }
433
455
  }
434
456
  return result;
435
457
  }
@@ -892,9 +914,15 @@ export {
892
914
  ALL_NGIT_FIXTURE_EVENTS,
893
915
  CI_ADVERTISEMENT_KIND,
894
916
  CI_JOB_RESULT_KIND,
917
+ CI_LIVE_LOG_TAIL_INTERVAL_MS,
918
+ CI_LIVE_LOG_TAIL_JOB_BYTES,
919
+ CI_LIVE_LOG_TAIL_KIND,
920
+ CI_LIVE_LOG_TAIL_MAX_BYTES,
895
921
  CI_MANUAL_TRIGGER_KIND,
896
922
  CI_MAX_ADVERTISEMENT_TTL,
923
+ CI_MAX_LIVE_LOG_TAIL_TTL,
897
924
  CI_MAX_PROGRESS_TTL,
925
+ CI_RUNNER_CHANNEL_KEY,
898
926
  CI_RUNNER_FAMILY,
899
927
  CI_SECRET_UPDATE_KIND,
900
928
  CI_SERVICE_REQUEST_KIND,
@@ -960,6 +988,7 @@ export {
960
988
  authorizedStatusAuthors,
961
989
  buildCiAdvertisement,
962
990
  buildCiJobResult,
991
+ buildCiLiveLogTail,
963
992
  buildCiManualTrigger,
964
993
  buildCiSecretUpdate,
965
994
  buildCiServiceRequest,
@@ -1003,6 +1032,8 @@ export {
1003
1032
  isCiTrustLevel,
1004
1033
  isSafeRefname,
1005
1034
  isValidEvmPayoutAddress,
1035
+ liveLogTailBudget,
1036
+ liveLogTailEventBudget,
1006
1037
  matchesPullRequest,
1007
1038
  matchesPush,
1008
1039
  missingObjectsMessage,
@@ -1010,6 +1041,7 @@ export {
1010
1041
  ownerToHex,
1011
1042
  parseCiAdvertisement,
1012
1043
  parseCiJobResult,
1044
+ parseCiLiveLogTail,
1013
1045
  parseCiManualTrigger,
1014
1046
  parseCiSecretUpdate,
1015
1047
  parseCiServiceControl,
@@ -1034,6 +1066,7 @@ export {
1034
1066
  serializePushResult,
1035
1067
  setHeadSymref,
1036
1068
  sha256Hex,
1069
+ sliceLogTail,
1037
1070
  trustAtLeast,
1038
1071
  updateRef,
1039
1072
  validateSecretUpdate,