pi-radar 0.2.0 → 0.4.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 +10 -4
- package/dist/extension/baseline.js +333 -394
- package/dist/extension/radar-client.js +126 -11
- package/dist/extension/radar-communication.js +39 -0
- package/dist/extension/radar-execution.js +169 -382
- package/dist/extension/radar-launch.js +18 -13
- package/dist/extension/radar-publication.js +161 -298
- package/dist/extension/radar-runtime.js +1 -1
- package/dist/index.js +356 -407
- package/extension/baseline.ts +2 -0
- package/extension/generated-contracts.ts +1310 -10
- package/extension/radar-client.ts +191 -23
- package/extension/radar-communication.ts +66 -0
- package/extension/radar-execution.ts +11 -58
- package/extension/radar-launch.ts +29 -22
- package/extension/radar-publication.ts +211 -410
- package/extension/radar-runtime.ts +4 -1
- package/index.ts +1 -0
- package/package.json +9 -5
- package/schema/public/v1/handoff-inbox.deserialize.schema.json +18 -0
- package/schema/public/v1/handoff-inbox.serialize.schema.json +18 -0
- package/schema/public/v1/handoff-publish-params.deserialize.schema.json +33 -0
- package/schema/public/v1/handoff-publish-params.serialize.schema.json +33 -0
- package/schema/public/v1/handoff-receipt.deserialize.schema.json +66 -0
- package/schema/public/v1/handoff-receipt.serialize.schema.json +66 -0
- package/schema/public/v1/handoff.deserialize.schema.json +84 -0
- package/schema/public/v1/handoff.serialize.schema.json +84 -0
- package/schema/public/v1/observation-get-params.deserialize.schema.json +46 -0
- package/schema/public/v1/observation-get-params.serialize.schema.json +52 -0
- package/schema/public/v1/observation-get-response.deserialize.schema.json +2731 -0
- package/schema/public/v1/observation-get-response.serialize.schema.json +2862 -0
- package/schema/public/v1/observation-snapshot.deserialize.schema.json +2616 -0
- package/schema/public/v1/observation-snapshot.serialize.schema.json +2741 -0
- package/schema/public/v1/presence-answer.deserialize.schema.json +40 -0
- package/schema/public/v1/presence-answer.serialize.schema.json +40 -0
- package/schema/public/v1/presence-release.deserialize.schema.json +51 -0
- package/schema/public/v1/presence-release.serialize.schema.json +52 -0
- package/schema/public/v1/presence-report.deserialize.schema.json +149 -0
- package/schema/public/v1/presence-report.serialize.schema.json +157 -0
- package/extension/radar-session-marker.ts +0 -146
- package/schema/public/v1/launch-identity-marker.deserialize.schema.json +0 -32
- package/schema/public/v1/launch-identity-marker.serialize.schema.json +0 -32
|
@@ -21,7 +21,7 @@ function trajectory(reason) {
|
|
|
21
21
|
return `the daemon's current record of this launch's child is ${reason}`;
|
|
22
22
|
}
|
|
23
23
|
async function observeRadarChild(client, provenance) {
|
|
24
|
-
if (provenance.
|
|
24
|
+
if (provenance.registration_id === void 0)
|
|
25
25
|
return unknownChild("not bound to a child by this launch");
|
|
26
26
|
if (provenance.pane_id === void 0)
|
|
27
27
|
return unknownChild("without a pane this launch recorded for it");
|
|
@@ -32,11 +32,11 @@ async function observeRadarChild(client, provenance) {
|
|
|
32
32
|
);
|
|
33
33
|
const topology = read.value;
|
|
34
34
|
const edge = topology.edge;
|
|
35
|
-
if (edge.bound === void 0 || edge.bound.
|
|
35
|
+
if (edge.bound === void 0 || edge.bound.registration_id === void 0)
|
|
36
36
|
return unknownChild("not bound to a child by the daemon");
|
|
37
|
-
if (edge.bound.
|
|
37
|
+
if (edge.bound.registration_id !== provenance.registration_id)
|
|
38
38
|
return unknownChild(
|
|
39
|
-
`bound to another subject (${edge.bound.
|
|
39
|
+
`bound to another subject (${edge.bound.registration_id}), not to ${provenance.registration_id}`
|
|
40
40
|
);
|
|
41
41
|
if (edge.location?.pane === void 0)
|
|
42
42
|
return unknownChild("recorded without a pane");
|
|
@@ -54,7 +54,7 @@ async function observeRadarChild(client, provenance) {
|
|
|
54
54
|
return unknownChild(
|
|
55
55
|
`not currently placed (state ${topology.state ?? "unreported"})`
|
|
56
56
|
);
|
|
57
|
-
const reply = await client.agentGet(edge.bound.
|
|
57
|
+
const reply = await client.agentGet(edge.bound.registration_id);
|
|
58
58
|
if (reply.ok === false)
|
|
59
59
|
return unknownChild(
|
|
60
60
|
`process verdict not readable (${reply.code}: ${reply.message})`
|
|
@@ -82,7 +82,7 @@ async function observeRadarChild(client, provenance) {
|
|
|
82
82
|
kind: "live",
|
|
83
83
|
evidence: {
|
|
84
84
|
request_id: provenance.request_id,
|
|
85
|
-
|
|
85
|
+
registration_id: edge.bound.registration_id,
|
|
86
86
|
source: edge.bound.source,
|
|
87
87
|
incarnation: edge.bound.incarnation,
|
|
88
88
|
pane_id: edge.location.pane
|
|
@@ -142,19 +142,24 @@ async function launchRadarWorker(options) {
|
|
|
142
142
|
const deadline = Date.now() + options.timeoutMs;
|
|
143
143
|
const remaining = () => Math.max(0, deadline - Date.now());
|
|
144
144
|
const pane = launch.parent.location?.pane;
|
|
145
|
-
if (!isUuid(launch.parent.
|
|
145
|
+
if (!isUuid(launch.parent.registration_id))
|
|
146
146
|
return refusedLaunch(
|
|
147
147
|
"the launch has no exact parent registration to spawn under"
|
|
148
148
|
);
|
|
149
|
+
if (!isUuid(launch.parent.subject_id))
|
|
150
|
+
return refusedLaunch(
|
|
151
|
+
"the launch has no managed Radar subject for its parent"
|
|
152
|
+
);
|
|
149
153
|
if (pane === void 0 || pane === "")
|
|
150
154
|
return refusedLaunch(
|
|
151
155
|
"this process's Radar registration names no pane, so it cannot be a spawn parent"
|
|
152
156
|
);
|
|
153
157
|
const spawned = await client.spawn({
|
|
154
158
|
request_id: launch.request_id,
|
|
155
|
-
parent: launch.parent.
|
|
159
|
+
parent: launch.parent.registration_id,
|
|
156
160
|
parent_session_id: launch.parent_session_id,
|
|
157
161
|
executable: launch.executable,
|
|
162
|
+
managed: { parent_subject_id: launch.parent.subject_id },
|
|
158
163
|
argv: launch.argv,
|
|
159
164
|
...launch.cwd !== "" ? { cwd: launch.cwd } : {},
|
|
160
165
|
...Object.keys(launch.env).length > 0 ? { env: launch.env } : {}
|
|
@@ -176,10 +181,10 @@ async function launchRadarWorker(options) {
|
|
|
176
181
|
...signal !== void 0 ? { signal } : {}
|
|
177
182
|
});
|
|
178
183
|
if (bound.kind !== "bound") return bound;
|
|
179
|
-
const agentId = bound.
|
|
184
|
+
const agentId = bound.registration_id;
|
|
180
185
|
if (launch.onBound !== void 0) {
|
|
181
186
|
try {
|
|
182
|
-
launch.onBound({
|
|
187
|
+
launch.onBound({ registration_id: agentId, pane_id: bound.pane_id });
|
|
183
188
|
} catch (error) {
|
|
184
189
|
return unresolvedLaunch(
|
|
185
190
|
launch.request_id,
|
|
@@ -207,7 +212,7 @@ async function launchRadarWorker(options) {
|
|
|
207
212
|
kind: "ready",
|
|
208
213
|
value: {
|
|
209
214
|
request_id: launch.request_id,
|
|
210
|
-
|
|
215
|
+
registration_id: agentId,
|
|
211
216
|
pane_id: bound.pane_id,
|
|
212
217
|
bound_process: {
|
|
213
218
|
source: bound.source,
|
|
@@ -253,7 +258,7 @@ async function waitForChild(client, requestId, options) {
|
|
|
253
258
|
requestId,
|
|
254
259
|
"the daemon observed the launched child's process exit"
|
|
255
260
|
);
|
|
256
|
-
const agentId = edge.bound?.
|
|
261
|
+
const agentId = edge.bound?.registration_id;
|
|
257
262
|
if (agentId !== void 0 && isUuid(agentId)) {
|
|
258
263
|
const source = edge.bound?.source;
|
|
259
264
|
const incarnation = edge.bound?.incarnation;
|
|
@@ -264,7 +269,7 @@ async function waitForChild(client, requestId, options) {
|
|
|
264
269
|
);
|
|
265
270
|
return {
|
|
266
271
|
kind: "bound",
|
|
267
|
-
|
|
272
|
+
registration_id: agentId,
|
|
268
273
|
pane_id: pane,
|
|
269
274
|
source,
|
|
270
275
|
incarnation
|