@agentteams/cli 0.1.97 → 0.1.99
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/.eslintcache +1 -1
- package/README.md +27 -11
- package/dist/api/sentry.d.ts +7 -0
- package/dist/api/sentry.d.ts.map +1 -0
- package/dist/api/sentry.js +18 -0
- package/dist/api/sentry.js.map +1 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +15 -4
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/coaction.d.ts.map +1 -1
- package/dist/commands/coaction.js +6 -21
- package/dist/commands/coaction.js.map +1 -1
- package/dist/commands/codeReview.d.ts.map +1 -1
- package/dist/commands/codeReview.js +4 -5
- package/dist/commands/codeReview.js.map +1 -1
- package/dist/commands/document.d.ts +0 -1
- package/dist/commands/document.d.ts.map +1 -1
- package/dist/commands/document.js +1 -1
- package/dist/commands/document.js.map +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +6 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/plan.d.ts.map +1 -1
- package/dist/commands/plan.js +42 -75
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/postmortem.d.ts.map +1 -1
- package/dist/commands/postmortem.js +1 -5
- package/dist/commands/postmortem.js.map +1 -1
- package/dist/commands/report.d.ts.map +1 -1
- package/dist/commands/report.js +7 -9
- package/dist/commands/report.js.map +1 -1
- package/dist/commands/sentry.d.ts +2 -0
- package/dist/commands/sentry.d.ts.map +1 -0
- package/dist/commands/sentry.js +26 -0
- package/dist/commands/sentry.js.map +1 -0
- package/dist/commands/task.js +2 -2
- package/dist/commands/task.js.map +1 -1
- package/dist/index.js +3 -1350
- package/dist/index.js.map +1 -1
- package/dist/mcp/context.js +1 -1
- package/dist/mcp/context.js.map +1 -1
- package/dist/mcp-registration/clients.d.ts.map +1 -1
- package/dist/mcp-registration/clients.js +92 -0
- package/dist/mcp-registration/clients.js.map +1 -1
- package/dist/mcp-registration/detect.d.ts +1 -0
- package/dist/mcp-registration/detect.d.ts.map +1 -1
- package/dist/mcp-registration/detect.js +25 -2
- package/dist/mcp-registration/detect.js.map +1 -1
- package/dist/mcp-registration/index.d.ts +2 -2
- package/dist/mcp-registration/index.d.ts.map +1 -1
- package/dist/mcp-registration/index.js +4 -0
- package/dist/mcp-registration/index.js.map +1 -1
- package/dist/mcp-registration/install.d.ts +2 -0
- package/dist/mcp-registration/install.d.ts.map +1 -1
- package/dist/mcp-registration/install.js +22 -2
- package/dist/mcp-registration/install.js.map +1 -1
- package/dist/mcp-registration/types.d.ts +8 -1
- package/dist/mcp-registration/types.d.ts.map +1 -1
- package/dist/mcp-registration/types.js +1 -0
- package/dist/mcp-registration/types.js.map +1 -1
- package/dist/program/agentConfig.d.ts +3 -0
- package/dist/program/agentConfig.d.ts.map +1 -0
- package/dist/program/agentConfig.js +14 -0
- package/dist/program/agentConfig.js.map +1 -0
- package/dist/program/attachment.d.ts +3 -0
- package/dist/program/attachment.d.ts.map +1 -0
- package/dist/program/attachment.js +17 -0
- package/dist/program/attachment.js.map +1 -0
- package/dist/program/auth.d.ts +3 -0
- package/dist/program/auth.d.ts.map +1 -0
- package/dist/program/auth.js +39 -0
- package/dist/program/auth.js.map +1 -0
- package/dist/program/changeSet.d.ts +4 -0
- package/dist/program/changeSet.d.ts.map +1 -0
- package/dist/program/changeSet.js +53 -0
- package/dist/program/changeSet.js.map +1 -0
- package/dist/program/coaction.d.ts +7 -0
- package/dist/program/coaction.d.ts.map +1 -0
- package/dist/program/coaction.js +81 -0
- package/dist/program/coaction.js.map +1 -0
- package/dist/program/codeReview.d.ts +4 -0
- package/dist/program/codeReview.d.ts.map +1 -0
- package/dist/program/codeReview.js +101 -0
- package/dist/program/codeReview.js.map +1 -0
- package/dist/program/comment.d.ts +4 -0
- package/dist/program/comment.d.ts.map +1 -0
- package/dist/program/comment.js +50 -0
- package/dist/program/comment.js.map +1 -0
- package/dist/program/config.d.ts +3 -0
- package/dist/program/config.d.ts.map +1 -0
- package/dist/program/config.js +9 -0
- package/dist/program/config.js.map +1 -0
- package/dist/program/convention.d.ts +4 -0
- package/dist/program/convention.d.ts.map +1 -0
- package/dist/program/convention.js +37 -0
- package/dist/program/convention.js.map +1 -0
- package/dist/program/dependency.d.ts +3 -0
- package/dist/program/dependency.d.ts.map +1 -0
- package/dist/program/dependency.js +15 -0
- package/dist/program/dependency.js.map +1 -0
- package/dist/program/doctor.d.ts +6 -0
- package/dist/program/doctor.d.ts.map +1 -0
- package/dist/program/doctor.js +31 -0
- package/dist/program/doctor.js.map +1 -0
- package/dist/program/document.d.ts +7 -0
- package/dist/program/document.d.ts.map +1 -0
- package/dist/program/document.js +87 -0
- package/dist/program/document.js.map +1 -0
- package/dist/program/feedback.d.ts +3 -0
- package/dist/program/feedback.d.ts.map +1 -0
- package/dist/program/feedback.js +10 -0
- package/dist/program/feedback.js.map +1 -0
- package/dist/program/index.d.ts +3 -0
- package/dist/program/index.d.ts.map +1 -0
- package/dist/program/index.js +68 -0
- package/dist/program/index.js.map +1 -0
- package/dist/program/init.d.ts +6 -0
- package/dist/program/init.d.ts.map +1 -0
- package/dist/program/init.js +50 -0
- package/dist/program/init.js.map +1 -0
- package/dist/program/linear.d.ts +3 -0
- package/dist/program/linear.d.ts.map +1 -0
- package/dist/program/linear.js +25 -0
- package/dist/program/linear.js.map +1 -0
- package/dist/program/mcp.d.ts +6 -0
- package/dist/program/mcp.d.ts.map +1 -0
- package/dist/program/mcp.js +95 -0
- package/dist/program/mcp.js.map +1 -0
- package/dist/program/options/completionReport.d.ts +5 -0
- package/dist/program/options/completionReport.d.ts.map +1 -0
- package/dist/program/options/completionReport.js +19 -0
- package/dist/program/options/completionReport.js.map +1 -0
- package/dist/program/options/connection.d.ts +3 -0
- package/dist/program/options/connection.d.ts.map +1 -0
- package/dist/program/options/connection.js +8 -0
- package/dist/program/options/connection.js.map +1 -0
- package/dist/program/options/output.d.ts +3 -0
- package/dist/program/options/output.d.ts.map +1 -0
- package/dist/program/options/output.js +6 -0
- package/dist/program/options/output.js.map +1 -0
- package/dist/program/options/pagination.d.ts +3 -0
- package/dist/program/options/pagination.d.ts.map +1 -0
- package/dist/program/options/pagination.js +6 -0
- package/dist/program/options/pagination.js.map +1 -0
- package/dist/program/options/resource.d.ts +6 -0
- package/dist/program/options/resource.d.ts.map +1 -0
- package/dist/program/options/resource.js +29 -0
- package/dist/program/options/resource.js.map +1 -0
- package/dist/program/plan.d.ts +7 -0
- package/dist/program/plan.d.ts.map +1 -0
- package/dist/program/plan.js +138 -0
- package/dist/program/plan.js.map +1 -0
- package/dist/program/postmortem.d.ts +4 -0
- package/dist/program/postmortem.d.ts.map +1 -0
- package/dist/program/postmortem.js +27 -0
- package/dist/program/postmortem.js.map +1 -0
- package/dist/program/report.d.ts +4 -0
- package/dist/program/report.d.ts.map +1 -0
- package/dist/program/report.js +39 -0
- package/dist/program/report.js.map +1 -0
- package/dist/program/resolve.d.ts +6 -0
- package/dist/program/resolve.d.ts.map +1 -0
- package/dist/program/resolve.js +30 -0
- package/dist/program/resolve.js.map +1 -0
- package/dist/program/search.d.ts +6 -0
- package/dist/program/search.d.ts.map +1 -0
- package/dist/program/search.js +43 -0
- package/dist/program/search.js.map +1 -0
- package/dist/program/sentry.d.ts +3 -0
- package/dist/program/sentry.d.ts.map +1 -0
- package/dist/program/sentry.js +19 -0
- package/dist/program/sentry.js.map +1 -0
- package/dist/program/shared.d.ts +32 -0
- package/dist/program/shared.d.ts.map +1 -0
- package/dist/program/shared.js +96 -0
- package/dist/program/shared.js.map +1 -0
- package/dist/program/sync.d.ts +6 -0
- package/dist/program/sync.d.ts.map +1 -0
- package/dist/program/sync.js +35 -0
- package/dist/program/sync.js.map +1 -0
- package/dist/program/task.d.ts +3 -0
- package/dist/program/task.d.ts.map +1 -0
- package/dist/program/task.js +13 -0
- package/dist/program/task.js.map +1 -0
- package/dist/program/worktree.d.ts +3 -0
- package/dist/program/worktree.d.ts.map +1 -0
- package/dist/program/worktree.js +30 -0
- package/dist/program/worktree.js.map +1 -0
- package/dist/utils/agentIdentity.d.ts +43 -0
- package/dist/utils/agentIdentity.d.ts.map +1 -1
- package/dist/utils/agentIdentity.js +45 -0
- package/dist/utils/agentIdentity.js.map +1 -1
- package/dist/utils/apiContext.d.ts.map +1 -1
- package/dist/utils/apiContext.js +6 -1
- package/dist/utils/apiContext.js.map +1 -1
- package/dist/utils/apiKeyInput.d.ts +1 -3
- package/dist/utils/apiKeyInput.d.ts.map +1 -1
- package/dist/utils/apiKeyInput.js +1 -9
- package/dist/utils/apiKeyInput.js.map +1 -1
- package/dist/utils/apiOrigin.d.ts +43 -0
- package/dist/utils/apiOrigin.d.ts.map +1 -0
- package/dist/utils/apiOrigin.js +78 -0
- package/dist/utils/apiOrigin.js.map +1 -0
- package/dist/utils/config.d.ts +9 -3
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +12 -4
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/httpClient.d.ts.map +1 -1
- package/dist/utils/httpClient.js +50 -0
- package/dist/utils/httpClient.js.map +1 -1
- package/dist/utils/outputPolicy.d.ts +6 -7
- package/dist/utils/outputPolicy.d.ts.map +1 -1
- package/dist/utils/outputPolicy.js +0 -5
- package/dist/utils/outputPolicy.js.map +1 -1
- package/dist/utils/projectRootHash.d.ts +30 -0
- package/dist/utils/projectRootHash.d.ts.map +1 -0
- package/dist/utils/projectRootHash.js +43 -0
- package/dist/utils/projectRootHash.js.map +1 -0
- package/dist/utils/runnerTypes.d.ts +29 -0
- package/dist/utils/runnerTypes.d.ts.map +1 -0
- package/dist/utils/runnerTypes.js +40 -0
- package/dist/utils/runnerTypes.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, resolve } from 'node:path';
|
|
3
|
+
import { Command, Option } from 'commander';
|
|
4
|
+
import { executeCommand } from '../commands/index.js';
|
|
5
|
+
import { formatAuthResultText } from '../utils/authFormat.js';
|
|
6
|
+
import { resolveApiKeyInput } from '../utils/apiKeyInput.js';
|
|
7
|
+
import { printDoctorResult, resolveDoctorExitCode } from '../utils/doctorOutput.js';
|
|
8
|
+
import { handleError } from '../utils/errors.js';
|
|
9
|
+
import { formatOutput } from '../utils/formatter.js';
|
|
10
|
+
import { printInitResult } from '../utils/initOutput.js';
|
|
11
|
+
import { executeValidatedInteractiveCommand, normalizeInteractiveFormat } from '../utils/interactiveCommand.js';
|
|
12
|
+
import { createSummaryLines } from '../utils/outputPolicy.js';
|
|
13
|
+
import { MCP_CLIENT_IDS } from '../mcp-registration/types.js';
|
|
14
|
+
export { Command, Option, executeCommand, executeValidatedInteractiveCommand, formatAuthResultText, formatOutput, handleError, MCP_CLIENT_IDS, normalizeInteractiveFormat, printDoctorResult, printInitResult, resolveDoctorExitCode, };
|
|
15
|
+
export function createApiKeyFileOption() {
|
|
16
|
+
return new Option('--api-key-file <path>', 'Read the API key from a file, or use "-" to read stdin.');
|
|
17
|
+
}
|
|
18
|
+
export function registerApiKeyHook(program) {
|
|
19
|
+
program.hook('preAction', (_thisCommand, actionCommand) => {
|
|
20
|
+
try {
|
|
21
|
+
const commands = [];
|
|
22
|
+
for (let command = actionCommand; command; command = command.parent) {
|
|
23
|
+
commands.push(command);
|
|
24
|
+
}
|
|
25
|
+
const apiKeyFileCommand = commands.find((command) => command.opts().apiKeyFile !== undefined);
|
|
26
|
+
if (!apiKeyFileCommand)
|
|
27
|
+
return;
|
|
28
|
+
const apiKeyFile = apiKeyFileCommand?.opts().apiKeyFile;
|
|
29
|
+
const resolvedApiKey = resolveApiKeyInput({ apiKeyFile });
|
|
30
|
+
apiKeyFileCommand.setOptionValue('apiKey', resolvedApiKey);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error(handleError(error));
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 제거된 공개 인자는 commander가 `unknown option '--format'`으로만 끝냅니다.
|
|
40
|
+
* 각 프로젝트에 이미 배포된 `.agentteams/convention.md` 사본이나 기존 CI 스크립트는
|
|
41
|
+
* 갱신 경로 없이 그대로 깨지므로, 오류 뒤에 대체 수단을 한 줄 덧붙입니다.
|
|
42
|
+
*/
|
|
43
|
+
const REMOVED_OPTION_HINTS = {
|
|
44
|
+
'--format': '--format only exists on init, auth, sync, and doctor. Every other command already prints JSON; use --verbose for the full payload when --output-file is set.',
|
|
45
|
+
'--api-key': '--api-key was removed. Use --api-key-file <path> or set the AGENTTEAMS_API_KEY environment variable.',
|
|
46
|
+
'--team-id': '--team-id was removed. Set the AGENTTEAMS_TEAM_ID environment variable or the teamId field in your CLI config.',
|
|
47
|
+
'--limit': '--limit was removed from list actions. Use --page-size.',
|
|
48
|
+
};
|
|
49
|
+
const REMOVED_COMMAND_HINTS = {
|
|
50
|
+
show: "The 'show' alias was removed. Use 'get'.",
|
|
51
|
+
};
|
|
52
|
+
export function removedContractHint(text) {
|
|
53
|
+
const option = /unknown option '(--[\w-]+)'/.exec(text)?.[1];
|
|
54
|
+
if (option && REMOVED_OPTION_HINTS[option])
|
|
55
|
+
return REMOVED_OPTION_HINTS[option];
|
|
56
|
+
const command = /unknown command '([\w-]+)'/.exec(text)?.[1];
|
|
57
|
+
if (command && REMOVED_COMMAND_HINTS[command])
|
|
58
|
+
return REMOVED_COMMAND_HINTS[command];
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
export function normalizeFormat(format) {
|
|
62
|
+
if (format === undefined || format === null || format === '')
|
|
63
|
+
return 'json';
|
|
64
|
+
if (format === 'json')
|
|
65
|
+
return 'json';
|
|
66
|
+
throw new Error(`Unsupported output format: ${String(format)}. Only json is supported.`);
|
|
67
|
+
}
|
|
68
|
+
function writeOutputFile(outputFile, content) {
|
|
69
|
+
const resolvedPath = resolve(outputFile);
|
|
70
|
+
mkdirSync(dirname(resolvedPath), { recursive: true });
|
|
71
|
+
writeFileSync(resolvedPath, content, 'utf-8');
|
|
72
|
+
const bytes = Buffer.byteLength(content, 'utf-8');
|
|
73
|
+
return { resolvedPath, bytes };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 출력 정책: 기본은 전체 결과, `--output-file`이 있으면 저장 경로 + 요약,
|
|
77
|
+
* 거기에 `--verbose`까지 있으면 요약 뒤에 전체 결과를 덧붙입니다.
|
|
78
|
+
*/
|
|
79
|
+
export function printCommandResult(params) {
|
|
80
|
+
const outputText = typeof params.result === 'string' ? params.result : formatOutput(params.result);
|
|
81
|
+
if (typeof params.outputFile === 'string' && params.outputFile.trim().length > 0) {
|
|
82
|
+
const { resolvedPath, bytes } = writeOutputFile(params.outputFile, outputText);
|
|
83
|
+
console.log(`Saved output to ${resolvedPath} (${bytes} bytes).`);
|
|
84
|
+
for (const line of createSummaryLines(params.result, { resource: params.resource, action: params.action })) {
|
|
85
|
+
console.log(line);
|
|
86
|
+
}
|
|
87
|
+
if (params.verbose)
|
|
88
|
+
console.log(outputText);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
console.log(outputText);
|
|
92
|
+
}
|
|
93
|
+
export const DEVICE_AUTH_OPTION_DESCRIPTION = 'authorize with a short code on another device instead of a local browser callback (for SSH, containers, and other headless shells)';
|
|
94
|
+
export const DEVICE_AUTH_SET_DEFAULT_DESCRIPTION = "with --device-auth: remember device-code login as this machine's default in ~/.agentteams/config.json";
|
|
95
|
+
export const CONVENTION_HINT = '\nFor workflow rules and reporting guidelines, see: .agentteams/convention.md';
|
|
96
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/program/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE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KAAK,KAAK,UAAU,CAAC,CAAC;QACjE,KAAK,MAAM,IAAI,IAAI,kBAAkB,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;YAC3G,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;QACD,IAAI,MAAM,CAAC,OAAO;YAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5C,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,CAAC,MAAM,8BAA8B,GACzC,oIAAoI,CAAC;AACvI,MAAM,CAAC,MAAM,mCAAmC,GAC9C,uGAAuG,CAAC;AAC1G,MAAM,CAAC,MAAM,eAAe,GAAG,+EAA+E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/program/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAOR,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8B1D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CONVENTION_HINT, executeCommand, formatOutput, handleError, normalizeInteractiveFormat, printCommandResult, } from './shared.js';
|
|
2
|
+
/**
|
|
3
|
+
* 액션 인벤토리: 액션: download. 실사용 옵션: cwd. 별칭/도움말 불일치: 없음.
|
|
4
|
+
*/
|
|
5
|
+
export function registerSyncCommand(program) {
|
|
6
|
+
program
|
|
7
|
+
.command('sync')
|
|
8
|
+
.description('Sync local convention files from API')
|
|
9
|
+
.option('--format <format>', 'Output format (json; defaults to human-readable view)')
|
|
10
|
+
.option('--output-file <path>', 'Write full output to a file (stdout prints a short summary)')
|
|
11
|
+
.option('--verbose', 'Print full raw output to stdout; with --output-file, also echo it', false)
|
|
12
|
+
.addHelpText('after', CONVENTION_HINT)
|
|
13
|
+
.action(async (options) => {
|
|
14
|
+
try {
|
|
15
|
+
const result = await executeCommand('sync', 'download', {
|
|
16
|
+
cwd: process.cwd(),
|
|
17
|
+
});
|
|
18
|
+
const format = normalizeInteractiveFormat(options.format);
|
|
19
|
+
if (format === 'human' && !options.outputFile) {
|
|
20
|
+
console.log(typeof result === 'string' ? result : formatOutput(result));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
printCommandResult({
|
|
24
|
+
result: format === 'json' && typeof result === 'string' ? { message: result } : result,
|
|
25
|
+
outputFile: options.outputFile,
|
|
26
|
+
verbose: options.verbose,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error(handleError(error));
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/program/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,cAAc,EACd,YAAY,EACZ,WAAW,EACX,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,sCAAsC,CAAC;SACnD,MAAM,CAAC,mBAAmB,EAAE,uDAAuD,CAAC;SACpF,MAAM,CAAC,sBAAsB,EAAE,6DAA6D,CAAC;SAC7F,MAAM,CAAC,WAAW,EAAE,mEAAmE,EAAE,KAAK,CAAC;SAC/F,WAAW,CAAC,OAAO,EAAE,eAAe,CAAC;SACrC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE;gBACtD,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;aACnB,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,0BAA0B,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAE1D,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;gBAC9C,OAAO,CAAC,GAAG,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;gBACxE,OAAO;YACT,CAAC;YAED,kBAAkB,CAAC;gBACjB,MAAM,EAAE,MAAM,KAAK,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM;gBACtF,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,OAAO,EAAE,OAAO,CAAC,OAAO;aACzB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;YAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/program/task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmB,MAAM,aAAa,CAAC;AAGvD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgB1D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CONVENTION_HINT } from './shared.js';
|
|
2
|
+
import { addJsonResourceLeaf } from './options/resource.js';
|
|
3
|
+
export function registerTaskCommand(program) {
|
|
4
|
+
const root = program.command('task').description('Manage plan tasks').addHelpText('after', CONVENTION_HINT);
|
|
5
|
+
const addLeaf = (action, description, configure) => addJsonResourceLeaf(root, 'task', action, description, configure, { connection: false });
|
|
6
|
+
addLeaf('get', 'Get a plan task', (command) => command.option('--plan-id <id>', 'Plan ID (optional for bare task focus)').option('--task-id <id>', 'Plan task ID'));
|
|
7
|
+
addLeaf('start', 'Start a plan task', (command) => command.option('--plan-id <id>', 'Plan ID').option('--task-id <id>', 'Plan task ID'));
|
|
8
|
+
addLeaf('finish', 'Finish a plan task', (command) => command
|
|
9
|
+
.option('--plan-id <id>', 'Plan ID')
|
|
10
|
+
.option('--task-id <id>', 'Plan task ID')
|
|
11
|
+
.option('--status <status>', 'Task finish status: DONE, BLOCKED, or SKIPPED'));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/program/task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,eAAe,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,WAAW,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC5G,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,WAAmB,EAAE,SAAwC,EAAE,EAAE,CAChG,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3F,OAAO,CAAC,KAAK,EAAE,iBAAiB,EAAE,CAAC,OAAO,EAAE,EAAE,CAC5C,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,wCAAwC,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CACpH,CAAC;IACF,OAAO,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC,OAAO,EAAE,EAAE,CAChD,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CACrF,CAAC;IACF,OAAO,CAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAC,OAAO,EAAE,EAAE,CAClD,OAAO;SACJ,MAAM,CAAC,gBAAgB,EAAE,SAAS,CAAC;SACnC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC;SACxC,MAAM,CAAC,mBAAmB,EAAE,+CAA+C,CAAC,CAChF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../src/program/worktree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAmD,MAAM,aAAa,CAAC;AAEvF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyB9D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { executeCommand, handleError, printCommandResult } from './shared.js';
|
|
2
|
+
export function registerWorktreeCommand(program) {
|
|
3
|
+
const root = program.command('worktree').description('Report Orca worktree lifecycle events');
|
|
4
|
+
const addLeaf = (action, description) => {
|
|
5
|
+
const command = root
|
|
6
|
+
.command(action)
|
|
7
|
+
.description(description)
|
|
8
|
+
.option('--repository-id <id>', 'AgentTeams repository ID (optional when remote origin matches)')
|
|
9
|
+
.option('--local-key <key>', 'Opaque worktree identity')
|
|
10
|
+
.option('--event-id <id>', 'Stable event ID for retries')
|
|
11
|
+
.option('--occurred-at <timestamp>', 'Event timestamp in ISO 8601 format')
|
|
12
|
+
.option('--quiet', 'Do not print a successful result', false);
|
|
13
|
+
if (action === 'notify-deleted')
|
|
14
|
+
command.option('--after-removal', 'Send only after the worktree path disappears', false);
|
|
15
|
+
command.action(async (options) => {
|
|
16
|
+
try {
|
|
17
|
+
const result = await executeCommand('worktree', action, { ...options, cwd: process.cwd() });
|
|
18
|
+
if (!options.quiet)
|
|
19
|
+
printCommandResult({ result, resource: 'worktree', action });
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error(handleError(error));
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
addLeaf('notify-created', 'Report a created worktree');
|
|
28
|
+
addLeaf('notify-deleted', 'Report a deleted worktree');
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=worktree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.js","sourceRoot":"","sources":["../../src/program/worktree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,cAAc,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEvF,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,uCAAuC,CAAC,CAAC;IAC9F,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,WAAmB,EAAE,EAAE;QACtD,MAAM,OAAO,GAAG,IAAI;aACjB,OAAO,CAAC,MAAM,CAAC;aACf,WAAW,CAAC,WAAW,CAAC;aACxB,MAAM,CAAC,sBAAsB,EAAE,gEAAgE,CAAC;aAChG,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC;aACvD,MAAM,CAAC,iBAAiB,EAAE,6BAA6B,CAAC;aACxD,MAAM,CAAC,2BAA2B,EAAE,oCAAoC,CAAC;aACzE,MAAM,CAAC,SAAS,EAAE,kCAAkC,EAAE,KAAK,CAAC,CAAC;QAChE,IAAI,MAAM,KAAK,gBAAgB;YAC7B,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,8CAA8C,EAAE,KAAK,CAAC,CAAC;QAC3F,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC/B,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;gBAC5F,IAAI,CAAC,OAAO,CAAC,KAAK;oBAAE,kBAAkB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;YACnF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;gBAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IACF,OAAO,CAAC,gBAAgB,EAAE,2BAA2B,CAAC,CAAC;IACvD,OAAO,CAAC,gBAAgB,EAAE,2BAA2B,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -18,4 +18,47 @@ export declare const AGENT_NAME_ENV = "AGENTTEAMS_AGENT_NAME";
|
|
|
18
18
|
* must then send nothing at all rather than an empty string or a placeholder.
|
|
19
19
|
*/
|
|
20
20
|
export declare function resolveSessionAgentConfigId(env?: NodeJS.ProcessEnv): string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Execution snapshot variables the daemon exports for every session it spawns
|
|
23
|
+
* (`daemon/src/runners/session-env.ts`). They describe how *this* run is executing —
|
|
24
|
+
* which engine, which model, whether fast mode is on — as opposed to who it runs as.
|
|
25
|
+
*
|
|
26
|
+
* The daemon omits a variable entirely when it has no value, so an absent variable
|
|
27
|
+
* means "unknown", never "empty" or "false-by-default".
|
|
28
|
+
*/
|
|
29
|
+
export declare const RUNNER_TYPE_ENV = "AGENTTEAMS_RUNNER_TYPE";
|
|
30
|
+
export declare const MODEL_ENV = "AGENTTEAMS_MODEL";
|
|
31
|
+
export declare const FAST_MODE_ENV = "AGENTTEAMS_FAST_MODE";
|
|
32
|
+
export declare function resolveSessionRunnerType(env?: NodeJS.ProcessEnv): string | undefined;
|
|
33
|
+
export declare function resolveSessionModel(env?: NodeJS.ProcessEnv): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Fast mode is a two-state boolean flag on the CLI (`--fast`), not a tri-state, so an
|
|
36
|
+
* absent variable simply reads as off. The daemon only exports it when fast mode is on.
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveSessionFastMode(env?: NodeJS.ProcessEnv): boolean;
|
|
39
|
+
export interface ExecutionSnapshotOptions {
|
|
40
|
+
runnerType?: unknown;
|
|
41
|
+
model?: unknown;
|
|
42
|
+
fast?: unknown;
|
|
43
|
+
}
|
|
44
|
+
export interface ExecutionSnapshot {
|
|
45
|
+
runnerType: string | undefined;
|
|
46
|
+
model: string | undefined;
|
|
47
|
+
fastMode: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The execution snapshot for this run: an explicit argument always wins, and the session
|
|
51
|
+
* environment fills the gap when the daemon spawned us.
|
|
52
|
+
*
|
|
53
|
+
* A resolved value can still be `undefined` — outside a daemon session nothing can tell us
|
|
54
|
+
* the model. Callers that require the snapshot must keep failing in that case; this resolver
|
|
55
|
+
* narrows *when* they fail, it does not relax the requirement.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveExecutionSnapshot(options: ExecutionSnapshotOptions, env?: NodeJS.ProcessEnv): ExecutionSnapshot;
|
|
58
|
+
/**
|
|
59
|
+
* Appended to the existing "required" errors so the message names the other way out. The
|
|
60
|
+
* previous wording implied passing the flags was the only path, which is wrong inside a
|
|
61
|
+
* runner session and sends agents looking for values the session already has.
|
|
62
|
+
*/
|
|
63
|
+
export declare const EXECUTION_SNAPSHOT_HINT = " In a runner session these are filled in automatically from the environment.";
|
|
21
64
|
//# sourceMappingURL=agentIdentity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentIdentity.d.ts","sourceRoot":"","sources":["../../src/utils/agentIdentity.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,cAAc,0BAA0B,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAEpG"}
|
|
1
|
+
{"version":3,"file":"agentIdentity.d.ts","sourceRoot":"","sources":["../../src/utils/agentIdentity.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,cAAc,0BAA0B,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAEpG;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,2BAA2B,CAAC;AACxD,eAAO,MAAM,SAAS,qBAAqB,CAAC;AAC5C,eAAO,MAAM,aAAa,yBAAyB,CAAC;AAEpD,wBAAgB,wBAAwB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAEjG;AAED,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAE5F;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAEpF;AAED,MAAM,WAAW,wBAAwB;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,wBAAwB,EACjC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,iBAAiB,CAMnB;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,iFAAiF,CAAC"}
|
|
@@ -21,4 +21,49 @@ export const AGENT_NAME_ENV = 'AGENTTEAMS_AGENT_NAME';
|
|
|
21
21
|
export function resolveSessionAgentConfigId(env = process.env) {
|
|
22
22
|
return toNonEmptyString(env[AGENT_NAME_ENV]);
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Execution snapshot variables the daemon exports for every session it spawns
|
|
26
|
+
* (`daemon/src/runners/session-env.ts`). They describe how *this* run is executing —
|
|
27
|
+
* which engine, which model, whether fast mode is on — as opposed to who it runs as.
|
|
28
|
+
*
|
|
29
|
+
* The daemon omits a variable entirely when it has no value, so an absent variable
|
|
30
|
+
* means "unknown", never "empty" or "false-by-default".
|
|
31
|
+
*/
|
|
32
|
+
export const RUNNER_TYPE_ENV = 'AGENTTEAMS_RUNNER_TYPE';
|
|
33
|
+
export const MODEL_ENV = 'AGENTTEAMS_MODEL';
|
|
34
|
+
export const FAST_MODE_ENV = 'AGENTTEAMS_FAST_MODE';
|
|
35
|
+
export function resolveSessionRunnerType(env = process.env) {
|
|
36
|
+
return toNonEmptyString(env[RUNNER_TYPE_ENV]);
|
|
37
|
+
}
|
|
38
|
+
export function resolveSessionModel(env = process.env) {
|
|
39
|
+
return toNonEmptyString(env[MODEL_ENV]);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Fast mode is a two-state boolean flag on the CLI (`--fast`), not a tri-state, so an
|
|
43
|
+
* absent variable simply reads as off. The daemon only exports it when fast mode is on.
|
|
44
|
+
*/
|
|
45
|
+
export function resolveSessionFastMode(env = process.env) {
|
|
46
|
+
return toNonEmptyString(env[FAST_MODE_ENV]) === 'true';
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The execution snapshot for this run: an explicit argument always wins, and the session
|
|
50
|
+
* environment fills the gap when the daemon spawned us.
|
|
51
|
+
*
|
|
52
|
+
* A resolved value can still be `undefined` — outside a daemon session nothing can tell us
|
|
53
|
+
* the model. Callers that require the snapshot must keep failing in that case; this resolver
|
|
54
|
+
* narrows *when* they fail, it does not relax the requirement.
|
|
55
|
+
*/
|
|
56
|
+
export function resolveExecutionSnapshot(options, env = process.env) {
|
|
57
|
+
return {
|
|
58
|
+
runnerType: toNonEmptyString(options.runnerType) ?? resolveSessionRunnerType(env),
|
|
59
|
+
model: toNonEmptyString(options.model) ?? resolveSessionModel(env),
|
|
60
|
+
fastMode: options.fast === true || resolveSessionFastMode(env),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Appended to the existing "required" errors so the message names the other way out. The
|
|
65
|
+
* previous wording implied passing the flags was the only path, which is wrong inside a
|
|
66
|
+
* runner session and sends agents looking for values the session already has.
|
|
67
|
+
*/
|
|
68
|
+
export const EXECUTION_SNAPSHOT_HINT = ' In a runner session these are filled in automatically from the environment.';
|
|
24
69
|
//# sourceMappingURL=agentIdentity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentIdentity.js","sourceRoot":"","sources":["../../src/utils/agentIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC9E,OAAO,gBAAgB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
|
1
|
+
{"version":3,"file":"agentIdentity.js","sourceRoot":"","sources":["../../src/utils/agentIdentity.ts"],"names":[],"mappings":"AAAA,OAAO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;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,8EAA8E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContext.d.ts","sourceRoot":"","sources":["../../src/utils/apiContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"apiContext.d.ts","sourceRoot":"","sources":["../../src/utils/apiContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAKhD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAStF;AAKD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEvE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAWrG"}
|
package/dist/utils/apiContext.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { registerApiOrigin } from './apiOrigin.js';
|
|
2
|
+
const CONFIG_OVERRIDE_KEYS = ['apiKey', 'apiUrl', 'projectId'];
|
|
2
3
|
/**
|
|
3
4
|
* Collect config overrides passed as CLI options.
|
|
4
5
|
*
|
|
@@ -30,6 +31,10 @@ export function buildAuthHeaders(apiKey) {
|
|
|
30
31
|
}
|
|
31
32
|
export function resolveApiContext(config) {
|
|
32
33
|
const apiUrl = config.apiUrl.endsWith('/') ? config.apiUrl.slice(0, -1) : config.apiUrl;
|
|
34
|
+
// This is where the CLI settles on "the API" for this invocation — env, config file, or an
|
|
35
|
+
// --api-url override alike. The HTTP layer scopes session identity headers to what lands here,
|
|
36
|
+
// so a custom deployment keeps the tool axis without leaking it to presigned upload hosts.
|
|
37
|
+
registerApiOrigin(apiUrl);
|
|
33
38
|
const headers = {
|
|
34
39
|
...buildAuthHeaders(config.apiKey),
|
|
35
40
|
'Content-Type': 'application/json',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContext.js","sourceRoot":"","sources":["../../src/utils/apiContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apiContext.js","sourceRoot":"","sources":["../../src/utils/apiContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAgC;IACnE,MAAM,SAAS,GAA2B,EAAE,CAAC;IAC7C,KAAK,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClD,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,gFAAgF;AAChF,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,OAAO,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,MAAM,EAAE,EAAE,CAAC;AACnH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IACxF,2FAA2F;IAC3F,+FAA+F;IAC/F,2FAA2F;IAC3F,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,OAAO,GAAG;QACd,GAAG,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC;QAClC,cAAc,EAAE,kBAAkB;KACnC,CAAC;IACF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export interface ApiKeyInputOptions {
|
|
2
|
-
apiKey?: string;
|
|
3
2
|
apiKeyFile?: string;
|
|
4
3
|
}
|
|
5
4
|
export interface ApiKeyInputDependencies {
|
|
@@ -9,8 +8,7 @@ export interface ApiKeyInputDependencies {
|
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* Resolve explicit credential input without ever writing the credential to
|
|
12
|
-
* output.
|
|
13
|
-
* safer environment, file and stdin alternatives on stderr.
|
|
11
|
+
* output.
|
|
14
12
|
*/
|
|
15
13
|
export declare function resolveApiKeyInput(options: ApiKeyInputOptions, dependencies?: ApiKeyInputDependencies): string | undefined;
|
|
16
14
|
//# sourceMappingURL=apiKeyInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiKeyInput.d.ts","sourceRoot":"","sources":["../../src/utils/apiKeyInput.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,
|
|
1
|
+
{"version":3,"file":"apiKeyInput.d.ts","sourceRoot":"","sources":["../../src/utils/apiKeyInput.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAmBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,kBAAkB,EAC3B,YAAY,GAAE,uBAA6C,GAC1D,MAAM,GAAG,SAAS,CAmBpB"}
|
|
@@ -16,17 +16,9 @@ const normalizeApiKey = (value, source) => {
|
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Resolve explicit credential input without ever writing the credential to
|
|
19
|
-
* output.
|
|
20
|
-
* safer environment, file and stdin alternatives on stderr.
|
|
19
|
+
* output.
|
|
21
20
|
*/
|
|
22
21
|
export function resolveApiKeyInput(options, dependencies = defaultDependencies) {
|
|
23
|
-
if (options.apiKey !== undefined && options.apiKeyFile !== undefined) {
|
|
24
|
-
throw new Error('--api-key and --api-key-file cannot be used together.');
|
|
25
|
-
}
|
|
26
|
-
if (options.apiKey !== undefined) {
|
|
27
|
-
dependencies.warn('[warn] --api-key exposes credentials in shell history and process listings. Prefer AGENTTEAMS_API_KEY, --api-key-file <path>, or --api-key-file - for stdin.\n');
|
|
28
|
-
return normalizeApiKey(options.apiKey, '--api-key');
|
|
29
|
-
}
|
|
30
22
|
if (options.apiKeyFile === undefined) {
|
|
31
23
|
return undefined;
|
|
32
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiKeyInput.js","sourceRoot":"","sources":["../../src/utils/apiKeyInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"apiKeyInput.js","sourceRoot":"","sources":["../../src/utils/apiKeyInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE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EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IACE,KAAK,YAAY,KAAK;YACtB,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC,EACtF,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,kBAAkB,MAAM,KAAK,MAAM,EAAE,CAAC,CAAC;IACzD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which origins may receive AgentTeams session identity headers.
|
|
3
|
+
*
|
|
4
|
+
* The CLI talks to more than one host. Entity writes go to the AgentTeams API, but attachment
|
|
5
|
+
* uploads go straight to a presigned object-storage URL (`commands/attachment.ts`), and a global
|
|
6
|
+
* axios interceptor cannot tell the two apart on its own. Sending the session identity headers
|
|
7
|
+
* everywhere would hand a stable device UUID and a fingerprint of the user's working directory to
|
|
8
|
+
* a storage endpoint that has no use for them — it ignores unsigned headers, so the leak would
|
|
9
|
+
* never surface as a failure. `desktop/src/main/webview/client-header.ts` scopes the same class of
|
|
10
|
+
* header by origin for the same reason.
|
|
11
|
+
*
|
|
12
|
+
* This module must not import the config loader: `utils/httpClient.ts` consumes it, and the loader
|
|
13
|
+
* imports the token client, which imports the HTTP layer back (see `auth/activeCredential.ts`).
|
|
14
|
+
* So origins arrive two ways instead:
|
|
15
|
+
*
|
|
16
|
+
* - **Seeded** from the environment and the built-in default, covering paths that run before a
|
|
17
|
+
* project config is resolved (`init`, `auth login`).
|
|
18
|
+
* - **Registered** by `resolveApiContext()`, the single place every command and the MCP server
|
|
19
|
+
* resolve their API base URL — including a `--api-url` override that no seed could predict.
|
|
20
|
+
*
|
|
21
|
+
* Unknown origin means the headers are omitted. Fail-closed: a missed origin costs the tool axis
|
|
22
|
+
* on that request, while a wrong one leaks the identifiers for good.
|
|
23
|
+
*/
|
|
24
|
+
/** Record an API base URL the CLI resolved for itself. Called from `resolveApiContext()`. */
|
|
25
|
+
export declare const registerApiOrigin: (rawUrl: string | null | undefined) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve the absolute origin an axios request will actually reach.
|
|
28
|
+
*
|
|
29
|
+
* `baseURL` is the base only when the url is relative; an absolute url wins, which is exactly the
|
|
30
|
+
* presigned-upload shape (`axios.put(uploadUrl, ...)` with no baseURL at all).
|
|
31
|
+
*/
|
|
32
|
+
export declare const resolveRequestOrigin: (request: {
|
|
33
|
+
url?: string;
|
|
34
|
+
baseURL?: string;
|
|
35
|
+
}) => string | null;
|
|
36
|
+
/** True only for a request headed to an AgentTeams API origin this process resolved for itself. */
|
|
37
|
+
export declare const isApiOriginRequest: (request: {
|
|
38
|
+
url?: string;
|
|
39
|
+
baseURL?: string;
|
|
40
|
+
}) => boolean;
|
|
41
|
+
/** Test seam. The registry is process-wide and memoized by design. */
|
|
42
|
+
export declare const __resetApiOriginsForTest: () => void;
|
|
43
|
+
//# sourceMappingURL=apiOrigin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiOrigin.d.ts","sourceRoot":"","sources":["../../src/utils/apiOrigin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAgBH,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,IAGrE,CAAC;AAKF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,MAAM,GAAG,IAa3F,CAAC;AAEF,mGAAmG;AACnG,eAAO,MAAM,kBAAkB,GAAI,SAAS;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,OAGhF,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,wBAAwB,QAAO,IAI3C,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which origins may receive AgentTeams session identity headers.
|
|
3
|
+
*
|
|
4
|
+
* The CLI talks to more than one host. Entity writes go to the AgentTeams API, but attachment
|
|
5
|
+
* uploads go straight to a presigned object-storage URL (`commands/attachment.ts`), and a global
|
|
6
|
+
* axios interceptor cannot tell the two apart on its own. Sending the session identity headers
|
|
7
|
+
* everywhere would hand a stable device UUID and a fingerprint of the user's working directory to
|
|
8
|
+
* a storage endpoint that has no use for them — it ignores unsigned headers, so the leak would
|
|
9
|
+
* never surface as a failure. `desktop/src/main/webview/client-header.ts` scopes the same class of
|
|
10
|
+
* header by origin for the same reason.
|
|
11
|
+
*
|
|
12
|
+
* This module must not import the config loader: `utils/httpClient.ts` consumes it, and the loader
|
|
13
|
+
* imports the token client, which imports the HTTP layer back (see `auth/activeCredential.ts`).
|
|
14
|
+
* So origins arrive two ways instead:
|
|
15
|
+
*
|
|
16
|
+
* - **Seeded** from the environment and the built-in default, covering paths that run before a
|
|
17
|
+
* project config is resolved (`init`, `auth login`).
|
|
18
|
+
* - **Registered** by `resolveApiContext()`, the single place every command and the MCP server
|
|
19
|
+
* resolve their API base URL — including a `--api-url` override that no seed could predict.
|
|
20
|
+
*
|
|
21
|
+
* Unknown origin means the headers are omitted. Fail-closed: a missed origin costs the tool axis
|
|
22
|
+
* on that request, while a wrong one leaks the identifiers for good.
|
|
23
|
+
*/
|
|
24
|
+
/** Mirrors `utils/config.ts` DEFAULT_API_URL. Duplicated to keep the import cycle above from existing. */
|
|
25
|
+
const DEFAULT_API_ORIGIN_URL = 'https://api.agentteams.run';
|
|
26
|
+
const knownApiOrigins = new Set();
|
|
27
|
+
const toOrigin = (rawUrl) => {
|
|
28
|
+
if (!rawUrl)
|
|
29
|
+
return null;
|
|
30
|
+
try {
|
|
31
|
+
return new URL(rawUrl).origin;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/** Record an API base URL the CLI resolved for itself. Called from `resolveApiContext()`. */
|
|
38
|
+
export const registerApiOrigin = (rawUrl) => {
|
|
39
|
+
const origin = toOrigin(rawUrl);
|
|
40
|
+
if (origin)
|
|
41
|
+
knownApiOrigins.add(origin);
|
|
42
|
+
};
|
|
43
|
+
registerApiOrigin(DEFAULT_API_ORIGIN_URL);
|
|
44
|
+
registerApiOrigin(process.env.AGENTTEAMS_API_URL);
|
|
45
|
+
/**
|
|
46
|
+
* Resolve the absolute origin an axios request will actually reach.
|
|
47
|
+
*
|
|
48
|
+
* `baseURL` is the base only when the url is relative; an absolute url wins, which is exactly the
|
|
49
|
+
* presigned-upload shape (`axios.put(uploadUrl, ...)` with no baseURL at all).
|
|
50
|
+
*/
|
|
51
|
+
export const resolveRequestOrigin = (request) => {
|
|
52
|
+
const { url, baseURL } = request;
|
|
53
|
+
if (!url && !baseURL)
|
|
54
|
+
return null;
|
|
55
|
+
const direct = toOrigin(url);
|
|
56
|
+
if (direct)
|
|
57
|
+
return direct;
|
|
58
|
+
if (!baseURL)
|
|
59
|
+
return null;
|
|
60
|
+
try {
|
|
61
|
+
return new URL(url ?? '', baseURL).origin;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
/** True only for a request headed to an AgentTeams API origin this process resolved for itself. */
|
|
68
|
+
export const isApiOriginRequest = (request) => {
|
|
69
|
+
const origin = resolveRequestOrigin(request);
|
|
70
|
+
return origin !== null && knownApiOrigins.has(origin);
|
|
71
|
+
};
|
|
72
|
+
/** Test seam. The registry is process-wide and memoized by design. */
|
|
73
|
+
export const __resetApiOriginsForTest = () => {
|
|
74
|
+
knownApiOrigins.clear();
|
|
75
|
+
registerApiOrigin(DEFAULT_API_ORIGIN_URL);
|
|
76
|
+
registerApiOrigin(process.env.AGENTTEAMS_API_URL);
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=apiOrigin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiOrigin.js","sourceRoot":"","sources":["../../src/utils/apiOrigin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,0GAA0G;AAC1G,MAAM,sBAAsB,GAAG,4BAA4B,CAAC;AAE5D,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;AAE1C,MAAM,QAAQ,GAAG,CAAC,MAAiC,EAAiB,EAAE;IACpE,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,6FAA6F;AAC7F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAiC,EAAQ,EAAE;IAC3E,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,MAAM;QAAE,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;AAC1C,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAA2C,EAAiB,EAAE;IACjG,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IACjC,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAElC,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,mGAAmG;AACnG,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAA2C,EAAW,EAAE;IACzF,MAAM,MAAM,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC7C,OAAO,MAAM,KAAK,IAAI,IAAI,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACxD,CAAC,CAAC;AAEF,sEAAsE;AACtE,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAS,EAAE;IACjD,eAAe,CAAC,KAAK,EAAE,CAAC;IACxB,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;IAC1C,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AACpD,CAAC,CAAC"}
|
package/dist/utils/config.d.ts
CHANGED
|
@@ -116,10 +116,16 @@ export declare function planCredential(options?: Partial<Config>): CredentialPla
|
|
|
116
116
|
*
|
|
117
117
|
* The distinction is worth carrying: telling someone to check a network that is
|
|
118
118
|
* fine, or to re-login with a credential that is valid, costs them the time it
|
|
119
|
-
* takes to rule those out.
|
|
120
|
-
*
|
|
119
|
+
* takes to rule those out. The same applies when the current directory has no
|
|
120
|
+
* project binding: point at the missing binding only when the login itself is
|
|
121
|
+
* usable. A concrete refresh failure still has to win because binding a project
|
|
122
|
+
* cannot repair a revoked login, a lock failure, or an unreachable server.
|
|
123
|
+
* Lock contention and an unusable lock both clear on a retry, so neither should
|
|
124
|
+
* read as "your login is broken".
|
|
121
125
|
*/
|
|
122
|
-
export declare function describeUnusableCredential(state: PersonalTokenState
|
|
126
|
+
export declare function describeUnusableCredential(state: PersonalTokenState, context?: {
|
|
127
|
+
projectConnected?: boolean;
|
|
128
|
+
}): string;
|
|
123
129
|
/** Decide which credential to authenticate with, and produce the value to send. */
|
|
124
130
|
export declare function resolveCredential(options?: Partial<Config>, deps?: ResolveCredentialDeps): Promise<ResolvedCredential | null>;
|
|
125
131
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,gCAAgC,CAAC;AAMxC,eAAO,MAAM,eAAe,+BAA+B,CAAC;AAE5D,6FAA6F;AAC7F,eAAO,MAAM,gBAAgB,MAAQ,CAAC;AACtC,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC;AAClH,MAAM,MAAM,2BAA2B,GAAG,eAAe,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAenF,yFAAyF;AACzF,wBAAgB,iBAAiB,CAAC,QAAQ,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAG1F;AAuBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA+BjE;AAED,wBAAgB,+BAA+B,CAC7C,QAAQ,GAAE,MAAsB,EAChC,WAAW,GAAE,MAAkB,GAC9B,MAAM,CAmBR;A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