@agimon-ai/po-team 0.0.0-alpha.13 → 0.0.0-alpha.15

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.
@@ -21,7 +21,7 @@ let node_path = require("node:path");
21
21
  node_path = require_atomicJson.__toESM(node_path, 1);
22
22
  let node_os = require("node:os");
23
23
  node_os = require_atomicJson.__toESM(node_os, 1);
24
- let _agimon_ai_po_core_serverFacet = require("@agimon-ai/po-core/serverFacet");
24
+ let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
25
25
  let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile");
26
26
  let _agimon_ai_po_core_backgroundWork = require("@agimon-ai/po-core/backgroundWork");
27
27
  let _agimon_ai_po_core_childSession = require("@agimon-ai/po-core/childSession");
@@ -1103,6 +1103,12 @@ function toModelInfo(model) {
1103
1103
  thinkingLevelMap: model.thinkingLevelMap
1104
1104
  };
1105
1105
  }
1106
+ /** The parent's authenticated models as the host lists them now; only the parent model when it cannot list. */
1107
+ async function availableModelInfos(execution) {
1108
+ const models = await execution.getAvailableModels?.();
1109
+ if (models) return models.map(toModelInfo);
1110
+ return execution.model ? [toModelInfo(execution.model)] : [];
1111
+ }
1106
1112
  function splitKnownThinkingSuffix(model) {
1107
1113
  const colonIdx = model.lastIndexOf(THINKING_SUFFIX_SEPARATOR);
1108
1114
  if (colonIdx === -1) return {
@@ -1848,14 +1854,13 @@ const DEFAULT_PARALLEL_CONCURRENCY = 4;
1848
1854
  * soon as its child confirms it started, and the child then runs detached. So
1849
1855
  * `runWithConcurrency` throttles how fast children are STARTED, not how many
1850
1856
  * are running - `{tasks: [8], concurrency: 4}` ends up with eight live model
1851
- * processes, not four. 8 matches the sibling implementation's
1852
- * `PI_TEAM_MATE_MAX_PARALLEL`.
1857
+ * processes, not four. 30 lets one call fan a whole swarm out.
1853
1858
  *
1854
1859
  * This is a per-call declaration limit and nothing more. What actually bounds
1855
1860
  * live children across concurrent calls is `AdmissionGate`
1856
1861
  * (`runs/shared/admissionGate.ts`), which every spawn passes through.
1857
1862
  */
1858
- const DEFAULT_PARALLEL_MAX_TASKS = 8;
1863
+ const DEFAULT_PARALLEL_MAX_TASKS = 30;
1859
1864
  /**
1860
1865
  * Process-wide ceiling on children ALIVE at once.
1861
1866
  *
@@ -2592,7 +2597,7 @@ function createDelegationBridge(deps) {
2592
2597
  sessionScope: session.sessionScope,
2593
2598
  parentSessionId: session.sessionId,
2594
2599
  ...forkRequestFields(forkSource),
2595
- availableModels: session.availableModels,
2600
+ availableModels: await session.availableModels(),
2596
2601
  ...session.parentModel ? { parentModel: session.parentModel } : {}
2597
2602
  }, deps.loadConfig())).outcomes[0];
2598
2603
  if (!outcome?.runId) {
@@ -4854,7 +4859,6 @@ function createHeadlessSubagentTool(runtime, initialExecution) {
4854
4859
  async execute(_toolCallId, parameters, signal, onUpdate, execution = initialExecution) {
4855
4860
  try {
4856
4861
  const params = validateParams(parameters);
4857
- const availableModels = execution.getAvailableModels?.().map(toModelInfo) ?? (execution.model ? [toModelInfo(execution.model)] : []);
4858
4862
  if (params.action === require_subagentTool.SUBAGENT_ACTIONS.agents) {
4859
4863
  const scope = scopeOf(params.scope);
4860
4864
  const agents = runtime.discovery.discover(params.cwd ?? execution.cwd, scope).agents;
@@ -4890,7 +4894,7 @@ function createHeadlessSubagentTool(runtime, initialExecution) {
4890
4894
  parentSessionId: execution.sessionId,
4891
4895
  ...params.concurrency === void 0 ? {} : { concurrency: params.concurrency },
4892
4896
  ...params.artifacts === void 0 ? {} : { artifacts: params.artifacts },
4893
- availableModels,
4897
+ availableModels: await availableModelInfos(execution),
4894
4898
  ...execution.model ? { parentModel: execution.model } : {},
4895
4899
  ...parentForkSource ? { parentForkSource } : {}
4896
4900
  }, loadConfig().config);
@@ -5277,7 +5281,7 @@ function buildCompletionDetails(result) {
5277
5281
  * The custom-message type the parent renders completions under. The literal is
5278
5282
  * shared by the producer here and the TUI renderer registered for it
5279
5283
  * (`(frontend)/message/_lib/subagent-notify.cli.ts`, which draws through
5280
- * `completionNotice.ts`), and by the headless facet, which persists the same
5284
+ * `completionNotice.ts`), and by the server plugin, which persists the same
5281
5285
  * type as a session entry so a cockpit transcript records what was delivered.
5282
5286
  */
5283
5287
  const SUBAGENT_NOTIFY_MESSAGE_TYPE = "subagent-notify";
@@ -6261,9 +6265,9 @@ function recordDelegationObservation(telemetry, observation) {
6261
6265
  }
6262
6266
  const root = (0, _agimon_ai_po_core_extensionFile.defineRoot)(({ context, host: serverHost, agent: host }) => {
6263
6267
  if (!host) throw new Error("Team session requires the headless host.");
6264
- if (serverHost.context.environment === void 0) throw new Error("Team headless facet requires an admitted session environment.");
6268
+ if (serverHost.context.environment === void 0) throw new Error("Team server plugin requires an admitted session environment.");
6265
6269
  const directEvents = serverHost.context.directEvents;
6266
- if (directEvents === void 0) throw new Error("Team headless facet requires host-owned direct events.");
6270
+ if (directEvents === void 0) throw new Error("Team server plugin requires host-owned direct events.");
6267
6271
  const execution = {
6268
6272
  ...host.context,
6269
6273
  get model() {
@@ -6381,9 +6385,7 @@ const root = (0, _agimon_ai_po_core_extensionFile.defineRoot)(({ context, host:
6381
6385
  sessionScope: scope,
6382
6386
  cwd: execution.cwd,
6383
6387
  environment: serverHost.context.environment,
6384
- get availableModels() {
6385
- return execution.getAvailableModels?.().map(toModelInfo) ?? (execution.model ? [toModelInfo(execution.model)] : []);
6386
- },
6388
+ availableModels: () => availableModelInfos(execution),
6387
6389
  get parentModel() {
6388
6390
  return execution.model;
6389
6391
  },
@@ -6812,7 +6814,7 @@ function createTeamSessionApi(runtime, execution) {
6812
6814
  environment: execution.environment,
6813
6815
  parentSessionId: execution.sessionId,
6814
6816
  ...parentForkSource ? { parentForkSource } : {},
6815
- availableModels: execution.model ? [toModelInfo(execution.model)] : [],
6817
+ availableModels: await availableModelInfos(execution),
6816
6818
  ...execution.model ? { parentModel: execution.model } : {},
6817
6819
  sender: HUMAN_SENDER
6818
6820
  }, loadConfig().config)).outcomes[0];
@@ -6856,7 +6858,7 @@ var sessionStart_server_default = (0, _agimon_ai_po_core_extensionFile.defineHoo
6856
6858
  * `TeamMemberContext`, whose `token` is a session capability documented as never
6857
6859
  * leaving the direct context. A context resource is pasted into the system prompt,
6858
6860
  * sent to the provider and persisted, so the raw struct must not be serialized here.
6859
- * `formatTeamContextSnapshot` is the same projection the Pi facet renders.
6861
+ * `formatTeamContextSnapshot` is the same projection the Pi extension renders.
6860
6862
  */
6861
6863
  var team_server_default$1 = (context) => ({
6862
6864
  name: "po/team",
@@ -6878,21 +6880,24 @@ var subagent_server_default = (0, _agimon_ai_po_core_extensionFile.defineServerT
6878
6880
  //#endregion
6879
6881
  //#region generated/server.ts
6880
6882
  const at = (value, context) => typeof value === "function" ? value(context) : value;
6883
+ /* v8 ignore next -- generated normalization branch */
6884
+ const defined = (values) => values.filter((value) => value !== void 0);
6881
6885
  const via = (identity, value) => value === void 0 ? void 0 : {
6882
6886
  ...identity,
6883
6887
  ...value
6884
6888
  };
6885
- const facet = (0, _agimon_ai_po_core_serverFacet.defineServerPlugin)({
6889
+ const serverPlugin = (0, _agimon_ai_po_core_serverPlugin.defineServerPlugin)({
6886
6890
  name: "@agimon-ai/po-team",
6887
- providerOverrides: (0, _agimon_ai_po_core_serverFacet.composeServerProviderOverrides)(root_server_default),
6891
+ providerOverrides: (0, _agimon_ai_po_core_serverPlugin.composeServerProviderOverrides)(root_server_default),
6892
+ injects: (0, _agimon_ai_po_core_extensionFile.composeRootInjects)({ session: [root_server_default] }),
6888
6893
  global: () => ({ get channels() {
6889
6894
  return [() => via({ frameType: "subagent_catalog" }, subagent_catalog_server_default()), () => via({ frameType: "subagent_runs" }, subagent_runs_server_default())];
6890
6895
  } }),
6891
- workspace: () => ({ get channels() {
6892
- return [() => via({ frameType: "subagent_catalog" }, subagent_catalog_server_default()), () => via({ frameType: "subagent_runs" }, subagent_runs_server_default())];
6896
+ workspace: (context) => ({ get channels() {
6897
+ 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())]);
6893
6898
  } }),
6894
6899
  session: async (context) => {
6895
- const scopeSession = await root_server_default(context);
6900
+ const scopeSession = await context.scopeRoot("session", root_server_default, context);
6896
6901
  const contextSession = {
6897
6902
  ...context,
6898
6903
  root: scopeSession.value
@@ -6903,7 +6908,7 @@ const facet = (0, _agimon_ai_po_core_serverFacet.defineServerPlugin)({
6903
6908
  return [at(route_server_default, contextSession)];
6904
6909
  },
6905
6910
  get channels() {
6906
- return [() => via({ frameType: "subagent_catalog" }, subagent_catalog_server_default()), () => via({ frameType: "subagent_runs" }, subagent_runs_server_default())];
6911
+ 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())]);
6907
6912
  },
6908
6913
  get hooks() {
6909
6914
  return [via({ event: "session_start" }, at(sessionStart_server_default, contextSession))];
@@ -6922,7 +6927,7 @@ const facet = (0, _agimon_ai_po_core_serverFacet.defineServerPlugin)({
6922
6927
  }
6923
6928
  });
6924
6929
  //#endregion
6925
- exports.default = facet;
6926
- exports.facet = facet;
6930
+ exports.default = serverPlugin;
6931
+ exports.serverPlugin = serverPlugin;
6927
6932
 
6928
6933
  //# sourceMappingURL=server.cjs.map