@botbotgo/common 1.0.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.
- package/README.md +54 -0
- package/dist/chunk-DIIWJNRE.js +51 -0
- package/dist/chunk-DIIWJNRE.js.map +1 -0
- package/dist/chunk-H5BG6SXW.js +33 -0
- package/dist/chunk-H5BG6SXW.js.map +1 -0
- package/dist/chunk-HBCZVEUG.js +92 -0
- package/dist/chunk-HBCZVEUG.js.map +1 -0
- package/dist/chunk-OTWARMTU.js +182 -0
- package/dist/chunk-OTWARMTU.js.map +1 -0
- package/dist/chunk-QG6CT2GZ.js +31 -0
- package/dist/chunk-QG6CT2GZ.js.map +1 -0
- package/dist/chunk-RUIAZ7GO.js +463 -0
- package/dist/chunk-RUIAZ7GO.js.map +1 -0
- package/dist/chunk-X4TDNR4V.js +206 -0
- package/dist/chunk-X4TDNR4V.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +13 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/startup.d.ts +14 -0
- package/dist/config/hydrate.d.ts +15 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.js +27 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/kind.d.ts +28 -0
- package/dist/config/path.d.ts +14 -0
- package/dist/config/yaml.d.ts +32 -0
- package/dist/connectivity/check.d.ts +19 -0
- package/dist/connectivity/index.d.ts +3 -0
- package/dist/connectivity/index.js +102 -0
- package/dist/connectivity/index.js.map +1 -0
- package/dist/connectivity/types.d.ts +12 -0
- package/dist/context/default-context.d.ts +10 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +16 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/tokens.d.ts +29 -0
- package/dist/events/index.d.ts +17 -0
- package/dist/events/index.js +20 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/progress-listener.d.ts +8 -0
- package/dist/events/runtime2-tree-listener.d.ts +26 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/npm/cache.d.ts +9 -0
- package/dist/npm/command.d.ts +36 -0
- package/dist/npm/index.d.ts +1 -0
- package/dist/npm/index.js +29 -0
- package/dist/npm/index.js.map +1 -0
- package/dist/npm/install.d.ts +8 -0
- package/dist/npm/provider.d.ts +14 -0
- package/dist/npm/version.d.ts +11 -0
- package/dist/security-store/backends/file/index.d.ts +19 -0
- package/dist/security-store/backends/index.d.ts +7 -0
- package/dist/security-store/backends/keychain/constants.d.ts +4 -0
- package/dist/security-store/backends/keychain/index.d.ts +17 -0
- package/dist/security-store/backends/keychain/keytar.d.ts +5 -0
- package/dist/security-store/backends/keychain/swift-bridge.d.ts +17 -0
- package/dist/security-store/backends/keychain/utils.d.ts +11 -0
- package/dist/security-store/backends/memory/index.d.ts +10 -0
- package/dist/security-store/backends/types.d.ts +29 -0
- package/dist/security-store/backends/utils.d.ts +2 -0
- package/dist/security-store/index.d.ts +2 -0
- package/dist/security-store/index.js +819 -0
- package/dist/security-store/index.js.map +1 -0
- package/dist/security-store/store.d.ts +49 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +7 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/utils/agent-result.d.ts +4 -0
- package/dist/utils/checksum.d.ts +16 -0
- package/dist/utils/deep-merge.d.ts +4 -0
- package/dist/utils/frontmatter.d.ts +12 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.js +38 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/log.d.ts +1 -0
- package/dist/utils/object.d.ts +4 -0
- package/dist/utils/override-with-config.d.ts +12 -0
- package/dist/utils/parsing.d.ts +4 -0
- package/dist/utils/selection/tool-choice.d.ts +1 -0
- package/dist/utils/selection/tool-registry.d.ts +5 -0
- package/package.json +128 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createAgentEventBus,
|
|
3
|
+
createConsoleAgentEventListener,
|
|
4
|
+
createProgressAgentEventListener,
|
|
5
|
+
createRuntime2TreeEventListener,
|
|
6
|
+
resolveRuntime2DebugConfig
|
|
7
|
+
} from "../chunk-RUIAZ7GO.js";
|
|
8
|
+
import "../chunk-OTWARMTU.js";
|
|
9
|
+
import "../chunk-X4TDNR4V.js";
|
|
10
|
+
import "../chunk-H5BG6SXW.js";
|
|
11
|
+
import "../chunk-DIIWJNRE.js";
|
|
12
|
+
import "../chunk-QG6CT2GZ.js";
|
|
13
|
+
export {
|
|
14
|
+
createAgentEventBus,
|
|
15
|
+
createConsoleAgentEventListener,
|
|
16
|
+
createProgressAgentEventListener,
|
|
17
|
+
createRuntime2TreeEventListener,
|
|
18
|
+
resolveRuntime2DebugConfig
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AgentEventListener } from "./index.js";
|
|
2
|
+
export interface ProgressEventListenerOptions {
|
|
3
|
+
writer?: (line: string) => void;
|
|
4
|
+
runLabelReact?: string;
|
|
5
|
+
runLabelDeep?: string;
|
|
6
|
+
reasonForAction?: (action: string) => string | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function createProgressAgentEventListener(options?: ProgressEventListenerOptions): AgentEventListener;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AgentEventListener } from "./index.js";
|
|
2
|
+
export interface Runtime2EventDebugConfig {
|
|
3
|
+
run?: boolean;
|
|
4
|
+
workspace?: boolean;
|
|
5
|
+
toolCall?: boolean;
|
|
6
|
+
stream?: boolean;
|
|
7
|
+
close?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface Runtime2EventRuntimeConfig {
|
|
10
|
+
debug?: Runtime2EventDebugConfig;
|
|
11
|
+
eventLogLevel?: "silent" | "lifecycle" | "tools" | "verbose";
|
|
12
|
+
}
|
|
13
|
+
export interface Runtime2TreeEventListenerOptions {
|
|
14
|
+
runtimeConfig?: Runtime2EventRuntimeConfig;
|
|
15
|
+
writer?: (line: string) => void;
|
|
16
|
+
}
|
|
17
|
+
interface ResolvedDebugConfig {
|
|
18
|
+
run: boolean;
|
|
19
|
+
workspace: boolean;
|
|
20
|
+
toolCall: boolean;
|
|
21
|
+
stream: boolean;
|
|
22
|
+
close: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function createRuntime2TreeEventListener(options?: Runtime2TreeEventListenerOptions): AgentEventListener;
|
|
25
|
+
export declare function resolveRuntime2DebugConfig(runtimeConfig?: Runtime2EventRuntimeConfig): ResolvedDebugConfig;
|
|
26
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createAgentEventBus, createConsoleAgentEventListener, createProgressAgentEventListener, createRuntime2TreeEventListener, type AgentEvent, type AgentEventBus, type AgentEventListener, type ProgressEventListenerOptions, type Runtime2EventDebugConfig, type Runtime2EventRuntimeConfig, type Runtime2TreeEventListenerOptions, } from "./events/index.js";
|
|
2
|
+
export { createAgentContext, getDefaultAgentContext, AgentContextTokens, type AgentContext, type AgentContextTokenKey, } from "./context/index.js";
|
|
3
|
+
export { formatLogPath, runStartupStep, StartupProgressRenderer, toErrorMessage, } from "./cli/index.js";
|
|
4
|
+
export { asRecord, extractTextFromLlmOutput, normalizeToolList, shortToolName, stripNullishObjectFields, summarizeForLog, } from "./utils/index.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StartupProgressRenderer,
|
|
3
|
+
formatLogPath,
|
|
4
|
+
runStartupStep,
|
|
5
|
+
toErrorMessage
|
|
6
|
+
} from "./chunk-HBCZVEUG.js";
|
|
7
|
+
import {
|
|
8
|
+
createAgentEventBus,
|
|
9
|
+
createConsoleAgentEventListener,
|
|
10
|
+
createProgressAgentEventListener,
|
|
11
|
+
createRuntime2TreeEventListener
|
|
12
|
+
} from "./chunk-RUIAZ7GO.js";
|
|
13
|
+
import {
|
|
14
|
+
asRecord,
|
|
15
|
+
extractTextFromLlmOutput,
|
|
16
|
+
normalizeToolList,
|
|
17
|
+
shortToolName,
|
|
18
|
+
stripNullishObjectFields,
|
|
19
|
+
summarizeForLog
|
|
20
|
+
} from "./chunk-OTWARMTU.js";
|
|
21
|
+
import "./chunk-X4TDNR4V.js";
|
|
22
|
+
import {
|
|
23
|
+
AgentContextTokens
|
|
24
|
+
} from "./chunk-H5BG6SXW.js";
|
|
25
|
+
import {
|
|
26
|
+
createAgentContext,
|
|
27
|
+
getDefaultAgentContext
|
|
28
|
+
} from "./chunk-DIIWJNRE.js";
|
|
29
|
+
import "./chunk-QG6CT2GZ.js";
|
|
30
|
+
export {
|
|
31
|
+
AgentContextTokens,
|
|
32
|
+
StartupProgressRenderer,
|
|
33
|
+
asRecord,
|
|
34
|
+
createAgentContext,
|
|
35
|
+
createAgentEventBus,
|
|
36
|
+
createConsoleAgentEventListener,
|
|
37
|
+
createProgressAgentEventListener,
|
|
38
|
+
createRuntime2TreeEventListener,
|
|
39
|
+
extractTextFromLlmOutput,
|
|
40
|
+
formatLogPath,
|
|
41
|
+
getDefaultAgentContext,
|
|
42
|
+
normalizeToolList,
|
|
43
|
+
runStartupStep,
|
|
44
|
+
shortToolName,
|
|
45
|
+
stripNullishObjectFields,
|
|
46
|
+
summarizeForLog,
|
|
47
|
+
toErrorMessage
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface EnsurePackageInCacheOptions {
|
|
2
|
+
cacheBase?: string;
|
|
3
|
+
/** Working directory used for npm view/pack (controls registry/.npmrc context). */
|
|
4
|
+
cwd?: string;
|
|
5
|
+
afterInstall?: (cacheDir: string, packageName: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function ensurePackageInCache(packageName: string, version?: string, options?: EnsurePackageInCacheOptions): string;
|
|
8
|
+
export declare function getPackageEntryPath(packageRoot: string): string;
|
|
9
|
+
export declare function importFromCache(packageRoot: string): Promise<unknown>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface RunNpmCommandOptions {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
env?: NodeJS.ProcessEnv;
|
|
4
|
+
timeoutMs?: number;
|
|
5
|
+
stdio?: "pipe" | "inherit";
|
|
6
|
+
shell?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface NpmCommandResult {
|
|
9
|
+
args: string[];
|
|
10
|
+
status: number | null;
|
|
11
|
+
stdout: string;
|
|
12
|
+
stderr: string;
|
|
13
|
+
signal: NodeJS.Signals | null;
|
|
14
|
+
error?: Error;
|
|
15
|
+
}
|
|
16
|
+
export interface NpmInstallOptions extends RunNpmCommandOptions {
|
|
17
|
+
packages?: string[];
|
|
18
|
+
global?: boolean;
|
|
19
|
+
noPackageLock?: boolean;
|
|
20
|
+
legacyPeerDeps?: boolean;
|
|
21
|
+
registry?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface NpmPublishOptions extends RunNpmCommandOptions {
|
|
24
|
+
tag?: string;
|
|
25
|
+
access?: "public" | "restricted";
|
|
26
|
+
registry?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function runNpmCommand(args: string[], options?: RunNpmCommandOptions): NpmCommandResult;
|
|
29
|
+
export declare function assertNpmCommandSuccess(result: NpmCommandResult, context: string): void;
|
|
30
|
+
export declare function npmSearchJson(query: string, options?: RunNpmCommandOptions): unknown[];
|
|
31
|
+
export declare function npmInstall(options?: NpmInstallOptions): void;
|
|
32
|
+
export declare function npmRunScript(script: string, options?: RunNpmCommandOptions): void;
|
|
33
|
+
export declare function npmPublish(options?: NpmPublishOptions): void;
|
|
34
|
+
export declare function npmRoot(options?: RunNpmCommandOptions & {
|
|
35
|
+
global?: boolean;
|
|
36
|
+
}): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { parseNpmProviderSpec, type NpmProviderSpec, } from "./provider.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/npm/provider.ts
|
|
2
|
+
var NPM_PROTOCOL_PREFIX = "npm:";
|
|
3
|
+
function isNpmProviderSpec(spec) {
|
|
4
|
+
return typeof spec === "string" && spec.startsWith(NPM_PROTOCOL_PREFIX);
|
|
5
|
+
}
|
|
6
|
+
function parseNpmProvider(provider) {
|
|
7
|
+
if (!isNpmProviderSpec(provider)) return null;
|
|
8
|
+
const rest = provider.slice(NPM_PROTOCOL_PREFIX.length);
|
|
9
|
+
const hashIdx = rest.indexOf("#");
|
|
10
|
+
const fragment = hashIdx >= 0 ? rest.slice(hashIdx + 1) : void 0;
|
|
11
|
+
const beforeHash = hashIdx >= 0 ? rest.slice(0, hashIdx) : rest;
|
|
12
|
+
const atIdx = beforeHash.startsWith("@") ? beforeHash.indexOf("@", 1) : beforeHash.lastIndexOf("@");
|
|
13
|
+
const pkg = atIdx > 0 ? beforeHash.slice(0, atIdx) : beforeHash;
|
|
14
|
+
const tag = atIdx > 0 ? beforeHash.slice(atIdx + 1) : void 0;
|
|
15
|
+
return { pkg: pkg || beforeHash, tag: tag || void 0, fragment };
|
|
16
|
+
}
|
|
17
|
+
function parseNpmProviderSpec(spec) {
|
|
18
|
+
const parsed = parseNpmProvider(spec);
|
|
19
|
+
if (!parsed) return null;
|
|
20
|
+
return {
|
|
21
|
+
packageName: parsed.pkg,
|
|
22
|
+
version: parsed.tag,
|
|
23
|
+
provider: parsed.fragment
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
parseNpmProviderSpec
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/npm/provider.ts"],"sourcesContent":["export const NPM_PROTOCOL_PREFIX = \"npm:\";\n\nexport interface NpmProviderInfo {\n pkg: string;\n tag?: string;\n fragment?: string;\n}\n\nexport interface NpmProviderSpec {\n packageName: string;\n version?: string;\n provider?: string;\n}\n\nexport function isNpmProviderSpec(spec: unknown): spec is string {\n return typeof spec === \"string\" && spec.startsWith(NPM_PROTOCOL_PREFIX);\n}\n\nexport function parseNpmProvider(provider: string): NpmProviderInfo | null {\n if (!isNpmProviderSpec(provider)) return null;\n const rest = provider.slice(NPM_PROTOCOL_PREFIX.length);\n const hashIdx = rest.indexOf(\"#\");\n const fragment = hashIdx >= 0 ? rest.slice(hashIdx + 1) : undefined;\n const beforeHash = hashIdx >= 0 ? rest.slice(0, hashIdx) : rest;\n const atIdx = beforeHash.startsWith(\"@\") ? beforeHash.indexOf(\"@\", 1) : beforeHash.lastIndexOf(\"@\");\n const pkg = atIdx > 0 ? beforeHash.slice(0, atIdx) : beforeHash;\n const tag = atIdx > 0 ? beforeHash.slice(atIdx + 1) : undefined;\n return { pkg: pkg || beforeHash, tag: tag || undefined, fragment };\n}\n\nexport function parseNpmProviderSpec(spec: string): NpmProviderSpec | null {\n const parsed = parseNpmProvider(spec);\n if (!parsed) return null;\n return {\n packageName: parsed.pkg,\n version: parsed.tag,\n provider: parsed.fragment,\n };\n}\n"],"mappings":";AAAO,IAAM,sBAAsB;AAc5B,SAAS,kBAAkB,MAA+B;AAC/D,SAAO,OAAO,SAAS,YAAY,KAAK,WAAW,mBAAmB;AACxE;AAEO,SAAS,iBAAiB,UAA0C;AACzE,MAAI,CAAC,kBAAkB,QAAQ,EAAG,QAAO;AACzC,QAAM,OAAO,SAAS,MAAM,oBAAoB,MAAM;AACtD,QAAM,UAAU,KAAK,QAAQ,GAAG;AAChC,QAAM,WAAW,WAAW,IAAI,KAAK,MAAM,UAAU,CAAC,IAAI;AAC1D,QAAM,aAAa,WAAW,IAAI,KAAK,MAAM,GAAG,OAAO,IAAI;AAC3D,QAAM,QAAQ,WAAW,WAAW,GAAG,IAAI,WAAW,QAAQ,KAAK,CAAC,IAAI,WAAW,YAAY,GAAG;AAClG,QAAM,MAAM,QAAQ,IAAI,WAAW,MAAM,GAAG,KAAK,IAAI;AACrD,QAAM,MAAM,QAAQ,IAAI,WAAW,MAAM,QAAQ,CAAC,IAAI;AACtD,SAAO,EAAE,KAAK,OAAO,YAAY,KAAK,OAAO,QAAW,SAAS;AACnE;AAEO,SAAS,qBAAqB,MAAsC;AACzE,QAAM,SAAS,iBAAiB,IAAI;AACpC,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO;AAAA,IACL,aAAa,OAAO;AAAA,IACpB,SAAS,OAAO;AAAA,IAChB,UAAU,OAAO;AAAA,EACnB;AACF;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface EnsureNpmPackageInstalledOptions {
|
|
2
|
+
version?: string;
|
|
3
|
+
cwd?: string;
|
|
4
|
+
stdio?: "inherit" | "pipe";
|
|
5
|
+
noPackageLock?: boolean;
|
|
6
|
+
logPrefix?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function ensureNpmPackageInstalled(packageName: string, options?: EnsureNpmPackageInstalledOptions): Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const NPM_PROTOCOL_PREFIX = "npm:";
|
|
2
|
+
export interface NpmProviderInfo {
|
|
3
|
+
pkg: string;
|
|
4
|
+
tag?: string;
|
|
5
|
+
fragment?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface NpmProviderSpec {
|
|
8
|
+
packageName: string;
|
|
9
|
+
version?: string;
|
|
10
|
+
provider?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function isNpmProviderSpec(spec: unknown): spec is string;
|
|
13
|
+
export declare function parseNpmProvider(provider: string): NpmProviderInfo | null;
|
|
14
|
+
export declare function parseNpmProviderSpec(spec: string): NpmProviderSpec | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ResolveNpmVersionOptions {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
timeoutMs?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function clearVersionCache(): void;
|
|
6
|
+
export declare function resolveNpmPackageVersion(pkg: string, tag?: string, options?: ResolveNpmVersionOptions): string | null;
|
|
7
|
+
export declare function resolveLatestVersionFromRegistry(packageName: string, options?: ResolveNpmVersionOptions): string;
|
|
8
|
+
export declare function formatProviderDisplay(provider: string): string;
|
|
9
|
+
export declare function getInstalledVersion(packageName: string, options?: {
|
|
10
|
+
cwd?: string;
|
|
11
|
+
}): string | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type FileSecretStoreBackendOptions, type SecretStoreBackend, type SecretStoreBackendContext } from "../types.js";
|
|
2
|
+
export declare class FileSecretStoreBackend implements SecretStoreBackend {
|
|
3
|
+
private readonly filePath;
|
|
4
|
+
private data;
|
|
5
|
+
private loading;
|
|
6
|
+
private writeQueue;
|
|
7
|
+
constructor(options?: FileSecretStoreBackendOptions);
|
|
8
|
+
init(): Promise<void>;
|
|
9
|
+
getSecret(service: string, account: string): Promise<string | undefined>;
|
|
10
|
+
setSecret(service: string, account: string, value: string): Promise<void>;
|
|
11
|
+
deleteSecret(service: string, account: string): Promise<boolean>;
|
|
12
|
+
getMasterKey(context: SecretStoreBackendContext): Promise<Buffer | null>;
|
|
13
|
+
setMasterKey(context: SecretStoreBackendContext, key: Buffer): Promise<void>;
|
|
14
|
+
private ensureLoaded;
|
|
15
|
+
private load;
|
|
16
|
+
private mutate;
|
|
17
|
+
private persist;
|
|
18
|
+
private setPermissions;
|
|
19
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CreateSecretStoreBackendOptions, type SecretStoreBackend, type SecretStoreBackendName } from "./types.js";
|
|
2
|
+
export declare function createSecretStoreBackend(backend?: SecretStoreBackendName | SecretStoreBackend, options?: CreateSecretStoreBackendOptions): SecretStoreBackend;
|
|
3
|
+
export { FileSecretStoreBackend } from "./file/index.js";
|
|
4
|
+
export { KeychainSecretStoreBackend } from "./keychain/index.js";
|
|
5
|
+
export { MemorySecretStoreBackend } from "./memory/index.js";
|
|
6
|
+
export { MASTER_KEY_LENGTH, deleteSecretFromKeychain, getKeyFromKeychain, getSecretFromKeychain, getTeamIdFromBinary, isPackagedApp, setKeyInKeychainWithAcl, setSecretInKeychain, } from "./keychain/index.js";
|
|
7
|
+
export type { BiometricPolicy, CreateSecretStoreBackendOptions, FileSecretStoreBackendOptions, KeychainAccessOptions, SecretStoreBackend, SecretStoreBackendContext, SecretStoreBackendName, } from "./types.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MASTER_KEY_LENGTH } from "./constants.js";
|
|
2
|
+
import { type KeychainAccessOptions, type SecretStoreBackend, type SecretStoreBackendContext } from "../types.js";
|
|
3
|
+
import { isPackagedApp } from "./utils.js";
|
|
4
|
+
export declare function getKeyFromKeychain(service: string, account: string, options?: KeychainAccessOptions): Promise<Buffer | null>;
|
|
5
|
+
export declare function getSecretFromKeychain(service: string, account: string): Promise<string | null>;
|
|
6
|
+
export declare function getTeamIdFromBinary(appBinPath: string): Promise<string | null>;
|
|
7
|
+
export declare function setKeyInKeychainWithAcl(service: string, account: string, keyBuffer: Buffer, appBinPath: string, appleDeveloperTeamId?: string | null, options?: KeychainAccessOptions): Promise<void>;
|
|
8
|
+
export declare function setSecretInKeychain(service: string, account: string, value: string): Promise<void>;
|
|
9
|
+
export declare function deleteSecretFromKeychain(service: string, account: string): Promise<boolean>;
|
|
10
|
+
export declare class KeychainSecretStoreBackend implements SecretStoreBackend {
|
|
11
|
+
getSecret(service: string, account: string): Promise<string | undefined>;
|
|
12
|
+
setSecret(service: string, account: string, value: string): Promise<void>;
|
|
13
|
+
deleteSecret(service: string, account: string): Promise<boolean>;
|
|
14
|
+
getMasterKey(context: SecretStoreBackendContext): Promise<Buffer | null>;
|
|
15
|
+
setMasterKey(context: SecretStoreBackendContext, key: Buffer): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export { MASTER_KEY_LENGTH, isPackagedApp };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type BiometricPolicy } from "../types.js";
|
|
2
|
+
type SwiftOp = "set" | "get";
|
|
3
|
+
interface SwiftResult {
|
|
4
|
+
ok: boolean;
|
|
5
|
+
found?: boolean;
|
|
6
|
+
value?: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function runSwiftKeychainWithFallback(op: SwiftOp, input: {
|
|
10
|
+
service: string;
|
|
11
|
+
account: string;
|
|
12
|
+
secret?: string;
|
|
13
|
+
prompt?: string;
|
|
14
|
+
biometric: BiometricPolicy;
|
|
15
|
+
}): Promise<SwiftResult | undefined>;
|
|
16
|
+
export declare function resolvePrompt(prompt?: string): string;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type BiometricPolicy } from "../types.js";
|
|
2
|
+
export declare function assertMacOS(): void;
|
|
3
|
+
export declare function assertNonEmpty(value: string, field: string): string;
|
|
4
|
+
export declare function normalizeAppleDeveloperTeamId(teamId: string | null | undefined): string | undefined;
|
|
5
|
+
export declare function normalizeBiometricPolicy(policy: BiometricPolicy | undefined): BiometricPolicy;
|
|
6
|
+
export declare function resolveSwiftBiometricPolicy(policy: BiometricPolicy): Exclude<BiometricPolicy, "none" | "auto">;
|
|
7
|
+
export declare function isSwiftUnavailableError(error: unknown): boolean;
|
|
8
|
+
export declare function isSwiftEntitlementError(error: unknown): boolean;
|
|
9
|
+
export declare function isKeychainNotFoundError(error: unknown): boolean;
|
|
10
|
+
export declare function isPackagedApp(): boolean;
|
|
11
|
+
export declare function resolveAppBinPath(appBinPath?: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type SecretStoreBackend, type SecretStoreBackendContext } from "../types.js";
|
|
2
|
+
export declare class MemorySecretStoreBackend implements SecretStoreBackend {
|
|
3
|
+
private readonly secrets;
|
|
4
|
+
private readonly masterKeys;
|
|
5
|
+
getSecret(service: string, account: string): Promise<string | undefined>;
|
|
6
|
+
setSecret(service: string, account: string, value: string): Promise<void>;
|
|
7
|
+
deleteSecret(service: string, account: string): Promise<boolean>;
|
|
8
|
+
getMasterKey(context: SecretStoreBackendContext): Promise<Buffer | null>;
|
|
9
|
+
setMasterKey(context: SecretStoreBackendContext, key: Buffer): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface SecretStoreBackendContext {
|
|
2
|
+
service: string;
|
|
3
|
+
account: string;
|
|
4
|
+
appBinPath?: string;
|
|
5
|
+
appleDeveloperTeamId?: string | null;
|
|
6
|
+
biometric?: BiometricPolicy;
|
|
7
|
+
prompt?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SecretStoreBackend {
|
|
10
|
+
init?(): Promise<void>;
|
|
11
|
+
getSecret(service: string, account: string): Promise<string | undefined>;
|
|
12
|
+
setSecret(service: string, account: string, value: string): Promise<void>;
|
|
13
|
+
deleteSecret(service: string, account: string): Promise<boolean>;
|
|
14
|
+
getMasterKey?(context: SecretStoreBackendContext): Promise<Buffer | null>;
|
|
15
|
+
setMasterKey?(context: SecretStoreBackendContext, key: Buffer): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export interface FileSecretStoreBackendOptions {
|
|
18
|
+
filePath?: string;
|
|
19
|
+
service?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CreateSecretStoreBackendOptions {
|
|
22
|
+
service?: string;
|
|
23
|
+
}
|
|
24
|
+
export type SecretStoreBackendName = "keychain" | "memory" | "file";
|
|
25
|
+
export type BiometricPolicy = "none" | "auto" | "user-presence" | "biometry-current-set";
|
|
26
|
+
export interface KeychainAccessOptions {
|
|
27
|
+
biometric?: BiometricPolicy;
|
|
28
|
+
prompt?: string;
|
|
29
|
+
}
|