@oscharko-dev/keiko 1.0.3 → 1.0.4
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/cli/index.js +10 -6
- package/dist/ui/csp-hashes.json +6 -6
- package/dist/ui/static/404.html +1 -1
- package/dist/ui/static/__next.__PAGE__.txt +2 -2
- package/dist/ui/static/__next._full.txt +3 -3
- package/dist/ui/static/__next._tree.txt +1 -1
- package/dist/ui/static/_next/static/chunks/{2aebtbzatv9jb.js → 1yj6x688jjk-a.js} +1 -1
- package/dist/ui/static/_next/static/chunks/{2_-v-c9bsad3u.js → 3f_-h2lm9ml4b.js} +1 -1
- package/dist/ui/static/_not-found/__next._full.txt +1 -1
- package/dist/ui/static/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/ui/static/_not-found/__next._tree.txt +1 -1
- package/dist/ui/static/_not-found.html +1 -1
- package/dist/ui/static/_not-found.txt +1 -1
- package/dist/ui/static/atlassian-connectors/__next._full.txt +1 -1
- package/dist/ui/static/atlassian-connectors/__next._tree.txt +1 -1
- package/dist/ui/static/atlassian-connectors/__next.atlassian-connectors.__PAGE__.txt +1 -1
- package/dist/ui/static/atlassian-connectors.html +1 -1
- package/dist/ui/static/atlassian-connectors.txt +1 -1
- package/dist/ui/static/index.html +1 -1
- package/dist/ui/static/index.txt +3 -3
- package/dist/ui/static/launch/__next._full.txt +3 -3
- package/dist/ui/static/launch/__next._tree.txt +1 -1
- package/dist/ui/static/launch/__next.launch.__PAGE__.txt +2 -2
- package/dist/ui/static/launch.html +1 -1
- package/dist/ui/static/launch.txt +3 -3
- package/dist/ui/static/local-knowledge/__next._full.txt +3 -3
- package/dist/ui/static/local-knowledge/__next._tree.txt +1 -1
- package/dist/ui/static/local-knowledge/__next.local-knowledge.__PAGE__.txt +2 -2
- package/dist/ui/static/local-knowledge/capsule/__next._full.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule/__next._tree.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule/__next.local-knowledge.capsule.__PAGE__.txt +1 -1
- package/dist/ui/static/local-knowledge/capsule.html +1 -1
- package/dist/ui/static/local-knowledge/capsule.txt +1 -1
- package/dist/ui/static/local-knowledge.html +1 -1
- package/dist/ui/static/local-knowledge.txt +3 -3
- package/node_modules/@oscharko-dev/keiko-cli/dist/audit.d.ts +5 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/audit.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/audit.js +109 -11
- package/node_modules/@oscharko-dev/keiko-cli/dist/cli-control-state.d.ts +13 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/cli-control-state.d.ts.map +1 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/cli-control-state.js +47 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/index.d.ts +1 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/index.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/index.js +1 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/install-layout.d.ts +28 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/install-layout.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/install-layout.js +71 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/launcher.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/launcher.js +2 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/lifecycle.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/lifecycle.js +2 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/portable.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/portable.js +11 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/repair.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/repair.js +7 -2
- package/node_modules/@oscharko-dev/keiko-cli/dist/runner.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/runner.js +81 -34
- package/node_modules/@oscharko-dev/keiko-cli/dist/security-log.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/security-log.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/security-log.js +2 -3
- package/node_modules/@oscharko-dev/keiko-cli/dist/support.d.ts +5 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/support.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/support.js +65 -3
- package/node_modules/@oscharko-dev/keiko-cli/dist/ui.d.ts +2 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/ui.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/ui.js +14 -13
- package/node_modules/@oscharko-dev/keiko-cli/dist/uninstall.d.ts +1 -0
- package/node_modules/@oscharko-dev/keiko-cli/dist/uninstall.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/uninstall.js +236 -69
- package/node_modules/@oscharko-dev/keiko-cli/dist/update.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-cli/dist/update.js +2 -0
- package/node_modules/@oscharko-dev/keiko-cli/package.json +14 -14
- package/node_modules/@oscharko-dev/keiko-connectors/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-connectors/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-connectors/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-contracts/dist/governed-tool-lifecycle.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-contracts/dist/governed-tool-lifecycle.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-contracts/dist/prompt-enhancer-analyzer-benchmark-fixture.d.ts +10 -0
- package/node_modules/@oscharko-dev/keiko-contracts/dist/prompt-enhancer-analyzer-benchmark-fixture.d.ts.map +1 -0
- package/node_modules/@oscharko-dev/keiko-contracts/dist/prompt-enhancer-analyzer-benchmark-fixture.js +63 -0
- package/node_modules/@oscharko-dev/keiko-contracts/dist/prompt-enhancer-analyzer.d.ts +1 -0
- package/node_modules/@oscharko-dev/keiko-contracts/dist/prompt-enhancer-analyzer.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-contracts/dist/prompt-enhancer-analyzer.js +29 -1
- package/node_modules/@oscharko-dev/keiko-contracts/dist/version.d.ts +2 -2
- package/node_modules/@oscharko-dev/keiko-contracts/dist/version.js +2 -2
- package/node_modules/@oscharko-dev/keiko-contracts/package.json +1 -1
- package/node_modules/@oscharko-dev/keiko-evaluations/package.json +9 -9
- package/node_modules/@oscharko-dev/keiko-evidence/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-evidence/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-evidence/package.json +4 -4
- package/node_modules/@oscharko-dev/keiko-git/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-git/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-git/package.json +1 -1
- package/node_modules/@oscharko-dev/keiko-harness/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-harness/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-harness/package.json +7 -7
- package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-local-knowledge/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-local-knowledge/package.json +6 -6
- package/node_modules/@oscharko-dev/keiko-memory-capture/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-capture/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-capture/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-consolidation/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-memory-governance/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-governance/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-governance/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-memory-retrieval/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-retrieval/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-retrieval/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-memory-vault/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-vault/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-memory-vault/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-model-gateway/package.json +4 -4
- package/node_modules/@oscharko-dev/keiko-quality-intelligence/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-sandbox/package.json +2 -2
- package/node_modules/@oscharko-dev/keiko-sdk/package.json +9 -9
- package/node_modules/@oscharko-dev/keiko-security/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-security/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-security/package.json +2 -2
- package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeRuntimeAdapter.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/opencodeRuntimeAdapter.js +16 -6
- package/node_modules/@oscharko-dev/keiko-server/dist/coding-runtime/productionOpenCodeBackend.js +9 -5
- package/node_modules/@oscharko-dev/keiko-server/dist/task-workspace/reconciliation-gitdir-pointer-benchmark-fixture.d.ts +3 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/task-workspace/reconciliation-gitdir-pointer-benchmark-fixture.d.ts.map +1 -0
- package/node_modules/@oscharko-dev/keiko-server/dist/task-workspace/reconciliation-gitdir-pointer-benchmark-fixture.js +5 -0
- package/node_modules/@oscharko-dev/keiko-server/package.json +22 -22
- package/node_modules/@oscharko-dev/keiko-tool-catalog/dist/catalog.d.ts.map +1 -1
- package/node_modules/@oscharko-dev/keiko-tool-catalog/dist/catalog.js +14 -2
- package/node_modules/@oscharko-dev/keiko-tool-catalog/package.json +3 -3
- package/node_modules/@oscharko-dev/keiko-tools/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-tools/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-tools/package.json +7 -7
- package/node_modules/@oscharko-dev/keiko-verification/package.json +5 -5
- package/node_modules/@oscharko-dev/keiko-workflows/package.json +10 -10
- package/node_modules/@oscharko-dev/keiko-workspace/dist/version.d.ts +1 -1
- package/node_modules/@oscharko-dev/keiko-workspace/dist/version.js +1 -1
- package/node_modules/@oscharko-dev/keiko-workspace/package.json +3 -3
- package/package.json +36 -36
- package/release-impact.catalog.json +56 -0
- package/vendor/oscharko-dev-keiko-cli-1.0.4.tgz +0 -0
- package/vendor/{oscharko-dev-keiko-connectors-1.0.3.tgz → oscharko-dev-keiko-connectors-1.0.4.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-contracts-1.0.4.tgz +0 -0
- package/vendor/{oscharko-dev-keiko-evaluations-1.0.3.tgz → oscharko-dev-keiko-evaluations-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-evidence-1.0.3.tgz → oscharko-dev-keiko-evidence-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-git-1.0.3.tgz → oscharko-dev-keiko-git-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-harness-1.0.3.tgz → oscharko-dev-keiko-harness-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-local-knowledge-1.0.3.tgz → oscharko-dev-keiko-local-knowledge-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-memory-capture-1.0.3.tgz → oscharko-dev-keiko-memory-capture-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-memory-consolidation-1.0.3.tgz → oscharko-dev-keiko-memory-consolidation-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-memory-governance-1.0.3.tgz → oscharko-dev-keiko-memory-governance-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-memory-retrieval-1.0.3.tgz → oscharko-dev-keiko-memory-retrieval-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-memory-vault-1.0.3.tgz → oscharko-dev-keiko-memory-vault-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-model-gateway-1.0.3.tgz → oscharko-dev-keiko-model-gateway-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-quality-intelligence-1.0.3.tgz → oscharko-dev-keiko-quality-intelligence-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-sandbox-1.0.3.tgz → oscharko-dev-keiko-sandbox-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-sdk-1.0.3.tgz → oscharko-dev-keiko-sdk-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-security-1.0.3.tgz → oscharko-dev-keiko-security-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-server-1.0.3.tgz → oscharko-dev-keiko-server-1.0.4.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-tool-catalog-1.0.4.tgz +0 -0
- package/vendor/{oscharko-dev-keiko-tools-1.0.3.tgz → oscharko-dev-keiko-tools-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-verification-1.0.3.tgz → oscharko-dev-keiko-verification-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-workflows-1.0.3.tgz → oscharko-dev-keiko-workflows-1.0.4.tgz} +0 -0
- package/vendor/{oscharko-dev-keiko-workspace-1.0.3.tgz → oscharko-dev-keiko-workspace-1.0.4.tgz} +0 -0
- package/vendor/oscharko-dev-keiko-cli-1.0.3.tgz +0 -0
- package/vendor/oscharko-dev-keiko-contracts-1.0.3.tgz +0 -0
- package/vendor/oscharko-dev-keiko-tool-catalog-1.0.3.tgz +0 -0
- /package/dist/ui/static/_next/static/{1BZa3EoPufXZpDHFm8Sty → t7N9H4GMepHS6cfU2Wj24}/_buildManifest.js +0 -0
- /package/dist/ui/static/_next/static/{1BZa3EoPufXZpDHFm8Sty → t7N9H4GMepHS6cfU2Wj24}/_clientMiddlewareManifest.js +0 -0
- /package/dist/ui/static/_next/static/{1BZa3EoPufXZpDHFm8Sty → t7N9H4GMepHS6cfU2Wj24}/_ssgManifest.js +0 -0
|
@@ -20,6 +20,7 @@ import { runUpdateCli } from "./update.js";
|
|
|
20
20
|
import { emitDoctorWarning, runDoctorCli } from "./doctor.js";
|
|
21
21
|
import { runAuditCli } from "./audit.js";
|
|
22
22
|
import { runSupportCli } from "./support.js";
|
|
23
|
+
import { installLayoutOverrideEvidence } from "./install-layout.js";
|
|
23
24
|
import { loadServer } from "./lazy-modules.js";
|
|
24
25
|
import { securityErrorKind, } from "@oscharko-dev/keiko-security";
|
|
25
26
|
// The version constant comes from the contracts LEAF, not the keiko-sdk barrel:
|
|
@@ -68,15 +69,21 @@ Exit codes:
|
|
|
68
69
|
1 Runtime error
|
|
69
70
|
2 Usage error
|
|
70
71
|
`;
|
|
71
|
-
function
|
|
72
|
+
function pendingSecurityLogEvent(stateDir, event, invocationCorrelationId) {
|
|
73
|
+
return {
|
|
74
|
+
stateDir,
|
|
75
|
+
event: invocationCorrelationId === undefined
|
|
76
|
+
? event
|
|
77
|
+
: { ...event, correlationId: invocationCorrelationId },
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function deferredSecurityLogCollector(invocationCorrelationId) {
|
|
72
81
|
const pending = [];
|
|
73
82
|
const sinks = new Map();
|
|
74
|
-
let active = false;
|
|
75
83
|
let drainPromise;
|
|
76
84
|
let fileSinkFactory;
|
|
85
|
+
let unavailable = false;
|
|
77
86
|
const drain = async () => {
|
|
78
|
-
if (pending.length === 0)
|
|
79
|
-
return;
|
|
80
87
|
try {
|
|
81
88
|
fileSinkFactory ??= (await loadServer()).createFileServerLogSink;
|
|
82
89
|
while (pending.length > 0) {
|
|
@@ -92,6 +99,7 @@ function deferredSecurityLogCollector() {
|
|
|
92
99
|
}
|
|
93
100
|
}
|
|
94
101
|
catch (cause) {
|
|
102
|
+
unavailable = true;
|
|
95
103
|
pending.splice(0);
|
|
96
104
|
warnSecurityLogSinkUnavailable(cause);
|
|
97
105
|
}
|
|
@@ -101,7 +109,7 @@ function deferredSecurityLogCollector() {
|
|
|
101
109
|
return drainPromise;
|
|
102
110
|
drainPromise = drain().finally(() => {
|
|
103
111
|
drainPromise = undefined;
|
|
104
|
-
if (
|
|
112
|
+
if (pending.length > 0)
|
|
105
113
|
void startDrain();
|
|
106
114
|
});
|
|
107
115
|
return drainPromise;
|
|
@@ -109,30 +117,36 @@ function deferredSecurityLogCollector() {
|
|
|
109
117
|
return {
|
|
110
118
|
factory: (stateDir) => ({
|
|
111
119
|
write: (event) => {
|
|
112
|
-
pending.push(
|
|
113
|
-
|
|
114
|
-
void startDrain();
|
|
120
|
+
pending.push(pendingSecurityLogEvent(stateDir, event, invocationCorrelationId));
|
|
121
|
+
void startDrain();
|
|
115
122
|
},
|
|
116
123
|
}),
|
|
117
124
|
flush: async () => {
|
|
118
|
-
active = true;
|
|
119
125
|
while (pending.length > 0 || drainPromise !== undefined) {
|
|
120
126
|
await (drainPromise ?? startDrain());
|
|
121
127
|
}
|
|
128
|
+
return !unavailable;
|
|
122
129
|
},
|
|
123
130
|
};
|
|
124
131
|
}
|
|
125
|
-
async function runWithDeferredSecurityLog(run) {
|
|
126
|
-
const collector = deferredSecurityLogCollector();
|
|
132
|
+
async function runWithDeferredSecurityLog(run, invocationCorrelationId, failure) {
|
|
133
|
+
const collector = deferredSecurityLogCollector(invocationCorrelationId);
|
|
134
|
+
let result;
|
|
127
135
|
try {
|
|
128
|
-
|
|
136
|
+
result = await run(collector.factory);
|
|
129
137
|
}
|
|
130
|
-
|
|
131
|
-
//
|
|
132
|
-
//
|
|
133
|
-
// error therefore starts another serialized drain instead of being stranded in this queue.
|
|
138
|
+
catch (cause) {
|
|
139
|
+
// Eventless commands never load the server graph. Detached helpers retain their sink after
|
|
140
|
+
// settlement; any later child error starts another serialized drain instead of being stranded.
|
|
134
141
|
await collector.flush();
|
|
142
|
+
throw cause;
|
|
143
|
+
}
|
|
144
|
+
const persisted = await collector.flush();
|
|
145
|
+
if (!persisted && failure !== undefined) {
|
|
146
|
+
failure.io.err(failure.message);
|
|
147
|
+
return 1;
|
|
135
148
|
}
|
|
149
|
+
return result;
|
|
136
150
|
}
|
|
137
151
|
function warnSecurityLogSinkUnavailable(cause) {
|
|
138
152
|
const errorKind = securityErrorKind(cause);
|
|
@@ -144,43 +158,73 @@ function warnSecurityLogSinkUnavailable(cause) {
|
|
|
144
158
|
});
|
|
145
159
|
}
|
|
146
160
|
catch {
|
|
147
|
-
// The warning channel is the last body-free fallback.
|
|
148
|
-
//
|
|
161
|
+
// The warning channel is the last body-free fallback. Its own failure must never block a
|
|
162
|
+
// recovery command; read-only audit separately fails closed when its evidence cannot persist.
|
|
149
163
|
}
|
|
150
164
|
}
|
|
151
165
|
function runRepairCommand(rest, io, env) {
|
|
152
166
|
// Keep repair's established synchronous return on hosts that cannot invoke the Windows shortcut
|
|
153
167
|
// helper. Windows loads the existing file sink only after dispatch, never on `keiko --version`.
|
|
154
|
-
|
|
168
|
+
const layoutEvidence = installLayoutOverrideEvidence(env);
|
|
169
|
+
const needsLayoutEvidence = layoutEvidence !== undefined;
|
|
170
|
+
if (!needsLayoutEvidence &&
|
|
171
|
+
(process.platform !== "win32" || rest[0] === "--help" || rest[0] === "-h")) {
|
|
155
172
|
return runRepairCli(rest, io, env);
|
|
156
173
|
}
|
|
157
|
-
return runWithDeferredSecurityLog((securityLogSinkFactory) => runRepairCli(rest, io, env, { securityLogSinkFactory }));
|
|
174
|
+
return runWithDeferredSecurityLog((securityLogSinkFactory) => runRepairCli(rest, io, env, { securityLogSinkFactory }), layoutEvidence?.correlationId);
|
|
158
175
|
}
|
|
159
176
|
function runLauncherCommand(rest, io, env) {
|
|
160
177
|
const command = rest[0];
|
|
161
178
|
const needsWindowsHelper = process.platform === "win32" && command === "install";
|
|
162
|
-
|
|
179
|
+
const layoutEvidence = installLayoutOverrideEvidence(env);
|
|
180
|
+
const needsLayoutEvidence = layoutEvidence !== undefined;
|
|
181
|
+
if (!needsWindowsHelper && !needsLayoutEvidence)
|
|
163
182
|
return runLauncherCli(rest, io, env);
|
|
164
|
-
return runWithDeferredSecurityLog((securityLogSinkFactory) => runLauncherCli(rest, io, env, { securityLogSinkFactory }));
|
|
183
|
+
return runWithDeferredSecurityLog((securityLogSinkFactory) => runLauncherCli(rest, io, env, { securityLogSinkFactory }), layoutEvidence?.correlationId);
|
|
184
|
+
}
|
|
185
|
+
function runSupportCommand(rest, io, env) {
|
|
186
|
+
if (rest[0] !== "export" || installLayoutOverrideEvidence(env) === undefined) {
|
|
187
|
+
return runSupportCli(rest, io, env);
|
|
188
|
+
}
|
|
189
|
+
return loadServer().then(({ createFileServerLogSink }) => runSupportCli(rest, io, env, { activityLogSinkFactory: createFileServerLogSink }));
|
|
190
|
+
}
|
|
191
|
+
function runUiCommand(rest, io, env) {
|
|
192
|
+
const layoutEvidence = installLayoutOverrideEvidence(env);
|
|
193
|
+
if (layoutEvidence === undefined)
|
|
194
|
+
return runUiCli(rest, io, env);
|
|
195
|
+
return runWithDeferredSecurityLog((activityLogSinkFactory) => runUiCli(rest, io, env, { activityLogSinkFactory }), layoutEvidence.correlationId);
|
|
165
196
|
}
|
|
166
197
|
function runLifecycleCommand(command, rest, io, env) {
|
|
167
|
-
const
|
|
168
|
-
|
|
198
|
+
const layoutEvidence = installLayoutOverrideEvidence(env);
|
|
199
|
+
const needsDeferredLog = (process.platform === "win32" && rest.includes("--open")) || layoutEvidence !== undefined;
|
|
200
|
+
if (!needsDeferredLog)
|
|
169
201
|
return runLifecycleCli(command, rest, io, env);
|
|
170
|
-
return runWithDeferredSecurityLog((securityLogSinkFactory) => runLifecycleCli(command, rest, io, env, { securityLogSinkFactory }));
|
|
202
|
+
return runWithDeferredSecurityLog((securityLogSinkFactory) => runLifecycleCli(command, rest, io, env, { securityLogSinkFactory }), layoutEvidence?.correlationId);
|
|
171
203
|
}
|
|
172
204
|
function runUninstallCommand(rest, io, env) {
|
|
173
205
|
const help = rest[0] === "--help" || rest[0] === "-h";
|
|
174
|
-
if (
|
|
206
|
+
if (help)
|
|
175
207
|
return runUninstallCli(rest, io, env);
|
|
176
|
-
return runWithDeferredSecurityLog((securityLogSinkFactory) => runUninstallCli(rest, io, env, { securityLogSinkFactory }));
|
|
208
|
+
return runWithDeferredSecurityLog((securityLogSinkFactory) => runUninstallCli(rest, io, env, { securityLogSinkFactory }), installLayoutOverrideEvidence(env)?.correlationId);
|
|
209
|
+
}
|
|
210
|
+
function runAuditCommand(rest, io, env) {
|
|
211
|
+
const help = rest.includes("--help") || rest.includes("-h");
|
|
212
|
+
if (help)
|
|
213
|
+
return runAuditCli(rest, io, env);
|
|
214
|
+
return runWithDeferredSecurityLog((activityLogSinkFactory) => runAuditCli(rest, io, env, { activityLogSinkFactory }), installLayoutOverrideEvidence(env)?.correlationId, {
|
|
215
|
+
io,
|
|
216
|
+
message: "keiko audit: durable activity logging is unavailable; audit refused.\n",
|
|
217
|
+
});
|
|
177
218
|
}
|
|
178
219
|
function runPortableCommand(rest, io, env) {
|
|
179
220
|
const command = rest[0];
|
|
180
221
|
const noShortcutOperation = command === undefined || command === "--help" || command === "-h" || command === "status";
|
|
181
|
-
|
|
222
|
+
const layoutEvidence = installLayoutOverrideEvidence(env);
|
|
223
|
+
const needsLayoutEvidence = layoutEvidence !== undefined;
|
|
224
|
+
if ((!needsLayoutEvidence && process.platform !== "win32") || noShortcutOperation) {
|
|
182
225
|
return runPortableCli(rest, io, env);
|
|
183
|
-
|
|
226
|
+
}
|
|
227
|
+
return runWithDeferredSecurityLog((securityLogSinkFactory) => runPortableCli(rest, io, env, { securityLogSinkFactory }), layoutEvidence?.correlationId);
|
|
184
228
|
}
|
|
185
229
|
// A Map has no prototype-chain lookup surface — `.get("toString")` etc. return undefined instead
|
|
186
230
|
// of resolving to inherited Object.prototype functions. An object literal indexed by raw argv let
|
|
@@ -203,8 +247,8 @@ const COMMAND_HANDLERS = new Map([
|
|
|
203
247
|
["task-workspace", runTaskWorkspaceCli],
|
|
204
248
|
["init", runInitCli],
|
|
205
249
|
["doctor", runDoctorCli],
|
|
206
|
-
["audit",
|
|
207
|
-
["support",
|
|
250
|
+
["audit", runAuditCommand],
|
|
251
|
+
["support", runSupportCommand],
|
|
208
252
|
["repair", runRepairCommand],
|
|
209
253
|
["uninstall", runUninstallCommand],
|
|
210
254
|
["update", runUpdateCli],
|
|
@@ -212,13 +256,16 @@ const COMMAND_HANDLERS = new Map([
|
|
|
212
256
|
"start",
|
|
213
257
|
(rest, io, env) => runLifecycleCommand("start", rest, io, env),
|
|
214
258
|
],
|
|
215
|
-
["stop", (rest, io, env) =>
|
|
216
|
-
[
|
|
259
|
+
["stop", (rest, io, env) => runLifecycleCommand("stop", rest, io, env)],
|
|
260
|
+
[
|
|
261
|
+
"status",
|
|
262
|
+
(rest, io, env) => runLifecycleCommand("status", rest, io, env),
|
|
263
|
+
],
|
|
217
264
|
[
|
|
218
265
|
"restart",
|
|
219
266
|
(rest, io, env) => runLifecycleCommand("restart", rest, io, env),
|
|
220
267
|
],
|
|
221
|
-
["ui",
|
|
268
|
+
["ui", runUiCommand],
|
|
222
269
|
["launcher", runLauncherCommand],
|
|
223
270
|
["portable", runPortableCommand],
|
|
224
271
|
]);
|
|
@@ -17,5 +17,5 @@ export declare function emitCliWindowsSystemFailure(error: unknown, sink: Securi
|
|
|
17
17
|
* boundary does know when an invocation begins, so it mints one UUID and overwrites any event-level
|
|
18
18
|
* value before forwarding. The adapter adds no argv, path, environment, or error content.
|
|
19
19
|
*/
|
|
20
|
-
export declare function createCliSecurityLogSink(stateDir: string, factory: CliSecurityLogSinkFactory | undefined): SecurityLogSink | undefined;
|
|
20
|
+
export declare function createCliSecurityLogSink(stateDir: string, factory: CliSecurityLogSinkFactory | undefined, invocationCorrelationId?: string): SecurityLogSink | undefined;
|
|
21
21
|
//# sourceMappingURL=security-log.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-log.d.ts","sourceRoot":"","sources":["../src/security-log.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,eAAe,EAGrB,MAAM,8BAA8B,CAAC;AAEtC,iGAAiG;AACjG,MAAM,MAAM,yBAAyB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,eAAe,CAAC;AAE9E,MAAM,MAAM,uBAAuB,GAC/B,kBAAkB,GAClB,2BAA2B,GAC3B,wBAAwB,GACxB,oBAAoB,CAAC;AA4FzB;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAUT;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,yBAAyB,GAAG,SAAS,GAC7C,eAAe,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"security-log.d.ts","sourceRoot":"","sources":["../src/security-log.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,eAAe,EAGrB,MAAM,8BAA8B,CAAC;AAEtC,iGAAiG;AACjG,MAAM,MAAM,yBAAyB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,eAAe,CAAC;AAE9E,MAAM,MAAM,uBAAuB,GAC/B,kBAAkB,GAClB,2BAA2B,GAC3B,wBAAwB,GACxB,oBAAoB,CAAC;AA4FzB;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAUT;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,yBAAyB,GAAG,SAAS,EAC9C,uBAAuB,GAAE,MAAqB,GAC7C,eAAe,GAAG,SAAS,CAa7B"}
|
|
@@ -105,10 +105,9 @@ export function emitCliWindowsSystemFailure(error, sink, surface) {
|
|
|
105
105
|
* boundary does know when an invocation begins, so it mints one UUID and overwrites any event-level
|
|
106
106
|
* value before forwarding. The adapter adds no argv, path, environment, or error content.
|
|
107
107
|
*/
|
|
108
|
-
export function createCliSecurityLogSink(stateDir, factory) {
|
|
108
|
+
export function createCliSecurityLogSink(stateDir, factory, invocationCorrelationId = randomUUID()) {
|
|
109
109
|
if (factory === undefined)
|
|
110
110
|
return undefined;
|
|
111
|
-
const correlationId = randomUUID();
|
|
112
111
|
let downstream;
|
|
113
112
|
return {
|
|
114
113
|
write(event) {
|
|
@@ -117,7 +116,7 @@ export function createCliSecurityLogSink(stateDir, factory) {
|
|
|
117
116
|
// eagerly creating `<stateDir>/logs` here would run before those fail-closed checks and would
|
|
118
117
|
// also mutate an otherwise read-only command that emits nothing.
|
|
119
118
|
downstream ??= factory(stateDir);
|
|
120
|
-
downstream.write({ ...event, correlationId });
|
|
119
|
+
downstream.write({ ...event, correlationId: invocationCorrelationId });
|
|
121
120
|
},
|
|
122
121
|
};
|
|
123
122
|
}
|
|
@@ -2,6 +2,7 @@ import type { EvidenceStore } from "@oscharko-dev/keiko-evidence";
|
|
|
2
2
|
import type { EnvSource } from "@oscharko-dev/keiko-model-gateway";
|
|
3
3
|
import { type AuditCliDeps } from "./audit.js";
|
|
4
4
|
import type { CliIo } from "./runner.js";
|
|
5
|
+
import { type CliSecurityLogSinkFactory } from "./security-log.js";
|
|
5
6
|
export interface SupportCliDeps {
|
|
6
7
|
readonly cwd?: string | undefined;
|
|
7
8
|
readonly now?: (() => Date) | undefined;
|
|
@@ -11,6 +12,10 @@ export interface SupportCliDeps {
|
|
|
11
12
|
readonly evidenceStore?: EvidenceStore | undefined;
|
|
12
13
|
/** Test seam for determining whether the newest raw-log process still exists. */
|
|
13
14
|
readonly processIsRunning?: ((pid: number) => boolean) | undefined;
|
|
15
|
+
readonly activityLogSinkFactory?: CliSecurityLogSinkFactory | undefined;
|
|
16
|
+
readonly controlActivityStateDir?: string | undefined;
|
|
17
|
+
readonly homedir?: (() => string) | undefined;
|
|
18
|
+
readonly platform?: NodeJS.Platform | undefined;
|
|
14
19
|
}
|
|
15
20
|
interface ExportArgs {
|
|
16
21
|
readonly out: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"support.d.ts","sourceRoot":"","sources":["../src/support.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"support.d.ts","sourceRoot":"","sources":["../src/support.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAEnE,OAAO,EAAE,KAAK,YAAY,EAAyC,MAAM,YAAY,CAAC;AAkBtF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAA4B,KAAK,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAwF7F,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IACxC,6FAA6F;IAC7F,QAAQ,CAAC,SAAS,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IAC9C,sEAAsE;IACtE,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IACnD,iFAAiF;IACjF,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,K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AAK,EAAE,UAAU,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;CAAE,CAAC;AAoG9D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,iBAAiB,CAc3E;AA8tBD,wBAAsB,aAAa,CACjC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,EAAE,KAAK,EACT,GAAG,GAAE,SAAc,EACnB,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,MAAM,CAAC,CAcjB"}
|
|
@@ -10,18 +10,23 @@
|
|
|
10
10
|
// selection, manifest assembly, parsing, grouping, ordering, rendering — lives in
|
|
11
11
|
// ./support-export.ts and ./support-analyze.ts, each independently unit-tested on data, not argv.
|
|
12
12
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
13
|
+
import { homedir as defaultHomedir } from "node:os";
|
|
13
14
|
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
14
15
|
import { KEIKO_PRODUCT_VERSION } from "@oscharko-dev/keiko-contracts/runtime/version";
|
|
16
|
+
import { emitSecurityLogEvent, securityErrorKind } from "@oscharko-dev/keiko-security";
|
|
15
17
|
import { AuditLoadError, auditLocalStateResult } from "./audit.js";
|
|
16
18
|
// KEIKO-0655: shared argv-parsing helper replaces the byte-identical flagValue copy this file held.
|
|
17
19
|
import { flagValue } from "./cli-arg-parsing.js";
|
|
20
|
+
import { cliControlStateConflictsWithTarget, cliTargetIdentitySha256, resolveCliControlStateDir, } from "./cli-control-state.js";
|
|
21
|
+
import { installLayoutOverrideEvidence, writeInstallLayoutOverrideEvidenceWithFactory, } from "./install-layout.js";
|
|
18
22
|
// GEN-PERF-CLI-001 — the evidence graph (and, below, the server module graph) load at dispatch,
|
|
19
23
|
// and only for `export`; tool-lifecycle analysis lazily loads its narrow validator subpath. Store-fingerprint collection (ui,
|
|
20
24
|
// local-knowledge, memory-vault) is owned by keiko-server (ADR-0019 direction rule 7: keiko-cli
|
|
21
25
|
// is a leaf consumer and must not import keiko-local-knowledge directly) and reached through the
|
|
22
26
|
// same lazily-loaded server module, via `server.collectStoreFingerprints`.
|
|
23
27
|
import { loadEvidence, loadServer, loadToolLifecycle } from "./lazy-modules.js";
|
|
24
|
-
import {
|
|
28
|
+
import { createCliSecurityLogSink } from "./security-log.js";
|
|
29
|
+
import { inspectStateRoot, resolveStateDir } from "./state-paths.js";
|
|
25
30
|
import { analyzeLogText, buildReproductionSeed, findTimeline, hasIssueToPrJourneyOps, renderGatewayReplayScriptFixture, renderHumanAllTimelines, renderHumanClusters, renderHumanReproductionSeed, renderHumanTimeline, } from "./support-analyze.js";
|
|
26
31
|
import { buildConfigSnapshotSection, buildEvidenceManifestSection, buildSupportBundleManifest, buildUiLogSection, bundleSha256Hex, bundleText, DEFAULT_MAX_BUNDLE_BYTES, describeErrorKind, discoverServerLogFiles, readKeptFiles, selectLogFilesWithinBudget, serializeBundleLines, sha256SidecarPath, UI_LOG_FILE_NAME, UI_LOG_SECTION, } from "./support-export.js";
|
|
27
32
|
const USAGE = `Usage:
|
|
@@ -68,6 +73,62 @@ a warnings field naming exactly what could not be reconstructed and why. --emit-
|
|
|
68
73
|
from that seed's gatewayScript, to PATH — refusing to overwrite an existing file and creating
|
|
69
74
|
parent directories as needed. --seed and --emit-fixture may be combined in one invocation.
|
|
70
75
|
`;
|
|
76
|
+
function emitSupportInstallLayoutRefusal(context, errorKind, reason) {
|
|
77
|
+
try {
|
|
78
|
+
if (cliControlStateConflictsWithTarget(context.controlStateDir, context.stateDir))
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const sink = createCliSecurityLogSink(context.controlStateDir, context.factory, context.correlationId);
|
|
85
|
+
emitSecurityLogEvent(sink, {
|
|
86
|
+
level: "error",
|
|
87
|
+
category: "diagnostic",
|
|
88
|
+
op: "cli.support.export.failed",
|
|
89
|
+
errorKind,
|
|
90
|
+
extra: { reason, targetSha256: cliTargetIdentitySha256(context.stateDir) },
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function refuseSupportInstallLayout(context, errorKind, reason) {
|
|
94
|
+
emitSupportInstallLayoutRefusal(context, errorKind, reason);
|
|
95
|
+
return "refused";
|
|
96
|
+
}
|
|
97
|
+
function writeSupportInstallLayoutEvidence(stateDir, env, deps) {
|
|
98
|
+
const evidence = installLayoutOverrideEvidence(env);
|
|
99
|
+
if (evidence === undefined)
|
|
100
|
+
return "ready";
|
|
101
|
+
const controlStateDir = deps.controlActivityStateDir ??
|
|
102
|
+
resolveCliControlStateDir(deps.platform ?? process.platform, (deps.homedir ?? defaultHomedir)());
|
|
103
|
+
const context = {
|
|
104
|
+
stateDir,
|
|
105
|
+
controlStateDir,
|
|
106
|
+
correlationId: evidence.correlationId,
|
|
107
|
+
factory: deps.activityLogSinkFactory,
|
|
108
|
+
};
|
|
109
|
+
try {
|
|
110
|
+
const stateRoot = inspectStateRoot(stateDir);
|
|
111
|
+
if (stateRoot.status === "symlink") {
|
|
112
|
+
return refuseSupportInstallLayout(context, "SupportStateRootSymlinkError", "unsafe-state-root");
|
|
113
|
+
}
|
|
114
|
+
if (stateRoot.status === "not-directory") {
|
|
115
|
+
return refuseSupportInstallLayout(context, "SupportStateRootNotDirectoryError", "unsafe-state-root");
|
|
116
|
+
}
|
|
117
|
+
return writeInstallLayoutOverrideEvidenceWithFactory(deps.activityLogSinkFactory, stateDir, env)
|
|
118
|
+
? "ready"
|
|
119
|
+
: refuseSupportInstallLayout(context, "SupportActivityLogUnavailableError", "activity-log-unavailable");
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
return refuseSupportInstallLayout(context, securityErrorKind(error), "state-root-validation-failed");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function prepareSupportInstallLayoutEvidence(stateDir, env, deps, io) {
|
|
126
|
+
if (writeSupportInstallLayoutEvidence(stateDir, env, deps) === "ready")
|
|
127
|
+
return true;
|
|
128
|
+
io.err("keiko support export: refusing to consume a normalized install path because durable " +
|
|
129
|
+
"activity logging is unavailable.\n");
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
71
132
|
const SUPPORT_LOG_STALE_AFTER_MS = 5 * 60_000;
|
|
72
133
|
const SERVER_LOG_FILE_PATTERN = /^server(?:-\d{4}-\d{2}-\d{2})?\.log$/;
|
|
73
134
|
function parsePositiveInteger(value) {
|
|
@@ -412,7 +473,8 @@ async function runSupportExport(args, io, env, deps) {
|
|
|
412
473
|
const cwd = deps.cwd ?? process.cwd();
|
|
413
474
|
const now = deps.now ?? (() => new Date());
|
|
414
475
|
const stateDir = resolveStateDir(cwd, env, args.stateDir);
|
|
415
|
-
|
|
476
|
+
if (!prepareSupportInstallLayoutEvidence(stateDir, env, deps, io))
|
|
477
|
+
return 1;
|
|
416
478
|
const logContent = collectLogContent(join(stateDir, "logs"), args.maxBytes ?? DEFAULT_MAX_BUNDLE_BYTES);
|
|
417
479
|
const evidenceDir = env.KEIKO_EVIDENCE_DIR ?? join(stateDir, "evidence");
|
|
418
480
|
const evidenceIndexCount = await resolveEvidenceIndexCount(evidenceDir, deps);
|
|
@@ -434,7 +496,7 @@ async function runSupportExport(args, io, env, deps) {
|
|
|
434
496
|
const evidenceSections = await resolveIncludedEvidenceSections(evidenceDir, args.includeEvidenceRunIds, deps);
|
|
435
497
|
const generatedAtDate = now();
|
|
436
498
|
const manifest = buildSupportBundleManifest({
|
|
437
|
-
...processProvenance(server, generatedAtDate,
|
|
499
|
+
...processProvenance(server, generatedAtDate, resolveStateDirSource(env, args.stateDir)),
|
|
438
500
|
...logContentManifestFields(logContent),
|
|
439
501
|
auditSummary,
|
|
440
502
|
evidenceIndexCount,
|
|
@@ -4,6 +4,7 @@ import type { UpdateInstallModeKind } from "@oscharko-dev/keiko-contracts";
|
|
|
4
4
|
import type { BuildHandlerDepsOptions, ImportLegacyUpdateAuditSnapshotOptions, LegacyUpdateAuditImportOutcome, PortableHandoffShutdownRequest, ServerLogSink, UiHandlerDeps, UpdateStartupRecoveryPort } from "@oscharko-dev/keiko-server";
|
|
5
5
|
import type { EnvSource } from "@oscharko-dev/keiko-model-gateway";
|
|
6
6
|
import type { CliIo } from "./runner.js";
|
|
7
|
+
import type { CliSecurityLogSinkFactory } from "./security-log.js";
|
|
7
8
|
export interface UiCliArgs {
|
|
8
9
|
readonly port: number;
|
|
9
10
|
readonly evidenceDir: string | undefined;
|
|
@@ -30,6 +31,7 @@ export interface UiCliDeps {
|
|
|
30
31
|
/** Test-harness seam scoped to governed local Git mutation subprocesses. */
|
|
31
32
|
readonly localGitMutationEnv?: EnvSource | undefined;
|
|
32
33
|
readonly activityLog?: ServerLogSink | undefined;
|
|
34
|
+
readonly activityLogSinkFactory?: CliSecurityLogSinkFactory | undefined;
|
|
33
35
|
readonly installModeProbe?: () => Promise<UpdateInstallModeKind | undefined>;
|
|
34
36
|
readonly updateStartupRecovery?: UpdateStartupRecoveryPort | undefined;
|
|
35
37
|
readonly importLegacyUpdateAuditSnapshot?: ((options: ImportLegacyUpdateAuditSnapshotOptions) => LegacyUpdateAuditImportOutcome | Promise<LegacyUpdateAuditImportOutcome>) | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAMxC,OAAO,EAAS,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAG3E,OAAO,KAAK,EACV,uBAAuB,EACvB,sCAAsC,EACtC,8BAA8B,EAC9B,8BAA8B,EAE9B,aAAa,EACb,aAAa,EAEb,yBAAyB,EAC1B,MAAM,4BAA4B,CAAC;AACpC,OA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Q,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC,GAAG,CAAC,OAAO,EAAE,8BAA8B,KAAK,OAAO,CAAC,IAAI,CAAC,CAc7D;AA8DD,UAAU,kBAAkB;IAC1B,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,KAAK,IAAI,IAAI,CAAC;IACd,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CACxC;AAmCD,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,aAAa,EAC1B,UAAU,GAAE,MAA8B,EAC1C,eAAe,GAAE,MAAM,kBAA0C,GAChE,MAAM,IAAI,CAWZ;AA4WD,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,KAAK,GACR,OAAO,CAAC,aAAa,CAAC,CAqCxB;AAqED,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,EAAE,KAAK,EACT,GAAG,EAAE,SAAS,EACd,IAAI,GAAE,SAAc,GACnB,OAAO,CAAC,MAAM,CAAC,CAmCjB"}
|
|
@@ -20,7 +20,7 @@ import { spawn } from "node:child_process";
|
|
|
20
20
|
import { monitorEventLoopDelay } from "node:perf_hooks";
|
|
21
21
|
import { DEFAULT_UI_PORT, UI_HOST } from "@oscharko-dev/keiko-contracts/runtime/bff-wire";
|
|
22
22
|
import { KEIKO_PRODUCT_VERSION } from "@oscharko-dev/keiko-contracts/runtime/version";
|
|
23
|
-
import { resolvePreferredInstallLayout } from "./install-layout.js";
|
|
23
|
+
import { resolvePreferredInstallLayout, writeInstallLayoutOverrideEvidence, writeInstallLayoutOverrideEvidenceWithFactory, } from "./install-layout.js";
|
|
24
24
|
// GEN-PERF-CLI-001 — the server module graph (routes, local-knowledge/sqlite wiring,
|
|
25
25
|
// ws, …) loads on FIRST USE, not when this module is parsed. The CLI barrel evaluates
|
|
26
26
|
// ui.ts on every `keiko` invocation, and this one eager import accounted for most of
|
|
@@ -1045,18 +1045,6 @@ export async function createLiveCspSource(staticRoot, hashesFile, io) {
|
|
|
1045
1045
|
}
|
|
1046
1046
|
async function launchUiFromDeps(parsed, staticRoot, csp, cwd, effectiveEnv, io, deps) {
|
|
1047
1047
|
const stateDir = resolveRuntimeStateDir(cwd, effectiveEnv);
|
|
1048
|
-
// process-guards.ts's fatal-crash handler is installed before any CLI parsing happens and reads
|
|
1049
|
-
// the REAL process.env directly (it cannot receive this value any other way) -- without this
|
|
1050
|
-
// assignment, a direct `keiko ui` launch (no --state-dir / KEIKO_STATE_DIR from the operator)
|
|
1051
|
-
// never has process.env.KEIKO_STATE_DIR set, so a crash inside startUiServer/the real server
|
|
1052
|
-
// factory below writes only the generic stderr line and silently drops the structured
|
|
1053
|
-
// process.fatal record. Mirrors what lifecycle.ts's spawnUiProcess already gives the CHILD
|
|
1054
|
-
// `keiko ui` process for free. Gated on the same "real launch" condition `startUiServer`
|
|
1055
|
-
// computes (`deps.createServer === undefined`) so injected-server unit tests never mutate the
|
|
1056
|
-
// real process.env.
|
|
1057
|
-
if (deps.createServer === undefined) {
|
|
1058
|
-
process.env.KEIKO_STATE_DIR = stateDir;
|
|
1059
|
-
}
|
|
1060
1048
|
// Captured from the ORIGINAL env, before `withDefaultLocalRuntimeStateEnv` unconditionally sets
|
|
1061
1049
|
// `KEIKO_STATE_DIR` on the derived copy below — otherwise every launch would read back as
|
|
1062
1050
|
// `env-override` regardless of what the operator actually configured.
|
|
@@ -1107,6 +1095,7 @@ export async function runUiCli(args, io, env, deps = {}) {
|
|
|
1107
1095
|
const reExec = await maybeReExecForSqlite(effectiveEnv, deps, cwd);
|
|
1108
1096
|
if (reExec !== undefined)
|
|
1109
1097
|
return reExec;
|
|
1098
|
+
prepareUiInstallLayoutEvidence(cwd, effectiveEnv, deps);
|
|
1110
1099
|
const staticRoot = deps.staticRoot ?? defaultStaticRoot(cwd);
|
|
1111
1100
|
if (!ensureStaticRoot(staticRoot, io)) {
|
|
1112
1101
|
return 1;
|
|
@@ -1124,3 +1113,15 @@ export async function runUiCli(args, io, env, deps = {}) {
|
|
|
1124
1113
|
cspRuntime.dispose();
|
|
1125
1114
|
}
|
|
1126
1115
|
}
|
|
1116
|
+
function prepareUiInstallLayoutEvidence(cwd, env, deps) {
|
|
1117
|
+
const stateDir = resolveRuntimeStateDir(cwd, env);
|
|
1118
|
+
// Persist normalization before static-export and CSP reads can fail. The process-level fatal
|
|
1119
|
+
// guard consumes the same resolved path on a real launch.
|
|
1120
|
+
if (deps.createServer === undefined)
|
|
1121
|
+
process.env.KEIKO_STATE_DIR = stateDir;
|
|
1122
|
+
if (deps.activityLog !== undefined) {
|
|
1123
|
+
writeInstallLayoutOverrideEvidence(deps.activityLog, env);
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
writeInstallLayoutOverrideEvidenceWithFactory(deps.activityLogSinkFactory, stateDir, env);
|
|
1127
|
+
}
|
|
@@ -12,6 +12,7 @@ export interface UninstallCliDeps {
|
|
|
12
12
|
readonly killWindowsTree?: WindowsTreeKill | undefined;
|
|
13
13
|
readonly processEnv?: NodeJS.ProcessEnv | undefined;
|
|
14
14
|
readonly securityLogSinkFactory?: CliSecurityLogSinkFactory | undefined;
|
|
15
|
+
readonly activityStateDir?: string | undefined;
|
|
15
16
|
readonly verifyLaunchIdentity?: ((pid: number, launchId: string) => boolean) | undefined;
|
|
16
17
|
}
|
|
17
18
|
export declare function runUninstallCli(args: readonly string[], io: CliIo, env: EnvSource, deps?: UninstallCliDeps): Promise<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../src/uninstall.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../src/uninstall.ts"],"names":[],"mappings":"AAmC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