@microsoft/copilot-sdk 0.0.0-stage → 2.0.0-preview.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/README.md +2531 -2
- package/dist/canvas.d.ts +135 -0
- package/dist/canvas.js +51 -0
- package/dist/cjs/canvas.js +77 -0
- package/dist/cjs/cliVersion.js +31 -0
- package/dist/cjs/client.js +3941 -0
- package/dist/cjs/copilotRequestHandler.js +815 -0
- package/dist/cjs/decisions.js +139 -0
- package/dist/cjs/entra.js +83 -0
- package/dist/cjs/extension.js +79 -0
- package/dist/cjs/ffiRuntimeHost.js +400 -0
- package/dist/cjs/generated/lifecycle-diagnostics.js +16 -0
- package/dist/cjs/generated/rpc.js +5883 -0
- package/dist/cjs/generated/session-events.js +16 -0
- package/dist/cjs/host.js +83 -0
- package/dist/cjs/index.js +100 -0
- package/dist/cjs/installationConfirmation.js +98 -0
- package/dist/cjs/jsonrpcTypes.js +41 -0
- package/dist/cjs/localModelJson.js +103 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/providerConfiguration.js +39 -0
- package/dist/cjs/rpcCancellation.js +49 -0
- package/dist/cjs/runtimeArtifacts.js +255 -0
- package/dist/cjs/schema.js +40 -0
- package/dist/cjs/sdkProtocolVersion.js +33 -0
- package/dist/cjs/session.js +2764 -0
- package/dist/cjs/sessionFsProvider.js +283 -0
- package/dist/cjs/taskAnalyticsJson.js +47 -0
- package/dist/cjs/telemetry.js +35 -0
- package/dist/cjs/toolSet.js +107 -0
- package/dist/cjs/types.js +204 -0
- package/dist/cjs/workflow.js +278 -0
- package/dist/cliVersion.d.ts +2 -0
- package/dist/cliVersion.js +6 -0
- package/dist/client.d.ts +576 -0
- package/dist/client.js +3924 -0
- package/dist/copilotRequestHandler.d.ts +91 -0
- package/dist/copilotRequestHandler.js +787 -0
- package/dist/decisions.d.ts +65 -0
- package/dist/decisions.js +113 -0
- package/dist/entra.d.ts +3 -0
- package/dist/entra.js +59 -0
- package/dist/extension.d.ts +69 -0
- package/dist/extension.js +59 -0
- package/dist/ffiRuntimeHost.d.ts +44 -0
- package/dist/ffiRuntimeHost.js +366 -0
- package/dist/generated/lifecycle-diagnostics.d.ts +232 -0
- package/dist/generated/lifecycle-diagnostics.js +0 -0
- package/dist/generated/rpc.d.ts +47706 -0
- package/dist/generated/rpc.js +5854 -0
- package/dist/generated/session-events.d.ts +17349 -0
- package/dist/generated/session-events.js +0 -0
- package/dist/host.d.ts +143 -0
- package/dist/host.js +59 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +74 -0
- package/dist/installationConfirmation.d.ts +19 -0
- package/dist/installationConfirmation.js +74 -0
- package/dist/jsonrpcTypes.d.ts +16 -0
- package/dist/jsonrpcTypes.js +17 -0
- package/dist/localModelJson.d.ts +1 -0
- package/dist/localModelJson.js +69 -0
- package/dist/providerConfiguration.d.ts +3 -0
- package/dist/providerConfiguration.js +15 -0
- package/dist/rpcCancellation.d.ts +3 -0
- package/dist/rpcCancellation.js +25 -0
- package/dist/runtimeArtifacts.d.ts +18 -0
- package/dist/runtimeArtifacts.js +233 -0
- package/dist/schema.d.ts +4 -0
- package/dist/schema.js +14 -0
- package/dist/sdkProtocolVersion.d.ts +10 -0
- package/dist/sdkProtocolVersion.js +8 -0
- package/dist/session.d.ts +524 -0
- package/dist/session.js +2751 -0
- package/dist/sessionFsProvider.d.ts +130 -0
- package/dist/sessionFsProvider.js +257 -0
- package/dist/taskAnalyticsJson.d.ts +8 -0
- package/dist/taskAnalyticsJson.js +12 -0
- package/dist/telemetry.d.ts +14 -0
- package/dist/telemetry.js +11 -0
- package/dist/toolSet.d.ts +75 -0
- package/dist/toolSet.js +82 -0
- package/dist/types.d.ts +3864 -0
- package/dist/types.js +169 -0
- package/dist/workflow.d.ts +413 -0
- package/dist/workflow.js +248 -0
- package/docs/agent-author.md +372 -0
- package/docs/examples.md +747 -0
- package/docs/extensions.md +121 -0
- package/docs/workflows.md +303 -0
- package/package.json +135 -5
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import koffi from "koffi";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { PassThrough, Writable } from "node:stream";
|
|
5
|
+
const SYMBOL_PREFIX = "copilot_runtime_";
|
|
6
|
+
const KEEP_ALIVE_INTERVAL_MS = 1 << 30;
|
|
7
|
+
const CLEANUP_RETRY_INTERVAL_MS = 100;
|
|
8
|
+
let loadedLibraryPath;
|
|
9
|
+
let loadedLibrary;
|
|
10
|
+
function loadLibrary(libraryPath) {
|
|
11
|
+
if (loadedLibrary) {
|
|
12
|
+
if (loadedLibraryPath !== libraryPath) {
|
|
13
|
+
throw new Error(
|
|
14
|
+
`An in-process FFI runtime library is already loaded from '${loadedLibraryPath}'; loading a different library from '${libraryPath}' in the same process is not supported.`
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
return loadedLibrary;
|
|
18
|
+
}
|
|
19
|
+
const lib = koffi.load(libraryPath);
|
|
20
|
+
const outboundCallbackType = koffi.pointer(
|
|
21
|
+
koffi.proto(
|
|
22
|
+
`void ${SYMBOL_PREFIX}outbound(void *userData, uint8 *bytesPtr, size_t bytesLen)`
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
loadedLibrary = {
|
|
26
|
+
hostStart: lib.func(`${SYMBOL_PREFIX}host_start`, "uint32", [
|
|
27
|
+
"uint8*",
|
|
28
|
+
"size_t",
|
|
29
|
+
"uint8*",
|
|
30
|
+
"size_t"
|
|
31
|
+
]),
|
|
32
|
+
hostShutdown: lib.func(`${SYMBOL_PREFIX}host_shutdown`, "bool", ["uint32"]),
|
|
33
|
+
connectionOpen: lib.func(`${SYMBOL_PREFIX}connection_open`, "uint32", [
|
|
34
|
+
"uint32",
|
|
35
|
+
outboundCallbackType,
|
|
36
|
+
"void*",
|
|
37
|
+
"uint8*",
|
|
38
|
+
"size_t",
|
|
39
|
+
"uint8*",
|
|
40
|
+
"size_t",
|
|
41
|
+
"uint8*",
|
|
42
|
+
"size_t"
|
|
43
|
+
]),
|
|
44
|
+
connectionWrite: lib.func(`${SYMBOL_PREFIX}connection_write`, "bool", [
|
|
45
|
+
"uint32",
|
|
46
|
+
"uint8*",
|
|
47
|
+
"size_t"
|
|
48
|
+
]),
|
|
49
|
+
connectionClose: lib.func(`${SYMBOL_PREFIX}connection_close`, "bool", ["uint32"]),
|
|
50
|
+
connectionSetUiThreadHandler: lib.func(
|
|
51
|
+
`${SYMBOL_PREFIX}connection_set_ui_thread_handler`,
|
|
52
|
+
"bool",
|
|
53
|
+
["uint32", "bool"]
|
|
54
|
+
),
|
|
55
|
+
connectionRunUiAction: lib.func(`${SYMBOL_PREFIX}connection_run_ui_action`, "bool", [
|
|
56
|
+
"uint32",
|
|
57
|
+
"uint32"
|
|
58
|
+
]),
|
|
59
|
+
outboundCallbackType
|
|
60
|
+
};
|
|
61
|
+
loadedLibraryPath = libraryPath;
|
|
62
|
+
return loadedLibrary;
|
|
63
|
+
}
|
|
64
|
+
function buildArgvJson(cliEntrypoint, args) {
|
|
65
|
+
const argv = cliEntrypoint ? cliEntrypoint.toLowerCase().endsWith(".js") ? ["node", cliEntrypoint, "--embedded-host", "--no-auto-update"] : [cliEntrypoint, "--embedded-host", "--no-auto-update"] : [];
|
|
66
|
+
argv.push(...args);
|
|
67
|
+
return Buffer.from(JSON.stringify(argv), "utf8");
|
|
68
|
+
}
|
|
69
|
+
function buildEnvJson(environment) {
|
|
70
|
+
if (!environment) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const obj = {};
|
|
74
|
+
for (const [key, value] of Object.entries(environment)) {
|
|
75
|
+
if (value !== void 0) {
|
|
76
|
+
obj[key] = value;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (Object.keys(obj).length === 0) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return Buffer.from(JSON.stringify(obj), "utf8");
|
|
83
|
+
}
|
|
84
|
+
class FfiRuntimeHost {
|
|
85
|
+
constructor(libraryPath, cliEntrypoint, environment, args) {
|
|
86
|
+
this.libraryPath = libraryPath;
|
|
87
|
+
this.cliEntrypoint = cliEntrypoint;
|
|
88
|
+
this.environment = environment;
|
|
89
|
+
this.args = args;
|
|
90
|
+
this.lib = loadLibrary(libraryPath);
|
|
91
|
+
this.receiveStream = new PassThrough();
|
|
92
|
+
this.sendStream = new Writable({
|
|
93
|
+
// connection_write enqueues the frame into the runtime's inbound channel and
|
|
94
|
+
// returns immediately, so a synchronous FFI call is sufficient here.
|
|
95
|
+
write: (chunk, _encoding, callback) => {
|
|
96
|
+
try {
|
|
97
|
+
this.writeFrame(chunk);
|
|
98
|
+
callback();
|
|
99
|
+
} catch (error) {
|
|
100
|
+
callback(error);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
libraryPath;
|
|
106
|
+
cliEntrypoint;
|
|
107
|
+
environment;
|
|
108
|
+
args;
|
|
109
|
+
static quarantinedHosts = /* @__PURE__ */ new Set();
|
|
110
|
+
lib;
|
|
111
|
+
serverId = 0;
|
|
112
|
+
connectionId = 0;
|
|
113
|
+
disposed = false;
|
|
114
|
+
starting = false;
|
|
115
|
+
outboundCallback;
|
|
116
|
+
keepAliveTimer;
|
|
117
|
+
cleanupRetryTimer;
|
|
118
|
+
cleanupInProgress = false;
|
|
119
|
+
/** The stream JSON-RPC reads server→client frames from. */
|
|
120
|
+
receiveStream;
|
|
121
|
+
/** The stream JSON-RPC writes client→server frames to. */
|
|
122
|
+
sendStream;
|
|
123
|
+
/**
|
|
124
|
+
* Loads the runtime cdylib at the given path and prepares the FFI host.
|
|
125
|
+
*/
|
|
126
|
+
static create(libraryPath, cliEntrypoint, environment, args) {
|
|
127
|
+
const fullLibraryPath = resolve(libraryPath);
|
|
128
|
+
if (!existsSync(fullLibraryPath)) {
|
|
129
|
+
throw new Error(`FFI runtime library not found at '${fullLibraryPath}'.`);
|
|
130
|
+
}
|
|
131
|
+
return new FfiRuntimeHost(
|
|
132
|
+
fullLibraryPath,
|
|
133
|
+
cliEntrypoint ? resolve(cliEntrypoint) : void 0,
|
|
134
|
+
environment,
|
|
135
|
+
args
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
/** Starts the in-process Rust runtime and opens the FFI JSON-RPC connection. */
|
|
139
|
+
async start() {
|
|
140
|
+
if (this.disposed) {
|
|
141
|
+
throw new Error("The in-process runtime host is disposed.");
|
|
142
|
+
}
|
|
143
|
+
this.starting = true;
|
|
144
|
+
const argvJson = buildArgvJson(this.cliEntrypoint, this.args);
|
|
145
|
+
const envJson = buildEnvJson(this.environment);
|
|
146
|
+
try {
|
|
147
|
+
this.serverId = await new Promise((resolvePromise, rejectPromise) => {
|
|
148
|
+
this.lib.hostStart.async(
|
|
149
|
+
argvJson,
|
|
150
|
+
argvJson.length,
|
|
151
|
+
envJson,
|
|
152
|
+
envJson ? envJson.length : 0,
|
|
153
|
+
(error, result) => {
|
|
154
|
+
if (error) {
|
|
155
|
+
rejectPromise(error);
|
|
156
|
+
} else {
|
|
157
|
+
resolvePromise(result);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
});
|
|
162
|
+
if (!this.serverId) {
|
|
163
|
+
throw new Error(
|
|
164
|
+
`copilot_runtime_host_start failed (library '${this.libraryPath}').`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
if (this.disposed) {
|
|
168
|
+
throw new Error("The in-process runtime host was disposed during startup.");
|
|
169
|
+
}
|
|
170
|
+
this.outboundCallback = koffi.register(
|
|
171
|
+
(_userData, bytesPtr, bytesLen) => this.feedInbound(bytesPtr, bytesLen),
|
|
172
|
+
this.lib.outboundCallbackType
|
|
173
|
+
);
|
|
174
|
+
this.connectionId = this.lib.connectionOpen(
|
|
175
|
+
this.serverId,
|
|
176
|
+
this.outboundCallback,
|
|
177
|
+
null,
|
|
178
|
+
null,
|
|
179
|
+
0,
|
|
180
|
+
null,
|
|
181
|
+
0,
|
|
182
|
+
null,
|
|
183
|
+
0
|
|
184
|
+
);
|
|
185
|
+
if (!this.connectionId) {
|
|
186
|
+
this.unregisterCallback();
|
|
187
|
+
await this.shutdownHost();
|
|
188
|
+
this.serverId = 0;
|
|
189
|
+
throw new Error("copilot_runtime_connection_open failed.");
|
|
190
|
+
}
|
|
191
|
+
this.keepAliveTimer = setInterval(() => {
|
|
192
|
+
}, KEEP_ALIVE_INTERVAL_MS);
|
|
193
|
+
} finally {
|
|
194
|
+
this.starting = false;
|
|
195
|
+
if (this.disposed) {
|
|
196
|
+
await this.tryFinalizeCleanup();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
writeFrame(frame) {
|
|
201
|
+
if (this.disposed || !this.connectionId) {
|
|
202
|
+
throw new Error("The in-process runtime connection is closed.");
|
|
203
|
+
}
|
|
204
|
+
const ok = this.lib.connectionWrite(this.connectionId, frame, frame.length);
|
|
205
|
+
if (!ok) {
|
|
206
|
+
throw new Error("Failed to write a frame to the in-process runtime connection.");
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
configureUiThread(enabled) {
|
|
210
|
+
if (this.disposed || !this.lib.connectionSetUiThreadHandler(this.connectionId, enabled)) {
|
|
211
|
+
throw new Error("Failed to configure the in-process UI dispatcher.");
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
runUiAction(actionId) {
|
|
215
|
+
if (!Number.isInteger(actionId) || actionId < 0 || actionId > 4294967295) {
|
|
216
|
+
throw new RangeError("UI action ID must be an unsigned 32-bit integer.");
|
|
217
|
+
}
|
|
218
|
+
if (this.disposed || !this.lib.connectionRunUiAction(this.connectionId, actionId)) {
|
|
219
|
+
throw new Error(
|
|
220
|
+
"Native UI action is retired, already executed, or not running on the process main thread."
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Native outbound (server→client) callback. koffi delivers it on the JS event loop
|
|
226
|
+
* via a threadsafe function, so the frame is decoded and written straight to
|
|
227
|
+
* {@link receiveStream}. The native pointer is only valid for this call, so the
|
|
228
|
+
* bytes are copied out before returning.
|
|
229
|
+
*/
|
|
230
|
+
feedInbound(bytesPtr, bytesLen) {
|
|
231
|
+
try {
|
|
232
|
+
if (this.disposed || this.receiveStream.writableEnded) {
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const length = Number(bytesLen);
|
|
236
|
+
if (!bytesPtr || length <= 0) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const bytes = koffi.decode(
|
|
240
|
+
bytesPtr,
|
|
241
|
+
koffi.array("uint8", length, "Typed")
|
|
242
|
+
);
|
|
243
|
+
this.receiveStream.write(Buffer.from(bytes));
|
|
244
|
+
} catch (error) {
|
|
245
|
+
console.error(
|
|
246
|
+
`In-process FFI inbound callback failed: ${error instanceof Error ? error.stack ?? error.message : String(error)}`
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
shutdownHost() {
|
|
251
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
252
|
+
this.lib.hostShutdown.async(this.serverId, (error, result) => {
|
|
253
|
+
if (error) {
|
|
254
|
+
rejectPromise(error);
|
|
255
|
+
} else {
|
|
256
|
+
resolvePromise(result);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
unregisterCallback() {
|
|
262
|
+
if (this.outboundCallback === void 0) {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
const callback = this.outboundCallback;
|
|
266
|
+
try {
|
|
267
|
+
koffi.unregister(callback);
|
|
268
|
+
this.outboundCallback = void 0;
|
|
269
|
+
return true;
|
|
270
|
+
} catch (error) {
|
|
271
|
+
console.error(
|
|
272
|
+
`Failed to unregister in-process FFI callback: ${error instanceof Error ? error.stack ?? error.message : String(error)}`
|
|
273
|
+
);
|
|
274
|
+
FfiRuntimeHost.quarantinedHosts.add(this);
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
scheduleCleanupRetry() {
|
|
279
|
+
if (this.cleanupRetryTimer !== void 0) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
this.cleanupRetryTimer = setTimeout(() => {
|
|
283
|
+
this.cleanupRetryTimer = void 0;
|
|
284
|
+
void this.tryFinalizeCleanup();
|
|
285
|
+
}, CLEANUP_RETRY_INTERVAL_MS);
|
|
286
|
+
}
|
|
287
|
+
async tryFinalizeCleanup() {
|
|
288
|
+
if (this.cleanupInProgress) {
|
|
289
|
+
this.scheduleCleanupRetry();
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
this.cleanupInProgress = true;
|
|
293
|
+
try {
|
|
294
|
+
if (this.connectionId) {
|
|
295
|
+
let closed = false;
|
|
296
|
+
try {
|
|
297
|
+
closed = await new Promise((resolvePromise, rejectPromise) => {
|
|
298
|
+
this.lib.connectionClose.async(
|
|
299
|
+
this.connectionId,
|
|
300
|
+
(error, result) => {
|
|
301
|
+
if (error) {
|
|
302
|
+
rejectPromise(error);
|
|
303
|
+
} else {
|
|
304
|
+
resolvePromise(result);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
});
|
|
309
|
+
} catch (error) {
|
|
310
|
+
console.error(
|
|
311
|
+
`Failed to close in-process FFI connection: ${error instanceof Error ? error.stack ?? error.message : String(error)}`
|
|
312
|
+
);
|
|
313
|
+
FfiRuntimeHost.quarantinedHosts.add(this);
|
|
314
|
+
if (this.keepAliveTimer !== void 0) {
|
|
315
|
+
clearInterval(this.keepAliveTimer);
|
|
316
|
+
this.keepAliveTimer = void 0;
|
|
317
|
+
}
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (!closed) {
|
|
321
|
+
this.scheduleCleanupRetry();
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
this.connectionId = 0;
|
|
325
|
+
}
|
|
326
|
+
const callbackUnregistered = this.unregisterCallback();
|
|
327
|
+
if (this.keepAliveTimer !== void 0) {
|
|
328
|
+
clearInterval(this.keepAliveTimer);
|
|
329
|
+
this.keepAliveTimer = void 0;
|
|
330
|
+
}
|
|
331
|
+
if (this.serverId) {
|
|
332
|
+
try {
|
|
333
|
+
if (!await this.shutdownHost()) {
|
|
334
|
+
console.error(
|
|
335
|
+
`In-process FFI host shutdown did not recognize server ${this.serverId}.`
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
} catch (error) {
|
|
339
|
+
console.error(
|
|
340
|
+
`Failed to shut down in-process FFI host: ${error instanceof Error ? error.stack ?? error.message : String(error)}`
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
this.serverId = 0;
|
|
344
|
+
}
|
|
345
|
+
if (callbackUnregistered) {
|
|
346
|
+
FfiRuntimeHost.quarantinedHosts.delete(this);
|
|
347
|
+
}
|
|
348
|
+
} finally {
|
|
349
|
+
this.cleanupInProgress = false;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
/** Awaits the initial cleanup attempt; a non-quiescent close is retried in the background. */
|
|
353
|
+
async dispose() {
|
|
354
|
+
if (this.disposed) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
this.disposed = true;
|
|
358
|
+
this.receiveStream.end();
|
|
359
|
+
if (!this.starting) {
|
|
360
|
+
await this.tryFinalizeCleanup();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
export {
|
|
365
|
+
FfiRuntimeHost
|
|
366
|
+
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-GENERATED FILE - DO NOT EDIT
|
|
3
|
+
* Generated from: lifecycle-diagnostics.schema.json
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Union of experimental lifecycle diagnostic event variants emitted by the Copilot CLI runtime.
|
|
7
|
+
*/
|
|
8
|
+
export type LifecycleDiagnosticEvent = RuntimeLifecycleSystemStateDiagnosticEvent | RuntimeLifecycleProgressStateDiagnosticEvent;
|
|
9
|
+
/**
|
|
10
|
+
* How a settled lifecycle operation or progress record ended.
|
|
11
|
+
*/
|
|
12
|
+
export type RuntimeLifecycleDisposition = "succeeded" | "failed" | "cancelled" | "timed_out" | "superseded" | "abandoned";
|
|
13
|
+
/**
|
|
14
|
+
* Lifecycle diagnostic event "runtime.lifecycle.system_state". Experimental, ephemeral, observational-only state of one runtime system after an operation transition. Observation and delivery never control runtime work. Process death, diagnostic projection loss, transport loss, or serialization failure can prevent external delivery.
|
|
15
|
+
*/
|
|
16
|
+
export interface RuntimeLifecycleSystemStateDiagnosticEvent {
|
|
17
|
+
data: RuntimeLifecycleSystemStateData;
|
|
18
|
+
/**
|
|
19
|
+
* ISO 8601 timestamp when the lifecycle diagnostic event was projected.
|
|
20
|
+
*/
|
|
21
|
+
timestamp: string;
|
|
22
|
+
/**
|
|
23
|
+
* Type discriminator. Always "runtime.lifecycle.system_state".
|
|
24
|
+
*/
|
|
25
|
+
type: "runtime.lifecycle.system_state";
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Experimental, observational-only state of one runtime system after an operation transition. Observation and delivery never control runtime work. Process death, diagnostic projection loss, transport loss, or serialization failure can prevent external delivery.
|
|
29
|
+
*/
|
|
30
|
+
export interface RuntimeLifecycleSystemStateData {
|
|
31
|
+
/**
|
|
32
|
+
* Complete active operation set after applying the change.
|
|
33
|
+
*/
|
|
34
|
+
activeOperations: RuntimeLifecycleOperation[];
|
|
35
|
+
changedOperation: RuntimeLifecycleOperation;
|
|
36
|
+
/**
|
|
37
|
+
* Authoritative condition retained after this change. Initial shared values are `current`, `disabled`, `degraded`, and `quiescent`; integrations can add bounded values as the contract matures.
|
|
38
|
+
*/
|
|
39
|
+
condition?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Opaque identity for one session registry generation.
|
|
42
|
+
*/
|
|
43
|
+
incarnationId: string;
|
|
44
|
+
/**
|
|
45
|
+
* Session whose lifecycle owns this system.
|
|
46
|
+
*/
|
|
47
|
+
sessionId: string;
|
|
48
|
+
/**
|
|
49
|
+
* Stable subsystem identifier.
|
|
50
|
+
*/
|
|
51
|
+
system: string;
|
|
52
|
+
/**
|
|
53
|
+
* Orders every observed change to this system in the incarnation.
|
|
54
|
+
*/
|
|
55
|
+
systemRevision: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Observed state of one readiness or convergence operation.
|
|
59
|
+
*/
|
|
60
|
+
export interface RuntimeLifecycleOperation {
|
|
61
|
+
/**
|
|
62
|
+
* Complete dependency blocker set after this operation change.
|
|
63
|
+
*/
|
|
64
|
+
blockers: RuntimeLifecycleBlocker[];
|
|
65
|
+
disposition?: RuntimeLifecycleDisposition;
|
|
66
|
+
/**
|
|
67
|
+
* Opaque operation identifier, unique within the lifecycle incarnation and system.
|
|
68
|
+
*/
|
|
69
|
+
operationId: string;
|
|
70
|
+
/**
|
|
71
|
+
* Orders transitions of this operation.
|
|
72
|
+
*/
|
|
73
|
+
operationRevision: number;
|
|
74
|
+
/**
|
|
75
|
+
* System-owned lifecycle stage.
|
|
76
|
+
*/
|
|
77
|
+
phase: string;
|
|
78
|
+
/**
|
|
79
|
+
* System-owned production boundary within the phase.
|
|
80
|
+
*/
|
|
81
|
+
step: string;
|
|
82
|
+
timing: RuntimeLifecycleOperationTiming;
|
|
83
|
+
/**
|
|
84
|
+
* System-owned reason the operation started.
|
|
85
|
+
*/
|
|
86
|
+
trigger: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Exact lifecycle operation awaited by a real dependency wait.
|
|
90
|
+
*/
|
|
91
|
+
export interface RuntimeLifecycleBlocker {
|
|
92
|
+
/**
|
|
93
|
+
* Opaque blocker identifier, stable for one guard lifetime and scoped to its owner.
|
|
94
|
+
*/
|
|
95
|
+
blockerId: string;
|
|
96
|
+
/**
|
|
97
|
+
* Current phase of the awaited operation.
|
|
98
|
+
*/
|
|
99
|
+
currentPhase: string;
|
|
100
|
+
/**
|
|
101
|
+
* Current production boundary of the awaited operation.
|
|
102
|
+
*/
|
|
103
|
+
currentStep: string;
|
|
104
|
+
operationDisposition?: RuntimeLifecycleDisposition;
|
|
105
|
+
/**
|
|
106
|
+
* Opaque awaited operation identifier.
|
|
107
|
+
*/
|
|
108
|
+
operationId: string;
|
|
109
|
+
/**
|
|
110
|
+
* Awaited operation revision observed by this blocker.
|
|
111
|
+
*/
|
|
112
|
+
operationRevision: number;
|
|
113
|
+
/**
|
|
114
|
+
* System-owned capability required by the blocker owner.
|
|
115
|
+
*/
|
|
116
|
+
requirement: string;
|
|
117
|
+
/**
|
|
118
|
+
* System that owns the awaited operation.
|
|
119
|
+
*/
|
|
120
|
+
system: string;
|
|
121
|
+
timing: RuntimeLifecycleBlockerTiming;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Timing of one real dependency wait.
|
|
125
|
+
*/
|
|
126
|
+
export interface RuntimeLifecycleBlockerTiming {
|
|
127
|
+
/**
|
|
128
|
+
* ISO 8601 timestamp when this dependency began blocking its owner.
|
|
129
|
+
*/
|
|
130
|
+
blockingSince: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Fixed timestamps for one observed operation revision.
|
|
134
|
+
*/
|
|
135
|
+
export interface RuntimeLifecycleOperationTiming {
|
|
136
|
+
/**
|
|
137
|
+
* ISO 8601 timestamp when the current phase began.
|
|
138
|
+
*/
|
|
139
|
+
phaseStartedAt: string;
|
|
140
|
+
/**
|
|
141
|
+
* ISO 8601 timestamp when the operation began.
|
|
142
|
+
*/
|
|
143
|
+
startedAt: string;
|
|
144
|
+
/**
|
|
145
|
+
* ISO 8601 timestamp when this operation revision was recorded.
|
|
146
|
+
*/
|
|
147
|
+
transitionedAt: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Lifecycle diagnostic event "runtime.lifecycle.progress_state". Experimental, ephemeral, observational-only state of runtime progress and the lifecycle operations that block it. Observation and delivery never control runtime or model behavior. Process death, diagnostic projection loss, transport loss, or serialization failure can prevent external delivery.
|
|
151
|
+
*/
|
|
152
|
+
export interface RuntimeLifecycleProgressStateDiagnosticEvent {
|
|
153
|
+
data: RuntimeLifecycleProgressStateData;
|
|
154
|
+
/**
|
|
155
|
+
* ISO 8601 timestamp when the lifecycle diagnostic event was projected.
|
|
156
|
+
*/
|
|
157
|
+
timestamp: string;
|
|
158
|
+
/**
|
|
159
|
+
* Type discriminator. Always "runtime.lifecycle.progress_state".
|
|
160
|
+
*/
|
|
161
|
+
type: "runtime.lifecycle.progress_state";
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Experimental, observational-only state of runtime progress and the lifecycle operations that block it. Observation and delivery never control runtime or model behavior. Process death, diagnostic projection loss, transport loss, or serialization failure can prevent external delivery.
|
|
165
|
+
*/
|
|
166
|
+
export interface RuntimeLifecycleProgressStateData {
|
|
167
|
+
/**
|
|
168
|
+
* Agent that owns this progress. Absent for the primary agent and progress without an agent owner.
|
|
169
|
+
*/
|
|
170
|
+
agentId?: string;
|
|
171
|
+
/**
|
|
172
|
+
* Complete dependency blocker set after this progress change.
|
|
173
|
+
*/
|
|
174
|
+
blockers: RuntimeLifecycleBlocker[];
|
|
175
|
+
disposition?: RuntimeLifecycleDisposition;
|
|
176
|
+
/**
|
|
177
|
+
* Opaque identity for one session registry generation.
|
|
178
|
+
*/
|
|
179
|
+
incarnationId: string;
|
|
180
|
+
/**
|
|
181
|
+
* Progress-owner-defined kind.
|
|
182
|
+
*/
|
|
183
|
+
kind: string;
|
|
184
|
+
origin?: RuntimeLifecycleProgressOrigin;
|
|
185
|
+
/**
|
|
186
|
+
* Progress-owner-defined phase.
|
|
187
|
+
*/
|
|
188
|
+
phase: string;
|
|
189
|
+
/**
|
|
190
|
+
* Opaque progress identifier, unique within the incarnation and kind.
|
|
191
|
+
*/
|
|
192
|
+
progressId: string;
|
|
193
|
+
/**
|
|
194
|
+
* Orders changes to this progress record.
|
|
195
|
+
*/
|
|
196
|
+
revision: number;
|
|
197
|
+
/**
|
|
198
|
+
* Session whose lifecycle owns this progress.
|
|
199
|
+
*/
|
|
200
|
+
sessionId: string;
|
|
201
|
+
timing: RuntimeLifecycleProgressTiming;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Immutable causal origin of a progress record with independent identity and settlement.
|
|
205
|
+
*/
|
|
206
|
+
export interface RuntimeLifecycleProgressOrigin {
|
|
207
|
+
/**
|
|
208
|
+
* Kind of the originating progress record.
|
|
209
|
+
*/
|
|
210
|
+
kind: string;
|
|
211
|
+
/**
|
|
212
|
+
* Identifier of the originating progress record.
|
|
213
|
+
*/
|
|
214
|
+
progressId: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Fixed timestamps for one observed progress revision.
|
|
218
|
+
*/
|
|
219
|
+
export interface RuntimeLifecycleProgressTiming {
|
|
220
|
+
/**
|
|
221
|
+
* ISO 8601 timestamp when the current phase began.
|
|
222
|
+
*/
|
|
223
|
+
phaseStartedAt: string;
|
|
224
|
+
/**
|
|
225
|
+
* ISO 8601 timestamp when the progress record began.
|
|
226
|
+
*/
|
|
227
|
+
startedAt: string;
|
|
228
|
+
/**
|
|
229
|
+
* ISO 8601 timestamp when this progress revision was recorded.
|
|
230
|
+
*/
|
|
231
|
+
transitionedAt: string;
|
|
232
|
+
}
|
|
File without changes
|