@stitchmux/client 0.0.0-stage → 0.96.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 (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -2
  3. package/dist/chunk-wddwdvbj.js +714 -0
  4. package/dist/index.js +4070 -0
  5. package/dist/monitoring.js +279 -0
  6. package/native-stream.json +8 -0
  7. package/package.json +36 -4
  8. package/types/src/agent/claude/native/commandSchema.d.ts +14 -0
  9. package/types/src/agent/custom/config.d.ts +159 -0
  10. package/types/src/agent/custom/endpoint.d.ts +26 -0
  11. package/types/src/agent/transcript/messageSchema.d.ts +153 -0
  12. package/types/src/attachments/reference.d.ts +56 -0
  13. package/types/src/attachments/schema.d.ts +512 -0
  14. package/types/src/chat/communicationAuthorizationSchema.d.ts +77 -0
  15. package/types/src/chat/communicationReceiptSchema.d.ts +82 -0
  16. package/types/src/chat/feedSchema.d.ts +641 -0
  17. package/types/src/chat/holdKind.d.ts +26 -0
  18. package/types/src/chat/identity.d.ts +55 -0
  19. package/types/src/chat/identitySchema.d.ts +121 -0
  20. package/types/src/chat/letterRequestSchema.d.ts +35 -0
  21. package/types/src/chat/messageOperationSchema.d.ts +277 -0
  22. package/types/src/chat/messageSchema.d.ts +284 -0
  23. package/types/src/chat/originSchema.d.ts +67 -0
  24. package/types/src/chat/sentLetterSchema.d.ts +79 -0
  25. package/types/src/client.d.ts +16 -0
  26. package/types/src/config/claudeProfileSchema.d.ts +22 -0
  27. package/types/src/config/launchSchema.d.ts +136 -0
  28. package/types/src/config/location.d.ts +6 -0
  29. package/types/src/config/machineSchema.d.ts +320 -0
  30. package/types/src/config/modelSelectionFlags.d.ts +4 -0
  31. package/types/src/config/paths.d.ts +87 -0
  32. package/types/src/config/remoteTransport.d.ts +12 -0
  33. package/types/src/content/schema.d.ts +312 -0
  34. package/types/src/content/toolSchema.d.ts +36 -0
  35. package/types/src/context/corpusSearchSchema.d.ts +578 -0
  36. package/types/src/context/exactMessageSchema.d.ts +54 -0
  37. package/types/src/context/messageSenderSchema.d.ts +14 -0
  38. package/types/src/context/schema.d.ts +176 -0
  39. package/types/src/context/searchFrames.d.ts +225 -0
  40. package/types/src/context/searchRequestSchema.d.ts +47 -0
  41. package/types/src/context/transcriptJsonSchema.d.ts +210 -0
  42. package/types/src/control/schema/context.d.ts +188 -0
  43. package/types/src/control/schema/contract.d.ts +7142 -0
  44. package/types/src/control/schema/core.d.ts +722 -0
  45. package/types/src/control/schema/directory.d.ts +34 -0
  46. package/types/src/control/schema/eventsContract.d.ts +1423 -0
  47. package/types/src/control/schema/externalList.d.ts +96 -0
  48. package/types/src/control/schema/message.d.ts +280 -0
  49. package/types/src/control/schema/model.d.ts +128 -0
  50. package/types/src/control/schema/native.d.ts +664 -0
  51. package/types/src/control/schema/nativeStreamContract.d.ts +155 -0
  52. package/types/src/control/schema/performance.d.ts +85 -0
  53. package/types/src/control/schema/public.d.ts +48 -0
  54. package/types/src/control/schema/reading.d.ts +24 -0
  55. package/types/src/control/schema/refusals.d.ts +433 -0
  56. package/types/src/control/schema/runtimeOps.d.ts +724 -0
  57. package/types/src/control/schema/searchContract.d.ts +258 -0
  58. package/types/src/control/schema/selection.d.ts +124 -0
  59. package/types/src/control/schema/session.d.ts +272 -0
  60. package/types/src/control/schema/terminalPrompt.d.ts +102 -0
  61. package/types/src/control/transport/boundary.d.ts +7137 -0
  62. package/types/src/control/transport/client.d.ts +10838 -0
  63. package/types/src/control/transport/connection.d.ts +13 -0
  64. package/types/src/control/transport/socketPath.d.ts +3 -0
  65. package/types/src/control-client.d.ts +9 -0
  66. package/types/src/delegation/applicationSchema.d.ts +132 -0
  67. package/types/src/delegation/schema.d.ts +267 -0
  68. package/types/src/events/schema.d.ts +155 -0
  69. package/types/src/external/contentSchema.d.ts +145 -0
  70. package/types/src/external/messageSchema.d.ts +131 -0
  71. package/types/src/external/residentFrames.d.ts +130 -0
  72. package/types/src/external/residentSchema.d.ts +144 -0
  73. package/types/src/external/sessionSchema.d.ts +427 -0
  74. package/types/src/external/turnSchema.d.ts +55 -0
  75. package/types/src/fleet/fleetSchema.d.ts +937 -0
  76. package/types/src/inventory/listSchema.d.ts +442 -0
  77. package/types/src/monitoring/nativeFile.d.ts +7 -0
  78. package/types/src/monitoring/nativeRead.d.ts +14 -0
  79. package/types/src/monitoring/performanceSchema.d.ts +28 -0
  80. package/types/src/monitoring/schema.d.ts +410 -0
  81. package/types/src/monitoring/validate.d.ts +5 -0
  82. package/types/src/monitoring-reader.d.ts +4 -0
  83. package/types/src/policy/reference.d.ts +93 -0
  84. package/types/src/policy/runtimeProfile.d.ts +24 -0
  85. package/types/src/policy/schema.d.ts +177 -0
  86. package/types/src/runtime/capabilities.d.ts +124 -0
  87. package/types/src/runtime/modes.d.ts +47 -0
  88. package/types/src/runtime/permissionScope.d.ts +22 -0
  89. package/types/src/runtime/planLimitsSchema.d.ts +55 -0
  90. package/types/src/runtime/projectionSchema.d.ts +539 -0
  91. package/types/src/runtime/rewindSchema.d.ts +16 -0
  92. package/types/src/runtime/selectionSchema.d.ts +158 -0
  93. package/types/src/runtime/workloadContract.d.ts +55 -0
  94. package/types/src/session/boundary.d.ts +43 -0
  95. package/types/src/session/identitySchema.d.ts +353 -0
  96. package/types/src/session/schema.d.ts +341 -0
  97. package/types/src/session/sleep/schema.d.ts +283 -0
  98. package/types/src/steering/schema.d.ts +197 -0
  99. package/types/src/types.d.ts +48 -0
  100. package/types/src/usage/schema.d.ts +978 -0
  101. package/types/src/util/home.d.ts +9 -0
  102. package/types/src/util/preview.d.ts +13 -0
  103. package/types/src/util/version.d.ts +3 -0
@@ -0,0 +1,145 @@
1
+ import { z } from 'zod';
2
+ export declare const EXTERNAL_CONTENT_LIMITS: {
3
+ sourceBytes: number;
4
+ chunkBytes: number;
5
+ recordBytes: number;
6
+ snapshotBytes: number;
7
+ cacheBytes: number;
8
+ snapshots: number;
9
+ concurrentBuilds: number;
10
+ snapshotTtlMs: number;
11
+ metadataBytes: number;
12
+ textCharacters: number;
13
+ entries: number;
14
+ lookupEntries: number;
15
+ lookupDepth: number;
16
+ responseBytes: number;
17
+ };
18
+ export declare const ExternalContentTargetSchema: z.ZodObject<{
19
+ provider: z.ZodEnum<{
20
+ claude: "claude";
21
+ codex: "codex";
22
+ }>;
23
+ machine: z.ZodString;
24
+ threadId: z.ZodUUID;
25
+ }, z.core.$strict>;
26
+ export declare const ExternalContentReadSchema: z.ZodObject<{
27
+ target: z.ZodObject<{
28
+ provider: z.ZodEnum<{
29
+ claude: "claude";
30
+ codex: "codex";
31
+ }>;
32
+ machine: z.ZodString;
33
+ threadId: z.ZodUUID;
34
+ }, z.core.$strict>;
35
+ cursor: z.ZodDefault<z.ZodNullable<z.ZodString>>;
36
+ limit: z.ZodDefault<z.ZodNumber>;
37
+ }, z.core.$strict>;
38
+ export declare const ExternalContentSelectorSchema: z.ZodObject<{
39
+ target: z.ZodObject<{
40
+ provider: z.ZodEnum<{
41
+ claude: "claude";
42
+ codex: "codex";
43
+ }>;
44
+ machine: z.ZodString;
45
+ threadId: z.ZodUUID;
46
+ }, z.core.$strict>;
47
+ }, z.core.$strict>;
48
+ export declare const ExternalContentStateSchema: z.ZodEnum<{
49
+ available: "available";
50
+ "history-absent": "history-absent";
51
+ stale: "stale";
52
+ unavailable: "unavailable";
53
+ }>;
54
+ export declare const ExternalContentEntrySchema: z.ZodObject<{
55
+ id: z.ZodString;
56
+ role: z.ZodEnum<{
57
+ assistant: "assistant";
58
+ user: "user";
59
+ }>;
60
+ text: z.ZodString;
61
+ truncated: z.ZodBoolean;
62
+ }, z.core.$strict>;
63
+ export declare const ExternalContentResultSchema: z.ZodObject<{
64
+ target: z.ZodObject<{
65
+ provider: z.ZodEnum<{
66
+ claude: "claude";
67
+ codex: "codex";
68
+ }>;
69
+ machine: z.ZodString;
70
+ threadId: z.ZodUUID;
71
+ }, z.core.$strict>;
72
+ outcome: z.ZodEnum<{
73
+ available: "available";
74
+ "history-absent": "history-absent";
75
+ stale: "stale";
76
+ unavailable: "unavailable";
77
+ }>;
78
+ revision: z.ZodNullable<z.ZodString>;
79
+ observedAt: z.ZodISODateTime;
80
+ entries: z.ZodArray<z.ZodObject<{
81
+ id: z.ZodString;
82
+ role: z.ZodEnum<{
83
+ assistant: "assistant";
84
+ user: "user";
85
+ }>;
86
+ text: z.ZodString;
87
+ truncated: z.ZodBoolean;
88
+ }, z.core.$strict>>;
89
+ nextCursor: z.ZodNullable<z.ZodString>;
90
+ truncated: z.ZodBoolean;
91
+ omittedRecords: z.ZodNumber;
92
+ earlierFiles: z.ZodNumber;
93
+ sourceWindow: z.ZodNullable<z.ZodObject<{
94
+ startByte: z.ZodInt;
95
+ endByte: z.ZodInt;
96
+ }, z.core.$strict>>;
97
+ }, z.core.$strict>;
98
+ export declare const ExternalContentCapabilitiesSchema: z.ZodObject<{
99
+ target: z.ZodObject<{
100
+ provider: z.ZodEnum<{
101
+ claude: "claude";
102
+ codex: "codex";
103
+ }>;
104
+ machine: z.ZodString;
105
+ threadId: z.ZodUUID;
106
+ }, z.core.$strict>;
107
+ history: z.ZodObject<{
108
+ outcome: z.ZodEnum<{
109
+ available: "available";
110
+ "history-absent": "history-absent";
111
+ stale: "stale";
112
+ unavailable: "unavailable";
113
+ }>;
114
+ source: z.ZodLiteral<"provider-storage">;
115
+ projection: z.ZodLiteral<"authored-text">;
116
+ pageEntries: z.ZodLiteral<number>;
117
+ sourceBytes: z.ZodLiteral<number>;
118
+ }, z.core.$strict>;
119
+ control: z.ZodObject<{
120
+ message: z.ZodObject<{
121
+ supported: z.ZodLiteral<false>;
122
+ reason: z.ZodLiteral<"not-exposed">;
123
+ }, z.core.$strict>;
124
+ interrupt: z.ZodObject<{
125
+ supported: z.ZodLiteral<false>;
126
+ reason: z.ZodLiteral<"not-exposed">;
127
+ }, z.core.$strict>;
128
+ respond: z.ZodObject<{
129
+ supported: z.ZodLiteral<false>;
130
+ reason: z.ZodLiteral<"not-exposed">;
131
+ }, z.core.$strict>;
132
+ fork: z.ZodObject<{
133
+ supported: z.ZodLiteral<false>;
134
+ reason: z.ZodLiteral<"not-exposed">;
135
+ }, z.core.$strict>;
136
+ compact: z.ZodObject<{
137
+ supported: z.ZodLiteral<false>;
138
+ reason: z.ZodLiteral<"not-exposed">;
139
+ }, z.core.$strict>;
140
+ }, z.core.$strict>;
141
+ }, z.core.$strict>;
142
+ export type ExternalContentTarget = z.output<typeof ExternalContentTargetSchema>;
143
+ export type ExternalContentRead = z.input<typeof ExternalContentReadSchema>;
144
+ export type ExternalContentResult = z.output<typeof ExternalContentResultSchema>;
145
+ export type ExternalContentEntry = z.output<typeof ExternalContentEntrySchema>;
@@ -0,0 +1,131 @@
1
+ import { z } from 'zod';
2
+ export declare const EXTERNAL_MESSAGE_LIMITS: {
3
+ /** One file is streamed in constant memory, so the bound is time: about 1.3 GB/s measured on a
4
+ * 213 MB history, inside the six-second read deadline. A long Desktop thread's live file passes
5
+ * 1 GB before it is split. */
6
+ sourceBytes: number;
7
+ /** One native record holding the message, images included, is parsed whole up to this size. */
8
+ recordBytes: number;
9
+ /** The message text is returned whole or not at all; past this it is `too-large`. */
10
+ textBytes: number;
11
+ /** Turns whose trigger is remembered while the source is scanned. */
12
+ turns: number;
13
+ };
14
+ export declare const ExternalMessageReadSchema: z.ZodObject<{
15
+ target: z.ZodObject<{
16
+ provider: z.ZodEnum<{
17
+ claude: "claude";
18
+ codex: "codex";
19
+ }>;
20
+ machine: z.ZodString;
21
+ threadId: z.ZodUUID;
22
+ }, z.core.$strict>;
23
+ messageId: z.ZodUUID;
24
+ }, z.core.$strict>;
25
+ /**
26
+ * What the thread's own native history says about who submitted an input.
27
+ * `person`: the turn it opened was started by a person in the provider's own client (its composer, a
28
+ * phone, an edit of an earlier message) — the person sent it, which says nothing about who wrote the
29
+ * text: pasted material is still sent by the person. `not-person`: an agent, an automation or the
30
+ * client itself started that turn. `unverifiable`: the history does not say — a message added to a
31
+ * turn already running, a turn with no recorded trigger, or a trigger that does not identify a sender.
32
+ */
33
+ export declare const ExternalMessageAuthorshipSchema: z.ZodObject<{
34
+ verdict: z.ZodEnum<{
35
+ "not-person": "not-person";
36
+ person: "person";
37
+ unverifiable: "unverifiable";
38
+ }>;
39
+ trigger: z.ZodNullable<z.ZodString>;
40
+ position: z.ZodEnum<{
41
+ "mid-turn": "mid-turn";
42
+ "turn-opening": "turn-opening";
43
+ }>;
44
+ reason: z.ZodString;
45
+ }, z.core.$strict>;
46
+ export declare const ExternalMessageSchema: z.ZodObject<{
47
+ id: z.ZodUUID;
48
+ clientId: z.ZodNullable<z.ZodString>;
49
+ turnId: z.ZodString;
50
+ recordedAt: z.ZodNullable<z.ZodISODateTime>;
51
+ text: z.ZodString;
52
+ images: z.ZodNumber;
53
+ authorship: z.ZodObject<{
54
+ verdict: z.ZodEnum<{
55
+ "not-person": "not-person";
56
+ person: "person";
57
+ unverifiable: "unverifiable";
58
+ }>;
59
+ trigger: z.ZodNullable<z.ZodString>;
60
+ position: z.ZodEnum<{
61
+ "mid-turn": "mid-turn";
62
+ "turn-opening": "turn-opening";
63
+ }>;
64
+ reason: z.ZodString;
65
+ }, z.core.$strict>;
66
+ }, z.core.$strict>;
67
+ /**
68
+ * `resolved`: the exact native message, whole. `not-found`: this thread's history has no item with
69
+ * that id. `not-user-input`: the id names an item that is not user input (an assistant message, a
70
+ * tool call). `ambiguous`: two different records carry the id. `too-large`: the record or its text
71
+ * exceeds the bounds and is not returned cut. `unsupported`: the provider or this history's format
72
+ * records no native message identities. `history-absent`: no history for the thread on this host.
73
+ * `unavailable`: the history could not be read.
74
+ */
75
+ export declare const ExternalMessageOutcomeSchema: z.ZodEnum<{
76
+ ambiguous: "ambiguous";
77
+ "history-absent": "history-absent";
78
+ "not-found": "not-found";
79
+ "not-user-input": "not-user-input";
80
+ resolved: "resolved";
81
+ "too-large": "too-large";
82
+ unavailable: "unavailable";
83
+ unsupported: "unsupported";
84
+ }>;
85
+ export declare const ExternalMessageResultSchema: z.ZodObject<{
86
+ target: z.ZodObject<{
87
+ provider: z.ZodEnum<{
88
+ claude: "claude";
89
+ codex: "codex";
90
+ }>;
91
+ machine: z.ZodString;
92
+ threadId: z.ZodUUID;
93
+ }, z.core.$strict>;
94
+ messageId: z.ZodUUID;
95
+ outcome: z.ZodEnum<{
96
+ ambiguous: "ambiguous";
97
+ "history-absent": "history-absent";
98
+ "not-found": "not-found";
99
+ "not-user-input": "not-user-input";
100
+ resolved: "resolved";
101
+ "too-large": "too-large";
102
+ unavailable: "unavailable";
103
+ unsupported: "unsupported";
104
+ }>;
105
+ revision: z.ZodNullable<z.ZodString>;
106
+ observedAt: z.ZodISODateTime;
107
+ message: z.ZodNullable<z.ZodObject<{
108
+ id: z.ZodUUID;
109
+ clientId: z.ZodNullable<z.ZodString>;
110
+ turnId: z.ZodString;
111
+ recordedAt: z.ZodNullable<z.ZodISODateTime>;
112
+ text: z.ZodString;
113
+ images: z.ZodNumber;
114
+ authorship: z.ZodObject<{
115
+ verdict: z.ZodEnum<{
116
+ "not-person": "not-person";
117
+ person: "person";
118
+ unverifiable: "unverifiable";
119
+ }>;
120
+ trigger: z.ZodNullable<z.ZodString>;
121
+ position: z.ZodEnum<{
122
+ "mid-turn": "mid-turn";
123
+ "turn-opening": "turn-opening";
124
+ }>;
125
+ reason: z.ZodString;
126
+ }, z.core.$strict>;
127
+ }, z.core.$strict>>;
128
+ }, z.core.$strict>;
129
+ export type ExternalMessageRead = z.input<typeof ExternalMessageReadSchema>;
130
+ export type ExternalMessageResult = z.output<typeof ExternalMessageResultSchema>;
131
+ export type ExternalMessageAuthorship = z.output<typeof ExternalMessageAuthorshipSchema>;
@@ -0,0 +1,130 @@
1
+ import { z } from 'zod';
2
+ import { type ExternalStatusSnapshot } from "./residentSchema.js";
3
+ /**
4
+ * The external status stream, carried by change.
5
+ *
6
+ * The observer republishes every two seconds, and between two passes of a quiet machine nothing
7
+ * moves but the clock: the snapshot's `observedAt`/`expiresAt` and each row's turn-state times,
8
+ * which are that same pass's times. Sending the whole snapshot to say "still true, for five more
9
+ * seconds" made this stream the largest flow from a quiet node. So a reader gets the whole snapshot
10
+ * when it opens the stream and whenever its content changes, and in between a renewal: the new
11
+ * sequence and times, applied to the snapshot it already holds.
12
+ *
13
+ * A renewal is emitted only when applying it reproduces the new snapshot exactly — the encoder
14
+ * checks that with the reader's own function — so the rebuilt snapshot is the published one, not an
15
+ * approximation of it. It names the sequence it follows: a reader holding anything else (it missed
16
+ * a line, or reopened) cannot apply it and must reopen, and a reopened stream starts with a snapshot.
17
+ */
18
+ export declare const ExternalStatusRenewalSchema: z.ZodObject<{
19
+ frame: z.ZodLiteral<"renewal">;
20
+ generation: z.ZodUUID;
21
+ after: z.ZodNumber;
22
+ sequence: z.ZodNumber;
23
+ observedAt: z.ZodNullable<z.ZodISODateTime>;
24
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
25
+ }, z.core.$strict>;
26
+ export type ExternalStatusRenewal = z.infer<typeof ExternalStatusRenewalSchema>;
27
+ export declare const ExternalStatusFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
28
+ frame: z.ZodLiteral<"snapshot">;
29
+ snapshot: z.ZodObject<{
30
+ protocol: z.ZodLiteral<1>;
31
+ version: z.ZodString;
32
+ machine: z.ZodString;
33
+ generation: z.ZodUUID;
34
+ sequence: z.ZodNumber;
35
+ source: z.ZodLiteral<"codex-app-server">;
36
+ status: z.ZodEnum<{
37
+ live: "live";
38
+ stale: "stale";
39
+ unavailable: "unavailable";
40
+ }>;
41
+ reason: z.ZodNullable<z.ZodEnum<{
42
+ "clock-skew": "clock-skew";
43
+ "config-changed": "config-changed";
44
+ "connection-lost": "connection-lost";
45
+ "connection-unavailable": "connection-unavailable";
46
+ "daemon-stopped": "daemon-stopped";
47
+ deadline: "deadline";
48
+ "endpoint-absent": "endpoint-absent";
49
+ "endpoint-not-listening": "endpoint-not-listening";
50
+ "invalid-response": "invalid-response";
51
+ "observation-expired": "observation-expired";
52
+ "observation-pending": "observation-pending";
53
+ "unsupported-runtime": "unsupported-runtime";
54
+ "upgrade-refused": "upgrade-refused";
55
+ }>>;
56
+ observedAt: z.ZodNullable<z.ZodISODateTime>;
57
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
58
+ truncated: z.ZodBoolean;
59
+ omitted: z.ZodNumber;
60
+ sessions: z.ZodArray<z.ZodObject<{
61
+ identity: z.ZodObject<{
62
+ provider: z.ZodLiteral<"codex">;
63
+ machine: z.ZodString;
64
+ threadId: z.ZodUUID;
65
+ }, z.core.$strict>;
66
+ name: z.ZodNullable<z.ZodString>;
67
+ dir: z.ZodNullable<z.ZodString>;
68
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
69
+ turnState: z.ZodObject<{
70
+ state: z.ZodEnum<{
71
+ idle: "idle";
72
+ unknown: "unknown";
73
+ "waiting-approval": "waiting-approval";
74
+ "waiting-input": "waiting-input";
75
+ working: "working";
76
+ }>;
77
+ evidence: z.ZodEnum<{
78
+ observed: "observed";
79
+ stale: "stale";
80
+ unavailable: "unavailable";
81
+ unknown: "unknown";
82
+ }>;
83
+ source: z.ZodEnum<{
84
+ "codex-app-server": "codex-app-server";
85
+ unsupported: "unsupported";
86
+ }>;
87
+ turnId: z.ZodNullable<z.ZodString>;
88
+ startedAt: z.ZodNullable<z.ZodISODateTime>;
89
+ observedAt: z.ZodNullable<z.ZodISODateTime>;
90
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
91
+ reason: z.ZodEnum<{
92
+ "connection-lost": "connection-lost";
93
+ "connection-unavailable": "connection-unavailable";
94
+ deadline: "deadline";
95
+ "endpoint-absent": "endpoint-absent";
96
+ "endpoint-not-listening": "endpoint-not-listening";
97
+ "native-status": "native-status";
98
+ "not-loaded": "not-loaded";
99
+ "not-observed": "not-observed";
100
+ "not-reported": "not-reported";
101
+ "read-limit": "read-limit";
102
+ "system-error": "system-error";
103
+ "unsupported-provider": "unsupported-provider";
104
+ "unsupported-runtime": "unsupported-runtime";
105
+ "unsupported-status": "unsupported-status";
106
+ "upgrade-refused": "upgrade-refused";
107
+ }>;
108
+ remedy: z.ZodNullable<z.ZodString>;
109
+ }, z.core.$strict>;
110
+ }, z.core.$strict>>;
111
+ }, z.core.$strict>;
112
+ }, z.core.$strict>, z.ZodObject<{
113
+ frame: z.ZodLiteral<"renewal">;
114
+ generation: z.ZodUUID;
115
+ after: z.ZodNumber;
116
+ sequence: z.ZodNumber;
117
+ observedAt: z.ZodNullable<z.ZodISODateTime>;
118
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
119
+ }, z.core.$strict>], "frame">;
120
+ export type ExternalStatusFrame = z.infer<typeof ExternalStatusFrameSchema>;
121
+ /**
122
+ * The snapshot a frame leaves the reader holding; null when a renewal does not follow what it holds
123
+ * — the reader then reopens the stream rather than extend a snapshot it does not have.
124
+ *
125
+ * A renewal moves the snapshot's times, and each row's turn-state times that were the snapshot's
126
+ * own; a row observed at another moment keeps its times.
127
+ */
128
+ export declare function applyExternalStatusFrame(held: ExternalStatusSnapshot | null, frame: ExternalStatusFrame): ExternalStatusSnapshot | null;
129
+ /** One stream's encoder: the first snapshot whole, then a renewal wherever one reproduces it. */
130
+ export declare function createExternalStatusEncoder(): (snapshot: ExternalStatusSnapshot) => ExternalStatusFrame;
@@ -0,0 +1,144 @@
1
+ import { z } from 'zod';
2
+ export declare const EXTERNAL_MAX_ROWS = 512;
3
+ export declare const EXTERNAL_MAX_BYTES: number;
4
+ export declare const EXTERNAL_MAX_READERS = 32;
5
+ export declare const EXTERNAL_INTERVAL_MS = 2000;
6
+ export declare const EXTERNAL_TTL_MS = 5000;
7
+ export declare const ExternalStatusRowSchema: z.ZodObject<{
8
+ identity: z.ZodObject<{
9
+ provider: z.ZodLiteral<"codex">;
10
+ machine: z.ZodString;
11
+ threadId: z.ZodUUID;
12
+ }, z.core.$strict>;
13
+ name: z.ZodNullable<z.ZodString>;
14
+ dir: z.ZodNullable<z.ZodString>;
15
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
16
+ turnState: z.ZodObject<{
17
+ state: z.ZodEnum<{
18
+ idle: "idle";
19
+ unknown: "unknown";
20
+ "waiting-approval": "waiting-approval";
21
+ "waiting-input": "waiting-input";
22
+ working: "working";
23
+ }>;
24
+ evidence: z.ZodEnum<{
25
+ observed: "observed";
26
+ stale: "stale";
27
+ unavailable: "unavailable";
28
+ unknown: "unknown";
29
+ }>;
30
+ source: z.ZodEnum<{
31
+ "codex-app-server": "codex-app-server";
32
+ unsupported: "unsupported";
33
+ }>;
34
+ turnId: z.ZodNullable<z.ZodString>;
35
+ startedAt: z.ZodNullable<z.ZodISODateTime>;
36
+ observedAt: z.ZodNullable<z.ZodISODateTime>;
37
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
38
+ reason: z.ZodEnum<{
39
+ "connection-lost": "connection-lost";
40
+ "connection-unavailable": "connection-unavailable";
41
+ deadline: "deadline";
42
+ "endpoint-absent": "endpoint-absent";
43
+ "endpoint-not-listening": "endpoint-not-listening";
44
+ "native-status": "native-status";
45
+ "not-loaded": "not-loaded";
46
+ "not-observed": "not-observed";
47
+ "not-reported": "not-reported";
48
+ "read-limit": "read-limit";
49
+ "system-error": "system-error";
50
+ "unsupported-provider": "unsupported-provider";
51
+ "unsupported-runtime": "unsupported-runtime";
52
+ "unsupported-status": "unsupported-status";
53
+ "upgrade-refused": "upgrade-refused";
54
+ }>;
55
+ remedy: z.ZodNullable<z.ZodString>;
56
+ }, z.core.$strict>;
57
+ }, z.core.$strict>;
58
+ export type ExternalStatusRow = z.infer<typeof ExternalStatusRowSchema>;
59
+ export declare const ExternalStatusSnapshotSchema: z.ZodObject<{
60
+ protocol: z.ZodLiteral<1>;
61
+ version: z.ZodString;
62
+ machine: z.ZodString;
63
+ generation: z.ZodUUID;
64
+ sequence: z.ZodNumber;
65
+ source: z.ZodLiteral<"codex-app-server">;
66
+ status: z.ZodEnum<{
67
+ live: "live";
68
+ stale: "stale";
69
+ unavailable: "unavailable";
70
+ }>;
71
+ reason: z.ZodNullable<z.ZodEnum<{
72
+ "clock-skew": "clock-skew";
73
+ "config-changed": "config-changed";
74
+ "connection-lost": "connection-lost";
75
+ "connection-unavailable": "connection-unavailable";
76
+ "daemon-stopped": "daemon-stopped";
77
+ deadline: "deadline";
78
+ "endpoint-absent": "endpoint-absent";
79
+ "endpoint-not-listening": "endpoint-not-listening";
80
+ "invalid-response": "invalid-response";
81
+ "observation-expired": "observation-expired";
82
+ "observation-pending": "observation-pending";
83
+ "unsupported-runtime": "unsupported-runtime";
84
+ "upgrade-refused": "upgrade-refused";
85
+ }>>;
86
+ observedAt: z.ZodNullable<z.ZodISODateTime>;
87
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
88
+ truncated: z.ZodBoolean;
89
+ omitted: z.ZodNumber;
90
+ sessions: z.ZodArray<z.ZodObject<{
91
+ identity: z.ZodObject<{
92
+ provider: z.ZodLiteral<"codex">;
93
+ machine: z.ZodString;
94
+ threadId: z.ZodUUID;
95
+ }, z.core.$strict>;
96
+ name: z.ZodNullable<z.ZodString>;
97
+ dir: z.ZodNullable<z.ZodString>;
98
+ updatedAt: z.ZodNullable<z.ZodISODateTime>;
99
+ turnState: z.ZodObject<{
100
+ state: z.ZodEnum<{
101
+ idle: "idle";
102
+ unknown: "unknown";
103
+ "waiting-approval": "waiting-approval";
104
+ "waiting-input": "waiting-input";
105
+ working: "working";
106
+ }>;
107
+ evidence: z.ZodEnum<{
108
+ observed: "observed";
109
+ stale: "stale";
110
+ unavailable: "unavailable";
111
+ unknown: "unknown";
112
+ }>;
113
+ source: z.ZodEnum<{
114
+ "codex-app-server": "codex-app-server";
115
+ unsupported: "unsupported";
116
+ }>;
117
+ turnId: z.ZodNullable<z.ZodString>;
118
+ startedAt: z.ZodNullable<z.ZodISODateTime>;
119
+ observedAt: z.ZodNullable<z.ZodISODateTime>;
120
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
121
+ reason: z.ZodEnum<{
122
+ "connection-lost": "connection-lost";
123
+ "connection-unavailable": "connection-unavailable";
124
+ deadline: "deadline";
125
+ "endpoint-absent": "endpoint-absent";
126
+ "endpoint-not-listening": "endpoint-not-listening";
127
+ "native-status": "native-status";
128
+ "not-loaded": "not-loaded";
129
+ "not-observed": "not-observed";
130
+ "not-reported": "not-reported";
131
+ "read-limit": "read-limit";
132
+ "system-error": "system-error";
133
+ "unsupported-provider": "unsupported-provider";
134
+ "unsupported-runtime": "unsupported-runtime";
135
+ "unsupported-status": "unsupported-status";
136
+ "upgrade-refused": "upgrade-refused";
137
+ }>;
138
+ remedy: z.ZodNullable<z.ZodString>;
139
+ }, z.core.$strict>;
140
+ }, z.core.$strict>>;
141
+ }, z.core.$strict>;
142
+ export type ExternalStatusSnapshot = z.infer<typeof ExternalStatusSnapshotSchema>;
143
+ /** Transport health does not prove that a thread is loaded by this particular runtime. */
144
+ export declare function currentExternalStatus(snapshot: ExternalStatusSnapshot, now?: number): ExternalStatusSnapshot;