@agimon-ai/po-team 0.0.0-alpha.28 → 0.0.0-alpha.29

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
@@ -110,6 +110,14 @@ final model and tools. A child cannot exceed the capability ceiling supplied by
110
110
  provider policy. Allowed MCP and stdio tools can execute commands, so treat agent definitions and
111
111
  the inherited environment as trusted configuration.
112
112
 
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.
120
+
113
121
  ## Task delegation bridge
114
122
 
115
123
  With Task installed:
@@ -153,3 +161,13 @@ Business Source License 1.1: free for personal use, organisations under USD 1M r
153
161
  ## Source and lifecycle
154
162
 
155
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.
@@ -27,6 +27,7 @@ let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile
27
27
  let _agimon_ai_po_config = require("@agimon-ai/po-config");
28
28
  let _agimon_ai_po_core_backgroundWork = require("@agimon-ai/po-core/backgroundWork");
29
29
  let _agimon_ai_po_core_childSession = require("@agimon-ai/po-core/childSession");
30
+ let _agimon_ai_po_core_codemode = require("@agimon-ai/po-core/codemode");
30
31
  let _agimon_ai_po_core_contextContributions = require("@agimon-ai/po-core/contextContributions");
31
32
  let _agimon_ai_po_core_mcpToolResolver = require("@agimon-ai/po-core/mcpToolResolver");
32
33
  let _agimon_ai_po_session = require("@agimon-ai/po-session");
@@ -3795,6 +3796,7 @@ function createHeadlessIntercomTool(channel, sessions) {
3795
3796
  return {
3796
3797
  name: "intercom",
3797
3798
  label: "Intercom",
3799
+ mainAgentOnly: true,
3798
3800
  description: "Communicate with active agents and related live sessions.",
3799
3801
  parameters: TeamToolParamsSchema,
3800
3802
  promptGuidelines: ["Send only new progress, blockers, or decisions. Do not repeat task briefs or delegation instructions.", "Use members to find related sessions by the names people give them, then send to that name or its session ID. Session peers use send, not ask/reply, and can send back."],
@@ -4888,6 +4890,7 @@ function createHeadlessSubagentTool(runtime, initialExecution) {
4888
4890
  return {
4889
4891
  name: "subagent",
4890
4892
  label: "Subagent",
4893
+ mainAgentOnly: true,
4891
4894
  description: SUBAGENT_DESCRIPTION,
4892
4895
  parameters: require_subagentTool.SubagentToolSchema,
4893
4896
  promptSnippet: "Discover, run, inspect, steer, and stop persistent subagents",
@@ -5690,6 +5693,92 @@ function teamCollaborationPlugin(ctx, config) {
5690
5693
  }, "@agimon-ai/po-team/collaboration");
5691
5694
  }
5692
5695
  //#endregion
5696
+ //#region src/services/teamNamespace/index.ts
5697
+ const DECLARATIONS = `interface TeamMember {
5698
+ name: string;
5699
+ role: 'main' | 'subagent';
5700
+ agent?: string;
5701
+ inline?: boolean;
5702
+ runId?: string;
5703
+ task?: { id: string; subject: string };
5704
+ }
5705
+ interface TeamRun {
5706
+ runId: string;
5707
+ agent?: string;
5708
+ identity?: string;
5709
+ status: string | undefined;
5710
+ startedAt?: number;
5711
+ updatedAt?: number;
5712
+ activityState?: 'starting' | 'working' | 'tool' | 'waiting_for_reply' | 'needs_attention' | 'finalizing' | 'active_long_running';
5713
+ attentionReason?: string;
5714
+ runtime?: string;
5715
+ native?: boolean;
5716
+ summary?: string;
5717
+ error?: string;
5718
+ tokens?: number;
5719
+ cost?: number;
5720
+ currentTool?: string;
5721
+ toolCount?: number;
5722
+ }
5723
+ declare const team: {
5724
+ /** Native team members in this session, not peer sessions. */
5725
+ members(): TeamMember[];
5726
+ /** Tracked runs. Finished runs drop off 10 minutes after acknowledgement. */
5727
+ runs(): TeamRun[];
5728
+ };`;
5729
+ /** Session-owned read-only state. Direct tools retain all mutation capabilities. */
5730
+ function createTeamNamespace(options) {
5731
+ return {
5732
+ name: "team",
5733
+ summary: "Read native team members and tracked runs in this session with team.members() and team.runs().",
5734
+ declarations: DECLARATIONS,
5735
+ bind(run) {
5736
+ if (run.sessionId !== options.sessionId) throw new Error("Team namespace belongs to another session.");
5737
+ let disposed = false;
5738
+ run.onDispose(() => {
5739
+ disposed = true;
5740
+ });
5741
+ const check = () => {
5742
+ run.signal.throwIfAborted();
5743
+ if (disposed) throw new Error("Team code-mode run is disposed.");
5744
+ options.assertAvailable();
5745
+ };
5746
+ const members = Object.create(null);
5747
+ members.members = () => {
5748
+ check();
5749
+ const snapshot = JSON.parse(JSON.stringify(require_teamSnapshot.readActiveTeamSnapshot(options.channel)?.members ?? []));
5750
+ check();
5751
+ return snapshot;
5752
+ };
5753
+ members.runs = () => {
5754
+ check();
5755
+ const runs = options.jobs.list().map((job) => ({
5756
+ runId: job.runId,
5757
+ agent: job.agent,
5758
+ identity: job.identity,
5759
+ status: job.status,
5760
+ startedAt: job.startedAt,
5761
+ updatedAt: job.updatedAt,
5762
+ activityState: job.activityState,
5763
+ attentionReason: job.attentionReason,
5764
+ runtime: job.runtime,
5765
+ native: job.native,
5766
+ summary: job.summary,
5767
+ error: job.error,
5768
+ tokens: job.tokens,
5769
+ cost: job.cost,
5770
+ currentTool: job.currentTool,
5771
+ toolCount: job.toolCount
5772
+ }));
5773
+ const snapshot = JSON.parse(JSON.stringify(runs));
5774
+ check();
5775
+ return snapshot;
5776
+ };
5777
+ return members;
5778
+ }
5779
+ };
5780
+ }
5781
+ //#endregion
5693
5782
  //#region src/services/managementActions/index.ts
5694
5783
  /**
5695
5784
  * Session-scoped management over in-memory run projections and typed controls.
@@ -6598,6 +6687,17 @@ const root = (0, _agimon_ai_po_core_extensionFile.defineRoot)(({ context, host:
6598
6687
  policies: runtime.capabilityPolicies,
6599
6688
  observeDelegation: (observation) => recordDelegationObservation(telemetry, observation)
6600
6689
  });
6690
+ providerContext.inject([_agimon_ai_po_core_codemode.PO_CODEMODE_SERVICE], (scoped) => {
6691
+ const registration = (0, _agimon_ai_po_core_codemode.readPoCodemode)(scoped)?.register("@agimon-ai/po-team", createTeamNamespace({
6692
+ sessionId: execution.sessionId,
6693
+ channel,
6694
+ jobs,
6695
+ assertAvailable: () => {
6696
+ if (disposing) throw new Error("Team session is disposing.");
6697
+ }
6698
+ }));
6699
+ return () => registration?.dispose();
6700
+ });
6601
6701
  providerContext.inject([_agimon_ai_po_config.PO_CONFIG_SERVICE], (configContext) => {
6602
6702
  const config = configContext.get(_agimon_ai_po_config.PO_CONFIG_SERVICE);
6603
6703
  if (!config) throw new Error("Team requires the session Po config service.");
@@ -7069,6 +7169,15 @@ var sessionStart_server_default = (0, _agimon_ai_po_core_extensionFile.defineHoo
7069
7169
  handle: () => root.restoreRuns()
7070
7170
  }));
7071
7171
  //#endregion
7172
+ //#region src/extensions/workspaces/sessions/(backend)/resource/po-use-team.server.ts
7173
+ var po_use_team_server_default = (0, _agimon_ai_po_core_extensionFile.defineResource)({
7174
+ name: "po-use-team",
7175
+ description: "Use @agimon-ai/po-team: see which native team members and tracked subagent runs this session has, and read their state in code mode before deciding to wait, steer, or stop a run.",
7176
+ kind: "skill",
7177
+ path: (0, _agimon_ai_po_core_serverPlugin.packageResourcePath)(require("url").pathToFileURL(__filename).href, "src/prompts/po-use-team/SKILL.md"),
7178
+ read: () => (0, _agimon_ai_po_core_serverPlugin.readPackageResource)(require("url").pathToFileURL(__filename).href, "src/prompts/po-use-team/SKILL.md")
7179
+ });
7180
+ //#endregion
7072
7181
  //#region src/extensions/workspaces/sessions/(backend)/resource/_lib/team.server.ts
7073
7182
  /**
7074
7183
  * The roster the model is allowed to see.
@@ -7109,11 +7218,11 @@ const serverPlugin = (0, _agimon_ai_po_core_serverPlugin.defineServerPlugin)({
7109
7218
  name: "@agimon-ai/po-team",
7110
7219
  providerOverrides: (0, _agimon_ai_po_core_serverPlugin.composeServerProviderOverrides)(root_server_default),
7111
7220
  injects: (0, _agimon_ai_po_core_extensionFile.composeRootInjects)({ session: [root_server_default] }),
7112
- global: () => ({ get channels() {
7113
- return [() => via({ frameType: "subagent_catalog" }, subagent_catalog_server_default()), () => via({ frameType: "subagent_runs" }, subagent_runs_server_default())];
7221
+ global: (context) => ({ get channels() {
7222
+ return [() => via({ frameType: "subagent_catalog" }, at(subagent_catalog_server_default, context)), () => via({ frameType: "subagent_runs" }, at(subagent_runs_server_default, context))];
7114
7223
  } }),
7115
7224
  workspace: (context) => ({ get channels() {
7116
- return defined([context.hosted("global") ? void 0 : () => via({ frameType: "subagent_catalog" }, subagent_catalog_server_default()), context.hosted("global") ? void 0 : () => via({ frameType: "subagent_runs" }, subagent_runs_server_default())]);
7225
+ return defined([context.hosted("global") ? void 0 : () => via({ frameType: "subagent_catalog" }, at(subagent_catalog_server_default, context)), context.hosted("global") ? void 0 : () => via({ frameType: "subagent_runs" }, at(subagent_runs_server_default, context))]);
7117
7226
  } }),
7118
7227
  session: async (context) => {
7119
7228
  const scopeSession = await context.scopeRoot("session", root_server_default, context);
@@ -7127,13 +7236,13 @@ const serverPlugin = (0, _agimon_ai_po_core_serverPlugin.defineServerPlugin)({
7127
7236
  return [at(route_server_default, contextSession)];
7128
7237
  },
7129
7238
  get channels() {
7130
- return defined([context.hosted("global") ? void 0 : () => via({ frameType: "subagent_catalog" }, subagent_catalog_server_default()), context.hosted("global") ? void 0 : () => via({ frameType: "subagent_runs" }, subagent_runs_server_default())]);
7239
+ return defined([context.hosted("global") ? void 0 : () => via({ frameType: "subagent_catalog" }, at(subagent_catalog_server_default, context)), context.hosted("global") ? void 0 : () => via({ frameType: "subagent_runs" }, at(subagent_runs_server_default, context))]);
7131
7240
  },
7132
7241
  get hooks() {
7133
7242
  return [via({ event: "session_start" }, at(sessionStart_server_default, contextSession))];
7134
7243
  },
7135
7244
  get resources() {
7136
- return [at(team_server_default, contextSession)];
7245
+ return [at(po_use_team_server_default, contextSession), at(team_server_default, contextSession)];
7137
7246
  },
7138
7247
  get tools() {
7139
7248
  return [via({ name: "intercom" }, at(intercom_server_default, contextSession)), via({ name: "subagent" }, at(subagent_server_default, contextSession))];