@enterpriseai/cli 3.19.1 → 3.19.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/README.md +28 -0
- package/dist/commands/eai-managed-deploy-customer-source.d.ts.map +1 -1
- package/dist/commands/eai-managed-deploy-customer-source.js +24 -0
- package/dist/commands/eai-managed-deploy-customer-source.js.map +1 -1
- package/dist/commands/eai-managed-deploy-github-dispatch.d.ts.map +1 -1
- package/dist/commands/eai-managed-deploy-github-dispatch.js +30 -0
- package/dist/commands/eai-managed-deploy-github-dispatch.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +33 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/provision.js +2 -5
- package/dist/commands/provision.js.map +1 -1
- package/dist/commands/support.d.ts +18 -0
- package/dist/commands/support.d.ts.map +1 -0
- package/dist/commands/support.js +110 -0
- package/dist/commands/support.js.map +1 -0
- package/dist/commands/types.d.ts +5 -1
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/commands/types.js +55 -12
- package/dist/commands/types.js.map +1 -1
- package/dist/index.js +34 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-guide.d.ts.map +1 -1
- package/dist/lib/agent-guide.js +25 -4
- package/dist/lib/agent-guide.js.map +1 -1
- package/dist/lib/api.d.ts +4 -2
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/api.js +17 -5
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/config.d.ts +2 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +8 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/eai-managed-deploy-contract.d.ts +4 -0
- package/dist/lib/eai-managed-deploy-contract.d.ts.map +1 -1
- package/dist/lib/eai-managed-deploy-contract.js.map +1 -1
- package/dist/lib/eai-managed-deploy-operation.d.ts.map +1 -1
- package/dist/lib/eai-managed-deploy-operation.js +14 -0
- package/dist/lib/eai-managed-deploy-operation.js.map +1 -1
- package/dist/lib/eai-managed-deploy-state.d.ts.map +1 -1
- package/dist/lib/eai-managed-deploy-state.js +15 -1
- package/dist/lib/eai-managed-deploy-state.js.map +1 -1
- package/dist/lib/error-codes.d.ts.map +1 -1
- package/dist/lib/error-codes.js +6 -3
- package/dist/lib/error-codes.js.map +1 -1
- package/dist/lib/output.d.ts +1 -0
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +3 -0
- package/dist/lib/output.js.map +1 -1
- package/dist/lib/profile.d.ts +2 -0
- package/dist/lib/profile.d.ts.map +1 -1
- package/dist/lib/profile.js.map +1 -1
- package/dist/lib/support-context.d.ts +31 -0
- package/dist/lib/support-context.d.ts.map +1 -0
- package/dist/lib/support-context.js +193 -0
- package/dist/lib/support-context.js.map +1 -0
- package/dist/lib/support-redaction.d.ts +10 -0
- package/dist/lib/support-redaction.d.ts.map +1 -0
- package/dist/lib/support-redaction.js +44 -0
- package/dist/lib/support-redaction.js.map +1 -0
- package/dist/lib/support-report.d.ts +68 -0
- package/dist/lib/support-report.d.ts.map +1 -0
- package/dist/lib/support-report.js +165 -0
- package/dist/lib/support-report.js.map +1 -0
- package/package.json +5 -4
- package/resources/deploy/eai-app-template/.github/workflows/eai-app.yml +46 -13
- package/resources/deploy/eai-app-template/producer-pin.json +8 -8
- package/resources/deploy/eai-app-template/scripts/source-unknown-deployment-evidence.mjs +29 -2
- package/resources/deploy/eai-app-template/tests/source-unknown-deployment-evidence.test.mjs +2239 -1
- package/resources/gofer/agents-skills/eai/SKILL.md +20 -0
- package/resources/gofer/claude-commands/eai.md +20 -0
- package/resources/gofer/claude-skills/eai/SKILL.md +20 -0
- package/resources/gofer/commands/0_gofer_start.md +18 -0
- package/resources/gofer/commands/gofer_eai_first_run.md +18 -0
- package/resources/gofer/copilot-prompts/eai.prompt.md +20 -0
- package/resources/gofer/gemini/commands/gofer/eai.md +20 -0
- package/resources/gofer/github-skills/eai/SKILL.md +20 -0
- package/resources/gofer/grok-skills/eai/SKILL.md +20 -0
- package/resources/gofer/instruction-templates/base/agents-base.md +18 -0
- package/resources/gofer/instruction-templates/base/claude-base.md +18 -0
- package/resources/gofer/instruction-templates/base/copilot-base.md +18 -0
- package/resources/gofer/instruction-templates/gofer/gofer-claude.md +4 -0
- package/resources/gofer/node-scripts/generate-commands.mjs +26 -0
- package/resources/gofer/references/platform/eai-support.md +19 -0
- package/resources/gofer/specify-commands/0_gofer_start.md +18 -0
- package/resources/gofer/specify-commands/gofer_eai_first_run.md +18 -0
- package/resources/gofer/system-skills/eai/SKILL.md +20 -0
- package/resources/linked-sources.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support-context.js","sourceRoot":"","sources":["../../src/lib/support-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EACL,SAAS,EACT,SAAS,EACT,YAAY,EACZ,UAAU,EACV,MAAM,EACN,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAWlF,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAChC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAChC,2FAA2F;AAC3F,MAAM,CAAC,MAAM,kBAAkB,GAAG,wDAAwD,CAAC;AAE3F,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,IAAI,WAAW,GAAqE,EAAE,CAAC;AACvF,IAA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YACtD,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,oDAAoD,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A key-name heuristic; opaque credentials under unrelated keys still need explicit sensitive values. */
|
|
2
|
+
export declare function isSupportSensitiveKey(key: string): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Removes known credential values, credential-shaped text and unsafe terminal controls before review.
|
|
5
|
+
* Supply values from every credential source: pattern matching alone cannot identify opaque secrets.
|
|
6
|
+
*/
|
|
7
|
+
export declare function redactSupportText(text: string, sensitiveValues?: readonly string[]): string;
|
|
8
|
+
/** Redacts a JSON-compatible tree without mutating it; sensitive-key values become placeholders and strings use text redaction. */
|
|
9
|
+
export declare function redactSupportBundle<T>(value: T, sensitiveValues?: readonly string[]): T;
|
|
10
|
+
//# sourceMappingURL=support-redaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support-redaction.d.ts","sourceRoot":"","sources":["../../src/lib/support-redaction.ts"],"names":[],"mappings":"AAEA,0GAA0G;AAC1G,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CAmB/F;AAED,mIAAmI;AACnI,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,eAAe,GAAE,SAAS,MAAM,EAAO,GAAG,CAAC,CAS3F"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const sensitiveKey = /token|secret|password|passwd|pwd|api[_-]?key|account[_-]?key|authorization|cookie|credential|connection[_-]?string|private[_-]?key/i;
|
|
2
|
+
/** A key-name heuristic; opaque credentials under unrelated keys still need explicit sensitive values. */
|
|
3
|
+
export function isSupportSensitiveKey(key) {
|
|
4
|
+
return sensitiveKey.test(key);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Removes known credential values, credential-shaped text and unsafe terminal controls before review.
|
|
8
|
+
* Supply values from every credential source: pattern matching alone cannot identify opaque secrets.
|
|
9
|
+
*/
|
|
10
|
+
export function redactSupportText(text, sensitiveValues = []) {
|
|
11
|
+
let safe = text;
|
|
12
|
+
for (const value of sensitiveValues) {
|
|
13
|
+
if (value)
|
|
14
|
+
safe = safe.split(value).join('[redacted]');
|
|
15
|
+
}
|
|
16
|
+
return safe
|
|
17
|
+
.replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g, '[redacted-private-key]')
|
|
18
|
+
.replace(/\b(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]+/gi, '$1 [redacted]')
|
|
19
|
+
.replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, '[redacted-jwt]')
|
|
20
|
+
.replace(/\b(?:gh[pousr]_[A-Za-z0-9_]+|github_pat_[A-Za-z0-9_]+|sk-[A-Za-z0-9_-]{16,})\b/g, '[redacted-key]')
|
|
21
|
+
.replace(/\b([a-z][a-z0-9+.-]*:\/\/)[^\s/@]+@/gi, '$1[redacted]@')
|
|
22
|
+
.replace(/((?:["']?[\w.-]*(?:token|secret|password|passwd|pwd|api[_-]?key|account[_-]?key|cookie|credential|authorization|connection[_-]?string|private[_-]?key)[\w.-]*["']?\s*[:=]\s*))(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^\s,;}]+)/gi, '$1[redacted]')
|
|
23
|
+
.replace(/((?:--[\w-]*(?:token|secret|password|passwd|pwd|api[_-]?key|account[_-]?key|authorization|cookie|credential|connection[_-]?string|private[_-]?key)[\w-]*)\s+)(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^\s]+)/gi, '$1[redacted]')
|
|
24
|
+
.replace(/([?&](?:sig|signature|access_token|token|key|code)=)[^&#\s]*/gi, '$1[redacted]')
|
|
25
|
+
.replace(/#draft=[^\s"']+/gi, '#draft=[redacted]')
|
|
26
|
+
// eslint-disable-next-line no-control-regex -- Upstream terminal escapes must not execute during report review.
|
|
27
|
+
.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g, '')
|
|
28
|
+
// eslint-disable-next-line no-control-regex -- Strip upstream terminal controls while retaining readable lines and tabs.
|
|
29
|
+
.replace(/[\u0000-\u0008\u000b-\u001f\u007f]/g, '');
|
|
30
|
+
}
|
|
31
|
+
/** Redacts a JSON-compatible tree without mutating it; sensitive-key values become placeholders and strings use text redaction. */
|
|
32
|
+
export function redactSupportBundle(value, sensitiveValues = []) {
|
|
33
|
+
if (typeof value === 'string')
|
|
34
|
+
return redactSupportText(value, sensitiveValues);
|
|
35
|
+
if (Array.isArray(value))
|
|
36
|
+
return value.map(item => redactSupportBundle(item, sensitiveValues));
|
|
37
|
+
if (value && typeof value === 'object') {
|
|
38
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
39
|
+
key, isSupportSensitiveKey(key) ? '[redacted]' : redactSupportBundle(item, sensitiveValues),
|
|
40
|
+
]));
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=support-redaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support-redaction.js","sourceRoot":"","sources":["../../src/lib/support-redaction.ts"],"names":[],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OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAM,CAAC;IACpG,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;YACnE,GAAG,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,EAAE,eAAe,CAAC;SAC5F,CAAC,CAAM,CAAC;IACX,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { StoredTokens } from './auth.js';
|
|
2
|
+
/** Deadline for one draft POST, including its bounded response body. */
|
|
3
|
+
export declare const SUPPORT_TIMEOUT_MS = 10000;
|
|
4
|
+
/** Report inputs; `yes` asserts the person approved this exact bundle before submission. */
|
|
5
|
+
export interface SupportOptions {
|
|
6
|
+
readonly format?: string;
|
|
7
|
+
readonly source?: string;
|
|
8
|
+
readonly tool?: string;
|
|
9
|
+
readonly toolVersion?: string;
|
|
10
|
+
readonly command?: string;
|
|
11
|
+
readonly exitCode?: string;
|
|
12
|
+
readonly errorCode?: string;
|
|
13
|
+
readonly description?: string;
|
|
14
|
+
readonly yes?: boolean;
|
|
15
|
+
readonly open?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Redacted website draft payload; tenant and app labels are diagnostic context, not authorization. */
|
|
18
|
+
export interface SupportBundle {
|
|
19
|
+
readonly source: 'eai-cli' | 'harness';
|
|
20
|
+
readonly tool: {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly version: string;
|
|
23
|
+
};
|
|
24
|
+
readonly cli: {
|
|
25
|
+
readonly command?: string;
|
|
26
|
+
readonly exitCode?: number;
|
|
27
|
+
readonly errorCode?: string;
|
|
28
|
+
readonly reasonCode?: string;
|
|
29
|
+
};
|
|
30
|
+
readonly cliVersion: string;
|
|
31
|
+
readonly service: 'eai-cli';
|
|
32
|
+
readonly category: 'technical';
|
|
33
|
+
readonly summary: string;
|
|
34
|
+
readonly description: string;
|
|
35
|
+
readonly os: 'macos' | 'windows' | 'linux' | 'unknown';
|
|
36
|
+
readonly environment: 'dev' | 'test' | 'prod' | 'local' | 'unknown';
|
|
37
|
+
readonly tenantId?: string;
|
|
38
|
+
readonly tenantName?: string;
|
|
39
|
+
readonly appId?: string;
|
|
40
|
+
readonly appName?: string;
|
|
41
|
+
readonly error?: string;
|
|
42
|
+
readonly occurredAt?: string;
|
|
43
|
+
}
|
|
44
|
+
/** Safe draft failure code and message, excluding server response content and credentials. */
|
|
45
|
+
export declare class SupportRequestError extends Error {
|
|
46
|
+
readonly code: string;
|
|
47
|
+
constructor(code: string, message: string);
|
|
48
|
+
}
|
|
49
|
+
/** Resolve a trusted origin from user profile/runtime settings; project files cannot redirect the saved bearer. */
|
|
50
|
+
export declare function resolveSupportWebsite(): Promise<string>;
|
|
51
|
+
/** Collect a bounded, redacted report from the saved session, current project and canonical error metadata. */
|
|
52
|
+
export declare function collectSupportBundle(options: SupportOptions, session: StoredTokens | null): Promise<SupportBundle>;
|
|
53
|
+
/** Validated one-time capability link and expiry returned by the website. */
|
|
54
|
+
export interface SupportDraft {
|
|
55
|
+
readonly url: string;
|
|
56
|
+
readonly expiresAt: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Create one non-idempotent draft after consent; ambiguous failures never trigger a retry.
|
|
60
|
+
* @param website Trusted origin from resolveSupportWebsite.
|
|
61
|
+
* @param bundle Locally redacted payload returned by collectSupportBundle.
|
|
62
|
+
* @param bearer Access token from the saved eai login session.
|
|
63
|
+
* @param timeoutMs Deadline for the request and bounded response read.
|
|
64
|
+
* @returns A validated fragment link, or null when the website rejects the session with 401.
|
|
65
|
+
* @throws SupportRequestError for safe HTTP, response-validation or ambiguous request failures.
|
|
66
|
+
*/
|
|
67
|
+
export declare function createSupportDraft(website: string, bundle: SupportBundle, bearer: string, timeoutMs?: number): Promise<SupportDraft | null>;
|
|
68
|
+
//# sourceMappingURL=support-report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support-report.d.ts","sourceRoot":"","sources":["../../src/lib/support-report.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAQ9C,wEAAwE;AACxE,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAGzC,4FAA4F;AAC5F,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,uGAAuG;AACvG,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,QAAQ,CAAC,GAAG,EAAE;QAAE,QAAQ,C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AAa,CAAC,CAwCxH;AAED,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IAAG,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE;AAElF;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,SAAqB,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAmD7J"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { platform, release } from 'node:os';
|
|
3
|
+
import { findProjectRoot, loadEnvFile } from './config.js';
|
|
4
|
+
import { getActiveProfile, loadProfileConfig } from './profile.js';
|
|
5
|
+
import { findGuidanceByCodeOrReason } from './error-guidance/catalog.js';
|
|
6
|
+
import { readSupportContext } from './support-context.js';
|
|
7
|
+
import { isSupportSensitiveKey, redactSupportBundle, redactSupportText } from './support-redaction.js';
|
|
8
|
+
const require = createRequire(import.meta.url);
|
|
9
|
+
const { version: cliVersion } = require('../../package.json');
|
|
10
|
+
/** Deadline for one draft POST, including its bounded response body. */
|
|
11
|
+
export const SUPPORT_TIMEOUT_MS = 10_000;
|
|
12
|
+
const MAX_RESPONSE_BYTES = 8_192;
|
|
13
|
+
/** Safe draft failure code and message, excluding server response content and credentials. */
|
|
14
|
+
export class SupportRequestError extends Error {
|
|
15
|
+
code;
|
|
16
|
+
constructor(code, message) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.code = code;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Resolve a trusted origin from user profile/runtime settings; project files cannot redirect the saved bearer. */
|
|
22
|
+
export async function resolveSupportWebsite() {
|
|
23
|
+
const profile = getActiveProfile();
|
|
24
|
+
const config = await loadProfileConfig(profile);
|
|
25
|
+
const value = process.env.EAI_WEBSITE_URL || config?.websiteUrl
|
|
26
|
+
|| (profile === 'default' ? 'https://www.enterpriseaigroup.com' : undefined);
|
|
27
|
+
if (!value)
|
|
28
|
+
throw new Error('Configure websiteUrl for the active CLI profile before preparing a support report.');
|
|
29
|
+
let url;
|
|
30
|
+
try {
|
|
31
|
+
url = new URL(value);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
throw new Error('The configured support website must be a valid origin.');
|
|
35
|
+
}
|
|
36
|
+
const loopback = ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname);
|
|
37
|
+
if ((url.protocol !== 'https:' && !(url.protocol === 'http:' && loopback))
|
|
38
|
+
|| url.username || url.password || url.search || url.hash || url.pathname !== '/') {
|
|
39
|
+
throw new Error('The support website must be an HTTPS origin (HTTP is allowed for a local fixture).');
|
|
40
|
+
}
|
|
41
|
+
return url.origin;
|
|
42
|
+
}
|
|
43
|
+
function boundedOption(value, limit, label) {
|
|
44
|
+
if (value !== undefined && (!value.trim() || value.length > limit)) {
|
|
45
|
+
throw new Error(`${label} must be nonempty and at most ${limit} characters.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Collect a bounded, redacted report from the saved session, current project and canonical error metadata. */
|
|
49
|
+
export async function collectSupportBundle(options, session) {
|
|
50
|
+
if (options.format && !['text', 'json'].includes(options.format))
|
|
51
|
+
throw new Error('Use --format text or --format json.');
|
|
52
|
+
const source = options.source ?? (options.tool ? 'harness' : 'eai-cli');
|
|
53
|
+
if (source !== 'harness' && source !== 'eai-cli')
|
|
54
|
+
throw new Error('Use --source eai-cli or --source harness.');
|
|
55
|
+
boundedOption(options.tool, 80, 'Tool name');
|
|
56
|
+
boundedOption(options.toolVersion, 100, 'Tool version');
|
|
57
|
+
boundedOption(options.command, 500, 'Command');
|
|
58
|
+
boundedOption(options.description, 6000, 'Description');
|
|
59
|
+
const exitCode = options.exitCode === undefined ? undefined : Number(options.exitCode);
|
|
60
|
+
if (exitCode !== undefined && (!/^-?\d+$/.test(options.exitCode) || !Number.isInteger(exitCode)
|
|
61
|
+
|| exitCode < -2147483648 || exitCode > 2147483647))
|
|
62
|
+
throw new Error('Exit code must be a signed 32-bit integer.');
|
|
63
|
+
const context = readSupportContext();
|
|
64
|
+
const guidance = findGuidanceByCodeOrReason(options.errorCode ?? context?.errorCode ?? context?.reasonCode ?? '');
|
|
65
|
+
if (options.errorCode && !guidance)
|
|
66
|
+
throw new Error('Unknown error code or reason. Run eai errors list --format json.');
|
|
67
|
+
const projectRoot = await findProjectRoot();
|
|
68
|
+
const env = projectRoot ? await loadEnvFile(projectRoot) : {};
|
|
69
|
+
const sensitiveValues = [...new Set([session?.accessToken, session?.refreshToken,
|
|
70
|
+
...[...Object.entries(env), ...Object.entries(process.env)]
|
|
71
|
+
.filter(([key]) => isSupportSensitiveKey(key)).map(([, value]) => value)]
|
|
72
|
+
.filter((value) => typeof value === 'string' && value.length > 0))];
|
|
73
|
+
const safe = (value, limit) => value ? redactSupportText(value, sensitiveValues).slice(0, limit) : undefined;
|
|
74
|
+
const os = platform() === 'darwin' ? 'macos' : platform() === 'win32' ? 'windows' : platform() === 'linux' ? 'linux' : 'unknown';
|
|
75
|
+
const profile = getActiveProfile();
|
|
76
|
+
const environment = ['dev', 'test', 'prod', 'local'].includes(profile) ? profile : profile === 'default' ? 'prod' : 'unknown';
|
|
77
|
+
const command = safe(options.command ?? context?.command, 500);
|
|
78
|
+
const description = safe(options.description ?? [
|
|
79
|
+
'Help requested for an EAI CLI command.', `CLI version: ${cliVersion}`, `OS: ${os} ${release()}`,
|
|
80
|
+
command ? `Command: ${command}` : '', guidance ? `Error: ${guidance.code} (${guidance.reasonCode})` : '',
|
|
81
|
+
].filter(Boolean).join('\n'), 6000).trim();
|
|
82
|
+
if (description.length < 10)
|
|
83
|
+
throw new Error('Description must contain at least 10 characters after redaction.');
|
|
84
|
+
return redactSupportBundle({
|
|
85
|
+
source, tool: { name: safe(options.tool ?? 'eai-cli', 80), version: safe(options.toolVersion ?? (options.tool ? undefined : cliVersion), 100) ?? '' },
|
|
86
|
+
cli: { command, exitCode: exitCode ?? context?.exitCode, errorCode: guidance?.code, reasonCode: guidance?.reasonCode },
|
|
87
|
+
cliVersion, service: 'eai-cli', category: 'technical', summary: safe(guidance?.title ?? 'Help with EAI CLI', 180),
|
|
88
|
+
description, os, environment,
|
|
89
|
+
tenantId: safe(env.EAI_TENANT_ID ?? env.NEXT_PUBLIC_EAI_TENANT_ID ?? env.TENANT_DEFAULT_ID ?? session?.activeTenantId, 160),
|
|
90
|
+
tenantName: safe(env.EAI_TENANT_NAME ?? session?.activeTenantName, 160),
|
|
91
|
+
appId: safe(env.EAI_APP_KEY ?? env.NEXT_PUBLIC_EAI_APP_KEY, 160), appName: safe(env.NEXT_PUBLIC_APP_NAME, 160),
|
|
92
|
+
error: safe(guidance?.title, 4000), occurredAt: context?.recordedAt,
|
|
93
|
+
}, sensitiveValues);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Create one non-idempotent draft after consent; ambiguous failures never trigger a retry.
|
|
97
|
+
* @param website Trusted origin from resolveSupportWebsite.
|
|
98
|
+
* @param bundle Locally redacted payload returned by collectSupportBundle.
|
|
99
|
+
* @param bearer Access token from the saved eai login session.
|
|
100
|
+
* @param timeoutMs Deadline for the request and bounded response read.
|
|
101
|
+
* @returns A validated fragment link, or null when the website rejects the session with 401.
|
|
102
|
+
* @throws SupportRequestError for safe HTTP, response-validation or ambiguous request failures.
|
|
103
|
+
*/
|
|
104
|
+
export async function createSupportDraft(website, bundle, bearer, timeoutMs = SUPPORT_TIMEOUT_MS) {
|
|
105
|
+
try {
|
|
106
|
+
// Draft creates are not idempotent. A timeout must never trigger an automatic retry.
|
|
107
|
+
const response = await fetch(`${website}/api/support/drafts`, {
|
|
108
|
+
method: 'POST', redirect: 'error', signal: AbortSignal.timeout(timeoutMs),
|
|
109
|
+
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${bearer}` }, body: JSON.stringify(bundle),
|
|
110
|
+
});
|
|
111
|
+
if (response.status !== 201) {
|
|
112
|
+
await response.body?.cancel();
|
|
113
|
+
if (response.status === 401)
|
|
114
|
+
return null;
|
|
115
|
+
const messages = {
|
|
116
|
+
400: 'The website rejected the support report fields.', 413: 'The support report is too large.',
|
|
117
|
+
429: 'The support report limit was reached. Try again later.',
|
|
118
|
+
503: 'The support website is temporarily unavailable.',
|
|
119
|
+
};
|
|
120
|
+
throw new SupportRequestError(`http_${response.status}`, messages[response.status] ?? 'The support website could not create a draft.');
|
|
121
|
+
}
|
|
122
|
+
if (!response.headers.get('content-type')?.includes('application/json') || !response.body) {
|
|
123
|
+
await response.body?.cancel();
|
|
124
|
+
throw new SupportRequestError('invalid_response', 'The support website returned an invalid draft response.');
|
|
125
|
+
}
|
|
126
|
+
const reader = response.body.getReader();
|
|
127
|
+
const chunks = [];
|
|
128
|
+
let bytes = 0;
|
|
129
|
+
try {
|
|
130
|
+
while (true) {
|
|
131
|
+
const { done, value } = await reader.read();
|
|
132
|
+
if (done)
|
|
133
|
+
break;
|
|
134
|
+
bytes += value.byteLength;
|
|
135
|
+
if (bytes > MAX_RESPONSE_BYTES) {
|
|
136
|
+
await reader.cancel();
|
|
137
|
+
throw new SupportRequestError('invalid_response', 'The support website returned an invalid draft response.');
|
|
138
|
+
}
|
|
139
|
+
chunks.push(value);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
reader.releaseLock();
|
|
144
|
+
}
|
|
145
|
+
const data = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
146
|
+
if (!data || typeof data !== 'object')
|
|
147
|
+
throw new SupportRequestError('invalid_response', 'The support website returned an invalid draft response.');
|
|
148
|
+
const { id, token, expiresAt, redeemUrl } = data;
|
|
149
|
+
if (typeof id !== 'string' || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id)
|
|
150
|
+
|| typeof token !== 'string' || !/^[A-Za-z0-9_-]{43}$/.test(token)
|
|
151
|
+
|| typeof expiresAt !== 'string' || !Number.isFinite(Date.parse(expiresAt)) || Date.parse(expiresAt) <= Date.now()
|
|
152
|
+
|| redeemUrl !== `${website}/support#draft=${id}.${token}`) {
|
|
153
|
+
throw new SupportRequestError('invalid_response', 'The support website returned an invalid draft response.');
|
|
154
|
+
}
|
|
155
|
+
return { url: redeemUrl, expiresAt };
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
if (error instanceof SupportRequestError)
|
|
159
|
+
throw error;
|
|
160
|
+
if (error instanceof SyntaxError)
|
|
161
|
+
throw new SupportRequestError('invalid_response', 'The support website returned an invalid draft response.');
|
|
162
|
+
throw new SupportRequestError('request_failed', 'The support request failed or timed out. No retry was sent; a draft may have been created.');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=support-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support-report.js","sourceRoot":"","sources":["../../src/lib/support-report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEvG,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAwB,CAAC;AACrF,w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QAAQ,IAAI,CAAC,iEAAiE,CAAC,IAAI,CAAC,EAAE,CAAC;eACpG,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC;eAC/D,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE;eAC/G,SAAS,KAAK,GAAG,OAAO,kBAAkB,EAAE,IAAI,KAAK,EAAE,EAAE,CAAC;YAC7D,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,yDAAyD,CAAC,CAAC;QAC/G,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IACvC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,mBAAmB;YAAE,MAAM,KAAK,CAAC;QACtD,IAAI,KAAK,YAAY,WAAW;YAAE,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,yDAAyD,CAAC,CAAC;QAC/I,MAAM,IAAI,mBAAmB,CAAC,gBAAgB,EAAE,4FAA4F,CAAC,CAAC;IAChJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enterpriseai/cli",
|
|
3
|
-
"version": "3.19.
|
|
3
|
+
"version": "3.19.3",
|
|
4
4
|
"description": "EnterpriseAI CLI for app setup, validation, deployment readiness, and platform operations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"eai": "dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "tsc",
|
|
10
|
+
"build": "node scripts/clean-build-output.cjs && tsc",
|
|
11
11
|
"dev": "tsc --watch",
|
|
12
12
|
"start": "node dist/index.js",
|
|
13
13
|
"lint": "eslint src/",
|
|
14
14
|
"typecheck": "tsc --noEmit",
|
|
15
15
|
"test": "vitest run",
|
|
16
|
-
"test:eai-cli:ci": "mkdir -p test-results && vitest run tests/unit/managed-profile-gateway.test.ts tests/unit/gofer-resource-override.test.ts tests/unit/init-app-binding.test.ts tests/unit/object-type-identifiers.test.ts tests/unit/release-terminology.test.ts tests/unit/ai-surfaces.test.ts tests/unit/eai-managed-deploy.test.ts tests/unit/eai-managed-deploy-write.test.ts tests/unit/eai-managed-source.test.ts tests/unit/eai-managed-source-race.test.ts tests/unit/eai-managed-source-client.test.ts tests/integration/object-type-documentation.test.ts tests/integration/login.test.ts tests/integration/whoami.test.ts tests/integration/tenant.test.ts tests/integration/init.test.ts tests/integration/create.test.ts tests/integration/splash.test.ts tests/integration/help.test.ts tests/integration/describe-contract.test.ts tests/integration/start.test.ts tests/integration/dev.test.ts tests/integration/update.test.ts tests/integration/output.test.ts tests/integration/error-guidance.test.ts tests/integration/resources-command.test.ts tests/integration/agent-guide.test.ts tests/integration/agent-discovery-eval.test.ts tests/integration/gofer.test.ts tests/integration/provision.test.ts tests/integration/types.test.ts tests/integration/user.test.ts tests/integration/publicapi.test.ts tests/integration/publicapi-v4-only.test.ts tests/integration/docs-classify.test.ts tests/integration/classifier.test.ts tests/integration/platform-api-client.test.ts tests/integration/eai-managed-deploy.test.ts tests/integration/vertical.test.ts tests/integration/dedicated-tenant-lifecycle.test.ts tests/integration/runtime-contract.test.ts tests/integration/inquirer-prompt-types.test.ts tests/integration/full-e2e-smoke.test.ts tests/integration/release-metadata.test.ts --reporter=default --reporter=junit --outputFile=test-results/eai-cli-results.xml",
|
|
16
|
+
"test:eai-cli:ci": "mkdir -p test-results && vitest run tests/unit/managed-profile-gateway.test.ts tests/unit/gofer-resource-override.test.ts tests/unit/init-app-binding.test.ts tests/unit/object-type-identifiers.test.ts tests/unit/release-terminology.test.ts tests/unit/ai-surfaces.test.ts tests/unit/eai-managed-deploy.test.ts tests/unit/eai-managed-deploy-write.test.ts tests/unit/eai-managed-source.test.ts tests/unit/eai-managed-source-race.test.ts tests/unit/eai-managed-source-client.test.ts tests/integration/object-type-documentation.test.ts tests/integration/login.test.ts tests/integration/whoami.test.ts tests/integration/tenant.test.ts tests/integration/init.test.ts tests/integration/create.test.ts tests/integration/splash.test.ts tests/integration/help.test.ts tests/integration/describe-contract.test.ts tests/integration/start.test.ts tests/integration/dev.test.ts tests/integration/update.test.ts tests/integration/output.test.ts tests/integration/error-guidance.test.ts tests/integration/resources-command.test.ts tests/integration/agent-guide.test.ts tests/integration/agent-discovery-eval.test.ts tests/integration/gofer.test.ts tests/integration/provision.test.ts tests/integration/types.test.ts tests/integration/user.test.ts tests/integration/publicapi.test.ts tests/integration/publicapi-v4-only.test.ts tests/integration/docs-classify.test.ts tests/integration/classifier.test.ts tests/integration/platform-api-client.test.ts tests/integration/eai-managed-deploy.test.ts tests/integration/vertical.test.ts tests/integration/dedicated-tenant-lifecycle.test.ts tests/integration/runtime-contract.test.ts tests/integration/inquirer-prompt-types.test.ts tests/integration/full-e2e-smoke.test.ts tests/integration/release-metadata.test.ts tests/integration/support.test.ts tests/integration/support-context.test.ts tests/unit/support-report.test.ts --reporter=default --reporter=junit --outputFile=test-results/eai-cli-results.xml",
|
|
17
17
|
"test:e2e-local": "bash scripts/test-local-dedicated-tenant-lifecycle.sh",
|
|
18
18
|
"smoke:resourceapi-lifecycle": "bash scripts/smoke-resourceapi-schema-sync-lifecycle.sh",
|
|
19
19
|
"smoke:eai-full:check": "node scripts/eai-full-e2e-smoke.cjs --check",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test:watch": "vitest",
|
|
23
23
|
"test:ui": "vitest --ui",
|
|
24
24
|
"test:coverage": "vitest run --coverage",
|
|
25
|
-
"prepare": "
|
|
25
|
+
"prepare": "npm run build",
|
|
26
26
|
"lint:no-placeholder": "! grep -r EAI_CLI_CLIENT_ID_PLACEHOLDER src/",
|
|
27
27
|
"sync:gofer": "node scripts/sync-gofer-resources.cjs",
|
|
28
28
|
"sync:linked-sources": "node scripts/sync-linked-sources.js",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@eslint/js": "10.0.1",
|
|
91
|
+
"@next/env": "15.5.27",
|
|
91
92
|
"@types/node": "24.13.3",
|
|
92
93
|
"@vitest/ui": "4.1.8",
|
|
93
94
|
"eslint": "10.4.1",
|
|
@@ -234,6 +234,7 @@ jobs:
|
|
|
234
234
|
--target-tenant-id "$TARGET_TENANT_ID" \
|
|
235
235
|
--operation-id "$OPERATION_ID" \
|
|
236
236
|
--nonce "$NONCE" \
|
|
237
|
+
--ref "$GITHUB_REF" \
|
|
237
238
|
--expected-config-hash "$CONFIG_HASH" \
|
|
238
239
|
--environment "$DEPLOY_ENVIRONMENT" \
|
|
239
240
|
--preferred-environment "$PREFERRED_DEPLOY_ENVIRONMENT" \
|
|
@@ -450,7 +451,7 @@ jobs:
|
|
|
450
451
|
shell: bash
|
|
451
452
|
run: |
|
|
452
453
|
if [[ "$LOCAL_E2E_TUNNEL" == true ]]; then
|
|
453
|
-
[[ "$SOURCE_MODE" == eai-cli-generated && "$GITHUB_EVENT_NAME" == workflow_dispatch && "$REUSABLE_CALL" != true ]]
|
|
454
|
+
[[ ( "$SOURCE_MODE" == eai-cli-generated || "$SOURCE_MODE" == source-unknown ) && "$GITHUB_EVENT_NAME" == workflow_dispatch && "$REUSABLE_CALL" != true ]]
|
|
454
455
|
[[ "$DEPLOY_ENVIRONMENT" == dev || "$DEPLOY_ENVIRONMENT" == preview ]]
|
|
455
456
|
[[ "$EAI_BOUND_PUBLIC_API_URL" =~ ^https://[a-z0-9-]+-8000\.[a-z0-9-]+\.devtunnels\.ms$ ]]
|
|
456
457
|
else
|
|
@@ -795,14 +796,33 @@ jobs:
|
|
|
795
796
|
const local = evidence.localE2e;
|
|
796
797
|
const repositoryId = process.env.GITHUB_REPOSITORY_ID;
|
|
797
798
|
const expiresAt = process.env.LOCAL_E2E_EXPIRES_AT;
|
|
798
|
-
|
|
799
|
-
|
|
799
|
+
const sourceUnknownLocal = process.env.SOURCE_MODE === 'source-unknown';
|
|
800
|
+
const expectedKeys = sourceUnknownLocal
|
|
801
|
+
? 'audience,expiresAt,mode,nonceDigest,origin'
|
|
802
|
+
: 'audience,expiresAt,mode,origin,templateCommitSha';
|
|
803
|
+
if (!local || Object.keys(local).sort().join(',') !== expectedKeys ||
|
|
804
|
+
local.mode !== (sourceUnknownLocal ? 'source-unknown-local-v1' : 'local-tunnel-v1') ||
|
|
805
|
+
local.origin !== process.env.EAI_BOUND_PUBLIC_API_URL ||
|
|
800
806
|
local.expiresAt !== expiresAt || !/^[1-9][0-9]*$/.test(repositoryId) ||
|
|
801
|
-
|
|
807
|
+
Date.parse(expiresAt) <= Date.now()) {
|
|
802
808
|
throw new Error('Build evidence local endpoint binding changed.');
|
|
803
809
|
}
|
|
804
|
-
|
|
805
|
-
|
|
810
|
+
if (sourceUnknownLocal && local.nonceDigest !== 'sha256:' + createHash('sha256').update(evidence.nonce).digest('hex')) {
|
|
811
|
+
throw new Error('Build evidence local nonce binding changed.');
|
|
812
|
+
}
|
|
813
|
+
if (!sourceUnknownLocal && !/^[a-f0-9]{40}$/.test(local.templateCommitSha)) {
|
|
814
|
+
throw new Error('Build evidence local template binding changed.');
|
|
815
|
+
}
|
|
816
|
+
const tuple = sourceUnknownLocal
|
|
817
|
+
? ['eai.source-unknown-local-e2e-aud.v1', local.origin, process.env.TENANT_ID,
|
|
818
|
+
process.env.TARGET_TENANT_ID || process.env.TENANT_ID, process.env.APP_KEY, evidence.operationId,
|
|
819
|
+
repositoryId, evidence.workflowPath, evidence.ref, evidence.commitSha,
|
|
820
|
+
evidence.configHash, local.nonceDigest, expiresAt]
|
|
821
|
+
: ['eai.cli-managed-local-e2e-aud.v1', local.origin, evidence.operationId, repositoryId, local.templateCommitSha, expiresAt];
|
|
822
|
+
const prefix = sourceUnknownLocal
|
|
823
|
+
? 'api://enterprise-ai-publicapi/source-unknown/local-v1/'
|
|
824
|
+
: 'api://enterprise-ai-publicapi/eai-cli-generated/local-v1/';
|
|
825
|
+
const audience = prefix + createHash('sha256').update(JSON.stringify(tuple)).digest('hex');
|
|
806
826
|
if (local.audience !== audience) throw new Error('Build evidence local OIDC audience changed.');
|
|
807
827
|
} else if (evidence.localE2e !== undefined) {
|
|
808
828
|
throw new Error('Unexpected local endpoint binding in build evidence.');
|
|
@@ -1016,7 +1036,7 @@ jobs:
|
|
|
1016
1036
|
set -euo pipefail
|
|
1017
1037
|
validate_endpoint_and_audience() {
|
|
1018
1038
|
if [[ "$LOCAL_E2E_TUNNEL" == true ]]; then
|
|
1019
|
-
[[ "$SOURCE_MODE" == eai-cli-generated && "$GITHUB_EVENT_NAME" == workflow_dispatch && "$REUSABLE_CALL" != true ]]
|
|
1039
|
+
[[ ( "$SOURCE_MODE" == eai-cli-generated || "$SOURCE_MODE" == source-unknown ) && "$GITHUB_EVENT_NAME" == workflow_dispatch && "$REUSABLE_CALL" != true ]]
|
|
1020
1040
|
[[ "$DEPLOY_ENVIRONMENT" == dev || "$DEPLOY_ENVIRONMENT" == preview ]]
|
|
1021
1041
|
[[ "$EAI_BOUND_PUBLIC_API_URL" =~ ^https://[a-z0-9-]+-8000\.[a-z0-9-]+\.devtunnels\.ms$ ]]
|
|
1022
1042
|
node - <<'NODE'
|
|
@@ -1032,14 +1052,27 @@ jobs:
|
|
|
1032
1052
|
const local = evidence.localE2e;
|
|
1033
1053
|
const repoId = process.env.GITHUB_REPOSITORY_ID;
|
|
1034
1054
|
const expiry = process.env.LOCAL_E2E_EXPIRES_AT;
|
|
1035
|
-
|
|
1036
|
-
|
|
1055
|
+
const sourceUnknownLocal = process.env.SOURCE_MODE === 'source-unknown';
|
|
1056
|
+
const expectedKeys = sourceUnknownLocal
|
|
1057
|
+
? 'audience,expiresAt,mode,nonceDigest,origin'
|
|
1058
|
+
: 'audience,expiresAt,mode,origin,templateCommitSha';
|
|
1059
|
+
if (!local || Object.keys(local).sort().join(',') !== expectedKeys ||
|
|
1060
|
+
local.mode !== (sourceUnknownLocal ? 'source-unknown-local-v1' : 'local-tunnel-v1') ||
|
|
1061
|
+
local.origin !== process.env.EAI_BOUND_PUBLIC_API_URL ||
|
|
1037
1062
|
local.expiresAt !== expiry || !/^[1-9][0-9]*$/.test(repoId) ||
|
|
1038
|
-
!/^cli-managed-[a-f0-9]{32}$/.test(evidence.operationId) ||
|
|
1039
|
-
!/^[a-f0-9]{40}$/.test(local.templateCommitSha) ||
|
|
1040
1063
|
!Number.isFinite(Date.parse(expiry)) || Date.parse(expiry) <= Date.now()) process.exit(1);
|
|
1041
|
-
const tuple =
|
|
1042
|
-
|
|
1064
|
+
const tuple = sourceUnknownLocal
|
|
1065
|
+
? ['eai.source-unknown-local-e2e-aud.v1', local.origin, process.env.TENANT_ID,
|
|
1066
|
+
evidence.targetTenantId || process.env.TENANT_ID, process.env.APP_KEY, evidence.operationId, repoId,
|
|
1067
|
+
evidence.workflowPath, evidence.ref, evidence.commitSha, evidence.configHash,
|
|
1068
|
+
local.nonceDigest, expiry]
|
|
1069
|
+
: ['eai.cli-managed-local-e2e-aud.v1', local.origin, evidence.operationId, repoId, local.templateCommitSha, expiry];
|
|
1070
|
+
if (sourceUnknownLocal ? local.nonceDigest !== 'sha256:' + createHash('sha256').update(evidence.nonce).digest('hex')
|
|
1071
|
+
: !/^[a-f0-9]{40}$/.test(local.templateCommitSha)) process.exit(1);
|
|
1072
|
+
const prefix = sourceUnknownLocal
|
|
1073
|
+
? 'api://enterprise-ai-publicapi/source-unknown/local-v1/'
|
|
1074
|
+
: 'api://enterprise-ai-publicapi/eai-cli-generated/local-v1/';
|
|
1075
|
+
const audience = prefix + createHash('sha256').update(JSON.stringify(tuple)).digest('hex');
|
|
1043
1076
|
if (local.audience !== audience) process.exit(1);
|
|
1044
1077
|
process.stdout.write(audience);
|
|
1045
1078
|
NODE
|
|
@@ -2,28 +2,28 @@
|
|
|
2
2
|
"schemaVersion": "eai.managed-deploy-producer-pin.v1",
|
|
3
3
|
"repository": "eai-support/eai-app-template",
|
|
4
4
|
"candidate": {
|
|
5
|
-
"commit": "
|
|
5
|
+
"commit": "d777e97d188c1a5a611d1bc14fbb16a3ea1d9acb",
|
|
6
6
|
"workflow": {
|
|
7
7
|
"path": ".github/workflows/eai-app.yml",
|
|
8
|
-
"sha256": "sha256:
|
|
8
|
+
"sha256": "sha256:bce4e34fe5c47377e6a679966a37257d944cd00ccf3c15b4ba437f144ed559ed"
|
|
9
9
|
},
|
|
10
10
|
"collector": {
|
|
11
11
|
"path": "scripts/source-unknown-deployment-evidence.mjs",
|
|
12
|
-
"sha256": "sha256:
|
|
12
|
+
"sha256": "sha256:06e7f33bf1db1d7adbebb75a76d2756e46371318f36d2518c5cfbb58ad4f5e1c"
|
|
13
13
|
},
|
|
14
14
|
"evidenceTest": {
|
|
15
15
|
"path": "tests/source-unknown-deployment-evidence.test.mjs",
|
|
16
|
-
"sha256": "sha256:
|
|
16
|
+
"sha256": "sha256:fe5f8381d882ac39656b67b30e1e18193cb676a8aba26a6776a88880a3bb5827"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"releaseGate": {
|
|
20
20
|
"status": "released",
|
|
21
|
-
"tag": "v1.0.
|
|
22
|
-
"commit": "
|
|
21
|
+
"tag": "v1.0.12",
|
|
22
|
+
"commit": "d777e97d188c1a5a611d1bc14fbb16a3ea1d9acb"
|
|
23
23
|
},
|
|
24
24
|
"githubProducerIdentity": {
|
|
25
25
|
"profile": "github-environment-v1",
|
|
26
|
-
"templateCommitSha": "
|
|
27
|
-
"workflowSha256": "sha256:
|
|
26
|
+
"templateCommitSha": "d777e97d188c1a5a611d1bc14fbb16a3ea1d9acb",
|
|
27
|
+
"workflowSha256": "sha256:bce4e34fe5c47377e6a679966a37257d944cd00ccf3c15b4ba437f144ed559ed"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -181,7 +181,7 @@ function localE2eBinding(options, mode, environment, root) {
|
|
|
181
181
|
const operationId = option(options, 'operationId');
|
|
182
182
|
const repositoryId = option(options, 'repositoryId');
|
|
183
183
|
if (
|
|
184
|
-
|
|
184
|
+
!['eai-cli-generated', 'source-unknown'].includes(mode) ||
|
|
185
185
|
!['preview', 'dev'].includes(environment) ||
|
|
186
186
|
option(options, 'githubEventName') !== 'workflow_dispatch' ||
|
|
187
187
|
option(options, 'reusableCall') === 'true' ||
|
|
@@ -189,7 +189,6 @@ function localE2eBinding(options, mode, environment, root) {
|
|
|
189
189
|
!/^[1-9][0-9]*$/.test(repositoryId) ||
|
|
190
190
|
!Number.isSafeInteger(Number(repositoryId)) ||
|
|
191
191
|
String(Number(repositoryId)) !== repositoryId ||
|
|
192
|
-
!/^cli-managed-[a-f0-9]{32}$/.test(operationId) ||
|
|
193
192
|
!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d+)?\+00:00$/.test(expiresAt) ||
|
|
194
193
|
!Number.isFinite(Date.parse(expiresAt)) ||
|
|
195
194
|
Date.parse(expiresAt) <= Date.now() ||
|
|
@@ -197,6 +196,34 @@ function localE2eBinding(options, mode, environment, root) {
|
|
|
197
196
|
) {
|
|
198
197
|
throw new Error('Local deployment requires an exact direct DEV/preview tunnel binding.');
|
|
199
198
|
}
|
|
199
|
+
if (mode === 'source-unknown') {
|
|
200
|
+
const nonce = option(options, 'nonce');
|
|
201
|
+
const tenantId = option(options, 'tenantId');
|
|
202
|
+
const targetTenant = option(options, 'targetTenantId') || tenantId;
|
|
203
|
+
const appKey = option(options, 'appKey');
|
|
204
|
+
const workflowPath = option(options, 'workflow', '.github/workflows/eai-app.yml');
|
|
205
|
+
const ref = option(options, 'ref', process.env.GITHUB_REF || '');
|
|
206
|
+
const commitSha = option(options, 'commit', process.env.GITHUB_SHA || '');
|
|
207
|
+
const configHash = option(options, 'expectedConfigHash');
|
|
208
|
+
if (!/^source-unknown-[a-f0-9]{16}$/.test(operationId)
|
|
209
|
+
|| !tenantId || !targetTenant || !appKey || !nonce
|
|
210
|
+
|| workflowPath !== CANONICAL_WORKFLOW_PATH
|
|
211
|
+
|| !/^refs\/heads\//.test(ref)
|
|
212
|
+
|| !/^[a-f0-9]{40}$/.test(commitSha)
|
|
213
|
+
|| !SHA256_DIGEST.test(configHash)) {
|
|
214
|
+
throw new Error('Local source-unknown operation binding is incomplete.');
|
|
215
|
+
}
|
|
216
|
+
const nonceDigest = `sha256:${createHash('sha256').update(nonce).digest('hex')}`;
|
|
217
|
+
const fields = ['eai.source-unknown-local-e2e-aud.v1', origin, tenantId,
|
|
218
|
+
targetTenant, appKey, operationId, repositoryId, workflowPath, ref,
|
|
219
|
+
commitSha, configHash, nonceDigest, expiresAt];
|
|
220
|
+
return { mode: 'source-unknown-local-v1', origin, expiresAt, nonceDigest,
|
|
221
|
+
audience: 'api://enterprise-ai-publicapi/source-unknown/local-v1/'
|
|
222
|
+
+ createHash('sha256').update(JSON.stringify(fields)).digest('hex') };
|
|
223
|
+
}
|
|
224
|
+
if (!/^cli-managed-[a-f0-9]{32}$/.test(operationId)) {
|
|
225
|
+
throw new Error('Local CLI operation binding is invalid.');
|
|
226
|
+
}
|
|
200
227
|
const binding = JSON.parse(readRegularFileNoFollow(root, '.eai/cli-managed-source-operation.json').toString('utf8'));
|
|
201
228
|
if (
|
|
202
229
|
binding.schemaVersion !== 'eai.cli_managed_source_operation.v1' ||
|