@agimon-ai/po-config 0.0.0-alpha.83 → 0.0.0-alpha.85

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-config",
3
- "version": "0.0.0-alpha.83",
3
+ "version": "0.0.0-alpha.85",
4
4
  "description": "Typed configuration loading, validation, and host services for composing Po sessions.",
5
5
  "keywords": [
6
6
  "agent-configuration",
@@ -139,14 +139,14 @@
139
139
  "registry": "https://registry.npmjs.org/"
140
140
  },
141
141
  "dependencies": {
142
- "@agimon-ai/po-core": "0.0.0-alpha.83",
143
- "@agimon-ai/po-web-components": "0.0.0-alpha.83",
142
+ "@agimon-ai/po-core": "0.0.0-alpha.85",
143
+ "@agimon-ai/po-web-components": "0.0.0-alpha.85",
144
144
  "@deepseek-ai/cordis": "4.0.5",
145
145
  "typebox": "1.4.2",
146
146
  "yaml": "2.9.1"
147
147
  },
148
148
  "devDependencies": {
149
- "@agimon-ai/po-build": "0.0.0-alpha.83",
149
+ "@agimon-ai/po-build": "0.0.0-alpha.85",
150
150
  "@earendil-works/pi-coding-agent": "1.4.0",
151
151
  "@modelcontextprotocol/ext-apps": "2.0.3",
152
152
  "@modelcontextprotocol/server": "2.3.1",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: help-how-to-config
3
- description: Configure Po runtime settings, workspace declarations, source precedence, and typed session configuration. Use for config.yaml, workspaces.yaml, the po/config or po/workspace-registry Cordis services, immutable context snapshots, or shared selection transition state. Do not use for defining modes.yaml, domains.yaml, or profiles.yaml.
3
+ description: Configure Po runtime settings, workspace declarations and free-form metadata, source precedence, and typed session configuration. Use for config.yaml, workspaces.yaml, plugin metadata lookup through po/workspace-registry, workspace-scoped Cordis services, immutable context snapshots, or shared selection transition state. Do not use for defining modes.yaml, domains.yaml, or profiles.yaml.
4
4
  ---
5
5
 
6
6
  # Author Po runtime configuration
@@ -23,12 +23,25 @@ Configure runtime policy in `config.yaml`, declare workspaces in the repository'
23
23
 
24
24
  Use the package-owned Major Mode, Domain, or Profile Help skill when the task is to define an axis in `modes.yaml`, `domains.yaml`, or `profiles.yaml`.
25
25
 
26
- For workspaces, read the repository's `.po/workspaces.yaml` first. Its presence overrides the old
27
- `config.yaml` list, including an empty list; malformed new files are errors. Keep aliases unique
28
- within the file and paths canonically equal to the repository root in this version. Metadata is a
29
- free-form JSON object, checked and interpreted by each plugin. Never store credentials there.
30
- Use the injected `po/workspace-registry` instead of parsing files in plugins. Declaration names
31
- carry identity; changing one unlinks metadata from an already-created workspace. Core does not
32
- read `products.yaml` or enforce a plugin's scope.
26
+ ## Workspaces, metadata and services
27
+
28
+ Read the repository's `.po/workspaces.yaml` first. Its presence overrides the old `config.yaml`
29
+ list, including an empty list; malformed new files are errors. Keep aliases unique within the
30
+ file and paths canonically equal to the repository root in this version. Declaration names
31
+ carry identity; changing one unlinks metadata from an already-created workspace.
32
+
33
+ Metadata is a free-form JSON object for other plugins to leverage, not a product-specific
34
+ schema. Flat keys and plugin-namespaced blocks are both valid. Each consuming plugin validates
35
+ and interprets the fields it uses. Core does not read `products.yaml` or enforce a plugin's
36
+ scope. Never store credentials in metadata.
37
+
38
+ Inject `po/workspace-registry` through Cordis instead of parsing files in plugins. Resolve the
39
+ current `host.context.workspaceId` and read the returned workspace's metadata. Handle `missing`
40
+ and `ambiguous` results explicitly; a shared root path does not identify same-root siblings.
41
+
42
+ Registry lookup and workspace-scoped services are separate mechanisms. A plugin provides a
43
+ workspace-scoped service through `po/server-scope`; other plugins in that workspace and its
44
+ sessions consume it through normal Cordis injection. The registry exposes detached identity
45
+ and metadata records, not another workspace's Cordis context or service instances.
33
46
 
34
47
  Read [references/config-contract.md](references/config-contract.md) for the runtime and workspace schemas, source merge rules, immutable context, and transition contract.
@@ -70,6 +70,7 @@ workspaces:
70
70
  alias: product
71
71
  instructions: Focus on this product.
72
72
  metadata:
73
+ team: operations
73
74
  '@example/plugin': { projectId: 'product-id' }
74
75
  ```
75
76
 
@@ -81,9 +82,12 @@ strings preserved verbatim. Aliases are optional non-empty strings, unique withi
81
82
  canonically equal to that root (including equivalent symlinks). Subfolder and cross-repository
82
83
  paths fail explicitly. Multiple declarations share the root but have separate workspace ids.
83
84
 
84
- Metadata is a free-form JSON object. Plugin namespacing is conventional, not required. Core does
85
- not read `products.yaml`, validate plugin-specific blocks, select credentials or enforce tool
86
- scope. Each plugin decides its own policy. Never put credentials in metadata.
85
+ Metadata is a free-form JSON object for other plugins to leverage, not a product-specific schema.
86
+ Flat keys and plugin-namespaced blocks are both valid; namespacing is conventional, not required.
87
+ Core validates JSON compatibility, but does not read `products.yaml`, validate plugin-specific
88
+ blocks, select credentials or enforce tool scope. Each consuming plugin validates and interprets
89
+ the fields it uses and decides whether they supply defaults or enforced policy. Never put
90
+ credentials in metadata.
87
91
 
88
92
  An existing new document replaces the entire legacy list, including an empty list. Invalid or
89
93
  blank new documents fail instead of falling back. When absent, the repository `config.yaml`
@@ -97,10 +101,39 @@ workspaces. Metadata and aliases are not copied into `workspaces.json`. Instruct
97
101
  existing first-creation copy behavior. Renaming a declaration breaks its association with an
98
102
  existing workspace; aliases are lookup labels, not identity keys.
99
103
 
100
- Plugins inject `po/workspace-registry` through Cordis, then resolve their current
101
- `host.context.workspaceId`. The read-only service returns detached records and distinguishes
102
- `found`, `missing` and `ambiguous`. Same-root siblings are ambiguous by path; cross-file alias
103
- collisions are also ambiguous. It never returns another workspace's Cordis services.
104
+ #### Consuming metadata and workspace services
105
+
106
+ Plugins inject `po/workspace-registry` through Cordis instead of reading the YAML themselves:
107
+
108
+ ```ts
109
+ import { PO_WORKSPACE_REGISTRY_SERVICE, readPoWorkspaceRegistry } from '@agimon-ai/po-core/workspaceRegistry';
110
+
111
+ context.inject([PO_WORKSPACE_REGISTRY_SERVICE], async (context) => {
112
+ const registry = readPoWorkspaceRegistry(context)!;
113
+ const result = await registry.resolve({ id: host.context.workspaceId });
114
+ if (result.status !== 'found') return; // This optional integration stays inactive without a unique workspace.
115
+ const metadata = result.workspace.metadata;
116
+ // Validate the fields this plugin consumes before applying its defaults or policy.
117
+ });
118
+ ```
119
+
120
+ `list()` returns detached workspace records. `resolve()` accepts exactly one selector: `{ id }`,
121
+ `{ name }`, `{ path }` or `{ alias }`, and distinguishes `found`, `missing` and `ambiguous`.
122
+ Use the current workspace id for session-local integrations. Same-root siblings are ambiguous
123
+ by path; cross-file alias collisions are also ambiguous. Do not pick the first candidate.
124
+ An optional integration may stay inactive when resolution is not `found`; a required integration
125
+ must report the missing or ambiguous workspace instead of silently applying another workspace's policy.
126
+
127
+ Workspace-scoped services are separate from this registry. Their provider declares a contract
128
+ with `defineServiceContract(name, { scope: 'workspace' })` and binds it with
129
+ `requirePoServerScope(context).provide(contract, service)` from `@agimon-ai/po-core/serverPlugin`.
130
+ Other plugins in that workspace and its descendant sessions acquire the service through normal
131
+ Cordis `context.inject([contract.name], ...)` and `context.get(contract.name)`. A global scope
132
+ cannot see services provided below it, and sibling workspaces do not inherit one another's services.
133
+ Plugins can combine the current workspace's metadata with its injected services. The registry
134
+ itself is read-only inventory, not a cross-workspace service locator; it never returns another
135
+ workspace's Cordis context or services.
136
+
104
137
  The current edge host exposes only its admitted tenant id/root with empty metadata, since edge
105
138
  admission does not yet associate a tenant id with a declaration key.
106
139