@agimon-ai/po-vault 0.0.0-alpha.61

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/LICENSE ADDED
@@ -0,0 +1,149 @@
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.
package/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # @agimon-ai/po-vault
2
+
3
+ The one place Po keeps secrets: OAuth tokens, API keys and sign-in sessions, encrypted in the shared Po database.
4
+
5
+ Po binds the vault as the global `po/vault` service on top of `po/db`. Every workspace and session resolves the same vault.
6
+
7
+ ## How it stores secrets
8
+
9
+ - Each entry is an AES-256-GCM row in `vault_entries` inside `<po home>/db/po.sqlite`, with a fresh 12-byte IV and the namespace and key bound in as associated data. Nothing is written in plaintext.
10
+ - One 32-byte data-encryption key protects every entry. It lives in the OS keyring (service `ai.agimon.po-vault`) when there is one, and otherwise in `<po home>/vault/key.bin`, an owner-only file. That file is the only thing in `<po home>/vault/`.
11
+ - **File-key mode is obfuscation-grade.** On a host with no keyring, such as headless Linux, `key.bin` sits next to the database, so anyone who can read your home folder can read your secrets. `status().backend` reports `'file'` in that case.
12
+ - If the key is lost while entries exist, the vault clears them and shows "Vault key was lost. Saved sign-ins were cleared; sign in again."
13
+
14
+ ## Trust
15
+
16
+ Any in-process Po plugin can read any namespace. The vault keeps secrets off disk in plaintext; it does not isolate plugins from one another. It never logs, and it has no agent tool, code-mode namespace or skill.
17
+
18
+ ## API
19
+
20
+ ```ts
21
+ import { PO_VAULT_CONTRACT, PO_VAULT_SERVICE, VaultError, type Vault } from '@agimon-ai/po-vault';
22
+
23
+ const vault = context.get(PO_VAULT_SERVICE) as Vault;
24
+ const saved = await vault.put('agiflow', 'global', { apiKey: 'k' });
25
+ await vault.put('agiflow', 'global', { apiKey: 'k2' }, { expectRevision: saved.revision });
26
+ const record = await vault.get('agiflow', 'global'); // { value, revision, updatedAt } or undefined
27
+ await vault.delete('agiflow', 'global');
28
+ ```
29
+
30
+ - `put` with `expectRevision: n` writes only when the stored revision is `n`; `null` writes only when there is no entry; omitted means last write wins. A mismatch throws `VaultError` with code `conflict`.
31
+ - `withLock(namespace, key, op)` holds a cross-process lease while `op` runs, so it may span network calls such as a token refresh. The lease renews itself; if it is lost, the signal passed to `op` aborts. Write inside it with `put({ expectRevision })`.
32
+ - Names: a namespace matches `^[a-z][a-z0-9.-]{0,63}$`, a key is 1 to 512 characters with no control characters, and a value is JSON of at most 64 KiB. Anything else throws code `invalid`.
33
+ - Errors are `VaultError` with code `unavailable`, `invalid` or `conflict`. Messages are fixed per code and never carry a key, a value or an upstream cause.
34
+
35
+ Declare the contract your root waits for, so a host without the vault shows a "waits for contract" notice instead of hanging:
36
+
37
+ ```ts
38
+ export default defineRoot(createMyRoot, { inject: [PO_VAULT_CONTRACT] });
39
+ ```
40
+
41
+ ## Testing
42
+
43
+ ```ts
44
+ import { createMemoryVault } from '@agimon-ai/po-vault/testing';
45
+
46
+ const vault = createMemoryVault(); // same revision, conflict and lock rules, in memory
47
+ ```
48
+
49
+ ## Public API
50
+
51
+ - `@agimon-ai/po-vault`: `PO_VAULT_SERVICE`, `PO_VAULT_CONTRACT`, `VAULT_KEYRING_SERVICE`, `VaultError`, and the `Vault`, `VaultRecord`, `VaultValue`, `VaultStatus`, `VaultErrorCode`, `VaultPutOptions`, `VaultDeleteOptions` types.
52
+ - `@agimon-ai/po-vault/testing`: `createMemoryVault`.
53
+ - `@agimon-ai/po-vault/extensions/server`: the native server entry, a fixed Po host package.
54
+
55
+ ## Requirements
56
+
57
+ - Node.js 24 or newer
@@ -0,0 +1,17 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ //#region src/schemas/apiContracts.ts
6
+ /** The vault is a Cordis service only: no HTTP route, socket, agent tool or command. */
7
+ const apiContracts = (0, require("@agimon-ai/po-core/apiContracts").defineApiContract)({
8
+ version: 1,
9
+ http: [],
10
+ sockets: [],
11
+ dynamic: []
12
+ });
13
+ //#endregion
14
+ exports.apiContracts = apiContracts;
15
+ exports.default = apiContracts;
16
+
17
+ //# sourceMappingURL=apiContracts.cjs.map
@@ -0,0 +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/** The vault is a Cordis service only: no HTTP route, socket, agent tool or command. */\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"}
@@ -0,0 +1,53 @@
1
+ //#region src/schemas/apiContracts.d.ts
2
+ /** The vault is a Cordis service only: no HTTP route, socket, agent tool or command. */
3
+ export declare const apiContracts: {
4
+ version: 1;
5
+ protocols?: Record<string, string> | undefined;
6
+ schemas?: Record<string, boolean | object> | undefined;
7
+ http: {
8
+ id: string;
9
+ scope: "global" | "session" | "workspace";
10
+ basePath?: string | undefined;
11
+ path: string;
12
+ method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
13
+ description: string;
14
+ availability?: string | undefined;
15
+ authentication: "device" | "none" | "owner";
16
+ parameters?: {
17
+ name: string;
18
+ in: "header" | "path" | "query";
19
+ required: boolean;
20
+ schema: boolean | object;
21
+ }[] | undefined;
22
+ body?: {
23
+ contentType: string;
24
+ contentTypes?: string[] | undefined;
25
+ required: boolean;
26
+ schema: boolean | object;
27
+ } | undefined;
28
+ responses: Record<string, {
29
+ description: string;
30
+ contentType?: string | undefined;
31
+ schema?: boolean | object | undefined;
32
+ events?: Record<string, boolean | object> | undefined;
33
+ }>;
34
+ }[];
35
+ sockets: {
36
+ id: string;
37
+ scope: "global" | "session" | "workspace";
38
+ description: string;
39
+ availability?: string | undefined;
40
+ service: string;
41
+ member: string;
42
+ direction: "client-to-server" | "server-to-client";
43
+ kind: "channel" | "method" | "state";
44
+ input: boolean | object;
45
+ output?: boolean | object | undefined;
46
+ errors?: boolean | object | undefined;
47
+ }[];
48
+ dynamic: string[];
49
+ gaps?: string[] | undefined;
50
+ };
51
+ //#endregion
52
+ export { apiContracts as default };
53
+ //# sourceMappingURL=apiContracts.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";;qBAGa"}
@@ -0,0 +1,13 @@
1
+ import { defineApiContract } from "@agimon-ai/po-core/apiContracts";
2
+ //#region src/schemas/apiContracts.ts
3
+ /** The vault is a Cordis service only: no HTTP route, socket, agent tool or command. */
4
+ const apiContracts = defineApiContract({
5
+ version: 1,
6
+ http: [],
7
+ sockets: [],
8
+ dynamic: []
9
+ });
10
+ //#endregion
11
+ export { apiContracts, apiContracts as default };
12
+
13
+ //# sourceMappingURL=apiContracts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** The vault is a Cordis service only: no HTTP route, socket, agent tool or command. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAa,eAAe,kBAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { o as PO_VAULT_SERVICE } from "./vaultRules-B84nuLpN.mjs";
2
+ import { defineServiceContract } from "@agimon-ai/po-core/extensionFile";
3
+ //#region src/schemas/contracts.ts
4
+ /** Bound once at the global level; every workspace and session resolves the same vault. */
5
+ const PO_VAULT_CONTRACT = defineServiceContract(PO_VAULT_SERVICE, { scope: "global" });
6
+ //#endregion
7
+ export { PO_VAULT_CONTRACT as t };
8
+
9
+ //# sourceMappingURL=contracts-C6dCp2Il.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts-C6dCp2Il.mjs","names":[],"sources":["../src/schemas/contracts.ts"],"sourcesContent":["import { defineServiceContract } from '@agimon-ai/po-core/extensionFile';\n\nimport { PO_VAULT_SERVICE } from '../constants/vault';\nimport type { Vault } from '../services/vault/type';\n\n/** Bound once at the global level; every workspace and session resolves the same vault. */\nexport const PO_VAULT_CONTRACT = defineServiceContract<Vault>(PO_VAULT_SERVICE, { scope: 'global' });\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/vault': Vault;\n }\n}\n"],"mappings":";;;;AAMA,MAAa,oBAAoB,sBAA6B,kBAAkB,EAAE,OAAO,SAAS,CAAC"}
@@ -0,0 +1,13 @@
1
+ const require_vaultRules = require("./vaultRules-CUudYo7G.cjs");
2
+ //#region src/schemas/contracts.ts
3
+ /** Bound once at the global level; every workspace and session resolves the same vault. */
4
+ const PO_VAULT_CONTRACT = (0, require("@agimon-ai/po-core/extensionFile").defineServiceContract)(require_vaultRules.PO_VAULT_SERVICE, { scope: "global" });
5
+ //#endregion
6
+ Object.defineProperty(exports, "PO_VAULT_CONTRACT", {
7
+ enumerable: true,
8
+ get: function() {
9
+ return PO_VAULT_CONTRACT;
10
+ }
11
+ });
12
+
13
+ //# sourceMappingURL=contracts-Do7L_d_L.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts-Do7L_d_L.cjs","names":["defineServiceContract","PO_VAULT_SERVICE"],"sources":["../src/schemas/contracts.ts"],"sourcesContent":["import { defineServiceContract } from '@agimon-ai/po-core/extensionFile';\n\nimport { PO_VAULT_SERVICE } from '../constants/vault';\nimport type { Vault } from '../services/vault/type';\n\n/** Bound once at the global level; every workspace and session resolves the same vault. */\nexport const PO_VAULT_CONTRACT = defineServiceContract<Vault>(PO_VAULT_SERVICE, { scope: 'global' });\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context {\n 'po/vault': Vault;\n }\n}\n"],"mappings":";;;AAMA,MAAa,qBAAA,6CAAoBA,CAAAA,CAAAA,sBAAAA,CAA6BC,mBAAAA,kBAAkB,EAAE,OAAO,SAAS,CAAC"}