@agentorg/cli 0.0.1 → 0.0.2

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 (90) hide show
  1. package/README.md +3 -3
  2. package/dist/src/bindings/mcp/encoding.js +1 -4
  3. package/dist/src/clients/cli/commands.js +1 -1
  4. package/dist/src/clients/cli/index.js +1 -1
  5. package/dist/src/clients/mcp/agent.d.ts +3 -5
  6. package/dist/src/clients/mcp/agent.js +10 -23
  7. package/dist/src/clients/mcp/command.d.ts +1 -1
  8. package/dist/src/clients/mcp/command.js +5 -11
  9. package/dist/src/clients/mcp/projects.d.ts +1 -2
  10. package/dist/src/clients/mcp/projects.js +5 -9
  11. package/dist/src/clients/mcp/sessions.d.ts +1 -5
  12. package/dist/src/clients/mcp/sessions.js +1 -10
  13. package/dist/src/clients/mcp/setup.js +4 -8
  14. package/dist/src/clients/mcp/waiter.d.ts +0 -2
  15. package/dist/src/clients/mcp/waiter.js +9 -20
  16. package/dist/src/domain/actors.js +3 -7
  17. package/dist/src/domain/attention.d.ts +8 -7
  18. package/dist/src/domain/attention.js +31 -47
  19. package/dist/src/domain/capabilities.js +0 -1
  20. package/dist/src/domain/claims.js +2 -2
  21. package/dist/src/domain/errors.d.ts +1 -1
  22. package/dist/src/domain/errors.js +1 -1
  23. package/dist/src/domain/index.d.ts +1 -15
  24. package/dist/src/domain/model/attention.d.ts +1 -5
  25. package/dist/src/domain/model/attention.js +5 -6
  26. package/dist/src/domain/model/builtins.d.ts +12 -179
  27. package/dist/src/domain/model/builtins.js +3 -6
  28. package/dist/src/domain/model/claims.d.ts +1 -3
  29. package/dist/src/domain/model/claims.js +1 -3
  30. package/dist/src/domain/model/index.d.ts +0 -7
  31. package/dist/src/domain/model/index.js +0 -3
  32. package/dist/src/domain/model/json-schema.d.ts +1 -4
  33. package/dist/src/domain/model/records.d.ts +0 -3
  34. package/dist/src/domain/model/records.js +3 -7
  35. package/dist/src/domain/model/system.d.ts +1 -5
  36. package/dist/src/domain/model/system.js +1 -5
  37. package/dist/src/domain/model/team.d.ts +4 -119
  38. package/dist/src/domain/model/team.js +8 -19
  39. package/dist/src/domain/model/workspace.d.ts +2 -86
  40. package/dist/src/domain/model/workspace.js +0 -1
  41. package/dist/src/domain/ports.d.ts +3 -4
  42. package/dist/src/domain/registry.d.ts +2 -16
  43. package/dist/src/domain/registry.js +22 -54
  44. package/dist/src/domain/system.js +1 -5
  45. package/dist/src/domain/team.d.ts +1 -1
  46. package/dist/src/domain/team.js +13 -33
  47. package/dist/src/domain/workspace.js +2 -10
  48. package/dist/src/home.d.ts +5 -5
  49. package/dist/src/home.js +6 -6
  50. package/dist/src/server/command.js +2 -2
  51. package/dist/src/server/index.d.ts +1 -1
  52. package/dist/src/server/index.js +2 -2
  53. package/dist/src/storage/sqlite/database.d.ts +5 -0
  54. package/dist/src/storage/sqlite/database.js +32 -1
  55. package/dist/src/storage/sqlite/index.js +1 -2
  56. package/dist/src/storage/sqlite/schema.d.ts +3 -4
  57. package/dist/src/storage/sqlite/schema.js +4 -4
  58. package/node_modules/@uniac/agentic-workspace/README.md +5 -5
  59. package/node_modules/@uniac/agentic-workspace/dist/examples/authority.d.ts +0 -1
  60. package/node_modules/@uniac/agentic-workspace/dist/examples/authority.js +3 -16
  61. package/node_modules/@uniac/agentic-workspace/dist/src/actors/index.d.ts +13 -13
  62. package/node_modules/@uniac/agentic-workspace/dist/src/actors/index.js +9 -25
  63. package/node_modules/@uniac/agentic-workspace/dist/src/contracts/common.d.ts +1 -9
  64. package/node_modules/@uniac/agentic-workspace/dist/src/contracts/common.js +2 -4
  65. package/node_modules/@uniac/agentic-workspace/dist/src/contracts/forms.d.ts +0 -13
  66. package/node_modules/@uniac/agentic-workspace/dist/src/contracts/forms.js +0 -3
  67. package/node_modules/@uniac/agentic-workspace/dist/src/contracts/messages.d.ts +0 -3
  68. package/node_modules/@uniac/agentic-workspace/dist/src/contracts/messages.js +3 -3
  69. package/node_modules/@uniac/agentic-workspace/dist/src/contracts/work.d.ts +2 -15
  70. package/node_modules/@uniac/agentic-workspace/dist/src/contracts/work.js +9 -14
  71. package/node_modules/@uniac/agentic-workspace/dist/src/mcp/index.js +1 -1
  72. package/node_modules/@uniac/agentic-workspace/dist/src/persistence/index.d.ts +1 -4
  73. package/node_modules/@uniac/agentic-workspace/dist/src/persistence/sqlite.js +2 -15
  74. package/node_modules/@uniac/agentic-workspace/dist/src/records.d.ts +0 -7
  75. package/node_modules/@uniac/agentic-workspace/dist/src/records.js +0 -14
  76. package/node_modules/@uniac/agentic-workspace/dist/src/work/asks.d.ts +20 -19
  77. package/node_modules/@uniac/agentic-workspace/dist/src/work/asks.js +39 -41
  78. package/node_modules/@uniac/agentic-workspace/dist/src/work/index.js +18 -24
  79. package/node_modules/@uniac/agentic-workspace/docs/contracts.md +23 -29
  80. package/node_modules/@uniac/agentic-workspace/docs/design.md +13 -13
  81. package/node_modules/@uniac/agentic-workspace/docs/hub-integration.md +25 -50
  82. package/node_modules/@uniac/agentic-workspace/package.json +1 -1
  83. package/package.json +3 -3
  84. package/skills/agentorg/SKILL.md +39 -38
  85. package/skills/agentorg/references/claude-code.md +3 -4
  86. package/vendor/uniac-agentic-workspace-0.0.2-8aebc44.tgz +0 -0
  87. package/vendor/workspace.json +6 -6
  88. package/dist/src/clients/mcp/levels.d.ts +0 -17
  89. package/dist/src/clients/mcp/levels.js +0 -7
  90. package/vendor/uniac-agentic-workspace-0.0.1-26fd0ee.tgz +0 -0
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * What concerns an Actor, read from the audited writes after its position, by the next mover.
3
- * On its records: Work given to it or changed by its requester, an answer to its
4
- * submission, an answer to its ask or the ask's raise, and a message to it. Routed to it, or to a
5
- * closed Actor it stands in for: an ask from a report or raised to it while the ask is open and
6
- * with it, and a submission of Work it requested while the submission waits. Closing an Actor gives
7
- * its stand-in an ask for each open ask the close re-routes and a review_due for each waiting
8
- * submission, from the Actor that closed it; a stand-in that closed it gets none, as its own
9
- * write. A read that finds nothing waits for the next audited write, up to `wait` seconds.
3
+ * On its records: Work given to it or changed by its requester, an answer to its submission, an
4
+ * answer to its ask, and a message to it. Routed to it: an ask on Work it requested while the ask
5
+ * is open and still routed to it, and a submission of Work it requested while the submission
6
+ * waits. The person also gets the asks on Work their asker requested itself or on no Work, and
7
+ * stands in for closed Actors: closing one gives it an ask for each open ask the close re-routes
8
+ * and a review_due for each waiting submission, from the Actor that closed it, or none when the
9
+ * person closed it, as its own write. A read that finds nothing waits for the next audited write,
10
+ * up to `wait` seconds.
10
11
  */
11
12
  import { Invalid, Refusal } from "./errors.js";
12
13
  import { ATTENTION } from "./model/index.js";
@@ -44,11 +45,17 @@ export function attention(registry, audit, workspace) {
44
45
  throw error;
45
46
  }
46
47
  }
47
- /** The Actor an open ask waits on: its last raiser's, else its asker's, nearest open manager. */
48
- function routeOf(ask) {
49
- const origin = ask.raises.at(-1)?.actorID ?? ask.requesterID;
50
- const manager = registry.get(origin)?.manager;
51
- return ask.status === "open" && manager ? registry.standIn(manager) : undefined;
48
+ /**
49
+ * The Actor an open ask waits on: its Work's requester, or the person when its asker requested
50
+ * the Work itself or it names no Work. A closed requester's asks go to the person.
51
+ */
52
+ function routeOf(ask, reads) {
53
+ if (ask.status !== "open")
54
+ return undefined;
55
+ const requester = ask.workID === undefined ? undefined : reads.work(ask.workID)?.requesterID;
56
+ return requester !== undefined && requester !== ask.requesterID
57
+ ? registry.standIn(requester)
58
+ : registry.root()?.id;
52
59
  }
53
60
  /**
54
61
  * Asks and Work as the caller reads them, with history, and what one read derives from them:
@@ -139,14 +146,8 @@ export function attention(registry, audit, workspace) {
139
146
  }));
140
147
  return works.get(id);
141
148
  },
142
- /** The open asks routed to the caller, and submitted Work requested in its branch. */
149
+ /** The open asks routed to the caller. */
143
150
  routing: once(() => all(caller, (clients, after) => clients.work.asks({ routedTo: caller.id, limit: 100, after }))),
144
- submitted: once(() => all(caller, (clients, after) => clients.work.list({
145
- requesterWithin: caller.id,
146
- status: ["submitted"],
147
- limit: 100,
148
- after,
149
- }))),
150
151
  };
151
152
  }
152
153
  /** Every page of a list the caller reads; none where it can't read it. */
@@ -162,17 +163,6 @@ export function attention(registry, audit, workspace) {
162
163
  after = found.next;
163
164
  }
164
165
  }
165
- /** Whether the walk from `actorID` up to its nearest open Actor passes `closed`. */
166
- function through(actorID, closed) {
167
- for (let at = actorID ? registry.get(actorID) : undefined; at;) {
168
- if (at.id === closed)
169
- return true;
170
- if (at.closed_at === null)
171
- return false;
172
- at = at.manager === null ? undefined : registry.get(at.manager);
173
- }
174
- return false;
175
- }
176
166
  /** What one entry did: the parties and records it touched, and the item it makes, if any. */
177
167
  function factOf(caller, entry, reads) {
178
168
  const touched = {
@@ -195,16 +185,18 @@ export function attention(registry, audit, workspace) {
195
185
  }
196
186
  }
197
187
  else if (entry.operation === "actor_create" || entry.operation === "actor_close") {
198
- touched.actorIDs.push(id, registry.get(id)?.manager);
199
- // A closed Actor's part passes to its nearest open manager: what was routed to it,
200
- // or on its way through it, is the caller's now.
188
+ touched.actorIDs.push(id);
189
+ // A closed Actor's part passes to the person: the asks on Work it requested, and the
190
+ // submissions of that Work, are the person's now.
201
191
  if (entry.operation === "actor_close" && registry.standIn(id) === caller.id) {
202
192
  for (const ask of reads.routing())
203
- if (through(registry.get(ask.raises.at(-1)?.actorID ?? ask.requesterID)?.manager, id))
193
+ if (ask.requesterID !== id &&
194
+ ask.workID !== undefined &&
195
+ reads.work(ask.workID)?.requesterID === id)
204
196
  items.push({ kind: "ask", title: ask.title, recordID: ask.formID });
205
- for (const work of reads.submitted())
206
- if (through(work.requesterID, id))
207
- items.push({ kind: "review_due", title: work.title, recordID: work.ticketID });
197
+ const submitted = all(caller, (clients, after) => clients.work.list({ requesterID: id, status: ["submitted"], limit: 100, after }));
198
+ for (const work of submitted)
199
+ items.push({ kind: "review_due", title: work.title, recordID: work.ticketID });
208
200
  }
209
201
  }
210
202
  else if (entry.operation.startsWith("work_")) {
@@ -219,21 +211,13 @@ export function attention(registry, audit, workspace) {
219
211
  touched.workIDs.push(ask.workID);
220
212
  title = ask.title;
221
213
  const asker = ask.requesterID === caller.id;
222
- const routed = routeOf(ask) === caller.id;
214
+ const routed = routeOf(ask, reads) === caller.id;
223
215
  // Only its asker and the Actor it routes to get items from an ask.
224
216
  const action = asker || routed ? reads.event(entry, ask.history)?.action : undefined;
225
- // Once raised, the ask reaches its route from the raise that sent it there.
226
- if (action === "created" && routed && ask.raises.length === 0)
217
+ if (action === "created" && routed)
227
218
  kind = "ask";
228
219
  else if (action === "responded" && asker)
229
220
  kind = "answer";
230
- else if (action === "raised") {
231
- const raisedTo = registry.get(entry.actor)?.manager;
232
- if (asker)
233
- kind = "raised";
234
- else if (routed && raisedTo && registry.standIn(raisedTo) === caller.id)
235
- kind = "ask";
236
- }
237
221
  }
238
222
  else if (work) {
239
223
  touched.workIDs.push(id);
@@ -24,7 +24,6 @@ export function capabilities(tools) {
24
24
  long_running: false,
25
25
  },
26
26
  read_only: !operation.definition.writes,
27
- level: operation.definition.level,
28
27
  },
29
28
  })),
30
29
  }));
@@ -32,8 +32,8 @@ export function claims(claimStore, registry, now) {
32
32
  const held = heldClaim(request.resource);
33
33
  if (!held)
34
34
  throw new NotFound(`nobody holds ${request.resource}`);
35
- if (held.holder !== actor.id && actor.manager !== null) {
36
- throw new Forbidden(`${heldMessage(held)}; only it or the root releases it`);
35
+ if (held.holder !== actor.id && registry.root()?.id !== actor.id) {
36
+ throw new Forbidden(`${heldMessage(held)}; only it or the person releases it`);
37
37
  }
38
38
  claimStore.remove(request.resource);
39
39
  return held;
@@ -14,7 +14,7 @@ export declare class Invalid extends Refusal {
14
14
  export declare class Forbidden extends Refusal {
15
15
  readonly code = "forbidden";
16
16
  }
17
- /** The records' state does not allow it, such as closing a position with open reports. */
17
+ /** The records' state does not allow it, such as a handle an open Actor already has. */
18
18
  export declare class Conflict extends Refusal {
19
19
  readonly code = "conflict";
20
20
  }
@@ -13,7 +13,7 @@ export class Invalid extends Refusal {
13
13
  export class Forbidden extends Refusal {
14
14
  code = "forbidden";
15
15
  }
16
- /** The records' state does not allow it, such as closing a position with open reports. */
16
+ /** The records' state does not allow it, such as a handle an open Actor already has. */
17
17
  export class Conflict extends Refusal {
18
18
  code = "conflict";
19
19
  }
@@ -15,7 +15,6 @@ export declare function organization(store: Store, options?: OrganizationOptions
15
15
  id: string;
16
16
  name: string;
17
17
  purpose: string;
18
- manager: string | null;
19
18
  created_at: string;
20
19
  closed_at: string | null;
21
20
  credential_hash: string;
@@ -24,7 +23,7 @@ export declare function organization(store: Store, options?: OrganizationOptions
24
23
  root: import("./ports.ts").ActorRow;
25
24
  credential: string;
26
25
  }>;
27
- create: (manager: string, name: string, purpose: string) => Promise<{
26
+ create: (name: string, purpose: string) => Promise<{
28
27
  actor: import("./ports.ts").ActorRow;
29
28
  credential: string;
30
29
  }>;
@@ -33,7 +32,6 @@ export declare function organization(store: Store, options?: OrganizationOptions
33
32
  id: string;
34
33
  name: string;
35
34
  purpose: string;
36
- manager: string | null;
37
35
  created_at: string;
38
36
  closed_at: string | null;
39
37
  credential_hash: string;
@@ -41,31 +39,19 @@ export declare function organization(store: Store, options?: OrganizationOptions
41
39
  found: (id: string) => import("./ports.ts").ActorRow;
42
40
  byCredential: (credential: string) => Promise<import("./ports.ts").ActorRow | undefined>;
43
41
  identify: (credential: string) => Promise<string | undefined>;
44
- reports: (manager: string) => {
45
- id: string;
46
- name: string;
47
- purpose: string;
48
- manager: string | null;
49
- created_at: string;
50
- closed_at: string | null;
51
- credential_hash: string;
52
- }[];
53
42
  open: () => {
54
43
  id: string;
55
44
  name: string;
56
45
  purpose: string;
57
- manager: string | null;
58
46
  created_at: string;
59
47
  closed_at: string | null;
60
48
  credential_hash: string;
61
49
  }[];
62
- within: (actorID: string, ancestorID: string) => boolean;
63
50
  standIn: (actorID: string) => string | undefined;
64
51
  close: (caller: import("./ports.ts").ActorRow, id: string) => {
65
52
  actor: import("./ports.ts").ActorRow;
66
53
  changed: boolean;
67
54
  };
68
- path: (actor: import("./ports.ts").ActorRow) => string;
69
55
  names: (ids: Iterable<string>) => Record<string, string>;
70
56
  };
71
57
  connections: {
@@ -10,7 +10,6 @@ export declare const AttentionItem: z.ZodObject<{
10
10
  ask: "ask";
11
11
  assigned: "assigned";
12
12
  message: "message";
13
- raised: "raised";
14
13
  review_due: "review_due";
15
14
  reviewed: "reviewed";
16
15
  updated: "updated";
@@ -30,7 +29,6 @@ export declare const Attention: z.ZodObject<{
30
29
  ask: "ask";
31
30
  assigned: "assigned";
32
31
  message: "message";
33
- raised: "raised";
34
32
  review_due: "review_due";
35
33
  reviewed: "reviewed";
36
34
  updated: "updated";
@@ -56,7 +54,6 @@ export declare const ATTENTION: {
56
54
  interfaces: {
57
55
  readonly attention: {
58
56
  readonly writes: false;
59
- readonly level: "report";
60
57
  readonly request: z.ZodObject<{
61
58
  since: z.ZodOptional<z.ZodString>;
62
59
  wait: z.ZodDefault<z.ZodNumber>;
@@ -68,7 +65,6 @@ export declare const ATTENTION: {
68
65
  ask: "ask";
69
66
  assigned: "assigned";
70
67
  message: "message";
71
- raised: "raised";
72
68
  review_due: "review_due";
73
69
  reviewed: "reviewed";
74
70
  updated: "updated";
@@ -88,7 +84,7 @@ export declare const ATTENTION: {
88
84
  }, z.core.$strict>;
89
85
  next: z.ZodString;
90
86
  }, z.core.$strict>;
91
- readonly description: "Read what concerns you since your last read. On your records: Work given to you or changed by its requester, an answer to your submission, an answer to your ask or its raise, and a message to you. Routed to you: an ask from a report or raised to you, and a submission of Work you requested, with those of a closed Actor you stand in for. Your own writes are not items. changed names the Actors, Work and conversations anyone's writes touched.\n\nReturns at once when there is something; otherwise it waits up to wait seconds. Pass the returned next as since to continue, and give the call a timeout longer than wait.";
87
+ readonly description: "Read what concerns you since your last read. On your records: Work given to you or changed by its requester, an answer to your submission, an answer to your ask, and a message to you. Routed to you: an ask on Work you requested, and a submission of Work you requested. The person also gets the asks on Work their asker requested itself or on no Work, and stands in for closed Actors. Your own writes are not items. changed names the Actors, Work and conversations anyone's writes touched.\n\nReturns at once when there is something; otherwise it waits up to wait seconds. Pass the returned next as since to continue, and give the call a timeout longer than wait.";
92
88
  };
93
89
  };
94
90
  };
@@ -21,11 +21,11 @@ export const AttentionRequest = z
21
21
  export const AttentionItem = z
22
22
  .strictObject({
23
23
  kind: z
24
- .enum(["assigned", "updated", "reviewed", "answer", "raised", "message", "ask", "review_due"])
25
- .describe("On your records: assigned (Work given to you), updated (Work you own, changed or cancelled by its requester), reviewed (your submission answered), answer (your ask answered, one per responder), raised (your ask passed one manager up), message (one to you). Routed to you: ask (from a report, raised to you, or passed to you by the close of an Actor it waited on, while it is open and still routed to you), review_due (a submission of Work you requested, or that a closed requester you stand in for requested, while it waits)."),
24
+ .enum(["assigned", "updated", "reviewed", "answer", "message", "ask", "review_due"])
25
+ .describe("On your records: assigned (Work given to you), updated (Work you own, changed or cancelled by its requester), reviewed (your submission answered), answer (your ask answered, one per responder), message (one to you). Routed to you: ask (on Work you requested; for the person, also on Work its asker requested itself or on no Work, or passed by the close of the Actor it waited on; while it is open and still routed to you), review_due (a submission of Work you requested, or for the person of Work a closed Actor requested, while it waits)."),
26
26
  recordID: z
27
27
  .string()
28
- .describe("The ticketID for assigned, updated, reviewed and review_due; the askID for answer, raised and ask; the messageID for message."),
28
+ .describe("The ticketID for assigned, updated, reviewed and review_due; the askID for answer and ask; the messageID for message."),
29
29
  from: z.strictObject({ actorID: Id, name: z.string() }).describe("Who wrote it."),
30
30
  title: z.string().describe("The ask's or the Work's title, or the message's first line."),
31
31
  at: Timestamp,
@@ -40,7 +40,7 @@ export const Attention = z
40
40
  .strictObject({
41
41
  actorIDs: z
42
42
  .array(Id)
43
- .describe("The parties of each write: a Work's owner, requester and previous owner, an ask's asker, a message's two Actors, and an Actor created or closed with its manager."),
43
+ .describe("The parties of each write: a Work's owner, requester and previous owner, an ask's asker, a message's two Actors, and an Actor created or closed."),
44
44
  workIDs: z.array(z.string()).describe("Work written, and the Work each written ask is on."),
45
45
  conversationIDs: z.array(z.string()).describe("Conversations a message was sent in."),
46
46
  })
@@ -51,10 +51,9 @@ export const Attention = z
51
51
  export const ATTENTION = toolDefinition("attention", {
52
52
  attention: {
53
53
  writes: false,
54
- level: "report",
55
54
  request: AttentionRequest,
56
55
  response: Attention,
57
- description: `Read what concerns you since your last read. On your records: Work given to you or changed by its requester, an answer to your submission, an answer to your ask or its raise, and a message to you. Routed to you: an ask from a report or raised to you, and a submission of Work you requested, with those of a closed Actor you stand in for. Your own writes are not items. changed names the Actors, Work and conversations anyone's writes touched.
56
+ description: `Read what concerns you since your last read. On your records: Work given to you or changed by its requester, an answer to your submission, an answer to your ask, and a message to you. Routed to you: an ask on Work you requested, and a submission of Work you requested. The person also gets the asks on Work their asker requested itself or on no Work, and stands in for closed Actors. Your own writes are not items. changed names the Actors, Work and conversations anyone's writes touched.
58
57
 
59
58
  Returns at once when there is something; otherwise it waits up to wait seconds. Pass the returned next as since to continue, and give the call a timeout longer than wait.`,
60
59
  },