@agimon-ai/po-core 0.0.0-alpha.47 → 0.0.0-alpha.49
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/dist/src/schemas/workspaceSandboxes.cjs.map +1 -1
- package/dist/src/schemas/workspaceSandboxes.d.mts +5 -3
- package/dist/src/schemas/workspaceSandboxes.d.mts.map +1 -1
- package/dist/src/schemas/workspaceSandboxes.mjs.map +1 -1
- package/dist/src/services/workspaceSandboxes/index.cjs +12 -5
- package/dist/src/services/workspaceSandboxes/index.cjs.map +1 -1
- package/dist/src/services/workspaceSandboxes/index.d.mts +4 -1
- package/dist/src/services/workspaceSandboxes/index.d.mts.map +1 -1
- package/dist/src/services/workspaceSandboxes/index.mjs +12 -5
- package/dist/src/services/workspaceSandboxes/index.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaceSandboxes.cjs","names":["defineServiceContract"],"sources":["../../../src/schemas/workspaceSandboxes.ts"],"sourcesContent":["import type { Context } from '@deepseek-ai/cordis';\n\nimport { defineServiceContract } from './serverScope';\n\nexport const PO_WORKSPACE_SANDBOXES_SERVICE = 'po/workspace-sandboxes';\n\n/** Where the host reaches the Po server a sandbox runs for one workspace. Host-side only. */\nexport interface PoWorkspaceSandboxEndpoint {\n /** A loopback `http://127.0.0.1:<port>` origin; the protocol socket is `/api/ws` on it. */\n readonly origin: string;\n /** The token that server requires on every request but health. */\n readonly token: string;\n}\n\n/** Whether a provider can run sandboxes now; `reason` is a plain sentence, such as 'Docker is not running.'. */\nexport type PoWorkspaceSandboxAvailability =\n | { readonly available: true }\n | { readonly available: false; readonly reason: string };\n\n/** What a provider knows of one workspace's sandbox. The host adds linking, stopping and its own failures. */\nexport type PoWorkspaceSandboxStatus =\n | { readonly state: 'starting' | 'running' }\n | { readonly state: 'failed'; readonly reason: string };\n\n/** A way to run a workspace away from the host. A workspace record names one by `sandbox`. */\nexport interface PoWorkspaceSandboxProvider {\n readonly id: string;\n readonly label?: string;\n /**\n * The workspace's running sandbox server, once the provider's start pass has settled; undefined while none runs.\n * Read again before every dial: a restarted sandbox may listen on another port with another token.\n */\n readonly endpoint?: (workspaceId: string) => Promise<PoWorkspaceSandboxEndpoint | undefined>;\n /**\n * Starts the workspace's sandbox, after the host switched the workspace on and handed its saved sessions over.\n * Resolves once it runs; rejects when it cannot start.\n */\n readonly start?: (workspace: { readonly id: string; readonly root: string }) => Promise<void>;\n /** Stops the workspace's sandbox, for switching it off. Resolves at once when none runs. */\n readonly stop?: (workspaceId: string) => Promise<void>;\n /**\n * The real path of the Po home the workspace's sandbox runs with, on host disk, created when missing. A provider\n * that offers it, `start` and `stop` gets the workspace's sessions handed over when it is switched on or off.\n */\n readonly sessionHome?: (workspaceId: string) => Promise<string>;\n /** Whether sandboxes can run now; undefined while the provider still checks. */\n readonly availability?: () => PoWorkspaceSandboxAvailability | undefined;\n /** The workspace's sandbox as the provider sees it; undefined when none was started. */\n readonly status?: (workspaceId: string) => PoWorkspaceSandboxStatus | undefined;\n /** Calls `listener` after `availability` or any `status` changed. Returns the unsubscribe. */\n readonly onStatusChange?: (listener: () => void) => () => void;\n /**\n * Runs once when the person stops the server cleanly, before the global scope unloads. Never on a reload, an\n * idle restart (exit 75) or a crash, so the provider's sandboxes keep running for the next start to adopt.\n */\n readonly onCleanStop?: () => Promise<void>;\n}\n\n/**\n * The global registry of sandbox providers. The server binds it before the global scope is served, so a\n * root registers its provider while it loads; the server closes it once the global scope is up, and a\n * registration after that throws. A workspace whose `sandbox` names no registered provider stays unavailable.\n */\nexport interface PoWorkspaceSandboxes {\n /** Returns a function that removes the provider again. Throws when the id is taken or
|
|
1
|
+
{"version":3,"file":"workspaceSandboxes.cjs","names":["defineServiceContract"],"sources":["../../../src/schemas/workspaceSandboxes.ts"],"sourcesContent":["import type { Context } from '@deepseek-ai/cordis';\n\nimport { defineServiceContract } from './serverScope';\n\nexport const PO_WORKSPACE_SANDBOXES_SERVICE = 'po/workspace-sandboxes';\n\n/** Where the host reaches the Po server a sandbox runs for one workspace. Host-side only. */\nexport interface PoWorkspaceSandboxEndpoint {\n /** A loopback `http://127.0.0.1:<port>` origin; the protocol socket is `/api/ws` on it. */\n readonly origin: string;\n /** The token that server requires on every request but health. */\n readonly token: string;\n}\n\n/** Whether a provider can run sandboxes now; `reason` is a plain sentence, such as 'Docker is not running.'. */\nexport type PoWorkspaceSandboxAvailability =\n | { readonly available: true }\n | { readonly available: false; readonly reason: string };\n\n/** What a provider knows of one workspace's sandbox. The host adds linking, stopping and its own failures. */\nexport type PoWorkspaceSandboxStatus =\n | { readonly state: 'starting' | 'running' }\n | { readonly state: 'failed'; readonly reason: string };\n\n/** A way to run a workspace away from the host. A workspace record names one by `sandbox`. */\nexport interface PoWorkspaceSandboxProvider {\n readonly id: string;\n readonly label?: string;\n /**\n * The workspace's running sandbox server, once the provider's start pass has settled; undefined while none runs.\n * Read again before every dial: a restarted sandbox may listen on another port with another token.\n */\n readonly endpoint?: (workspaceId: string) => Promise<PoWorkspaceSandboxEndpoint | undefined>;\n /**\n * Starts the workspace's sandbox, after the host switched the workspace on and handed its saved sessions over.\n * Resolves once it runs; rejects when it cannot start.\n */\n readonly start?: (workspace: { readonly id: string; readonly root: string }) => Promise<void>;\n /** Stops the workspace's sandbox, for switching it off. Resolves at once when none runs. */\n readonly stop?: (workspaceId: string) => Promise<void>;\n /**\n * The real path of the Po home the workspace's sandbox runs with, on host disk, created when missing. A provider\n * that offers it, `start` and `stop` gets the workspace's sessions handed over when it is switched on or off.\n */\n readonly sessionHome?: (workspaceId: string) => Promise<string>;\n /** Whether sandboxes can run now; undefined while the provider still checks. */\n readonly availability?: () => PoWorkspaceSandboxAvailability | undefined;\n /** The workspace's sandbox as the provider sees it; undefined when none was started. */\n readonly status?: (workspaceId: string) => PoWorkspaceSandboxStatus | undefined;\n /** Calls `listener` after `availability` or any `status` changed. Returns the unsubscribe. */\n readonly onStatusChange?: (listener: () => void) => () => void;\n /**\n * Runs once when the person stops the server cleanly, before the global scope unloads. Never on a reload, an\n * idle restart (exit 75) or a crash, so the provider's sandboxes keep running for the next start to adopt.\n */\n readonly onCleanStop?: () => Promise<void>;\n}\n\n/**\n * The global registry of sandbox providers. The server binds it before the global scope is served, so a\n * root registers its provider while it loads; the server closes it once the global scope is up, and a\n * registration of a new id after that throws. A provider registered before close may register again when its\n * package reloads. A workspace whose `sandbox` names no registered provider stays unavailable.\n */\nexport interface PoWorkspaceSandboxes {\n /** Returns a function that removes the provider again. Throws when the id is taken or new after close. */\n register(provider: PoWorkspaceSandboxProvider): () => void;\n get(id: string): PoWorkspaceSandboxProvider | undefined;\n list(): readonly PoWorkspaceSandboxProvider[];\n /** Ends registration of new ids; `onReplaced` hears each provider a reloaded package registers again. */\n close(onReplaced?: (provider: PoWorkspaceSandboxProvider) => void): void;\n}\n\n/** Global-scope contract: the server provides it, a root's global plugin registers into it. */\nexport const PO_WORKSPACE_SANDBOXES_CONTRACT = defineServiceContract<PoWorkspaceSandboxes>(\n PO_WORKSPACE_SANDBOXES_SERVICE,\n {\n scope: 'global',\n },\n);\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/workspace-sandboxes': PoWorkspaceSandboxes;\n }\n}\n\nexport function readPoWorkspaceSandboxes(context: Context): PoWorkspaceSandboxes | undefined {\n return context.get(PO_WORKSPACE_SANDBOXES_SERVICE) as PoWorkspaceSandboxes | undefined;\n}\n"],"mappings":";;AAIA,MAAa,iCAAiC;;AAsE9C,MAAa,kCAAkCA,oBAAAA,sBAC7C,gCACA,EACE,OAAO,SACT,CACF;AAQA,SAAgB,yBAAyB,SAAoD;CAC3F,OAAO,QAAQ,IAAI,8BAA8B;AACnD"}
|
|
@@ -62,14 +62,16 @@ export interface PoWorkspaceSandboxProvider {
|
|
|
62
62
|
/**
|
|
63
63
|
* The global registry of sandbox providers. The server binds it before the global scope is served, so a
|
|
64
64
|
* root registers its provider while it loads; the server closes it once the global scope is up, and a
|
|
65
|
-
* registration after that throws. A
|
|
65
|
+
* registration of a new id after that throws. A provider registered before close may register again when its
|
|
66
|
+
* package reloads. A workspace whose `sandbox` names no registered provider stays unavailable.
|
|
66
67
|
*/
|
|
67
68
|
export interface PoWorkspaceSandboxes {
|
|
68
|
-
/** Returns a function that removes the provider again. Throws when the id is taken or
|
|
69
|
+
/** Returns a function that removes the provider again. Throws when the id is taken or new after close. */
|
|
69
70
|
register(provider: PoWorkspaceSandboxProvider): () => void;
|
|
70
71
|
get(id: string): PoWorkspaceSandboxProvider | undefined;
|
|
71
72
|
list(): readonly PoWorkspaceSandboxProvider[];
|
|
72
|
-
|
|
73
|
+
/** Ends registration of new ids; `onReplaced` hears each provider a reloaded package registers again. */
|
|
74
|
+
close(onReplaced?: (provider: PoWorkspaceSandboxProvider) => void): void;
|
|
73
75
|
}
|
|
74
76
|
/** Global-scope contract: the server provides it, a root's global plugin registers into it. */
|
|
75
77
|
export declare const PO_WORKSPACE_SANDBOXES_CONTRACT: PoServiceContract<PoWorkspaceSandboxes>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaceSandboxes.d.mts","names":["_$__serverScope0.PoServiceContract"],"sources":["../../../src/schemas/workspaceSandboxes.ts"],"mappings":";;;qBAIa;;iBAGI;;WAEN;;WAEA;;;YAIC;WACG;;WACA;WAA2B;;;YAG9B;WACG;;WACA;WAA0B;;;iBAGxB;WACN;WACA;;;;;WAKA,YAAY,wBAAwB,QAAQ;;;;;WAK5C,SAAS;aAAsB;aAAqB;QAAmB;;WAEvE,QAAQ,wBAAwB;;;;;WAKhC,eAAe,wBAAwB;;WAEvC,qBAAqB;;WAErB,UAAU,wBAAwB;;WAElC,kBAAkB;;;;;WAKlB,oBAAoB
|
|
1
|
+
{"version":3,"file":"workspaceSandboxes.d.mts","names":["_$__serverScope0.PoServiceContract"],"sources":["../../../src/schemas/workspaceSandboxes.ts"],"mappings":";;;qBAIa;;iBAGI;;WAEN;;WAEA;;;YAIC;WACG;;WACA;WAA2B;;;YAG9B;WACG;;WACA;WAA0B;;;iBAGxB;WACN;WACA;;;;;WAKA,YAAY,wBAAwB,QAAQ;;;;;WAK5C,SAAS;aAAsB;aAAqB;QAAmB;;WAEvE,QAAQ,wBAAwB;;;;;WAKhC,eAAe,wBAAwB;;WAEvC,qBAAqB;;WAErB,UAAU,wBAAwB;;WAElC,kBAAkB;;;;;WAKlB,oBAAoB;;;;;;;;iBASd;;EAEf,SAAS,UAAU;EACnB,IAAI,aAAa;EACjB,iBAAiB;;EAEjB,MAAM,cAAc,UAAU;;;qBAInB,iCAA+BA,kBAAA;;YAQhC;IACR,0BAA0B;;;wBAId,yBAAyB,SAAS,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaceSandboxes.mjs","names":[],"sources":["../../../src/schemas/workspaceSandboxes.ts"],"sourcesContent":["import type { Context } from '@deepseek-ai/cordis';\n\nimport { defineServiceContract } from './serverScope';\n\nexport const PO_WORKSPACE_SANDBOXES_SERVICE = 'po/workspace-sandboxes';\n\n/** Where the host reaches the Po server a sandbox runs for one workspace. Host-side only. */\nexport interface PoWorkspaceSandboxEndpoint {\n /** A loopback `http://127.0.0.1:<port>` origin; the protocol socket is `/api/ws` on it. */\n readonly origin: string;\n /** The token that server requires on every request but health. */\n readonly token: string;\n}\n\n/** Whether a provider can run sandboxes now; `reason` is a plain sentence, such as 'Docker is not running.'. */\nexport type PoWorkspaceSandboxAvailability =\n | { readonly available: true }\n | { readonly available: false; readonly reason: string };\n\n/** What a provider knows of one workspace's sandbox. The host adds linking, stopping and its own failures. */\nexport type PoWorkspaceSandboxStatus =\n | { readonly state: 'starting' | 'running' }\n | { readonly state: 'failed'; readonly reason: string };\n\n/** A way to run a workspace away from the host. A workspace record names one by `sandbox`. */\nexport interface PoWorkspaceSandboxProvider {\n readonly id: string;\n readonly label?: string;\n /**\n * The workspace's running sandbox server, once the provider's start pass has settled; undefined while none runs.\n * Read again before every dial: a restarted sandbox may listen on another port with another token.\n */\n readonly endpoint?: (workspaceId: string) => Promise<PoWorkspaceSandboxEndpoint | undefined>;\n /**\n * Starts the workspace's sandbox, after the host switched the workspace on and handed its saved sessions over.\n * Resolves once it runs; rejects when it cannot start.\n */\n readonly start?: (workspace: { readonly id: string; readonly root: string }) => Promise<void>;\n /** Stops the workspace's sandbox, for switching it off. Resolves at once when none runs. */\n readonly stop?: (workspaceId: string) => Promise<void>;\n /**\n * The real path of the Po home the workspace's sandbox runs with, on host disk, created when missing. A provider\n * that offers it, `start` and `stop` gets the workspace's sessions handed over when it is switched on or off.\n */\n readonly sessionHome?: (workspaceId: string) => Promise<string>;\n /** Whether sandboxes can run now; undefined while the provider still checks. */\n readonly availability?: () => PoWorkspaceSandboxAvailability | undefined;\n /** The workspace's sandbox as the provider sees it; undefined when none was started. */\n readonly status?: (workspaceId: string) => PoWorkspaceSandboxStatus | undefined;\n /** Calls `listener` after `availability` or any `status` changed. Returns the unsubscribe. */\n readonly onStatusChange?: (listener: () => void) => () => void;\n /**\n * Runs once when the person stops the server cleanly, before the global scope unloads. Never on a reload, an\n * idle restart (exit 75) or a crash, so the provider's sandboxes keep running for the next start to adopt.\n */\n readonly onCleanStop?: () => Promise<void>;\n}\n\n/**\n * The global registry of sandbox providers. The server binds it before the global scope is served, so a\n * root registers its provider while it loads; the server closes it once the global scope is up, and a\n * registration after that throws. A workspace whose `sandbox` names no registered provider stays unavailable.\n */\nexport interface PoWorkspaceSandboxes {\n /** Returns a function that removes the provider again. Throws when the id is taken or
|
|
1
|
+
{"version":3,"file":"workspaceSandboxes.mjs","names":[],"sources":["../../../src/schemas/workspaceSandboxes.ts"],"sourcesContent":["import type { Context } from '@deepseek-ai/cordis';\n\nimport { defineServiceContract } from './serverScope';\n\nexport const PO_WORKSPACE_SANDBOXES_SERVICE = 'po/workspace-sandboxes';\n\n/** Where the host reaches the Po server a sandbox runs for one workspace. Host-side only. */\nexport interface PoWorkspaceSandboxEndpoint {\n /** A loopback `http://127.0.0.1:<port>` origin; the protocol socket is `/api/ws` on it. */\n readonly origin: string;\n /** The token that server requires on every request but health. */\n readonly token: string;\n}\n\n/** Whether a provider can run sandboxes now; `reason` is a plain sentence, such as 'Docker is not running.'. */\nexport type PoWorkspaceSandboxAvailability =\n | { readonly available: true }\n | { readonly available: false; readonly reason: string };\n\n/** What a provider knows of one workspace's sandbox. The host adds linking, stopping and its own failures. */\nexport type PoWorkspaceSandboxStatus =\n | { readonly state: 'starting' | 'running' }\n | { readonly state: 'failed'; readonly reason: string };\n\n/** A way to run a workspace away from the host. A workspace record names one by `sandbox`. */\nexport interface PoWorkspaceSandboxProvider {\n readonly id: string;\n readonly label?: string;\n /**\n * The workspace's running sandbox server, once the provider's start pass has settled; undefined while none runs.\n * Read again before every dial: a restarted sandbox may listen on another port with another token.\n */\n readonly endpoint?: (workspaceId: string) => Promise<PoWorkspaceSandboxEndpoint | undefined>;\n /**\n * Starts the workspace's sandbox, after the host switched the workspace on and handed its saved sessions over.\n * Resolves once it runs; rejects when it cannot start.\n */\n readonly start?: (workspace: { readonly id: string; readonly root: string }) => Promise<void>;\n /** Stops the workspace's sandbox, for switching it off. Resolves at once when none runs. */\n readonly stop?: (workspaceId: string) => Promise<void>;\n /**\n * The real path of the Po home the workspace's sandbox runs with, on host disk, created when missing. A provider\n * that offers it, `start` and `stop` gets the workspace's sessions handed over when it is switched on or off.\n */\n readonly sessionHome?: (workspaceId: string) => Promise<string>;\n /** Whether sandboxes can run now; undefined while the provider still checks. */\n readonly availability?: () => PoWorkspaceSandboxAvailability | undefined;\n /** The workspace's sandbox as the provider sees it; undefined when none was started. */\n readonly status?: (workspaceId: string) => PoWorkspaceSandboxStatus | undefined;\n /** Calls `listener` after `availability` or any `status` changed. Returns the unsubscribe. */\n readonly onStatusChange?: (listener: () => void) => () => void;\n /**\n * Runs once when the person stops the server cleanly, before the global scope unloads. Never on a reload, an\n * idle restart (exit 75) or a crash, so the provider's sandboxes keep running for the next start to adopt.\n */\n readonly onCleanStop?: () => Promise<void>;\n}\n\n/**\n * The global registry of sandbox providers. The server binds it before the global scope is served, so a\n * root registers its provider while it loads; the server closes it once the global scope is up, and a\n * registration of a new id after that throws. A provider registered before close may register again when its\n * package reloads. A workspace whose `sandbox` names no registered provider stays unavailable.\n */\nexport interface PoWorkspaceSandboxes {\n /** Returns a function that removes the provider again. Throws when the id is taken or new after close. */\n register(provider: PoWorkspaceSandboxProvider): () => void;\n get(id: string): PoWorkspaceSandboxProvider | undefined;\n list(): readonly PoWorkspaceSandboxProvider[];\n /** Ends registration of new ids; `onReplaced` hears each provider a reloaded package registers again. */\n close(onReplaced?: (provider: PoWorkspaceSandboxProvider) => void): void;\n}\n\n/** Global-scope contract: the server provides it, a root's global plugin registers into it. */\nexport const PO_WORKSPACE_SANDBOXES_CONTRACT = defineServiceContract<PoWorkspaceSandboxes>(\n PO_WORKSPACE_SANDBOXES_SERVICE,\n {\n scope: 'global',\n },\n);\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/workspace-sandboxes': PoWorkspaceSandboxes;\n }\n}\n\nexport function readPoWorkspaceSandboxes(context: Context): PoWorkspaceSandboxes | undefined {\n return context.get(PO_WORKSPACE_SANDBOXES_SERVICE) as PoWorkspaceSandboxes | undefined;\n}\n"],"mappings":";;AAIA,MAAa,iCAAiC;;AAsE9C,MAAa,kCAAkC,sBAC7C,gCACA,EACE,OAAO,SACT,CACF;AAQA,SAAgB,yBAAyB,SAAoD;CAC3F,OAAO,QAAQ,IAAI,8BAA8B;AACnD"}
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
//#region src/services/workspaceSandboxes/index.ts
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* An in-memory sandbox provider registry; `close` ends registration of new ids and keeps what was registered.
|
|
4
|
+
* A provider registered before close may register again, which is how a reloaded package replaces itself.
|
|
5
|
+
*/
|
|
3
6
|
function createWorkspaceSandboxRegistry() {
|
|
4
7
|
const providers = /* @__PURE__ */ new Map();
|
|
5
|
-
let closed
|
|
8
|
+
let closed;
|
|
6
9
|
return {
|
|
7
10
|
register(provider) {
|
|
8
|
-
if (closed) throw new Error(`Sandbox provider "${provider.id}" registered after the registry closed.`);
|
|
11
|
+
if (closed !== void 0 && !closed.ids.has(provider.id)) throw new Error(`Sandbox provider "${provider.id}" registered after the registry closed.`);
|
|
9
12
|
if (provider.id === "") throw new Error("A sandbox provider needs an id.");
|
|
10
13
|
if (providers.has(provider.id)) throw new Error(`Sandbox provider "${provider.id}" is already registered.`);
|
|
11
14
|
providers.set(provider.id, provider);
|
|
15
|
+
closed?.onReplaced?.(provider);
|
|
12
16
|
return () => {
|
|
13
17
|
if (providers.get(provider.id) === provider) providers.delete(provider.id);
|
|
14
18
|
};
|
|
15
19
|
},
|
|
16
20
|
get: (id) => providers.get(id),
|
|
17
21
|
list: () => [...providers.values()],
|
|
18
|
-
close() {
|
|
19
|
-
closed =
|
|
22
|
+
close(onReplaced) {
|
|
23
|
+
closed = {
|
|
24
|
+
ids: new Set(providers.keys()),
|
|
25
|
+
...onReplaced === void 0 ? {} : { onReplaced }
|
|
26
|
+
};
|
|
20
27
|
}
|
|
21
28
|
};
|
|
22
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../src/services/workspaceSandboxes/index.ts"],"sourcesContent":["import type { PoWorkspaceSandboxes, PoWorkspaceSandboxProvider } from '../../schemas/workspaceSandboxes';\n\n
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../src/services/workspaceSandboxes/index.ts"],"sourcesContent":["import type { PoWorkspaceSandboxes, PoWorkspaceSandboxProvider } from '../../schemas/workspaceSandboxes';\n\n/**\n * An in-memory sandbox provider registry; `close` ends registration of new ids and keeps what was registered.\n * A provider registered before close may register again, which is how a reloaded package replaces itself.\n */\nexport function createWorkspaceSandboxRegistry(): PoWorkspaceSandboxes {\n const providers = new Map<string, PoWorkspaceSandboxProvider>();\n let closed: { ids: ReadonlySet<string>; onReplaced?: (provider: PoWorkspaceSandboxProvider) => void } | undefined;\n return {\n register(provider) {\n if (closed !== undefined && !closed.ids.has(provider.id))\n throw new Error(`Sandbox provider \"${provider.id}\" registered after the registry closed.`);\n if (provider.id === '') throw new Error('A sandbox provider needs an id.');\n if (providers.has(provider.id)) throw new Error(`Sandbox provider \"${provider.id}\" is already registered.`);\n providers.set(provider.id, provider);\n closed?.onReplaced?.(provider);\n return () => {\n if (providers.get(provider.id) === provider) providers.delete(provider.id);\n };\n },\n get: (id) => providers.get(id),\n list: () => [...providers.values()],\n close(onReplaced) {\n closed = { ids: new Set(providers.keys()), ...(onReplaced === undefined ? {} : { onReplaced }) };\n },\n };\n}\n"],"mappings":";;;;;AAMA,SAAgB,iCAAuD;CACrE,MAAM,4BAAY,IAAI,IAAwC;CAC9D,IAAI;CACJ,OAAO;EACL,SAAS,UAAU;GACjB,IAAI,WAAW,KAAA,KAAa,CAAC,OAAO,IAAI,IAAI,SAAS,EAAE,GACrD,MAAM,IAAI,MAAM,qBAAqB,SAAS,GAAG,wCAAwC;GAC3F,IAAI,SAAS,OAAO,IAAI,MAAM,IAAI,MAAM,iCAAiC;GACzE,IAAI,UAAU,IAAI,SAAS,EAAE,GAAG,MAAM,IAAI,MAAM,qBAAqB,SAAS,GAAG,yBAAyB;GAC1G,UAAU,IAAI,SAAS,IAAI,QAAQ;GACnC,QAAQ,aAAa,QAAQ;GAC7B,aAAa;IACX,IAAI,UAAU,IAAI,SAAS,EAAE,MAAM,UAAU,UAAU,OAAO,SAAS,EAAE;GAC3E;EACF;EACA,MAAM,OAAO,UAAU,IAAI,EAAE;EAC7B,YAAY,CAAC,GAAG,UAAU,OAAO,CAAC;EAClC,MAAM,YAAY;GAChB,SAAS;IAAE,KAAK,IAAI,IAAI,UAAU,KAAK,CAAC;IAAG,GAAI,eAAe,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW;GAAG;EACjG;CACF;AACF"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { PoWorkspaceSandboxes } from "../../schemas/workspaceSandboxes.mjs";
|
|
2
2
|
//#region src/services/workspaceSandboxes/index.d.ts
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* An in-memory sandbox provider registry; `close` ends registration of new ids and keeps what was registered.
|
|
5
|
+
* A provider registered before close may register again, which is how a reloaded package replaces itself.
|
|
6
|
+
*/
|
|
4
7
|
export declare function createWorkspaceSandboxRegistry(): PoWorkspaceSandboxes;
|
|
5
8
|
//#endregion
|
|
6
9
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/services/workspaceSandboxes/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/services/workspaceSandboxes/index.ts"],"mappings":";;;;;;wBAMgB,kCAAkC"}
|
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
//#region src/services/workspaceSandboxes/index.ts
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* An in-memory sandbox provider registry; `close` ends registration of new ids and keeps what was registered.
|
|
4
|
+
* A provider registered before close may register again, which is how a reloaded package replaces itself.
|
|
5
|
+
*/
|
|
3
6
|
function createWorkspaceSandboxRegistry() {
|
|
4
7
|
const providers = /* @__PURE__ */ new Map();
|
|
5
|
-
let closed
|
|
8
|
+
let closed;
|
|
6
9
|
return {
|
|
7
10
|
register(provider) {
|
|
8
|
-
if (closed) throw new Error(`Sandbox provider "${provider.id}" registered after the registry closed.`);
|
|
11
|
+
if (closed !== void 0 && !closed.ids.has(provider.id)) throw new Error(`Sandbox provider "${provider.id}" registered after the registry closed.`);
|
|
9
12
|
if (provider.id === "") throw new Error("A sandbox provider needs an id.");
|
|
10
13
|
if (providers.has(provider.id)) throw new Error(`Sandbox provider "${provider.id}" is already registered.`);
|
|
11
14
|
providers.set(provider.id, provider);
|
|
15
|
+
closed?.onReplaced?.(provider);
|
|
12
16
|
return () => {
|
|
13
17
|
if (providers.get(provider.id) === provider) providers.delete(provider.id);
|
|
14
18
|
};
|
|
15
19
|
},
|
|
16
20
|
get: (id) => providers.get(id),
|
|
17
21
|
list: () => [...providers.values()],
|
|
18
|
-
close() {
|
|
19
|
-
closed =
|
|
22
|
+
close(onReplaced) {
|
|
23
|
+
closed = {
|
|
24
|
+
ids: new Set(providers.keys()),
|
|
25
|
+
...onReplaced === void 0 ? {} : { onReplaced }
|
|
26
|
+
};
|
|
20
27
|
}
|
|
21
28
|
};
|
|
22
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/services/workspaceSandboxes/index.ts"],"sourcesContent":["import type { PoWorkspaceSandboxes, PoWorkspaceSandboxProvider } from '../../schemas/workspaceSandboxes';\n\n
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/services/workspaceSandboxes/index.ts"],"sourcesContent":["import type { PoWorkspaceSandboxes, PoWorkspaceSandboxProvider } from '../../schemas/workspaceSandboxes';\n\n/**\n * An in-memory sandbox provider registry; `close` ends registration of new ids and keeps what was registered.\n * A provider registered before close may register again, which is how a reloaded package replaces itself.\n */\nexport function createWorkspaceSandboxRegistry(): PoWorkspaceSandboxes {\n const providers = new Map<string, PoWorkspaceSandboxProvider>();\n let closed: { ids: ReadonlySet<string>; onReplaced?: (provider: PoWorkspaceSandboxProvider) => void } | undefined;\n return {\n register(provider) {\n if (closed !== undefined && !closed.ids.has(provider.id))\n throw new Error(`Sandbox provider \"${provider.id}\" registered after the registry closed.`);\n if (provider.id === '') throw new Error('A sandbox provider needs an id.');\n if (providers.has(provider.id)) throw new Error(`Sandbox provider \"${provider.id}\" is already registered.`);\n providers.set(provider.id, provider);\n closed?.onReplaced?.(provider);\n return () => {\n if (providers.get(provider.id) === provider) providers.delete(provider.id);\n };\n },\n get: (id) => providers.get(id),\n list: () => [...providers.values()],\n close(onReplaced) {\n closed = { ids: new Set(providers.keys()), ...(onReplaced === undefined ? {} : { onReplaced }) };\n },\n };\n}\n"],"mappings":";;;;;AAMA,SAAgB,iCAAuD;CACrE,MAAM,4BAAY,IAAI,IAAwC;CAC9D,IAAI;CACJ,OAAO;EACL,SAAS,UAAU;GACjB,IAAI,WAAW,KAAA,KAAa,CAAC,OAAO,IAAI,IAAI,SAAS,EAAE,GACrD,MAAM,IAAI,MAAM,qBAAqB,SAAS,GAAG,wCAAwC;GAC3F,IAAI,SAAS,OAAO,IAAI,MAAM,IAAI,MAAM,iCAAiC;GACzE,IAAI,UAAU,IAAI,SAAS,EAAE,GAAG,MAAM,IAAI,MAAM,qBAAqB,SAAS,GAAG,yBAAyB;GAC1G,UAAU,IAAI,SAAS,IAAI,QAAQ;GACnC,QAAQ,aAAa,QAAQ;GAC7B,aAAa;IACX,IAAI,UAAU,IAAI,SAAS,EAAE,MAAM,UAAU,UAAU,OAAO,SAAS,EAAE;GAC3E;EACF;EACA,MAAM,OAAO,UAAU,IAAI,EAAE;EAC7B,YAAY,CAAC,GAAG,UAAU,OAAO,CAAC;EAClC,MAAM,YAAY;GAChB,SAAS;IAAE,KAAK,IAAI,IAAI,UAAU,KAAK,CAAC;IAAG,GAAI,eAAe,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW;GAAG;EACjG;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-core",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.49",
|
|
4
4
|
"description": "Po runtime systems and reusable core services.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -559,8 +559,8 @@
|
|
|
559
559
|
"registry": "https://registry.npmjs.org/"
|
|
560
560
|
},
|
|
561
561
|
"dependencies": {
|
|
562
|
-
"@agimon-ai/po-logsink": "0.0.1-alpha.
|
|
563
|
-
"@agimon-ai/po-web-security": "0.0.0-alpha.
|
|
562
|
+
"@agimon-ai/po-logsink": "0.0.1-alpha.31",
|
|
563
|
+
"@agimon-ai/po-web-security": "0.0.0-alpha.49",
|
|
564
564
|
"@deepseek-ai/cordis": "4.0.5",
|
|
565
565
|
"@earendil-works/chord": "1.4.0",
|
|
566
566
|
"@earendil-works/pi-agent-core": "1.4.0",
|
|
@@ -584,7 +584,7 @@
|
|
|
584
584
|
"yaml": "2.9.1"
|
|
585
585
|
},
|
|
586
586
|
"devDependencies": {
|
|
587
|
-
"@agimon-ai/vibe-lint-plugin-po-core": "0.0.0-alpha.
|
|
587
|
+
"@agimon-ai/vibe-lint-plugin-po-core": "0.0.0-alpha.49",
|
|
588
588
|
"@apidevtools/swagger-parser": "^13.1.0",
|
|
589
589
|
"@asyncapi/parser": "^3.6.4",
|
|
590
590
|
"@earendil-works/pi-ai": "1.4.0",
|