@jini-ai/platform 0.6.23 → 0.7.0

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.
@@ -1,157 +1,13 @@
1
- import type { SealedSecret } from "../types.js";
1
+ import type { VaultOptions, VaultRecord, VaultPutRecord, VaultQuery, VaultDefaultQuery, VaultErrorCode } from '@jini-ai/core/contracts/vault';
2
+ export type { VaultKind, CredentialType, CredentialMeta, VaultJson, VaultMeta, VaultOptions, VaultContext, VaultIdentity, VaultRecord, VaultSummary, VaultPutRecord, VaultQuery, VaultDefaultQuery, VaultSingletonQuery, VaultBatchOp, VaultBatchResult, VaultCopyResult, VaultMetaParser, VaultMetaParsers, VaultRepoPort } from '@jini-ai/core/contracts/vault';
2
3
  export declare const VAULT_KINDS: readonly ["site-assistant", "personal-execution", "media-provider", "publish-peer", "database-destination", "vendor", "source-control", "mcp-env", "mcp-auth", "api-connection"];
3
- /** `custom` remains readable/replaceable until each workspace activates its data migration. */
4
- export type VaultKind = typeof VAULT_KINDS[number] | "custom";
5
- export type CredentialType = "vendor" | "custom";
6
- /** Required metadata on every active vendor-kind credential. Subtype is immutable after create. */
7
- export type CredentialMeta = VaultMeta & {
8
- credentialType: CredentialType;
9
- worksFor: string[];
10
- };
11
- export type VaultJson = null | boolean | number | string | VaultJson[] | {
12
- [key: string]: VaultJson;
13
- };
14
- export type VaultMeta = {
15
- [key: string]: VaultJson;
16
- };
17
- export type VaultOptions = Record<string, never>;
18
- /** Expected ownership is supplied by the caller, never reconstructed from an untrusted row. */
19
- export interface VaultContext {
20
- workspaceId: string;
21
- kind: VaultKind;
22
- ownerKey: string;
23
- principalId: string | null;
24
- /** Host-canonicalized endpoint/resource binding; null for credentials without such a binding. */
25
- binding: string | null;
26
- }
27
- export interface VaultIdentity extends VaultContext {
28
- id: string;
29
- }
30
- export interface VaultRecord extends VaultIdentity {
31
- provider: string | null;
32
- label: string;
33
- isDefault: boolean;
34
- revision: number;
35
- sealed: SealedSecret | null;
36
- last4: string | null;
37
- tokenLength: number | null;
38
- meta: VaultMeta;
39
- createdAt: string;
40
- updatedAt: string;
41
- }
42
- export type VaultSummary = Omit<VaultRecord, "sealed"> & {
43
- configured: boolean;
44
- };
45
- /** Unspecified placement lets the repo auto-default a group's first row; false opts out.
46
- * Persisted records and read models always contain a concrete boolean.
47
- */
48
- export type VaultPutRecord = Omit<VaultRecord, "isDefault"> & {
49
- isDefault?: boolean | undefined;
50
- };
51
- export interface VaultQuery {
52
- workspaceId: string;
53
- kind: VaultKind;
54
- ownerKey: string;
55
- principalId: string | null;
56
- provider?: string | null | undefined;
57
- }
58
- /** A default belongs to one exact group; omitted provider never means all providers. */
59
- export interface VaultDefaultQuery extends VaultQuery {
60
- provider: string | null;
61
- }
62
- /** Singleton lookup ignores provider/default; omitted owner/principal leave that dimension unfiltered.
63
- * Hosts enforce singleton cardinality for their kind/scope. No binding is inferred by the service.
64
- */
65
- export interface VaultSingletonQuery {
66
- workspaceId: string;
67
- kind: VaultKind;
68
- ownerKey?: string | undefined;
69
- principalId?: string | null | undefined;
70
- }
71
- /** Ordered CAS operations; default side effects affect later operations' revisions. */
72
- export type VaultBatchOp = {
73
- put: {
74
- record: VaultPutRecord;
75
- expectedRevision: number | null;
76
- };
77
- } | {
78
- delete: {
79
- workspaceId: string;
80
- id: string;
81
- expectedRevision: number;
82
- };
83
- } | {
84
- patchMeta: {
85
- workspaceId: string;
86
- id: string;
87
- expectedRevision: number;
88
- patch: VaultMeta;
89
- updatedAt: string;
90
- };
91
- };
92
- export type VaultBatchResult = VaultRecord | boolean;
93
- export interface VaultCopyResult {
94
- kind: VaultKind;
95
- id: string;
96
- status: "copied" | "skipped" | "failed";
97
- last4?: string;
98
- reasonCode?: VaultError["code"] | "source-needs-upgrade" | "source-missing" | "target-exists" | "kind-not-copyable" | "requires-mcp-configuration" | "copy-failed";
99
- }
100
- export type VaultMetaParser = (input: {
101
- meta: unknown;
102
- provider?: string | null | undefined;
103
- }, options?: VaultOptions) => VaultMeta;
104
- export type VaultMetaParsers = Readonly<Record<VaultKind, VaultMetaParser>>;
105
4
  /** Safe error codes never contain submitted values or encrypted material. */
106
5
  export declare class VaultError extends Error {
107
- readonly code: "conflict" | "context" | "invalid-meta" | "invalid-record";
6
+ readonly code: VaultErrorCode;
108
7
  constructor({ code }: {
109
8
  code: VaultError["code"];
110
9
  }, _options?: VaultOptions);
111
10
  }
112
- /** CAS is mandatory: null creates only; a number replaces/deletes only that revision.
113
- * Defaults group by workspace/kind/owner/principal/provider. Every default change increments
114
- * revision; promotion uses updatedAt descending, then id descending (binary UTF-8 order).
115
- * All writes must join a host transaction when the adapter supports transaction composition.
116
- */
117
- export interface VaultRepoPort {
118
- find(input: {
119
- workspaceId: string;
120
- id: string;
121
- }, options?: VaultOptions): Promise<VaultRecord | null>;
122
- /** Indexed exact-group lookup; returns at most one row without listing its siblings.
123
- * Optional for compatibility with pre-C1 ports; both built-in adapters implement it.
124
- */
125
- findDefault?(input: VaultDefaultQuery, options?: VaultOptions): Promise<VaultRecord | null>;
126
- /** Optional additions keep older injected ports source-compatible; built-in adapters implement both. */
127
- findOne?(input: VaultSingletonQuery, options?: VaultOptions): Promise<VaultRecord | null>;
128
- /** All operations commit together or throw with no published changes. Default side effects
129
- * follow operation order; a delete carries full expected ownership.
130
- * SQL joins the host transaction: callers must propagate failures to roll that transaction back.
131
- * @example await repo.applyBatch!({ ops: [{ put: { record, expectedRevision: null } }] });
132
- */
133
- applyBatch?(input: {
134
- ops: readonly VaultBatchOp[];
135
- }, options?: VaultOptions): Promise<VaultBatchResult[]>;
136
- list(input: VaultQuery, options?: VaultOptions): Promise<VaultRecord[]>;
137
- put(input: {
138
- record: VaultPutRecord;
139
- expectedRevision: number | null;
140
- }, options?: VaultOptions): Promise<VaultRecord>;
141
- /** Service-validated patch: top-level keys are plain JSON-path identifiers. */
142
- patchMeta(input: {
143
- workspaceId: string;
144
- id: string;
145
- expectedRevision: number;
146
- patch: VaultMeta;
147
- updatedAt: string;
148
- }, options?: VaultOptions): Promise<VaultRecord>;
149
- delete(input: {
150
- workspaceId: string;
151
- id: string;
152
- expectedRevision: number;
153
- }, options?: VaultOptions): Promise<boolean>;
154
- }
155
11
  /** The record belongs to the query's exact workspace, kind, owner and principal; an omitted provider
156
12
  * matches every provider. @complexity O(1). */
157
13
  export declare function isInVaultQueryScope({ record, query }: {
@@ -1,33 +1,2 @@
1
- import type { SealedSecret } from "./types.js";
2
- /** Generation identity only: a sealed record never carries root-key bytes. */
3
- export interface RootKeyHandle {
4
- readonly keyId: string;
5
- }
6
- /** Swappable root-key adapter with two stable HKDF info layouts. */
7
- export interface KeyringPort {
8
- activeKey(_required: Record<string, never>): Promise<RootKeyHandle>;
9
- deriveSigningSecret(input: {
10
- workspaceId: string;
11
- subscriptionId: string;
12
- version: number;
13
- }): Promise<Uint8Array>;
14
- derive(input: {
15
- workspaceId: string;
16
- purpose: string;
17
- info: string;
18
- }): Promise<Uint8Array>;
19
- }
20
- /** AAD binds new ciphertext to its context; absent open AAD supports historical records only. */
21
- export interface SecretSealerPort {
22
- seal(input: {
23
- plaintext: string;
24
- key: RootKeyHandle;
25
- aad: string;
26
- }): Promise<SealedSecret>;
27
- open(input: {
28
- sealed: SealedSecret;
29
- }, optional?: {
30
- aad?: string;
31
- }): Promise<string>;
32
- }
1
+ export type * from '@jini-ai/core/contracts/vault';
33
2
  //# sourceMappingURL=ports.d.ts.map
@@ -1,10 +1,2 @@
1
- /** Persisted envelope: base64 ciphertext followed by the GCM tag, plus a base64 IV. */
2
- export interface SealedSecret {
3
- keyId: string;
4
- /** Base64 of encrypted bytes followed by the 16-byte authentication tag. */
5
- ciphertext: string;
6
- /** Base64 of the 12-byte IV. */
7
- nonce: string;
8
- alg: string;
9
- }
1
+ export type * from '@jini-ai/core/contracts/vault';
10
2
  //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/platform",
3
- "version": "0.6.23",
3
+ "version": "0.7.0",
4
4
  "description": "Generic OS/platform primitives: process exec and lifecycle, filesystem containment, HTTP readiness polling, toolchain discovery, blob storage, AWS signing, and an SSRF-safe asset cache.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -219,7 +219,7 @@
219
219
  "!dist/**/*.map"
220
220
  ],
221
221
  "dependencies": {
222
- "@jini-ai/core": "^0.6.13",
222
+ "@jini-ai/core": "^0.7.0",
223
223
  "undici": "^7.25.0"
224
224
  },
225
225
  "publishConfig": {