@agimon-ai/po-sandbox 0.0.0-alpha.21 → 0.0.0-alpha.210

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 (41) hide show
  1. package/LICENSE +110 -149
  2. package/README.md +75 -114
  3. package/dist/apiContracts.cjs.map +1 -1
  4. package/dist/apiContracts.d.mts +2 -2
  5. package/dist/extensionService-6rO7rH9c.mjs +22 -0
  6. package/dist/extensionService-6rO7rH9c.mjs.map +1 -0
  7. package/dist/extensionService-DKROEZa0.cjs +27 -0
  8. package/dist/extensionService-DKROEZa0.cjs.map +1 -0
  9. package/dist/extensions/mcp.cjs +6 -6
  10. package/dist/extensions/mcp.cjs.map +1 -1
  11. package/dist/extensions/mcp.mjs +6 -6
  12. package/dist/extensions/mcp.mjs.map +1 -1
  13. package/dist/extensions/server.cjs +1330 -349
  14. package/dist/extensions/server.cjs.map +1 -1
  15. package/dist/extensions/server.mjs +1307 -345
  16. package/dist/extensions/server.mjs.map +1 -1
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.mts +5 -2
  19. package/dist/index.d.mts.map +1 -1
  20. package/dist/index.mjs +1 -1
  21. package/dist/po-runtime-identity.json +1 -0
  22. package/llms.txt +3 -3
  23. package/locales/vi.json +4 -0
  24. package/locales/zh-CN.json +4 -0
  25. package/package.json +23 -17
  26. package/src/prompts/help-how-to-sandbox/SKILL.md +60 -0
  27. package/dist/cockpitHarness.cjs +0 -600
  28. package/dist/cockpitHarness.cjs.map +0 -1
  29. package/dist/cockpitHarness.d.mts +0 -41
  30. package/dist/cockpitHarness.d.mts.map +0 -1
  31. package/dist/cockpitHarness.mjs +0 -594
  32. package/dist/cockpitHarness.mjs.map +0 -1
  33. package/dist/extensionService-CoqM-IE1.cjs +0 -25
  34. package/dist/extensionService-CoqM-IE1.cjs.map +0 -1
  35. package/dist/extensionService-FmuCugPK.mjs +0 -20
  36. package/dist/extensionService-FmuCugPK.mjs.map +0 -1
  37. package/dist/sandboxBridge-77zC5pQR.mjs +0 -13
  38. package/dist/sandboxBridge-77zC5pQR.mjs.map +0 -1
  39. package/dist/sandboxBridge-Db6DubLC.cjs +0 -81
  40. package/dist/sandboxBridge-Db6DubLC.cjs.map +0 -1
  41. package/src/prompts/po-use-sandbox/SKILL.md +0 -14
package/LICENSE CHANGED
@@ -1,149 +1,110 @@
1
- License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
2
- "Business Source License" is a trademark of MariaDB Corporation Ab.
3
-
4
- Parameters
5
-
6
- Licensor: Agimon Pty Ltd
7
- Licensed Work: Po, the software in the Po source repository and the
8
- packages released from it, in each version released by
9
- the Licensor.
10
- The Licensed Work is (c) 2026 Agimon Pty Ltd.
11
- Material identified as third-party in the "Third-party
12
- components" section at the end of this file or in a
13
- NOTICE file, and any package or directory whose own
14
- license file grants a different license, is not part of
15
- the Licensed Work and remains under its own license.
16
- Additional Use Grant: You may make production use of the Licensed Work if
17
- your use is Eligible Use. "Eligible Use" is production use that falls
18
- within at least one of the following:
19
-
20
- (a) Personal Use. Use by an individual for their own personal purposes,
21
- and not on behalf of, or for the benefit of, an employer, client, or
22
- other Organization. Use by an individual in the course of employment
23
- or engagement by an Organization is use by that Organization.
24
-
25
- (b) Small Organization Use. Use by or on behalf of an Organization whose
26
- Annual Revenue is less than USD 1,000,000.
27
-
28
- (c) Non-profit, Education and Research Use. Use, regardless of Annual
29
- Revenue, by (i) an Organization registered or recognized as a
30
- non-profit or charitable organization under the laws of its
31
- jurisdiction, for its non-profit purposes; (ii) an accredited school,
32
- college, or university, for teaching, learning, or academic research;
33
- or (iii) a publicly funded research institution, for its research.
34
-
35
- (d) Service Provider Use. Use by a consultant, contractor, agency, or other
36
- service provider, regardless of its own Annual Revenue, solely to
37
- build, deploy, host, operate, or support the Licensed Work for a client
38
- whose own use would be Eligible Use under (a), (b), or (c). A service
39
- provider's use for its own purposes is Eligible Use only if the service
40
- provider itself qualifies under (b) or (c).
41
-
42
-
43
- Hosted services. Offering the Licensed Work to third parties as a hosted
44
- or managed service whose primary value is the Licensed Work is Eligible
45
- Use only if each such third party's own use would be Eligible Use.
46
-
47
- Definitions. "Organization" means any company, partnership, sole
48
- proprietorship, trust, association, government body, or other entity, and
49
- includes an individual acting in a business or professional capacity.
50
- "Affiliate" means any entity that directly or indirectly controls, is
51
- controlled by, or is under common control with an Organization, where
52
- "control" means ownership of more than 50% of the voting interests of an
53
- entity or the power to direct its management and policies by contract or
54
- otherwise. "Annual Revenue" means the total gross revenue of an
55
- Organization and all of its Affiliates combined, from all sources and
56
- whether or not related to the Licensed Work, for its most recently
57
- completed fiscal year, or, if it has not completed a fiscal year, for the
58
- twelve months before the use (or since its formation, if shorter),
59
- converted into US dollars at the average exchange rate for that period.
60
- Proceeds of equity or debt financing are not revenue.
61
-
62
- Threshold. If an Organization stops qualifying under (b), its existing
63
- production use remains Eligible Use for 90 days after it stops
64
- qualifying, after which it must obtain a commercial license or stop
65
- production use. Use that was Eligible Use when it occurred never requires
66
- a commercial license after the fact.
67
- Change Date: Four years from the date a version of the Licensed Work
68
- is first publicly released by the Licensor.
69
- Change License: Apache License, Version 2.0
70
-
71
- For information about alternative licensing arrangements for the Licensed
72
- Work, please visit: https://agimon.ai/licensing
73
-
74
- Notice
75
-
76
- The Business Source License (this document, or the "License") is not an Open
77
- Source license. However, the Licensed Work will eventually be made available
78
- under an Open Source License, as stated in this License.
79
-
80
- -----------------------------------------------------------------------------
81
-
82
- Business Source License 1.1
83
-
84
- Terms
85
-
86
- The Licensor hereby grants you the right to copy, modify, create derivative
87
- works, redistribute, and make non-production use of the Licensed Work. The
88
- Licensor may make an Additional Use Grant, above, permitting limited
89
- production use.
90
-
91
- Effective on the Change Date, or the fourth anniversary of the first publicly
92
- available distribution of a specific version of the Licensed Work under this
93
- License, whichever comes first, the Licensor hereby grants you rights under
94
- the terms of the Change License, and the rights granted in the paragraph
95
- above terminate.
96
-
97
- If your use of the Licensed Work does not comply with the requirements
98
- currently in effect as described in this License, you must purchase a
99
- commercial license from the Licensor, its affiliated entities, or authorized
100
- resellers, or you must refrain from using the Licensed Work.
101
-
102
- All copies of the original and modified Licensed Work, and derivative works
103
- of the Licensed Work, are subject to this License. This License applies
104
- separately for each version of the Licensed Work and the Change Date may vary
105
- for each version of the Licensed Work released by Licensor.
106
-
107
- You must conspicuously display this License on each original or modified copy
108
- of the Licensed Work. If you receive the Licensed Work in original or
109
- modified form from a third party, the terms and conditions set forth in this
110
- License apply to your use of that work.
111
-
112
- Any use of the Licensed Work in violation of this License will automatically
113
- terminate your rights under this License for the current and all other
114
- versions of the Licensed Work.
115
-
116
- This License does not grant you any right in any trademark or logo of
117
- Licensor or its affiliates (provided that you may use a trademark or logo of
118
- Licensor as expressly required by this License).
119
-
120
- TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
121
- AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
122
- EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
123
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
124
- TITLE.
125
-
126
- MariaDB hereby grants you permission to use this License’s text to license
127
- your works, and to refer to it using the trademark “Business Source License”,
128
- as long as you comply with the Covenants of Licensor below.
129
-
130
- Covenants of Licensor
131
-
132
- In consideration of the right to use this License’s text and the “Business
133
- Source License” name and trademark, Licensor covenants to MariaDB, and to all
134
- other recipients of the licensed work to be provided by Licensor:
135
-
136
- 1. To specify as the Change License the GPL Version 2.0 or any later version,
137
- or a license that is compatible with GPL Version 2.0 or a later version,
138
- where “compatible” means that software provided under the Change License can
139
- be included in a program with software provided under GPL Version 2.0 or a
140
- later version. Licensor may specify additional Change Licenses without
141
- limitation.
142
-
143
- 2. To either: (a) specify an additional grant of rights to use that does not
144
- impose any additional restriction on the right granted in this License, as
145
- the Additional Use Grant; or (b) insert the text “None”.
146
-
147
- 3. To specify a Change Date.
148
-
149
- 4. Not to modify this License in any other way.
1
+ # Functional Source License, Version 1.1, MIT Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-MIT
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 Agimon Pty Ltd
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the MIT license that is effective on the second anniversary of the date we make
91
+ the Software available. On or after that date, you may use the Software under
92
+ the MIT license, in which case the following will apply:
93
+
94
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
95
+ this software and associated documentation files (the "Software"), to deal in
96
+ the Software without restriction, including without limitation the rights to
97
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98
+ of the Software, and to permit persons to whom the Software is furnished to do
99
+ so, subject to the following conditions:
100
+
101
+ The above copyright notice and this permission notice shall be included in all
102
+ copies or substantial portions of the Software.
103
+
104
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
107
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
109
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
110
+ SOFTWARE.
package/README.md CHANGED
@@ -1,14 +1,60 @@
1
1
  # @agimon-ai/po-sandbox
2
2
 
3
- Run the Po web cockpit, its sessions, and their tools in a container while the browser stays on the host.
3
+ Sandbox layer for Po: registers the `container` sandbox provider on the host, runs one container per
4
+ sandboxed workspace, reports whether a session runs inside a container, and routes brokered providers when a
5
+ launch grants a credential broker.
4
6
 
5
7
  Part of the [Po distribution](https://www.npmjs.com/package/@agimon-ai/po).
6
8
 
9
+ ## Status
10
+
11
+ A new session of a sandboxed workspace runs in that workspace's container. Switching a workspace on moves its
12
+ saved sessions into the container; sessions already running on the host stay there until they close. Model calls
13
+ from a container go through the host's model gateway. The [setup guide](src/prompts/help-how-to-sandbox/SKILL.md)
14
+ has the prerequisites and a troubleshooting table, and is offered as the `help-how-to-sandbox` skill in Help mode.
15
+
16
+ ### The container provider
17
+
18
+ When the layer loads on a server's host scope, it registers the `container` provider in
19
+ `po/workspace-sandboxes` and publishes the `po/workspace-containers` service. A contained server registers
20
+ nothing, so containers never nest.
21
+
22
+ At hub start, in the background:
23
+
24
+ 1. `docker info` checks the engine. A missing or stopped engine leaves the provider unavailable, with the reason.
25
+ 2. The host must supply an exact public `@agimon-ai/po` CLI version. Without one, the provider is unavailable.
26
+ 3. If a workspace uses the provider, Po builds `po-sandbox:<digest>` only if missing. The image includes that exact
27
+ CLI release and its catalogue, plus Node 24, git, procps, ripgrep, corepack, and the headless cloak browser
28
+ and its libraries and fonts. The digest includes both the Dockerfile and CLI version.
29
+ 4. Po adopts a running container only if its owner, workspace, image and Artifacts shelf match. Otherwise, after
30
+ the new image is ready, Po replaces the container without deleting named volumes or the sandbox Po home.
31
+ Stale `*.po-v4.lock` files are cleared only when no container for that workspace runs.
32
+
33
+ Each container runs the baked `po-server` and mounts the workspace at its own path and
34
+ `P = ~/.po/sandboxes/<workspace>` at its own path with `PO_HOME=P`, so conversations and artifacts stay on host
35
+ disk. Package caches, worktrees and the container home live in named volumes. The container publishes one port on
36
+ host loopback only, runs with `--cap-drop=ALL`, `no-new-privileges` and a pid limit, and gets no credentials, no
37
+ hub token, no engine socket, and no part of the host `~/.po` beyond `P`, the shared host Artifacts shelf, the three seed files
38
+ (`presets.yaml`, `domains.yaml`, `config.yaml`, read-only) and its own token file (read-only).
39
+
40
+ The real outer host Artifacts shelf (`<outer agent directory>/po-host-artifacts`) is mounted read-write at
41
+ `/po-home/po-host-artifacts`, admitted through `PO_HOST_ARTIFACTS_DIR`. Only that folder is shared, not the
42
+ outer agent directory. Containers missing this mount contract are replaced while keeping their named volumes.
43
+
44
+ Every container runs with `--user`: the host user on Linux, `1000:1000` elsewhere (Docker Desktop maps it to the
45
+ host user on shared folders). A new runtime or git volume is first mounted on a world-writable image folder, so it
46
+ stays writable for that user, as the `/po-home` volume is.
47
+
48
+ Containers outlive the hub process: a reload, an idle restart (exit 75) or a crash leaves them running, and the
49
+ next start adopts them. A clean user stop stops them: the provider's `onCleanStop` hook in
50
+ `po/workspace-sandboxes` calls `stopAll`. `po/workspace-containers` also exposes `stop` for switching the sandbox
51
+ off.
52
+
7
53
  ## Requirements
8
54
 
9
55
  - Node.js 24 or newer
10
- - `@earendil-works/pi-coding-agent` 0.85.0
11
- - One of `docker`, `podman`, `nerdctl`, or `finch` on the host for the cockpit container
56
+ - Docker or a compatible engine, with network access to the image and package sources for the first build
57
+ - A host CLI version published to the public npm registry
12
58
 
13
59
  ## Install
14
60
 
@@ -16,13 +62,10 @@ Part of the [Po distribution](https://www.npmjs.com/package/@agimon-ai/po).
16
62
  npm install @agimon-ai/po-sandbox
17
63
  ```
18
64
 
19
- The cockpit container is started by the web cockpit (`po`, which runs `po-web`) and requires this package in the
20
- selected major mode's layers, as shown below.
21
-
22
65
  ## Enable the sandbox
23
66
 
24
- This layer is still in development, so `po init` does not add it to any mode. Opt in by hand:
25
- name it as a layer in `.po/modes.yaml`, then list that layer on the mode you want it in.
67
+ `po init` writes a `sandbox` layer and adds it to the `copilot` preset. To use it in another preset,
68
+ list the layer on that preset in `.po/presets.yaml`:
26
69
 
27
70
  ```yaml
28
71
  layers:
@@ -30,141 +73,59 @@ layers:
30
73
  packages:
31
74
  - '@agimon-ai/po-sandbox'
32
75
 
33
- majorMode:
76
+ preset:
34
77
  copilot:
35
- description: General-purpose coding mode.
78
+ description: General-purpose coding preset.
36
79
  layers: [team, ask-user, task, sandbox]
37
80
  ```
38
81
 
39
- A mode without this layer offers no cockpit container, and the cockpit refuses containment rather
40
- than running uncontained.
41
-
42
- ## Web cockpit container
43
-
44
- With this layer in the selected major mode, the web cockpit can hand over to one long-lived Linux
45
- container that holds the hub and every session it spawns:
46
-
47
- 1. The cockpit resolves this package's `./cockpitHarness` export and delegates the container
48
- lifecycle.
49
- 2. The layer detects the first available engine in the order `docker`, `podman`, `nerdctl`,
50
- `finch` (override with `PO_SANDBOX_ENGINE`), and builds a
51
- cockpit image when that tag is not cached. The digest covers the image definition and bridge
52
- source. The image installs `@agimon-ai/po-web` from the registry rather than copying the
53
- host's platform-specific packages.
54
- 3. It starts a detached container with each configured workspace bind-mounted at its host path,
55
- a named home volume, and the cockpit port published on host loopback, then waits until the
56
- cockpit inside answers `/api/health`.
57
-
58
- The browser stays on the host while bash, file edits, extensions, MCP servers, and skills all
59
- execute inside the container. `PO_SANDBOX=1` marks every sandboxed process; nesting is refused.
60
- See [The container plan and current wiring](../../../docs/securities.md#the-container-plan-and-current-wiring)
61
- for what the current server runtime connects.
62
-
63
- Only an allowlisted environment enters the container: terminal and locale variables, proxy
64
- settings, and `PO_PRESET`. Everything else a shell accumulates stays on the host.
65
-
66
- ## Engine and runtime selection
67
-
68
- The harness invokes each supported engine with Docker-compatible arguments. The engine and its
69
- VM, if any, must already be running on the host.
70
-
71
- `PO_SANDBOX_RUN_FLAGS` passes extra options straight to the engine, which is how you select a
72
- different isolation runtime without the layer having to know about it:
82
+ ## In-session command
73
83
 
74
- ```bash
75
- PO_SANDBOX_RUN_FLAGS=--runtime=runsc po
84
+ ```text
85
+ /po-sandbox
76
86
  ```
77
87
 
78
- Options must be self-contained (`--flag` or `--flag=value`). A separated value such as
79
- `--runtime runsc` is refused, because a bare word cannot be told apart from an image name and
80
- would silently launch a different container.
81
-
82
- Alternative isolation runtimes such as Kata or Firecracker are not verified here. Check their
83
- mount and broker-transport support before relying on them.
84
-
85
- ## Workspace dev containers
88
+ Reports whether the current session runs inside a sandbox container (the server's
89
+ `po/sandbox-identity` says it is contained) or directly on the host.
86
90
 
87
- The cockpit container ignores a workspace `.devcontainer` configuration. That file is
88
- author-controlled and could mount anything, including the container socket, which would make the
89
- containment claim false.
91
+ ## Brokered providers
90
92
 
91
- ## Signing in from inside the sandbox
93
+ When a session's admitted environment names brokered providers (`PO_BROKER_PROVIDERS`) and a
94
+ broker route (`PO_BROKER_SOCKET` or `PO_BROKER_ADDRESS`), the server plugin overrides those
95
+ providers' base URLs so requests go through the broker. The session's credential variables are
96
+ expected to hold the broker's session token, not the real key. With no broker route the layer
97
+ changes nothing.
92
98
 
93
- Subscription logins are not brokered. The cockpit container publishes only the cockpit port on
94
- host loopback, so a `/login` callback that a provider sends to `localhost:<port>` does not reach
95
- the container. Use a provider API key, which the credential broker below carries. Credentials stored inside the container land in the cockpit home
96
- volume, so they survive later runs.
97
-
98
- ## Provider credential broker
99
-
100
- For supported providers with a host API key, the credential broker:
101
-
102
- 1. Starts a broker on the host and grants the container exactly one route to it.
103
- 2. Replaces the credential variable with a random per-session token.
104
- 3. Redirects the provider's base URL at a loopback bridge inside the container, which forwards
105
- raw bytes to the broker.
106
-
107
- How the container reaches the broker depends on the engine:
99
+ How a container reaches the broker depends on the engine:
108
100
 
109
101
  | Host | Transport | Why |
110
102
  | ----------------------------- | ------------------------------------------- | ---------------------------------------------------------------------------------- |
111
103
  | Linux | Unix socket, bind-mounted, owner-only | Container and host share a kernel, so no port is needed |
112
104
  | macOS, Windows, any VM engine | Loopback TCP through `host.docker.internal` | A container in a virtual machine cannot connect to a mounted host socket (ENOTSUP) |
113
105
 
114
- On the TCP path the broker binds `127.0.0.1` on an ephemeral port, so it is never exposed beyond
115
- the host, and the launch passes `--add-host` so the gateway name resolves on every engine. Another
116
- local process could reach that port, and the session token is what stops it being useful.
117
-
118
- The broker validates the token, swaps in the real key, and streams the provider response back.
119
- Credentials for providers it cannot carry are withheld from the container rather than passed
120
- through. Turn the whole mechanism off with `PO_SANDBOX_BROKER=0`.
121
-
122
- ## In-session command
123
-
124
- ```text
125
- /po-sandbox
126
- ```
127
-
128
- Reports whether the current session runs inside the sandbox container or directly on the host.
106
+ A socket route goes through a loopback bridge inside the container, because no SDK can dial a
107
+ socket path. A TCP route is addressed directly.
129
108
 
130
109
  ## Current limits
131
110
 
132
- - The broker carries a curated provider list. OAuth subscription logins are not brokered, and
133
- their callbacks cannot reach the cockpit container.
111
+ - Nothing starts a credential broker for a workspace container; its model calls use the host's model gateway.
112
+ - The broker carries a curated provider list. OAuth subscription logins are not brokered.
134
113
  - A host `*_BASE_URL` override is dropped rather than used as the broker's upstream.
135
- - Compositions that declare local workspace packages cannot load their platform-specific
136
- dependencies inside the Linux container; use registry-installed layers for sandboxed work.
137
- - One container holds every cockpit session, so sessions can read each other's mounted
138
- workspaces.
139
- - Container network access follows the engine's defaults and is not restricted yet.
140
- - Mounted repositories are writable. Containers do not protect those files from agent edits,
141
- and the container engine remains part of the trusted base.
142
-
143
- ## Public API
144
-
145
- ```ts
146
- import { DefaultSandboxExtensionService } from '@agimon-ai/po-sandbox';
147
- import { createCockpitHarness, startCockpitContainer } from '@agimon-ai/po-sandbox/cockpitHarness';
148
- ```
149
-
150
- The service layer is host-neutral. `/extensions/server` registers the in-session command, and
151
- `/cockpitHarness` owns the web cockpit's container lifecycle and credential broker.
152
114
 
153
115
  ## Development
154
116
 
155
117
  Run from this package directory in the workspace:
156
118
 
157
119
  ```bash
158
- pnpm build
159
- pnpm typecheck
160
- pnpm test
161
- pnpm lint
162
- pnpm exec vibe-lint check .
163
- npm pack --dry-run
120
+ pnpm exec nx run-many -t lint typecheck build test -p @agimon-ai/po-sandbox
164
121
  ```
165
122
 
123
+ To exercise a real Docker boot with an exact published CLI release, set `PO_SANDBOX_CLI_VERSION` to that release
124
+ and run `PO_SANDBOX_REAL_BOOT=1 pnpm test-system` from this package. If Docker uses a non-default context,
125
+ pass `DOCKER_CONFIG` explicitly because the test sets a temporary `HOME`.
126
+
166
127
  Maintained by [Agimon](https://agimon.ai/about).
167
128
 
168
129
  ## License
169
130
 
170
- 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.
131
+ Functional Source License 1.1, MIT Future License (FSL-1.1-MIT): free for any purpose except a Competing Use; each version converts to MIT two years after release. See [LICENSE](LICENSE).
@@ -1 +1 @@
1
- {"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;AAGA,MAAa,gBAAA,4CAAeA,CAAAA,CAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
1
+ {"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;AAGA,MAAa,gBAAA,G,yCAAeA,CAAAA,CAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
@@ -6,7 +6,7 @@ export declare const apiContracts: {
6
6
  schemas?: Record<string, boolean | object> | undefined;
7
7
  http: {
8
8
  id: string;
9
- scope: "global" | "session" | "workspace";
9
+ scope: "host" | "session" | "workspace";
10
10
  basePath?: string | undefined;
11
11
  path: string;
12
12
  method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
@@ -34,7 +34,7 @@ export declare const apiContracts: {
34
34
  }[];
35
35
  sockets: {
36
36
  id: string;
37
- scope: "global" | "session" | "workspace";
37
+ scope: "host" | "session" | "workspace";
38
38
  description: string;
39
39
  availability?: string | undefined;
40
40
  service: string;
@@ -0,0 +1,22 @@
1
+ import { formatMessage } from "@agimon-ai/po-core/locale";
2
+ //#region src/services/extensionService/index.ts
3
+ var DefaultSandboxExtensionService = class {
4
+ translate;
5
+ identity;
6
+ /** `identity` is the server's `po/sandbox-identity`; a host server binds none. */
7
+ constructor(identity, translate = (_key, fallback) => formatMessage(fallback)) {
8
+ this.translate = translate;
9
+ this.identity = identity;
10
+ }
11
+ async execute() {
12
+ const t = this.translate;
13
+ return {
14
+ message: this.identity?.contained === true ? t("sandbox.notice.contained", "Sandboxed session: the agent, extensions, and tools run inside the container.") : t("sandbox.notice.host", "Host session: the agent, extensions, and tools run on the host. A session that was already running when its workspace switched to a container stays on the host until it closes."),
15
+ level: "info"
16
+ };
17
+ }
18
+ };
19
+ //#endregion
20
+ export { DefaultSandboxExtensionService as t };
21
+
22
+ //# sourceMappingURL=extensionService-6rO7rH9c.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensionService-6rO7rH9c.mjs","names":[],"sources":["../src/services/extensionService/index.ts"],"sourcesContent":["import { formatMessage } from '@agimon-ai/po-core/locale';\nimport type { PoSandboxIdentity } from '@agimon-ai/po-core/sandboxIdentity';\n\nimport type { SandboxExtensionResult, SandboxExtensionService } from '../../types/extension';\n\nexport class DefaultSandboxExtensionService implements SandboxExtensionService {\n private readonly identity: PoSandboxIdentity | undefined;\n\n /** `identity` is the server's `po/sandbox-identity`; a host server binds none. */\n constructor(\n identity: PoSandboxIdentity | undefined,\n private readonly translate: (key: string, fallback: string) => string = (_key, fallback) => formatMessage(fallback),\n ) {\n this.identity = identity;\n }\n\n async execute(): Promise<SandboxExtensionResult> {\n const t = this.translate;\n return {\n message:\n this.identity?.contained === true\n ? t(\n 'sandbox.notice.contained',\n 'Sandboxed session: the agent, extensions, and tools run inside the container.',\n )\n : t(\n 'sandbox.notice.host',\n 'Host session: the agent, extensions, and tools run on the host. A session that was already running when its workspace switched to a container stays on the host until it closes.',\n ),\n level: 'info',\n };\n }\n}\n"],"mappings":";;AAKA,IAAa,iCAAb,MAA+E;CAM1D;CALnB;;CAGA,YACE,UACA,aAAyE,MAAM,aAAa,cAAc,QAAQ,GAClH;EADiB,KAAA,YAAA;EAEjB,KAAK,WAAW;CAClB;CAEA,MAAM,UAA2C;EAC/C,MAAM,IAAI,KAAK;EACf,OAAO;GACL,SACE,KAAK,UAAU,cAAc,OACzB,EACE,4BACA,+EACF,IACA,EACE,uBACA,kLACF;GACN,OAAO;EACT;CACF;AACF"}
@@ -0,0 +1,27 @@
1
+ let _agimon_ai_po_core_locale = require("@agimon-ai/po-core/locale");
2
+ //#region src/services/extensionService/index.ts
3
+ var DefaultSandboxExtensionService = class {
4
+ translate;
5
+ identity;
6
+ /** `identity` is the server's `po/sandbox-identity`; a host server binds none. */
7
+ constructor(identity, translate = (_key, fallback) => (0, _agimon_ai_po_core_locale.formatMessage)(fallback)) {
8
+ this.translate = translate;
9
+ this.identity = identity;
10
+ }
11
+ async execute() {
12
+ const t = this.translate;
13
+ return {
14
+ message: this.identity?.contained === true ? t("sandbox.notice.contained", "Sandboxed session: the agent, extensions, and tools run inside the container.") : t("sandbox.notice.host", "Host session: the agent, extensions, and tools run on the host. A session that was already running when its workspace switched to a container stays on the host until it closes."),
15
+ level: "info"
16
+ };
17
+ }
18
+ };
19
+ //#endregion
20
+ Object.defineProperty(exports, "DefaultSandboxExtensionService", {
21
+ enumerable: true,
22
+ get: function() {
23
+ return DefaultSandboxExtensionService;
24
+ }
25
+ });
26
+
27
+ //# sourceMappingURL=extensionService-DKROEZa0.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensionService-DKROEZa0.cjs","names":["formatMessage"],"sources":["../src/services/extensionService/index.ts"],"sourcesContent":["import { formatMessage } from '@agimon-ai/po-core/locale';\nimport type { PoSandboxIdentity } from '@agimon-ai/po-core/sandboxIdentity';\n\nimport type { SandboxExtensionResult, SandboxExtensionService } from '../../types/extension';\n\nexport class DefaultSandboxExtensionService implements SandboxExtensionService {\n private readonly identity: PoSandboxIdentity | undefined;\n\n /** `identity` is the server's `po/sandbox-identity`; a host server binds none. */\n constructor(\n identity: PoSandboxIdentity | undefined,\n private readonly translate: (key: string, fallback: string) => string = (_key, fallback) => formatMessage(fallback),\n ) {\n this.identity = identity;\n }\n\n async execute(): Promise<SandboxExtensionResult> {\n const t = this.translate;\n return {\n message:\n this.identity?.contained === true\n ? t(\n 'sandbox.notice.contained',\n 'Sandboxed session: the agent, extensions, and tools run inside the container.',\n )\n : t(\n 'sandbox.notice.host',\n 'Host session: the agent, extensions, and tools run on the host. A session that was already running when its workspace switched to a container stays on the host until it closes.',\n ),\n level: 'info',\n };\n }\n}\n"],"mappings":";;AAKA,IAAa,iCAAb,MAA+E;CAM1D;CALnB;;CAGA,YACE,UACA,aAAyE,MAAM,cAAA,GAAaA,0BAAAA,cAAAA,CAAc,QAAQ,GAClH;EADiB,KAAA,YAAA;EAEjB,KAAK,WAAW;CAClB;CAEA,MAAM,UAA2C;EAC/C,MAAM,IAAI,KAAK;EACf,OAAO;GACL,SACE,KAAK,UAAU,cAAc,OACzB,EACE,4BACA,+EACF,IACA,EACE,uBACA,kLACF;GACN,OAAO;EACT;CACF;AACF"}