@north-light/crouter 0.3.355 → 0.3.356

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 (58) hide show
  1. package/dist/api/dto/delivery.d.ts +13 -3
  2. package/dist/api/dto/objects.d.ts +24 -22
  3. package/dist/api/dto/objects.js +1 -1
  4. package/dist/clients/attach/session/document-links.js +1 -1
  5. package/dist/clients/attach/viewer.js +829 -755
  6. package/dist/commands/canvas/list.js +3 -3
  7. package/dist/commands/canvas/read.d.ts +2 -4
  8. package/dist/commands/canvas/read.js +3 -5
  9. package/dist/commands/canvas/search.js +1 -1
  10. package/dist/commands/sys/context/admin/actions.js +1 -1
  11. package/dist/commands/sys/sync-deps.js +1 -1
  12. package/dist/commands/sys/sync-shared.js +1 -1
  13. package/dist/core/canvas/daemon-actions.d.ts +43 -0
  14. package/dist/core/canvas/daemon-actions.js +26 -0
  15. package/dist/core/canvas/deliveries.d.ts +1 -0
  16. package/dist/core/canvas/deliveries.js +1 -1
  17. package/dist/core/canvas/migrations.js +106 -46
  18. package/dist/core/feed/messages.d.ts +2 -20
  19. package/dist/core/feed/messages.js +6 -10
  20. package/dist/core/graph/events.d.ts +10 -5
  21. package/dist/core/graph/events.js +5 -5
  22. package/dist/core/graph/jobs.js +2 -2
  23. package/dist/core/graph/kinds/document.d.ts +19 -0
  24. package/dist/core/graph/kinds/document.js +5 -0
  25. package/dist/core/graph/kinds/dto.d.ts +5 -0
  26. package/dist/core/graph/kinds/dto.js +1 -0
  27. package/dist/core/graph/kinds/job.d.ts +2 -0
  28. package/dist/core/graph/kinds/job.js +2 -0
  29. package/dist/core/graph/kinds/kind.d.ts +39 -0
  30. package/dist/core/graph/kinds/kind.js +1 -0
  31. package/dist/core/graph/kinds/node.d.ts +2 -0
  32. package/dist/core/graph/kinds/node.js +4 -0
  33. package/dist/core/graph/kinds/owner.d.ts +2 -0
  34. package/dist/core/graph/kinds/owner.js +2 -0
  35. package/dist/core/graph/kinds/registry.d.ts +8 -0
  36. package/dist/core/graph/kinds/registry.js +1 -0
  37. package/dist/core/graph/kinds/render.d.ts +9 -0
  38. package/dist/core/graph/kinds/render.js +1 -0
  39. package/dist/core/graph/objects.d.ts +5 -4
  40. package/dist/core/graph/objects.js +5 -5
  41. package/dist/core/graph/types.d.ts +6 -5
  42. package/dist/core/runtime/broker-protocol.d.ts +2 -7
  43. package/dist/daemon/api/handlers/human-requests.js +1 -1
  44. package/dist/daemon/api/handlers/objects.js +2 -5
  45. package/dist/daemon/cron/settle.js +1 -1
  46. package/dist/daemon/cron/sinks.d.ts +3 -3
  47. package/dist/daemon/cron/sinks.js +2 -2
  48. package/dist/daemon/crtrd.js +6 -6
  49. package/dist/daemon/human/finish.js +6 -6
  50. package/dist/daemon/human/settle.d.ts +2 -3
  51. package/dist/daemon/human/settle.js +1 -1
  52. package/dist/daemon/reconcilers/action-lane.d.ts +8 -0
  53. package/dist/daemon/reconcilers/action-lane.js +1 -0
  54. package/dist/daemon/reconcilers/delivery-lane.d.ts +1 -1
  55. package/dist/daemon/reconcilers/delivery-lane.js +1 -1
  56. package/package.json +2 -2
  57. package/packages/crouter-identity/package.json +1 -1
  58. package/runtime.lock.json +11 -11
@@ -1,3 +1,4 @@
1
+ import type { NodeSubjectDTO } from './nodes.js';
1
2
  export type DeliveryActivity = 'boot' | 'system-prompt' | 'compact' | 'persona' | 'file-read' | 'command' | 'pre-command' | 'slash-command' | 'names'
2
3
  /** Dry run only: a live node's workspace-open arrives inside its boot. */
3
4
  | 'workspace-open'
@@ -9,7 +10,7 @@ export interface DeliveryRequest {
9
10
  subject?: string;
10
11
  inherited?: boolean;
11
12
  dry_run?: boolean;
12
- subject_override?: Partial<import('../../core/substrate/subject-fields.js').NodeConfigSubject>;
13
+ subject_override?: Partial<NodeSubjectDTO>;
13
14
  }
14
15
  /** A node that does not exist, for `POST /v1/delivery/dry-run`. Unset fields
15
16
  * come from `node` when one is named, else from defaults. */
@@ -32,7 +33,16 @@ export interface DeliveryDryRunRequest {
32
33
  subject?: string;
33
34
  node?: string;
34
35
  hypothetical?: HypotheticalNodeDTO;
35
- subject_override?: Partial<import('../../core/substrate/subject-fields.js').NodeConfigSubject>;
36
+ subject_override?: Partial<NodeSubjectDTO>;
37
+ }
38
+ /** One resolvable inline memory reference — the broker's `RefMeta`. Metadata
39
+ * only, never the document body or its source path. */
40
+ export interface DeliveryRefDTO {
41
+ name: string;
42
+ kind: 'knowledge' | 'preference';
43
+ scope: 'node' | 'project' | 'profile' | 'user' | 'builtin';
44
+ shortForm: string;
45
+ gatewayVisible: boolean;
36
46
  }
37
47
  export interface DeliveryCommandDTO {
38
48
  name: string;
@@ -47,7 +57,7 @@ export interface DeliveryResponse {
47
57
  commands?: DeliveryCommandDTO[];
48
58
  blocks?: string[];
49
59
  execution_body?: string;
50
- refs?: import('../../core/runtime/broker-protocol.js').RefMeta[];
60
+ refs?: DeliveryRefDTO[];
51
61
  names?: string[];
52
62
  plan?: unknown;
53
63
  }
@@ -1,5 +1,3 @@
1
- export declare const OBJECT_TYPES: readonly ["document", "node", "job", "person", "app", "repo", "profile"];
2
- export type ObjectTypeName = typeof OBJECT_TYPES[number];
3
1
  export declare const PRIVACY_LEVELS_DTO: readonly ["public", "friends", "private"];
4
2
  export type PrivacyName = typeof PRIVACY_LEVELS_DTO[number];
5
3
  export type OwnerTypeName = 'person' | 'app' | 'repo' | 'profile' | 'node' | 'document' | 'job';
@@ -10,7 +8,8 @@ export interface ObjectOwnerDTO {
10
8
  }
11
9
  export interface ObjectDTO {
12
10
  id: string;
13
- type: ObjectTypeName;
11
+ /** The object's kind name: `document`, `node`, `job`, `person`, `app`, `repo`, `profile`, or a later kind. */
12
+ type: string;
14
13
  kind: string | null;
15
14
  owner: ObjectOwnerDTO | null;
16
15
  privacy: PrivacyName;
@@ -33,10 +32,8 @@ export interface DocFieldsDTO {
33
32
  extensions?: Record<string, Record<string, unknown>>;
34
33
  rules?: import('./docs.js').DeliveryRuleDTO[];
35
34
  }
36
- export interface DocumentReadDTO {
37
- state: 'object';
38
- type: 'document';
39
- object: ObjectDTO;
35
+ /** `data` of a document read. */
36
+ export interface DocumentReadData {
40
37
  summary: string | null;
41
38
  revision: number;
42
39
  heads: DocHeadDTO[];
@@ -49,29 +46,23 @@ export interface DocumentReadDTO {
49
46
  attachments?: string;
50
47
  fields?: DocFieldsDTO;
51
48
  }
52
- export interface NodeReadDTO {
53
- state: 'object';
54
- type: 'node';
55
- object: ObjectDTO;
49
+ /** `data` of a node read. */
50
+ export interface NodeReadData {
56
51
  status: string;
57
52
  mandate_first_line: string;
58
53
  children: ObjectDTO[];
59
54
  owned: ObjectDTO[];
60
55
  jobs: ObjectDTO[];
61
56
  }
62
- export interface JobReadDTO {
63
- state: 'object';
64
- type: 'job';
65
- object: ObjectDTO;
57
+ /** `data` of a job read. */
58
+ export interface JobReadData {
66
59
  command: string;
67
60
  status: string;
68
61
  exit_code: number | null;
69
62
  log_path: string;
70
63
  }
71
- export interface OwnerReadDTO {
72
- state: 'object';
73
- type: 'person' | 'app' | 'repo' | 'profile';
74
- object: ObjectDTO;
64
+ /** `data` of a person, app, repo or profile read. */
65
+ export interface OwnerReadData {
75
66
  handle: string;
76
67
  display_name: string;
77
68
  identity: {
@@ -79,6 +70,15 @@ export interface OwnerReadDTO {
79
70
  external_id: string;
80
71
  };
81
72
  }
73
+ /** A live object: `text` is exactly what `crtr canvas read` prints; `data` holds the kind's
74
+ * structured fields (for the built-in kinds, the `*ReadData` shapes above). */
75
+ export interface ObjectLiveReadDTO {
76
+ state: 'object';
77
+ type: string;
78
+ object: ObjectDTO;
79
+ text: string;
80
+ data: Record<string, unknown>;
81
+ }
82
82
  /** A pointer to a deleted object resolves to that object (§8); an answer, not an error. */
83
83
  export interface ObjectDeletedDTO {
84
84
  state: 'deleted';
@@ -89,12 +89,13 @@ export interface ObjectRemoteDTO {
89
89
  state: 'remote';
90
90
  remote: string;
91
91
  }
92
- export type ObjectReadDTO = DocumentReadDTO | NodeReadDTO | JobReadDTO | OwnerReadDTO | ObjectDeletedDTO | ObjectRemoteDTO;
92
+ export type ObjectReadDTO = ObjectLiveReadDTO | ObjectDeletedDTO | ObjectRemoteDTO;
93
93
  export interface ObjectReadQuery {
94
94
  fields?: boolean;
95
95
  }
96
96
  export interface ObjectListRequest {
97
- type?: ObjectTypeName;
97
+ /** A kind name. */
98
+ type?: string;
98
99
  kind?: string;
99
100
  /** An owner ref (name or id). */
100
101
  owner?: string;
@@ -118,7 +119,8 @@ export interface ObjectSearchRequest {
118
119
  text: string;
119
120
  body?: boolean;
120
121
  grep?: string;
121
- type?: ObjectTypeName;
122
+ /** A kind name. */
123
+ type?: string;
122
124
  kind?: string;
123
125
  owner?: string;
124
126
  limit?: number;
@@ -1 +1 @@
1
- const o=["document","node","job","person","app","repo","profile"],e=["public","friends","private"];export{o as OBJECT_TYPES,e as PRIVACY_LEVELS_DTO};
1
+ const e=["public","friends","private"];export{e as PRIVACY_LEVELS_DTO};
@@ -1 +1 @@
1
- var k=Object.defineProperty;var i=(o,r)=>k(o,"name",{value:r,configurable:!0});import{APIError as C}from"../../../api/errors.js";import{cliClient as v}from"../../../commands/api-client.js";import{setDocLinkContext as y}from"../render/doc-links.js";import{DOC_SAVEBACK_ENV as g,documentForPath as h,materializeDocument as b,saveDocumentEdit as E,saveOutcomeNotice as L}from"./doc-materialize.js";async function w(o){const r=await v().objects.read(o);if(r.state!=="object"||r.type!=="document")return`${o} is not a readable document`;const n=r;if(n.needs_merge||n.bodies.length!==1)return`${o} has ${n.heads.length} heads and needs a merge`;const s=n.object.owner?.handle;return{id:n.object.id,name:s===void 0?n.object.name:`${s}/${n.object.name}`,revision:n.revision,heads_key:n.heads.map(d=>d.rev_id).sort().join(","),body:n.bodies[0]}}i(w,"readSnapshot");function z(o){const r=new Map,n=new Map,s=new Set,d=new Set;let m=!1,f=!1,l=!1;const j=i(()=>{m||f||(f=!0,o.canvasSource.listNodes().then(t=>{for(const e of t)r.set(e.node_id,e.name);m=!0,l||o.refresh()}).catch(()=>{m=!0}).finally(()=>{f=!1}))},"loadRoster"),N=i(t=>{o.remote||s.has(t)||d.has(t)||(s.add(t),w(t).then(e=>{if(typeof e=="string"){d.add(t);return}n.set(t,b(t,e)),l||o.refresh()}).catch(()=>{d.add(t)}).finally(()=>{s.delete(t)}))},"materialize"),S={selfNodeId:o.selfNodeId,nodeName:i(t=>{const e=r.get(t);return e===void 0&&j(),e},"nodeName"),pathFor:i(t=>{const e=n.get(t);return e===void 0&&N(t),e},"pathFor")};return y(S),{isDocumentPath:i(t=>h(t)!==void 0,"isDocumentPath"),async prepareOpen(t){if(o.remote)return{notice:"Opening a document is unavailable in a remote attach"};const e=h(t);if(e===void 0)return{notice:"Not a document link"};try{const a=await w(e.id);if(typeof a=="string")return{notice:a};const c=b(e.ref,a);return n.set(e.ref,c),{path:c}}catch(a){return{notice:`Could not read ${e.name}: ${a instanceof Error?a.message:String(a)}`}}},async consumeSaveBack(t){const e=process.env[g];if(e===void 0||e==="")return;delete process.env[g];const a=h(e),c=await E(e,async(_,$,D)=>{try{return{revision:(await v().docs.edit(_,{body:$,base:D,rationale:"edited by the person in the attach viewer"})).revision}}catch(u){if(u instanceof C&&u.code==="stale_revision")return"stale";throw u}}),p=L(a?.name??e,c);p!==void 0&&t(p)},dispose(){l=!0,y(void 0)}}}i(z,"createDocumentLinks");export{z as createDocumentLinks};
1
+ var k=Object.defineProperty;var i=(n,o)=>k(n,"name",{value:o,configurable:!0});import{APIError as C}from"../../../api/errors.js";import{cliClient as v}from"../../../commands/api-client.js";import{setDocLinkContext as y}from"../render/doc-links.js";import{DOC_SAVEBACK_ENV as g,documentForPath as h,materializeDocument as b,saveDocumentEdit as E,saveOutcomeNotice as L}from"./doc-materialize.js";async function w(n){const o=await v().objects.read(n);if(o.state!=="object"||o.type!=="document")return`${n} is not a readable document`;const a=o.data;if(a.needs_merge||a.bodies.length!==1)return`${n} has ${a.heads.length} heads and needs a merge`;const s=o.object.owner?.handle;return{id:o.object.id,name:s===void 0?o.object.name:`${s}/${o.object.name}`,revision:a.revision,heads_key:a.heads.map(d=>d.rev_id).sort().join(","),body:a.bodies[0]}}i(w,"readSnapshot");function z(n){const o=new Map,a=new Map,s=new Set,d=new Set;let m=!1,f=!1,l=!1;const j=i(()=>{m||f||(f=!0,n.canvasSource.listNodes().then(t=>{for(const e of t)o.set(e.node_id,e.name);m=!0,l||n.refresh()}).catch(()=>{m=!0}).finally(()=>{f=!1}))},"loadRoster"),N=i(t=>{n.remote||s.has(t)||d.has(t)||(s.add(t),w(t).then(e=>{if(typeof e=="string"){d.add(t);return}a.set(t,b(t,e)),l||n.refresh()}).catch(()=>{d.add(t)}).finally(()=>{s.delete(t)}))},"materialize"),S={selfNodeId:n.selfNodeId,nodeName:i(t=>{const e=o.get(t);return e===void 0&&j(),e},"nodeName"),pathFor:i(t=>{const e=a.get(t);return e===void 0&&N(t),e},"pathFor")};return y(S),{isDocumentPath:i(t=>h(t)!==void 0,"isDocumentPath"),async prepareOpen(t){if(n.remote)return{notice:"Opening a document is unavailable in a remote attach"};const e=h(t);if(e===void 0)return{notice:"Not a document link"};try{const r=await w(e.id);if(typeof r=="string")return{notice:r};const c=b(e.ref,r);return a.set(e.ref,c),{path:c}}catch(r){return{notice:`Could not read ${e.name}: ${r instanceof Error?r.message:String(r)}`}}},async consumeSaveBack(t){const e=process.env[g];if(e===void 0||e==="")return;delete process.env[g];const r=h(e),c=await E(e,async(_,$,D)=>{try{return{revision:(await v().docs.edit(_,{body:$,base:D,rationale:"edited by the person in the attach viewer"})).revision}}catch(u){if(u instanceof C&&u.code==="stale_revision")return"stale";throw u}}),p=L(r?.name??e,c);p!==void 0&&t(p)},dispose(){l=!0,y(void 0)}}}i(z,"createDocumentLinks");export{z as createDocumentLinks};