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.
Files changed (42) hide show
  1. package/README.md +10 -4
  2. package/dist/extension/baseline.js +333 -394
  3. package/dist/extension/radar-client.js +126 -11
  4. package/dist/extension/radar-communication.js +39 -0
  5. package/dist/extension/radar-execution.js +169 -382
  6. package/dist/extension/radar-launch.js +18 -13
  7. package/dist/extension/radar-publication.js +161 -298
  8. package/dist/extension/radar-runtime.js +1 -1
  9. package/dist/index.js +356 -407
  10. package/extension/baseline.ts +2 -0
  11. package/extension/generated-contracts.ts +1310 -10
  12. package/extension/radar-client.ts +191 -23
  13. package/extension/radar-communication.ts +66 -0
  14. package/extension/radar-execution.ts +11 -58
  15. package/extension/radar-launch.ts +29 -22
  16. package/extension/radar-publication.ts +211 -410
  17. package/extension/radar-runtime.ts +4 -1
  18. package/index.ts +1 -0
  19. package/package.json +9 -5
  20. package/schema/public/v1/handoff-inbox.deserialize.schema.json +18 -0
  21. package/schema/public/v1/handoff-inbox.serialize.schema.json +18 -0
  22. package/schema/public/v1/handoff-publish-params.deserialize.schema.json +33 -0
  23. package/schema/public/v1/handoff-publish-params.serialize.schema.json +33 -0
  24. package/schema/public/v1/handoff-receipt.deserialize.schema.json +66 -0
  25. package/schema/public/v1/handoff-receipt.serialize.schema.json +66 -0
  26. package/schema/public/v1/handoff.deserialize.schema.json +84 -0
  27. package/schema/public/v1/handoff.serialize.schema.json +84 -0
  28. package/schema/public/v1/observation-get-params.deserialize.schema.json +46 -0
  29. package/schema/public/v1/observation-get-params.serialize.schema.json +52 -0
  30. package/schema/public/v1/observation-get-response.deserialize.schema.json +2731 -0
  31. package/schema/public/v1/observation-get-response.serialize.schema.json +2862 -0
  32. package/schema/public/v1/observation-snapshot.deserialize.schema.json +2616 -0
  33. package/schema/public/v1/observation-snapshot.serialize.schema.json +2741 -0
  34. package/schema/public/v1/presence-answer.deserialize.schema.json +40 -0
  35. package/schema/public/v1/presence-answer.serialize.schema.json +40 -0
  36. package/schema/public/v1/presence-release.deserialize.schema.json +51 -0
  37. package/schema/public/v1/presence-release.serialize.schema.json +52 -0
  38. package/schema/public/v1/presence-report.deserialize.schema.json +149 -0
  39. package/schema/public/v1/presence-report.serialize.schema.json +157 -0
  40. package/extension/radar-session-marker.ts +0 -146
  41. package/schema/public/v1/launch-identity-marker.deserialize.schema.json +0 -32
  42. 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.agent_id === void 0)
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.agent_id === void 0)
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.agent_id !== provenance.agent_id)
37
+ if (edge.bound.registration_id !== provenance.registration_id)
38
38
  return unknownChild(
39
- `bound to another subject (${edge.bound.agent_id}), not to ${provenance.agent_id}`
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.agent_id);
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
- agent_id: edge.bound.agent_id,
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.agent_id))
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.agent_id,
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.agent_id;
184
+ const agentId = bound.registration_id;
180
185
  if (launch.onBound !== void 0) {
181
186
  try {
182
- launch.onBound({ agent_id: agentId, pane_id: bound.pane_id });
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
- agent_id: agentId,
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?.agent_id;
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
- agent_id: agentId,
272
+ registration_id: agentId,
268
273
  pane_id: pane,
269
274
  source,
270
275
  incarnation