@agimon-ai/po-team 0.0.0-alpha.160 → 0.0.0-alpha.162

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 CHANGED
@@ -1,23 +1,12 @@
1
1
  # @agimon-ai/po-team
2
2
 
3
- Discover agents, run them in the background, exchange messages, and enforce model and tool policy.
3
+ Discover agents, run them in the background, exchange messages, and apply model and tool policy. Requires Node.js 24 or newer and a Po server host. Run and policy contracts are alpha.
4
4
 
5
- Part of the [Po distribution](https://www.npmjs.com/package/@agimon-ai/po).
5
+ Team owns agents and runs, not Task's graph. With both selected, Team fulfills delegation requests while Task remains the source of truth for task status and dependencies.
6
6
 
7
- Team does not own Task's graph. When both packages are loaded, Team fulfills Task delegation
8
- requests while Task remains the source of truth for task status and dependencies.
7
+ ## Enable
9
8
 
10
- > **Alpha:** run, policy, and intercom contracts may change between releases.
11
-
12
- ## Requirements
13
-
14
- - Node.js 24 or newer
15
- - `@earendil-works/pi-agent-core`, `@earendil-works/pi-ai`,
16
- `@earendil-works/pi-coding-agent` 1.0.2
17
-
18
- ## Install
19
-
20
- Define a layer and select it in `.po/modes.yaml`. Add Task separately for graph-backed delegation:
9
+ Define a layer in `.po/modes.yaml` and select it in a major mode, then run `po sync`:
21
10
 
22
11
  ```yaml
23
12
  layers:
@@ -30,144 +19,50 @@ layers:
30
19
  - model: provider/model-id
31
20
  thinking: high
32
21
  excludeTools: [ask_user_question]
33
-
34
22
  majorMode:
35
23
  development:
36
- description: Development with tasks and delegated agents.
24
+ description: Tasks and delegated agents.
37
25
  layers: [coordination]
38
26
  ```
39
27
 
40
- Team-only sessions can launch and manage agents directly; they simply have no Task-owned graph to
41
- update.
42
-
43
- ## Commands and tools
44
-
45
- Slash commands include:
46
-
47
- ```text
48
- /run
49
- /parallel
50
- /subagents-doctor
51
- /subagents-steer <run-id> <message>
52
- /subagents-stop
53
- /subagents-list
54
- /subagents-fleet
55
- ```
56
-
57
- Use `/run` for one agent and `/parallel` for several. `/subagents-doctor` reports diagnostics,
58
- `/subagents-steer` sends guidance to a running agent, and `/subagents-stop` requests a stop.
59
- `/subagents-list` shows available agents, and `/subagents-fleet` shows current runs.
60
-
61
- The `subagent` tool exposes `agents`, `run`, `status`, `steer`, and `stop`.
62
- The `intercom` tool exposes `members`, `send`, `ask`, `pending`, and `reply`.
28
+ Task is optional. Team-only sessions can launch and manage agents directly without a stored task graph.
63
29
 
64
- `ask` is asynchronous in every direction (child to main, main to child, child to sibling). It
65
- returns at once with a `requestId`. The answer arrives later as an intercom message that wakes the
66
- asker. A child with an open ask stays alive after its turn ends. If no reply lands within 180
67
- seconds, the asker gets one notice and a turn to decide: keep working, ask again, or finish. The ask
68
- stays open, so a late reply still lands while the asker is alive. If the target finishes without
69
- replying, the asker is told right away.
30
+ ## Run and communicate
70
31
 
71
- ## Run lifecycle
32
+ The `subagent` tool discovers agents, starts runs, reads status, steers and stops them. Runs return an ID immediately; completion or failure arrives later. Check status before retrying an interrupted operation so work is not launched twice.
72
33
 
73
- Runs are asynchronous. The parent receives a run identifier and later completion or failure rather
74
- than an inline child transcript. A native child is a conversation in its parent session's own
75
- storage, so it survives a restart: when the session reopens, the child resumes where it stopped and
76
- its completion still reaches the parent once. External CLI execution is retired. Team runs use
77
- the native Pi child-session service.
34
+ Slash commands include `/run`, `/parallel`, `/subagents-doctor`, `/subagents-steer`, `/subagents-stop`, `/subagents-list` and `/subagents-fleet`. The [Team code-mode guide](src/prompts/codemode-how-to-team/SKILL.md) explains how to inspect state before choosing a control action.
78
35
 
79
- ## Agent identity
36
+ Each agent receives a unique identity such as `alan-reviewer-3`. Use the exact identity returned by discovery or status, not a guessed label. Run IDs remain valid and take precedence if a name collides. The root session owns results, membership and control messages.
80
37
 
81
- Every spawned agent is given a generated identity of the form `{name}-{role}-{number}`, for example
82
- `alan-reviewer-3`. The role comes from the agent name with its package prefix dropped, and the number
83
- counts every agent in the session, so no two agents share an identity. An agent defined inline, with
84
- no agent file on disk, is shown as `bea-developer-2 (inline)`.
38
+ `intercom` exchanges messages with native team members. `ask` returns immediately with a request ID; the reply wakes the asker later. An open ask keeps a child alive after its turn. After 180 seconds without an answer, one reminder lets it decide whether to continue, ask again or finish. A late answer can still arrive while the asker is alive. If the recipient finishes without answering, the asker is notified.
85
39
 
86
- The identity is the intercom member id, not a label beside one, so a peer can address exactly what it
87
- is shown:
40
+ When code mode supplies `network`, use that namespace to message other sessions; intercom then reaches only the current team. Session peers use durable sends rather than team ask/reply semantics outside that namespace.
88
41
 
89
- ```text
90
- intercom({ action: "send", to: "alan-reviewer-3", message: "..." })
91
- subagent({ action: "status", id: "alan-reviewer-3" })
92
- ```
42
+ Native child conversations live in the parent session's storage and resume after reopening, with completion delivered to the parent. External CLI execution is retired.
93
43
 
94
- Run ids keep working everywhere, and they win when a name and an id collide. Identities are unique
95
- within one root session and are not reused when a run ends.
96
- The root session scopes run results, transcripts, control inboxes, membership, and intercom. State
97
- is stored in private, per-user temporary directories with per-session subdirectories. Launch
98
- contracts can contain full prompts and are written with private permissions, then removed after
99
- handoff. Intercom messages expire after 24 hours; liveness checks remove stale membership and run
100
- state.
44
+ ## Model, tool and trust policy
101
45
 
102
- ## Model and tool policy
46
+ Package configuration belongs on the Team entry. Later selected entries replace `models`; `excludeTools` values combine in layer order. Agent definitions, explicit launch options, Team policy and provider availability determine the final model and tools.
103
47
 
104
- Package configuration belongs on the Team package entry. When several selected entries contribute
105
- configuration, later entries replace the `models` list and `excludeTools` values are combined in
106
- layer order.
48
+ Children cannot exceed the parent's capability ceiling. They borrow permitted Po capabilities, including code mode and skill loading, but not tools marked `mainAgentOnly`. Planning restrictions apply to children too. An agent definition with an explicit `tools` list narrows its tool set further. Code-mode calls share parent-session namespaces, including browser state; they are not separate sandboxed environments.
107
49
 
108
- Agent configuration, explicit launch options, Team policy, and provider availability determine the
109
- final model and tools. A child cannot exceed the capability ceiling supplied by its parent or
110
- provider policy. Allowed MCP and stdio tools can execute commands, so treat agent definitions and
111
- the inherited environment as trusted configuration.
50
+ Treat agent definitions, inherited environments and granted MCP tools as trusted executable configuration. Tool restrictions are not operating-system isolation.
112
51
 
113
- A subagent borrows its parent's Po tools, code mode (`discover` and `exec`) and skill loading included,
114
- beside Pi's coding tools and any MCP tools it is granted. It does not get a tool that needs the person to
115
- answer (`ask_user_question`, `write_plan`, `complete_plan`), since nobody can answer a subagent, nor
116
- `subagent` and `intercom`, which act for the main agent; a tool opts out with `mainAgentOnly`. A subagent
117
- is never given a tool its parent is denied: while the parent is planning, `edit` and `write` are withheld
118
- from both. An agent file that lists `tools` gets only those. Code-mode runs share the session's namespaces,
119
- so a subagent and its parent see the same browser pages and task graph.
52
+ ## Task integration and inspection
120
53
 
121
- ## Task delegation bridge
54
+ Task submits pending, unblocked assignments. Team resolves the agent and policy, owns execution and cancellation, and returns the terminal result to Task. The Cordis `po/delegation`, `po/background-work` and `po/subagent-policy` connections disconnect and reconnect with their provider; they do not imply shared persistence.
122
55
 
123
- With Task installed:
124
-
125
- 1. Task selects a pending, unblocked task and sends a delegation request.
126
- 2. Team resolves the named agent, context, model, skills, and capability policy.
127
- 3. Team owns the background run, messaging, steering, and suspension.
128
- 4. Task records the terminal result on its own task.
129
-
130
- This is a named Cordis service relationship, not shared persistence. Team provides
131
- `po/delegation`, `po/background-work`, and `po/subagent-policy` for the
132
- active session. Consumers disconnect and reconnect automatically when that provider changes.
133
-
134
- ## Public API
135
-
136
- ```ts
137
- import { resolveSubagentLaunchContract } from '@agimon-ai/po-team';
138
- ```
139
-
140
- Focused subpaths include `/api/capability-ceiling`, `/api/delegation`, `/api/team-snapshot`,
141
- and `/env`. Live cross-extension collaboration contracts come from
142
- `@agimon-ai/po-core`.
56
+ When code mode is loaded, `team.members()` returns native members and `team.runs()` returns tracked runs. These detached snapshots omit capability tokens and delegation prompts. Finished runs drop off ten minutes after acknowledgement; token counts remain available while retained. The direct `subagent` and `intercom` tools remain available.
143
57
 
144
58
  ## Development
145
59
 
146
- Run from this package directory in the workspace:
147
-
148
60
  ```bash
149
- pnpm build
150
- pnpm typecheck
151
- pnpm test
152
- pnpm lint
61
+ pnpm exec nx run-many -t lint typecheck build test -p @agimon-ai/po-team
153
62
  ```
154
63
 
155
- Maintained by [Agimon](https://agimon.ai/about).
64
+ Routed declarations own contributions; the session's collaboration fiber owns registration and disposal. Public exports are declared in `package.json`, not an independent runtime entry.
156
65
 
157
66
  ## License
158
67
 
159
68
  Business Source License 1.1: free for personal use, organisations under USD 1M revenue, non-profits and education. See [LICENSE](LICENSE) and https://agimon.ai/licensing.
160
-
161
- ## Source and lifecycle
162
-
163
- The routed files own contribution registration. Team's collaboration service replaces session fibers explicitly, uses the injected session only when its session manager matches, and otherwise mounts in the standalone plugin context. Losing that injected session disposes its collaboration fiber.
164
-
165
- ## Read-only code-mode state
166
-
167
- When code mode is loaded, `team.members()` returns native members of this session
168
- (not peer sessions), and `team.runs()` returns tracked runs. Use JavaScript to filter
169
- these detached snapshots, for example `team.runs().find(run => run.runId === id)`.
170
- Finished runs drop off 10 minutes after acknowledgement. Run projections exclude
171
- paths and delegation prompts, and member snapshots exclude capability tokens.
172
- Usage token counts remain available as `tokens` on runs. No writer members are
173
- exposed. Direct `subagent` and `intercom` tools remain available and unchanged.
@@ -3504,26 +3504,14 @@ function createHeadlessIntercomTool(channel, sessions) {
3504
3504
  const senderName = sessions.name?.()?.trim() || sessions.sessionId;
3505
3505
  const toName = peer?.name.trim() || recipientId;
3506
3506
  const deliveryId = `intercom:${sessions.sessionId}:${toolCallId}`;
3507
- const receipt = await delivery.deliver({
3507
+ const receipt = await (0, _agimon_ai_po_session.sendSessionMessage)({
3508
+ delivery,
3508
3509
  deliveryId,
3509
- recipientKey: recipientId,
3510
- kind: TEAM_MESSAGE_CUSTOM_TYPE,
3511
- prompt: `Message from session ${senderName} via intercom.\n\n${message}\n\nYour chat reply does not reach the sender. Answer what it asks with intercom send to ${metadata?.sourceReference ?? sessions.sessionId}, and send no acknowledgements.`,
3512
- delivery: "steer",
3513
- metadata: {
3514
- ...metadata,
3515
- customType: TEAM_MESSAGE_CUSTOM_TYPE,
3516
- customDetails: JSON.stringify({
3517
- kind: "send",
3518
- from: {
3519
- name: senderName,
3520
- role: "session",
3521
- sessionId: metadata?.sourceReference ?? sessions.sessionId
3522
- },
3523
- message,
3524
- requestId: deliveryId
3525
- })
3526
- }
3510
+ recipient: recipientId,
3511
+ text: message,
3512
+ senderName,
3513
+ self: metadata?.sourceReference ?? sessions.sessionId,
3514
+ group: metadata
3527
3515
  });
3528
3516
  return {
3529
3517
  content: [{