@kici-dev/agent 0.1.15 → 0.1.17

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.
Files changed (30) hide show
  1. package/dist/diagnostics/mini-bundle.d.ts +9 -0
  2. package/dist/execution/dep-installer.d.ts +7 -3
  3. package/dist/execution/dep-packer.d.ts +6 -1
  4. package/dist/execution/env-init/presets/directives.d.ts +20 -0
  5. package/dist/execution/env-init/presets/expand.d.ts +16 -0
  6. package/dist/execution/env-init/presets/mise/cache-key.d.ts +7 -0
  7. package/dist/execution/env-init/presets/mise/expander.d.ts +16 -0
  8. package/dist/execution/env-init/presets/mise/templates.d.ts +16 -0
  9. package/dist/execution/env-init/presets/mise/windows-install.d.ts +18 -0
  10. package/dist/execution/env-init/presets/registry.d.ts +31 -0
  11. package/dist/execution/init-runner.d.ts +7 -0
  12. package/dist/execution/job-runner.d.ts +18 -1
  13. package/dist/execution/sandbox/env-delta.d.ts +2 -0
  14. package/dist/execution/sandbox/index.d.ts +1 -1
  15. package/dist/execution/sandbox/ipc-protocol.d.ts +101 -3
  16. package/dist/execution/sandbox/step-loop.d.ts +24 -1
  17. package/dist/execution/sandbox/types.d.ts +18 -1
  18. package/dist/execution/sandbox/workflow-runner.d.ts +12 -7
  19. package/dist/execution/validate-kici-deps.d.ts +5 -0
  20. package/dist/execution/workspace-siblings.d.ts +33 -0
  21. package/dist/index.js +223 -6
  22. package/dist/provenance/attest.d.ts +30 -0
  23. package/dist/provenance/sign.d.ts +21 -0
  24. package/dist/provenance/statement-builder.d.ts +38 -0
  25. package/dist/server.js +698 -146
  26. package/dist/version.d.ts +2 -0
  27. package/dist/workflow-runner.js +877 -45
  28. package/dist/ws/orchestrator-client.d.ts +53 -4
  29. package/package.json +8 -5
  30. package/sbom.spdx.json +1957 -152
@@ -1,7 +1,7 @@
1
- import { type AgentToOrchestratorMessage, type JobDispatch, type JobCancel } from '@kici-dev/engine';
2
- import type { CacheRequestIpc, CacheResponseIpc } from '../execution/sandbox/index.js';
1
+ import { type AgentToOrchestratorMessage, type JobDispatch, type JobCancel, type FleetLogsRequest } from '@kici-dev/engine';
2
+ import type { CacheRequestIpc, CacheResponseIpc, ProvenanceRequestIpc, ProvenanceResponseIpc, StepApprovalRequestIpc, StepApprovalResolvedIpc } from '../execution/sandbox/index.js';
3
3
  export type ConnectionState = 'disconnected' | 'connecting' | 'authenticating' | 'registering' | 'registered';
4
- interface OrchestratorClientOptions {
4
+ export interface OrchestratorClientOptions {
5
5
  /** WebSocket URL of the orchestrator. */
6
6
  url: string;
7
7
  /** Agent's unique identifier. */
@@ -35,6 +35,18 @@ interface OrchestratorClientOptions {
35
35
  * doesn't have to read process.env directly.
36
36
  */
37
37
  scalerManaged?: boolean;
38
+ /**
39
+ * Supplies the inputs for the agent fleet mini-bundle on a fleet.logs.request.
40
+ * Returns the agent's resolved config (redacted inside the bundle assembler),
41
+ * the log directory, and the current Prometheus metrics text. Omitted in
42
+ * tests / contexts that don't participate in fleet collection — the handler
43
+ * then replies with an empty-config bundle.
44
+ */
45
+ getFleetBundleInputs?: () => Promise<{
46
+ config: Record<string, unknown>;
47
+ logDir?: string;
48
+ metricsText?: string;
49
+ }>;
38
50
  }
39
51
  /**
40
52
  * WebSocket client that connects the agent to the customer orchestrator.
@@ -70,6 +82,13 @@ export declare class OrchestratorClient {
70
82
  private readonly pendingApiRequests;
71
83
  /** Pending user-cache restore/save requests awaiting orchestrator response. */
72
84
  private readonly pendingUserCacheRequests;
85
+ /**
86
+ * Pending step-approval requests awaiting the orchestrator's resolution.
87
+ * No client-side timeout: the orchestrator owns the (org-/SDK-configured)
88
+ * expiry and sends `step.approval-resolved: expired` when it lapses. The
89
+ * workflow-runner carries an outer safety-net timeout.
90
+ */
91
+ private readonly pendingStepApprovals;
73
92
  /** Pending concurrency report requests awaiting orchestrator ack. */
74
93
  private readonly pendingConcurrencyRequests;
75
94
  private readonly url;
@@ -83,6 +102,7 @@ export declare class OrchestratorClient {
83
102
  private readonly getInFlightJobs?;
84
103
  private readonly roles;
85
104
  private readonly scalerManaged;
105
+ private readonly getFleetBundleInputs?;
86
106
  /** Timestamp when the connection was lost, used for gap marker outage duration. */
87
107
  private disconnectedAt;
88
108
  /** Set to true when auth.failure is received. Prevents retrying with a bad token. */
@@ -166,6 +186,14 @@ export declare class OrchestratorClient {
166
186
  arch: string;
167
187
  depsHash?: string;
168
188
  }): void;
189
+ /**
190
+ * Request a presigned PUT URL for a provenance bundle. Sends a
191
+ * `provenance.upload.request` and waits for a `provenance.upload.response`
192
+ * (resolved via the shared upload-request pending map). Times out after 30s.
193
+ */
194
+ requestProvenanceUploadUrl(jobId: string, subjectDigest: string): Promise<string>;
195
+ /** Notify the orchestrator a provenance bundle upload completed (records an attestations row). */
196
+ sendProvenanceUploadComplete(jobId: string, subjectName: string, subjectDigest: string, mediaType: string): void;
169
197
  /**
170
198
  * Send an event.emit WS message to the orchestrator and await the response.
171
199
  *
@@ -180,6 +208,12 @@ export declare class OrchestratorClient {
180
208
  deliveryId?: string;
181
209
  error?: string;
182
210
  }>;
211
+ /**
212
+ * Build this agent's fleet mini-bundle and stream it back to the orchestrator
213
+ * as ordered fleet.bundle.chunk frames (the WS frame cap forbids one frame).
214
+ * On failure, sends a single fleet.bundle.error. Public for unit testing.
215
+ */
216
+ streamFleetBundle(req: FleetLogsRequest): Promise<void>;
183
217
  /**
184
218
  * Send a typed API request to the orchestrator and await the response.
185
219
  *
@@ -202,6 +236,22 @@ export declare class OrchestratorClient {
202
236
  * Times out after 30 seconds for the round-trip ops.
203
237
  */
204
238
  requestUserCache(jobId: string, request: CacheRequestIpc): Promise<CacheResponseIpc>;
239
+ /**
240
+ * Relay a provenance bundle upload operation to the orchestrator. Maps the
241
+ * IPC `provenance.request` onto `requestProvenanceUploadUrl` (returns the
242
+ * presigned URL) or `sendProvenanceUploadComplete` (fire-and-forget) and
243
+ * returns the result on the IPC response shape.
244
+ */
245
+ relayProvenance(jobId: string, request: ProvenanceRequestIpc): Promise<ProvenanceResponseIpc>;
246
+ /**
247
+ * Relay a step-level approval request to the orchestrator. Sends a
248
+ * `step.approval-request` WS message and resolves with the orchestrator's
249
+ * `step.approval-resolved` mapped onto the IPC response shape. No client-side
250
+ * timeout — the orchestrator owns the approval expiry and replies with an
251
+ * `expired` outcome when it lapses. Rejects only on disconnect (the relay
252
+ * caller treats a rejection as a fail-closed reject).
253
+ */
254
+ sendStepApproval(runId: string, jobId: string, request: StepApprovalRequestIpc): Promise<StepApprovalResolvedIpc>;
205
255
  /**
206
256
  * Send a job.context message to the orchestrator.
207
257
  *
@@ -283,5 +333,4 @@ export declare class OrchestratorClient {
283
333
  private scheduleReconnect;
284
334
  private cancelReconnect;
285
335
  }
286
- export {};
287
336
  //# sourceMappingURL=orchestrator-client.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kici-dev/agent",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Customer-deployable agent for the KiCI CI/CD stack. Connects to an orchestrator, clones the workflow repo, executes steps, and streams logs back.",
5
5
  "keywords": [
6
6
  "ci",
@@ -54,17 +54,19 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@hono/node-server": "^2.0.0",
57
+ "archiver": "^7.0.1",
57
58
  "dockerode": "^5.0.0",
58
59
  "hono": "^4.12.18",
60
+ "jose": "^6.1.0",
59
61
  "tar": "^7.5.13",
60
62
  "winston": "^3.19.0",
61
63
  "ws": "^8.20.0",
62
64
  "zod": "^4.3.6",
63
65
  "zx": "^8.8.5",
64
- "@kici-dev/core": "0.1.15",
65
- "@kici-dev/sdk": "0.1.15",
66
- "@kici-dev/engine": "0.1.15",
67
- "@kici-dev/shared": "0.1.15"
66
+ "@kici-dev/core": "0.1.17",
67
+ "@kici-dev/sdk": "0.1.17",
68
+ "@kici-dev/shared": "0.1.17",
69
+ "@kici-dev/engine": "0.1.17"
68
70
  },
69
71
  "kici": {
70
72
  "metrics": {
@@ -73,6 +75,7 @@
73
75
  }
74
76
  },
75
77
  "devDependencies": {
78
+ "@types/archiver": "^7.0.0",
76
79
  "@types/dockerode": "^4.0.1"
77
80
  },
78
81
  "scripts": {