@aiwg/cli 2026.10.0 → 2026.10.3
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/agentic/code/providers/capability-matrix.yaml +270 -0
- package/agentic/code/providers/model-capabilities.v1.json +3091 -24
- package/bin/aiwg.mjs +86 -21
- package/dist/src/a2a/codecs.js +9 -0
- package/dist/src/artifacts/corpus-tools/vision-extract.js +105 -15
- package/dist/src/artifacts/repair.js +9 -4
- package/dist/src/channel/manager.mjs +59 -10
- package/dist/src/cli/child-process-result.js +40 -0
- package/dist/src/cli/env.js +38 -16
- package/dist/src/cli/flag-parsing.js +236 -0
- package/dist/src/cli/handlers/decision.js +297 -2
- package/dist/src/cli/handlers/diagnose.js +9 -2
- package/dist/src/cli/handlers/feedback.js +14 -5
- package/dist/src/cli/handlers/init.js +245 -30
- package/dist/src/cli/handlers/mc.js +23 -0
- package/dist/src/cli/handlers/models.js +69 -6
- package/dist/src/cli/handlers/ralph.js +3 -0
- package/dist/src/cli/handlers/refresh.js +16 -0
- package/dist/src/cli/handlers/regenerate.js +14 -0
- package/dist/src/cli/handlers/runtime-info.js +24 -9
- package/dist/src/cli/handlers/script-runner.js +16 -6
- package/dist/src/cli/handlers/session.js +396 -62
- package/dist/src/cli/handlers/sessions.js +146 -40
- package/dist/src/cli/handlers/setup-manifest.js +439 -39
- package/dist/src/cli/handlers/setup.js +139 -39
- package/dist/src/cli/handlers/subcommands.js +3 -1
- package/dist/src/cli/handlers/team.js +18 -8
- package/dist/src/cli/handlers/use.js +13 -0
- package/dist/src/cli/handlers/utilities.js +106 -23
- package/dist/src/cli/prompt-utils.js +72 -0
- package/dist/src/cli/provider-resolution.js +11 -0
- package/dist/src/config/aiwg-config.js +268 -4
- package/dist/src/config/cli.js +146 -19
- package/dist/src/config/dispatch-thresholds-runtime.mjs +38 -0
- package/dist/src/config/project-artifacts-health.mjs +14 -3
- package/dist/src/config/user-config.js +36 -10
- package/dist/src/decision/adapters/jev.js +80 -28
- package/dist/src/decision/ask.js +352 -0
- package/dist/src/decision/driver.js +4 -0
- package/dist/src/decision/entry.js +38 -6
- package/dist/src/decision/heldout/collector.js +10 -1
- package/dist/src/decision/index.js +3 -0
- package/dist/src/decision/interop.js +60 -8
- package/dist/src/decision/jev-credentials.js +121 -0
- package/dist/src/decision/ledger.js +839 -0
- package/dist/src/decision/validate.js +6 -3
- package/dist/src/effects/dispatch-verifier.js +252 -0
- package/dist/src/effects/index.js +1 -0
- package/dist/src/features/installer.js +2 -2
- package/dist/src/flow/graph-metadata.js +5 -0
- package/dist/src/gates/providers/loader.js +3 -1
- package/dist/src/installation/manager-command.mjs +1 -1
- package/dist/src/installation/manager.mjs +17 -2
- package/dist/src/lint/runner.js +2 -2
- package/dist/src/mcp/adapters/codex-runtime.js +360 -56
- package/dist/src/mcp/cli.mjs +587 -77
- package/dist/src/mcp/config-file.mjs +279 -0
- package/dist/src/mcp/config-layers.mjs +348 -0
- package/dist/src/mcp/credentials.mjs +484 -0
- package/dist/src/mcp/grok-build-config.mjs +16 -26
- package/dist/src/mcp/helpers.mjs +106 -2
- package/dist/src/mcp/omp-config.mjs +50 -29
- package/dist/src/mcp/profiles.js +97 -23
- package/dist/src/mcp/profiles.mjs +99 -27
- package/dist/src/mcp/registry.js +264 -57
- package/dist/src/mcp/registry.mjs +198 -45
- package/dist/src/mcp/server.mjs +403 -20
- package/dist/src/mcp/toml-string.mjs +9 -0
- package/dist/src/mcp/toml-strip-mcp.mjs +135 -0
- package/dist/src/mcp/tool-filters.mjs +357 -0
- package/dist/src/mcp/tools/agentic-sandbox.mjs +3 -1
- package/dist/src/mcp/tools/decision.mjs +58 -0
- package/dist/src/mcp/tools/orchestration.mjs +38 -0
- package/dist/src/mcp/tools/subsystems.mjs +39 -8
- package/dist/src/mcp/tools/worker-invoke.mjs +1539 -0
- package/dist/src/mcp/tools/worker-shell-control.mjs +258 -0
- package/dist/src/mcp/tools/worker-stdin-runtime.mjs +79 -0
- package/dist/src/memory/project-registry.js +2 -2
- package/dist/src/mission-protocol/codecs.js +639 -1
- package/dist/src/mission-protocol/types.js +110 -0
- package/dist/src/mission-protocol/worker-status.js +2 -0
- package/dist/src/models/config-loader.js +70 -13
- package/dist/src/models/grok-build-models.js +93 -41
- package/dist/src/models/model-capabilities.v1.json +3091 -24
- package/dist/src/models/model-discovery.js +862 -63
- package/dist/src/models/provider-policy.js +625 -11
- package/dist/src/models/qualification-digest.mjs +17 -0
- package/dist/src/models/resolver.js +259 -0
- package/dist/src/models/worker-direct-readiness.js +529 -0
- package/dist/src/models/worker-dispatch-offer.js +169 -0
- package/dist/src/models/worker-health-readiness.js +131 -0
- package/dist/src/models/worker-installation.mjs +879 -0
- package/dist/src/models/wrapper-route.js +18 -0
- package/dist/src/ops/registry.js +9 -14
- package/dist/src/plugins/standalone-packager.js +4 -3
- package/dist/src/process/bounded-child-process.mjs +387 -0
- package/dist/src/process/cli-command.mjs +75 -0
- package/dist/src/providers/capability-matrix.js +8 -0
- package/dist/src/providers/capability-matrix.yaml +270 -0
- package/dist/src/providers/grok-build-headless.js +43 -21
- package/dist/src/providers/provider-definitions.js +9 -1
- package/dist/src/providers/provider-definitions.mjs +9 -2
- package/dist/src/serve/executor-registry.js +16 -24
- package/dist/src/serve/fleet-mission-conductor.js +9 -0
- package/dist/src/serve/mission-conductor.js +9 -0
- package/dist/src/serve/shared-host-scheduler.js +2 -0
- package/dist/src/serve/worker-invocation.js +538 -0
- package/dist/src/serve/worker-stdin-frame.mjs +107 -0
- package/dist/src/sessions/adapter-registry.js +45 -0
- package/dist/src/sessions/adapters/generic.js +37 -3
- package/dist/src/sessions/adapters/grokbot-locator.js +111 -0
- package/dist/src/sessions/adapters/grokbot.js +423 -24
- package/dist/src/sessions/adapters/muse-workspace-scan.js +108 -0
- package/dist/src/sessions/adapters/muse.js +68 -29
- package/dist/src/sessions/adapters/pi.js +1 -0
- package/dist/src/sessions/batch-contracts.js +13 -1
- package/dist/src/sessions/batch-import.js +23 -42
- package/dist/src/sessions/candidates.js +47 -11
- package/dist/src/sessions/contracts.js +35 -0
- package/dist/src/sessions/coverage-preflight.js +134 -0
- package/dist/src/sessions/discovery.js +3 -0
- package/dist/src/sessions/grok-build-cli.js +67 -5
- package/dist/src/sessions/importer.js +24 -8
- package/dist/src/sessions/index.js +2 -0
- package/dist/src/sessions/repository.js +54 -13
- package/dist/src/sessions/workspace-discovery.js +99 -37
- package/dist/src/skills/adapters/clawhub.js +10 -8
- package/dist/src/skills/adapters/openclaw.js +10 -7
- package/dist/src/smiths/context-pipeline/parallelism-section.js +192 -3
- package/dist/src/smiths/context-pipeline/workspace-context.js +116 -9
- package/dist/src/smiths/hook-bridge/codex-translator.js +6 -5
- package/dist/src/smiths/mcpsmith/example.js +1 -1
- package/dist/src/smiths/toolsmith/runtime-discovery.mjs +10 -14
- package/dist/src/storage/backends/logseq.js +68 -7
- package/dist/src/storage/fortemi-qualification-receipt.js +2 -2
- package/dist/src/testing/generators/test-code-generator.js +57 -30
- package/dist/src/uhp/client.js +11 -1
- package/dist/src/uhp/mission.js +5 -0
- package/dist/src/update/checker.mjs +5 -5
- package/dist/src/update/notifier.mjs +54 -2
- package/dist/src/writing/fidelity.js +18 -1
- package/package.json +18 -1
- package/schemas/mission-v1.schema.json +2429 -0
- package/schemas/models/model-catalog.v1.schema.json +301 -0
- package/schemas/models/model-config-compatibility.v1.schema.json +281 -0
- package/schemas/models/model-policy.v1.schema.json +14 -0
- package/schemas/models/provider-model-capabilities.v1.schema.json +1066 -0
- package/tools/_resolve-impl.mjs +39 -0
- package/tools/agents/deploy-agents.mjs +15 -2
- package/tools/agents/providers/base.mjs +63 -43
- package/tools/agents/providers/grokbot.mjs +11 -12
- package/tools/agents/providers/hermes.mjs +6 -3
- package/tools/agents/providers/omp.mjs +5 -2
- package/tools/agents/providers/openclaw-translator.mjs +19 -5
- package/tools/providers/deepseek-harness-transport.mjs +358 -0
- package/tools/providers/omp-transport.mjs +192 -0
- package/tools/ralph-external/lib/claude-adapter.mjs +389 -0
- package/tools/ralph-external/lib/codex-adapter.mjs +432 -0
- package/tools/ralph-external/lib/deepseek-harness-adapter.mjs +397 -0
- package/tools/ralph-external/lib/factory-adapter.mjs +503 -0
- package/tools/ralph-external/lib/muse-adapter.mjs +364 -0
- package/tools/ralph-external/lib/omp-adapter.mjs +315 -0
- package/tools/ralph-external/lib/opencode-adapter.mjs +575 -0
- package/tools/ralph-external/lib/openhuman-adapter.mjs +75 -0
- package/tools/ralph-external/lib/pi-adapter.mjs +333 -0
- package/tools/ralph-external/lib/provider-adapter.mjs +690 -0
- package/tools/ralph-external/lib/worker-health.mjs +439 -0
- package/vscode-extension/schemas/aiwg.config.v1.json +1953 -0
|
@@ -53,6 +53,9 @@ export * from './sensitivity/index.js';
|
|
|
53
53
|
export * from './issue-triage/index.js';
|
|
54
54
|
export * from './routing/index.js';
|
|
55
55
|
export * from './interop.js';
|
|
56
|
+
export * from './ask.js';
|
|
57
|
+
export * from './ledger.js';
|
|
58
|
+
export * from './jev-credentials.js';
|
|
56
59
|
export { collectHeldoutStudy, scoreHeldoutStudy } from './heldout/collector.js';
|
|
57
60
|
export { heldoutDigest, heldoutExecutionDigest, planHeldoutCollection, validateHeldoutBundle, heldoutRowsInScope } from './heldout/contract.js';
|
|
58
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -38,7 +38,8 @@ const FORBIDDEN_CONTROL_FIELDS = new Set([
|
|
|
38
38
|
'calibration', 'executor', 'backend', 'acceptance', 'artifactPin', 'actionAuthorization',
|
|
39
39
|
]);
|
|
40
40
|
const SENSITIVE_LOG_KEY = /(?:raw|body|secret|token|credential|private|locator|state|authorization|password|key)/iu;
|
|
41
|
-
const SENSITIVE_LOG_VALUE = /(?:bearer\s+\S+|secret|token|file:\/\/|\/home\/|private
|
|
41
|
+
const SENSITIVE_LOG_VALUE = /(?:bearer\s+\S+|secret|token|file:\/\/|\/home\/|private)/iu;
|
|
42
|
+
const MAX_LOG_VALUE_LENGTH = 65_536;
|
|
42
43
|
const SUPPORTED_DMN_ELEMENTS = new Set(['definitions', 'decision', 'informationRequirement', 'requiredDecision', 'decisionTable', 'input', 'inputExpression', 'output', 'rule', 'inputEntry', 'outputEntry', 'text']);
|
|
43
44
|
export function decisionInteropDefaultBounds(overrides = {}) {
|
|
44
45
|
return { ...DEFAULT_BOUNDS, ...overrides };
|
|
@@ -580,7 +581,11 @@ function sanitizeJson(value, path, redaction) {
|
|
|
580
581
|
redaction.removed.push(`${path}.${key}`);
|
|
581
582
|
continue;
|
|
582
583
|
}
|
|
583
|
-
|
|
584
|
+
// Keep ordinary objects while preserving __proto__ as an own JSON data key.
|
|
585
|
+
Object.defineProperty(result, key, {
|
|
586
|
+
value: sanitizeJson(child, `${path}.${key}`, redaction),
|
|
587
|
+
enumerable: true, writable: true, configurable: true,
|
|
588
|
+
});
|
|
584
589
|
}
|
|
585
590
|
return result;
|
|
586
591
|
}
|
|
@@ -595,10 +600,16 @@ function projectOpaInput(input, allowlist, redaction) {
|
|
|
595
600
|
for (const pointer of allowlist) {
|
|
596
601
|
if (!pointer.startsWith('/'))
|
|
597
602
|
throw new DecisionInteropError('opa-input-projection', 'OPA input projection allowlist entries must be JSON Pointers');
|
|
603
|
+
const path = pointer.slice(1).split('/').map(part => part.replace(/~1/gu, '/').replace(/~0/gu, '~'));
|
|
604
|
+
// Only __proto__ is forbidden in pointers; constructor/prototype are valid data keys.
|
|
605
|
+
// Own-property traversal and data-property writes keep ordinary projection objects safe.
|
|
606
|
+
if (path.some(segment => segment === '__proto__')) {
|
|
607
|
+
throw new DecisionInteropError('opa-input-projection', 'OPA input projection cannot contain __proto__ segments');
|
|
608
|
+
}
|
|
598
609
|
const resolved = resolveJsonPointer(input, pointer);
|
|
599
610
|
if (!resolved.found)
|
|
600
611
|
continue;
|
|
601
|
-
setProjectedValue(output,
|
|
612
|
+
setProjectedValue(output, path, sanitizeJson(resolved.value, `$.input${pointer}`, redaction));
|
|
602
613
|
}
|
|
603
614
|
return output;
|
|
604
615
|
}
|
|
@@ -606,17 +617,58 @@ function setProjectedValue(target, path, value) {
|
|
|
606
617
|
let cursor = target;
|
|
607
618
|
path.forEach((segment, index) => {
|
|
608
619
|
if (index === path.length - 1) {
|
|
609
|
-
cursor
|
|
620
|
+
Object.defineProperty(cursor, segment, {
|
|
621
|
+
value, enumerable: true, writable: true, configurable: true,
|
|
622
|
+
});
|
|
610
623
|
return;
|
|
611
624
|
}
|
|
612
|
-
const existing = cursor[segment];
|
|
613
|
-
if (!existing || typeof existing !== 'object' || Array.isArray(existing))
|
|
614
|
-
cursor
|
|
625
|
+
const existing = Object.hasOwn(cursor, segment) ? cursor[segment] : undefined;
|
|
626
|
+
if (!existing || typeof existing !== 'object' || Array.isArray(existing)) {
|
|
627
|
+
Object.defineProperty(cursor, segment, {
|
|
628
|
+
value: {}, enumerable: true, writable: true, configurable: true,
|
|
629
|
+
});
|
|
630
|
+
}
|
|
615
631
|
cursor = cursor[segment];
|
|
616
632
|
});
|
|
617
633
|
}
|
|
618
634
|
function isSensitiveValue(value) {
|
|
619
|
-
|
|
635
|
+
if (typeof value !== 'string')
|
|
636
|
+
return false;
|
|
637
|
+
// Redact oversized values in full so a sensitive suffix cannot escape inspection.
|
|
638
|
+
if (value.length > MAX_LOG_VALUE_LENGTH)
|
|
639
|
+
return true;
|
|
640
|
+
if (SENSITIVE_LOG_VALUE.test(value))
|
|
641
|
+
return true;
|
|
642
|
+
let localLength = 0;
|
|
643
|
+
let domainLength = -1;
|
|
644
|
+
let suffixLength = -1;
|
|
645
|
+
for (const character of value) {
|
|
646
|
+
const letter = /[A-Z]/iu.test(character);
|
|
647
|
+
if (character === '@') {
|
|
648
|
+
domainLength = localLength > 0 ? 0 : -1;
|
|
649
|
+
suffixLength = -1;
|
|
650
|
+
}
|
|
651
|
+
else if (domainLength >= 0) {
|
|
652
|
+
if (/[A-Z0-9.-]/iu.test(character)) {
|
|
653
|
+
if (character === '.')
|
|
654
|
+
suffixLength = domainLength > 0 ? 0 : -1;
|
|
655
|
+
else if (letter && suffixLength >= 0) {
|
|
656
|
+
suffixLength++;
|
|
657
|
+
if (suffixLength >= 2)
|
|
658
|
+
return true;
|
|
659
|
+
}
|
|
660
|
+
else
|
|
661
|
+
suffixLength = -1;
|
|
662
|
+
domainLength++;
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
domainLength = -1;
|
|
666
|
+
suffixLength = -1;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
localLength = /[A-Z0-9._%+-]/iu.test(character) ? localLength + 1 : 0;
|
|
670
|
+
}
|
|
671
|
+
return false;
|
|
620
672
|
}
|
|
621
673
|
function assertUnique(values, label) {
|
|
622
674
|
const seen = new Set();
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { constants } from 'node:fs';
|
|
2
|
+
import { access, chmod, mkdir, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { randomUUID } from 'node:crypto';
|
|
6
|
+
import { JevCredentialError } from './adapters/jev.js';
|
|
7
|
+
export const JEV_CREDENTIAL_REF = 'typesafe-api';
|
|
8
|
+
export const JEV_DEFAULT_REGION = 'us';
|
|
9
|
+
function env(options) {
|
|
10
|
+
return options.env ?? process.env;
|
|
11
|
+
}
|
|
12
|
+
export function jevCredentialPath(options = {}) {
|
|
13
|
+
if (options.credentialPath)
|
|
14
|
+
return options.credentialPath;
|
|
15
|
+
const configuredHome = options.configHome ?? env(options).XDG_CONFIG_HOME;
|
|
16
|
+
const base = configuredHome && configuredHome.trim() ? configuredHome : path.join(options.homeDir ?? os.homedir(), '.config');
|
|
17
|
+
return path.join(base, 'aiwg', 'credentials', 'jev.json');
|
|
18
|
+
}
|
|
19
|
+
function isInsecureMode(mode) {
|
|
20
|
+
return (mode & 0o077) !== 0;
|
|
21
|
+
}
|
|
22
|
+
function parseRecord(raw) {
|
|
23
|
+
const parsed = JSON.parse(raw);
|
|
24
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
25
|
+
throw new JevCredentialError('configuration');
|
|
26
|
+
const record = parsed;
|
|
27
|
+
if (typeof record.token !== 'string' || !record.token.trim())
|
|
28
|
+
throw new JevCredentialError('configuration');
|
|
29
|
+
if (record.region !== undefined && (typeof record.region !== 'string' || !record.region.trim())) {
|
|
30
|
+
throw new JevCredentialError('configuration');
|
|
31
|
+
}
|
|
32
|
+
if (record.endpoint !== undefined && (typeof record.endpoint !== 'string' || !record.endpoint.trim())) {
|
|
33
|
+
throw new JevCredentialError('configuration');
|
|
34
|
+
}
|
|
35
|
+
if (record.enabled !== undefined && typeof record.enabled !== 'boolean')
|
|
36
|
+
throw new JevCredentialError('configuration');
|
|
37
|
+
return {
|
|
38
|
+
token: record.token,
|
|
39
|
+
region: typeof record.region === 'string' ? record.region : JEV_DEFAULT_REGION,
|
|
40
|
+
...(typeof record.endpoint === 'string' ? { endpoint: record.endpoint } : {}),
|
|
41
|
+
...(typeof record.enabled === 'boolean' ? { enabled: record.enabled } : {}),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
async function readCredentialFile(options = {}) {
|
|
45
|
+
const credentialPath = jevCredentialPath(options);
|
|
46
|
+
try {
|
|
47
|
+
const [fileStat, parentStat] = await Promise.all([stat(credentialPath), stat(path.dirname(credentialPath))]);
|
|
48
|
+
if (isInsecureMode(fileStat.mode) || isInsecureMode(parentStat.mode))
|
|
49
|
+
throw new JevCredentialError('denied');
|
|
50
|
+
return parseRecord(await readFile(credentialPath, 'utf8'));
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
if (error.code === 'ENOENT')
|
|
54
|
+
return null;
|
|
55
|
+
if (error instanceof JevCredentialError)
|
|
56
|
+
throw error;
|
|
57
|
+
if (error instanceof SyntaxError)
|
|
58
|
+
throw new JevCredentialError('configuration');
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export async function lookupJevCredential(options = {}) {
|
|
63
|
+
const environment = env(options);
|
|
64
|
+
const forced = environment.AIWG_DECISION_ENABLED;
|
|
65
|
+
const envToken = environment.JEV_API_KEY?.trim() || environment.AIWG_DECISION_JEV_API_KEY?.trim();
|
|
66
|
+
const fileRecord = envToken && (forced === '0' || forced === '1') ? null : await readCredentialFile(options);
|
|
67
|
+
const enabled = forced === '0' ? false : forced === '1' ? true : fileRecord?.enabled === true;
|
|
68
|
+
if (envToken)
|
|
69
|
+
return {
|
|
70
|
+
source: 'env',
|
|
71
|
+
token: envToken,
|
|
72
|
+
region: environment.AIWG_DECISION_JEV_REGION?.trim() || fileRecord?.region || JEV_DEFAULT_REGION,
|
|
73
|
+
...(environment.AIWG_DECISION_JEV_ENDPOINT?.trim() ? { endpoint: environment.AIWG_DECISION_JEV_ENDPOINT.trim() }
|
|
74
|
+
: fileRecord?.endpoint ? { endpoint: fileRecord.endpoint } : {}),
|
|
75
|
+
enabled,
|
|
76
|
+
};
|
|
77
|
+
if (!fileRecord)
|
|
78
|
+
return null;
|
|
79
|
+
return { source: 'file', token: fileRecord.token, region: fileRecord.region, ...(fileRecord.endpoint ? { endpoint: fileRecord.endpoint } : {}), enabled };
|
|
80
|
+
}
|
|
81
|
+
export async function resolveJevCredentialBytes(logicalRef, options = {}) {
|
|
82
|
+
if (logicalRef !== JEV_CREDENTIAL_REF)
|
|
83
|
+
throw new JevCredentialError('configuration');
|
|
84
|
+
const credential = await lookupJevCredential(options);
|
|
85
|
+
if (!credential?.enabled)
|
|
86
|
+
throw new JevCredentialError('denied');
|
|
87
|
+
if (!credential.token)
|
|
88
|
+
throw new JevCredentialError('missing');
|
|
89
|
+
return new TextEncoder().encode(credential.token);
|
|
90
|
+
}
|
|
91
|
+
export async function writeJevCredentialFile(record, options = {}) {
|
|
92
|
+
const credentialPath = jevCredentialPath(options);
|
|
93
|
+
const directory = path.dirname(credentialPath);
|
|
94
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
95
|
+
await chmod(directory, 0o700);
|
|
96
|
+
const tmp = path.join(directory, `.jev.${process.pid}.${randomUUID()}.tmp`);
|
|
97
|
+
const body = `${JSON.stringify(record, null, 2)}\n`;
|
|
98
|
+
try {
|
|
99
|
+
await writeFile(tmp, body, { mode: 0o600, flag: 'wx' });
|
|
100
|
+
await chmod(tmp, 0o600);
|
|
101
|
+
await rename(tmp, credentialPath);
|
|
102
|
+
await chmod(credentialPath, 0o600);
|
|
103
|
+
return credentialPath;
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
await rm(tmp, { force: true }).catch(() => undefined);
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export async function removeJevCredentialFile(options = {}) {
|
|
111
|
+
const credentialPath = jevCredentialPath(options);
|
|
112
|
+
try {
|
|
113
|
+
await access(credentialPath, constants.F_OK);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
await rm(credentialPath, { force: true });
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=jev-credentials.js.map
|