@atcx/contract 0.0.0 → 7.4.1

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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -30
  3. package/dist/agent-list.d.ts +215 -0
  4. package/dist/agent-session-id.d.ts +2 -0
  5. package/dist/answer-view.d.ts +10 -0
  6. package/dist/check-daemon.d.ts +15 -0
  7. package/dist/commit-id-pattern.d.ts +1 -0
  8. package/dist/config-file-schema.d.ts +15 -0
  9. package/dist/contract-version.d.ts +1 -0
  10. package/dist/daemon-contract.d.ts +1646 -0
  11. package/dist/daemon-error-map.d.ts +9 -0
  12. package/dist/daemon-event.d.ts +424 -0
  13. package/dist/daemon-features.d.ts +2 -0
  14. package/dist/daemon-id.d.ts +2 -0
  15. package/dist/events-page.d.ts +39 -0
  16. package/dist/fleet-entry-view.d.ts +32 -0
  17. package/dist/fleet-event.d.ts +35 -0
  18. package/dist/git-probe-result.d.ts +18 -0
  19. package/dist/git-ref.d.ts +10 -0
  20. package/dist/hello-result.d.ts +16 -0
  21. package/dist/index.d.ts +45 -0
  22. package/dist/index.js +1121 -0
  23. package/dist/light/error-codes.d.ts +2 -0
  24. package/dist/light/index.d.ts +6 -0
  25. package/dist/light/index.js +131 -0
  26. package/dist/light/message-sender.d.ts +17 -0
  27. package/dist/light/resolve-atc-paths.d.ts +11 -0
  28. package/dist/light/resolve-home-dir.d.ts +1 -0
  29. package/dist/light/resolve-state-dir.d.ts +1 -0
  30. package/dist/light/session-env-names.d.ts +7 -0
  31. package/dist/menu-view.d.ts +12 -0
  32. package/dist/message-answer.d.ts +10 -0
  33. package/dist/message-id.d.ts +2 -0
  34. package/dist/message-status.d.ts +7 -0
  35. package/dist/message-view.d.ts +36 -0
  36. package/dist/note-view.d.ts +10 -0
  37. package/dist/procedure-meta.d.ts +10 -0
  38. package/dist/published-record-schema.d.ts +3 -0
  39. package/dist/published-record.d.ts +39 -0
  40. package/dist/request-param-schemas.d.ts +252 -0
  41. package/dist/restart-result.d.ts +28 -0
  42. package/dist/schema/build-optional-boolean.d.ts +2 -0
  43. package/dist/schema/build-optional-non-empty-string.d.ts +2 -0
  44. package/dist/schema/build-optional-string-array.d.ts +2 -0
  45. package/dist/schema/build-optional-string.d.ts +2 -0
  46. package/dist/schema/index.d.ts +4 -0
  47. package/dist/schema/index.js +26 -0
  48. package/dist/session-descriptor.d.ts +71 -0
  49. package/dist/session-id.d.ts +2 -0
  50. package/dist/session-lifecycle.d.ts +26 -0
  51. package/dist/session-workspace.d.ts +8 -0
  52. package/dist/source-candidate.d.ts +13 -0
  53. package/dist/source-entry.d.ts +10 -0
  54. package/dist/source-interpretation.d.ts +14 -0
  55. package/dist/source-pick.d.ts +9 -0
  56. package/dist/spawn-answer.d.ts +73 -0
  57. package/dist/spawn-option-spec.d.ts +16 -0
  58. package/dist/to-agent-session-id.d.ts +2 -0
  59. package/dist/to-daemon-id.d.ts +2 -0
  60. package/dist/to-message-id.d.ts +2 -0
  61. package/dist/to-session-id.d.ts +2 -0
  62. package/dist/transcript-row.d.ts +14 -0
  63. package/package.json +34 -6
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Geoff Whatley
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,45 +1,60 @@
1
- # @atcx/contract
1
+ <div align="center">
2
+ <h1>@atcx/contract</h1>
2
3
 
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
4
+ <p>
5
+ <a href="https://www.npmjs.com/package/@atcx/contract"><img src="https://img.shields.io/npm/v/@atcx/contract" alt="npm version"></a>
6
+ <a href="https://github.com/zgeoff/atc/blob/%40zgeoff%2Fatc%407.4.1/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT license"></a>
7
+ </p>
4
8
 
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
9
+ <p>
10
+ <a href="https://github.com/zgeoff/atc/blob/%40zgeoff%2Fatc%407.4.1/docs/architecture/protocol/contract.md">The published contract</a> •
11
+ <a href="https://github.com/zgeoff/atc/blob/%40zgeoff%2Fatc%407.4.1/docs/architecture/protocol/protocol.md">The client protocol</a>
12
+ </p>
13
+ </div>
6
14
 
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
15
+ The schemas and constants a program needs to talk to an atc daemon and read what it writes.
8
16
 
9
- ## Purpose
17
+ atc hosts coding-agent sessions in a daemon, and this package holds the daemon's side of the
18
+ conversation: the oRPC request contract, the event and session record schemas, the hello answer, the
19
+ error codes, the session environment names, and the paths of the daemon's sockets and state. The
20
+ daemon and every atc client build on the same package, and each atc release publishes it at its own
21
+ version. To start, resolve the daemon's socket with `resolveAtcPaths`, send `daemon.hello`, and pass
22
+ the answer to `checkDaemon` to learn whether the daemon speaks your version of the contract.
10
23
 
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@atcx/contract`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
24
+ ## Install
15
25
 
16
- ## What is OIDC Trusted Publishing?
26
+ The package ships an ES module with its type declarations, for Node or Bun. It depends on Zod 4 and
27
+ oRPC's contract library.
17
28
 
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
29
+ ```bash
30
+ bun add @atcx/contract
31
+ ```
19
32
 
20
- ## Setup Instructions
33
+ oRPC's declarations import `@opentelemetry/api`, which oRPC lists only as an optional peer. A
34
+ project that type-checks the declarations of its dependencies, with `skipLibCheck` off, installs it
35
+ beside the package:
21
36
 
22
- To properly configure OIDC trusted publishing for this package:
37
+ ```bash
38
+ bun add -d @opentelemetry/api
39
+ ```
23
40
 
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
41
+ ## Features
28
42
 
29
- ## DO NOT USE THIS PACKAGE
43
+ - **The request contract.** `DAEMON_CONTRACT`, the oRPC contract of every daemon procedure, with
44
+ each input and answer schema.
45
+ - **Events and records.** `DAEMON_EVENT_SCHEMA` for the event stream, and `PUBLISHED_RECORD_SCHEMA`
46
+ for the session record a session's helpers read.
47
+ - **Checking a daemon.** `checkDaemon` compares the major version in the hello answer with the
48
+ contract's, and lists the features that differ.
49
+ - **The light entry.** `@atcx/contract/light` holds the session environment names, the state paths
50
+ and the error codes without the request contract, for a process that starts once per event.
30
51
 
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
52
+ ## Configuration
36
53
 
37
- ## More Information
54
+ `CONFIG_FILE_SCHEMA` parses the top-level keys of atc's `config.json`, and the
55
+ [configuration guide](https://github.com/zgeoff/atc/blob/%40zgeoff%2Fatc%407.4.1/docs/guides/configuration.md) describes each key.
38
56
 
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
57
+ ## Documentation
42
58
 
43
- ---
44
-
45
- **Maintained for OIDC setup purposes only**
59
+ [The published contract](https://github.com/zgeoff/atc/blob/%40zgeoff%2Fatc%407.4.1/docs/architecture/protocol/contract.md) covers what the package holds
60
+ and how its version moves with atc's.
@@ -0,0 +1,215 @@
1
+ import { z } from 'zod';
2
+ export declare const AGENT_ENTRY_SCHEMA: z.ZodObject<{
3
+ id: z.ZodString;
4
+ label: z.ZodString;
5
+ kind: z.ZodString;
6
+ installed: z.ZodBoolean;
7
+ brokerAuth: z.ZodBoolean;
8
+ brokerRequired: z.ZodBoolean;
9
+ spawnTargets: z.ZodReadonly<z.ZodArray<z.ZodString>>;
10
+ capabilities: z.ZodObject<{
11
+ spawn: z.ZodBoolean;
12
+ readTranscript: z.ZodBoolean;
13
+ message: z.ZodBoolean;
14
+ attach: z.ZodBoolean;
15
+ screen: z.ZodBoolean;
16
+ input: z.ZodBoolean;
17
+ }, z.core.$strip>;
18
+ models: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
19
+ spawnOptions: z.ZodObject<{
20
+ model: z.ZodObject<{
21
+ supported: z.ZodBoolean;
22
+ values: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
23
+ examples: z.ZodReadonly<z.ZodArray<z.ZodObject<{
24
+ value: z.ZodString;
25
+ resolvesTo: z.ZodNullable<z.ZodString>;
26
+ }, z.core.$strip>>>;
27
+ default: z.ZodNullable<z.ZodString>;
28
+ backendEffect: z.ZodNullable<z.ZodEnum<{
29
+ applied: "applied";
30
+ unverified: "unverified";
31
+ }>>;
32
+ note: z.ZodNullable<z.ZodString>;
33
+ available: z.ZodBoolean;
34
+ }, z.core.$strip>;
35
+ effort: z.ZodObject<{
36
+ supported: z.ZodBoolean;
37
+ values: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
38
+ examples: z.ZodReadonly<z.ZodArray<z.ZodObject<{
39
+ value: z.ZodString;
40
+ resolvesTo: z.ZodNullable<z.ZodString>;
41
+ }, z.core.$strip>>>;
42
+ default: z.ZodNullable<z.ZodString>;
43
+ backendEffect: z.ZodNullable<z.ZodEnum<{
44
+ applied: "applied";
45
+ unverified: "unverified";
46
+ }>>;
47
+ note: z.ZodNullable<z.ZodString>;
48
+ available: z.ZodBoolean;
49
+ }, z.core.$strip>;
50
+ pluginDirs: z.ZodObject<{
51
+ supported: z.ZodBoolean;
52
+ values: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
53
+ examples: z.ZodReadonly<z.ZodArray<z.ZodObject<{
54
+ value: z.ZodString;
55
+ resolvesTo: z.ZodNullable<z.ZodString>;
56
+ }, z.core.$strip>>>;
57
+ default: z.ZodNullable<z.ZodString>;
58
+ backendEffect: z.ZodNullable<z.ZodEnum<{
59
+ applied: "applied";
60
+ unverified: "unverified";
61
+ }>>;
62
+ note: z.ZodNullable<z.ZodString>;
63
+ available: z.ZodBoolean;
64
+ }, z.core.$strip>;
65
+ }, z.core.$strip>;
66
+ }, z.core.$strip>;
67
+ export type AgentEntry = z.output<typeof AGENT_ENTRY_SCHEMA>;
68
+ declare const TARGET_ENTRY_SCHEMA: z.ZodObject<{
69
+ id: z.ZodString;
70
+ provider: z.ZodString;
71
+ identity: z.ZodString;
72
+ available: z.ZodBoolean;
73
+ remote: z.ZodBoolean;
74
+ default: z.ZodBoolean;
75
+ capabilities: z.ZodObject<{
76
+ spawn: z.ZodBoolean;
77
+ attach: z.ZodBoolean;
78
+ input: z.ZodBoolean;
79
+ resize: z.ZodBoolean;
80
+ kill: z.ZodBoolean;
81
+ transfer: z.ZodBoolean;
82
+ run: z.ZodBoolean;
83
+ headless: z.ZodBoolean;
84
+ suspend: z.ZodBoolean;
85
+ destroy: z.ZodBoolean;
86
+ }, z.core.$strip>;
87
+ brokerAuth: z.ZodBoolean;
88
+ }, z.core.$strip>;
89
+ export type TargetEntry = z.output<typeof TARGET_ENTRY_SCHEMA>;
90
+ export declare const AGENT_LIST_SCHEMA: z.ZodObject<{
91
+ daemon: z.ZodObject<{
92
+ hostname: z.ZodString;
93
+ platform: z.ZodString;
94
+ arch: z.ZodString;
95
+ build: z.ZodString;
96
+ }, z.core.$strip>;
97
+ agents: z.ZodReadonly<z.ZodArray<z.ZodObject<{
98
+ id: z.ZodString;
99
+ label: z.ZodString;
100
+ kind: z.ZodString;
101
+ installed: z.ZodBoolean;
102
+ brokerAuth: z.ZodBoolean;
103
+ brokerRequired: z.ZodBoolean;
104
+ spawnTargets: z.ZodReadonly<z.ZodArray<z.ZodString>>;
105
+ capabilities: z.ZodObject<{
106
+ spawn: z.ZodBoolean;
107
+ readTranscript: z.ZodBoolean;
108
+ message: z.ZodBoolean;
109
+ attach: z.ZodBoolean;
110
+ screen: z.ZodBoolean;
111
+ input: z.ZodBoolean;
112
+ }, z.core.$strip>;
113
+ models: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
114
+ spawnOptions: z.ZodObject<{
115
+ model: z.ZodObject<{
116
+ supported: z.ZodBoolean;
117
+ values: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
118
+ examples: z.ZodReadonly<z.ZodArray<z.ZodObject<{
119
+ value: z.ZodString;
120
+ resolvesTo: z.ZodNullable<z.ZodString>;
121
+ }, z.core.$strip>>>;
122
+ default: z.ZodNullable<z.ZodString>;
123
+ backendEffect: z.ZodNullable<z.ZodEnum<{
124
+ applied: "applied";
125
+ unverified: "unverified";
126
+ }>>;
127
+ note: z.ZodNullable<z.ZodString>;
128
+ available: z.ZodBoolean;
129
+ }, z.core.$strip>;
130
+ effort: z.ZodObject<{
131
+ supported: z.ZodBoolean;
132
+ values: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
133
+ examples: z.ZodReadonly<z.ZodArray<z.ZodObject<{
134
+ value: z.ZodString;
135
+ resolvesTo: z.ZodNullable<z.ZodString>;
136
+ }, z.core.$strip>>>;
137
+ default: z.ZodNullable<z.ZodString>;
138
+ backendEffect: z.ZodNullable<z.ZodEnum<{
139
+ applied: "applied";
140
+ unverified: "unverified";
141
+ }>>;
142
+ note: z.ZodNullable<z.ZodString>;
143
+ available: z.ZodBoolean;
144
+ }, z.core.$strip>;
145
+ pluginDirs: z.ZodObject<{
146
+ supported: z.ZodBoolean;
147
+ values: z.ZodNullable<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
148
+ examples: z.ZodReadonly<z.ZodArray<z.ZodObject<{
149
+ value: z.ZodString;
150
+ resolvesTo: z.ZodNullable<z.ZodString>;
151
+ }, z.core.$strip>>>;
152
+ default: z.ZodNullable<z.ZodString>;
153
+ backendEffect: z.ZodNullable<z.ZodEnum<{
154
+ applied: "applied";
155
+ unverified: "unverified";
156
+ }>>;
157
+ note: z.ZodNullable<z.ZodString>;
158
+ available: z.ZodBoolean;
159
+ }, z.core.$strip>;
160
+ }, z.core.$strip>;
161
+ }, z.core.$strip>>>;
162
+ targets: z.ZodReadonly<z.ZodArray<z.ZodObject<{
163
+ id: z.ZodString;
164
+ provider: z.ZodString;
165
+ identity: z.ZodString;
166
+ available: z.ZodBoolean;
167
+ remote: z.ZodBoolean;
168
+ default: z.ZodBoolean;
169
+ capabilities: z.ZodObject<{
170
+ spawn: z.ZodBoolean;
171
+ attach: z.ZodBoolean;
172
+ input: z.ZodBoolean;
173
+ resize: z.ZodBoolean;
174
+ kill: z.ZodBoolean;
175
+ transfer: z.ZodBoolean;
176
+ run: z.ZodBoolean;
177
+ headless: z.ZodBoolean;
178
+ suspend: z.ZodBoolean;
179
+ destroy: z.ZodBoolean;
180
+ }, z.core.$strip>;
181
+ brokerAuth: z.ZodBoolean;
182
+ }, z.core.$strip>>>;
183
+ spawnDefaults: z.ZodObject<{
184
+ agent: z.ZodString;
185
+ target: z.ZodNullable<z.ZodString>;
186
+ }, z.core.$strip>;
187
+ configRevision: z.ZodString;
188
+ targetErrors: z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
189
+ scope: z.ZodEnum<{
190
+ defaultTarget: "defaultTarget";
191
+ target: "target";
192
+ targets: "targets";
193
+ }>;
194
+ target: z.ZodOptional<z.ZodString>;
195
+ problem: z.ZodString;
196
+ }, z.core.$strip>, z.ZodObject<{
197
+ scope: z.ZodLiteral<"config">;
198
+ problem: z.ZodEnum<{
199
+ config_malformed: "config_malformed";
200
+ config_unreadable: "config_unreadable";
201
+ }>;
202
+ path: z.ZodString;
203
+ detail: z.ZodString;
204
+ }, z.core.$strip>]>>>;
205
+ sources: z.ZodReadonly<z.ZodArray<z.ZodObject<{
206
+ id: z.ZodString;
207
+ label: z.ZodString;
208
+ kind: z.ZodEnum<{
209
+ git: "git";
210
+ path: "path";
211
+ }>;
212
+ }, z.core.$strip>>>;
213
+ }, z.core.$strip>;
214
+ export type AgentList = z.output<typeof AGENT_LIST_SCHEMA>;
215
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { z } from 'zod';
2
+ export type AgentSessionID = string & z.$brand<'AgentSessionID'>;
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ export declare const ANSWER_VIEW_SCHEMA: z.ZodObject<{
3
+ answer: z.ZodString;
4
+ at: z.ZodNumber;
5
+ session: z.ZodString;
6
+ name: z.ZodNullable<z.ZodString>;
7
+ message: z.ZodString;
8
+ text: z.ZodString;
9
+ complete: z.ZodBoolean;
10
+ }, z.core.$strip>;
@@ -0,0 +1,15 @@
1
+ import type { DaemonFeature } from './daemon-features.js';
2
+ import type { HelloResult } from './hello-result.js';
3
+ export type DaemonCheck = {
4
+ readonly verdict: 'match';
5
+ readonly missing: readonly DaemonFeature[];
6
+ readonly added: readonly string[];
7
+ } | {
8
+ readonly verdict: 'older' | 'newer';
9
+ readonly daemonMajor: number;
10
+ readonly contractMajor: number;
11
+ } | {
12
+ readonly verdict: 'unreadable';
13
+ readonly daemon: string;
14
+ };
15
+ export declare function checkDaemon(hello: Pick<HelloResult, 'daemon' | 'features'>, contractVersion?: string): DaemonCheck;
@@ -0,0 +1 @@
1
+ export declare const COMMIT_ID_PATTERN: RegExp;
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ export declare const CONFIG_FILE_SCHEMA: z.ZodObject<{
3
+ agents: z.ZodOptional<z.ZodUnknown>;
4
+ dirs: z.ZodOptional<z.ZodUnknown>;
5
+ workspaces: z.ZodOptional<z.ZodUnknown>;
6
+ authProfiles: z.ZodOptional<z.ZodUnknown>;
7
+ hooks: z.ZodOptional<z.ZodUnknown>;
8
+ leader: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
9
+ targets: z.ZodOptional<z.ZodUnknown>;
10
+ defaultTarget: z.ZodOptional<z.ZodUnknown>;
11
+ principals: z.ZodOptional<z.ZodUnknown>;
12
+ daemons: z.ZodOptional<z.ZodUnknown>;
13
+ restoreFleetOnRestart: z.ZodPreprocess<z.ZodOptional<z.ZodBoolean>, unknown>;
14
+ }, z.core.$strip>;
15
+ export type ConfigFile = z.output<typeof CONFIG_FILE_SCHEMA>;
@@ -0,0 +1 @@
1
+ export declare const CONTRACT_VERSION: string;