@team-ai/teamai-cli 0.40.5 → 0.40.9
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/CHANGELOG.md +3 -1
- package/dist/cli.js +259 -65
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -21,6 +21,8 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
21
21
|
|
|
22
22
|
### Changed
|
|
23
23
|
|
|
24
|
+
- `teamai import --dir`, `--from-repo`, `--from-repo-list` and `--from-org` exit 1 when a codebase's deep enrich leaves component or architecture docs missing or fails, and print the command that resumes it: in a team repo the same import without `--incremental`, keeping `--max-files`, `--domain` and `--ssh` (`--from-repo <url>` for each unfinished repo of a batch), with `--output` `teamai codebase --deep-enrich --output <dir>`. The extracted evidence is still published, and a deep enrich error is now a warning instead of a debug line. A deep enrich refused at a symbolic link says to replace it before retrying. The teamwiki update of `import --from-mr` and `teamai ci extract-mr`, and `codebase --upgrade-wiki`, still exit 0 (for [#1500](https://github.com/Tencent/teamai-cli/issues/1500)).
|
|
25
|
+
- `teamai init --http` exits 1, before it writes anything, when the HTTP local agent already uses another endpoint or token; `--force` replaces it as before. Running it again with the same endpoint and token succeeds, and a first `init --http --scope user` now sets up the local agent and its token file, which it used to skip without saying so. An endpoint in `TEAMAI_HTTP_ENDPOINT` does not count as an existing local agent. `teamai source add-http` on the endpoint already set up, without `--token`, keeps the stored token instead of clearing it (for [#1500](https://github.com/Tencent/teamai-cli/issues/1500)).
|
|
24
26
|
- `teamai pull` exits 1 when the team repo cannot be fetched, as it already did for a pinned ref. A pull a session hook or git hook runs (`--silent`) still exits 0 and records the failure as before (for [#1500](https://github.com/Tencent/teamai-cli/issues/1500)).
|
|
25
27
|
- The friction reminder offers the `session-close` workflow, which teams can override with `workflows/session-close.yaml`. It fires on the same Stops as before, at most once per session, and keeps its old text, naming `teamai skill get share`, in a session teamai launched, in a workflow worktree, in an unattended session, while the session drives a workflow run that is not done, and when the team's `session-close` sets `invoke: deny`. A session resumed more than a day after its reminder is no longer reminded again. In the dashboard, attended `ask` now reads "proposed when the friction reminder offers session-close" (for [#1388](https://github.com/Tencent/teamai-cli/issues/1388)).
|
|
26
28
|
- Member settings in `~/.teamai/config.yaml` now apply in every workspace and self scope whose own config does not set them, also in workspaces of other teams, and that file needs no `repo` or `username`. A member with a user install who set one there for user scope only, such as `recallEnabled`, `coAuthorEnabled`, `usageReportEnabled` or `workflows.*`, sees it apply in their workspaces too. `teamai doctor` lists each member setting with the level that set it. An AI call fails when the workspace config where it runs cannot be read, a bad `workflows.allow` in `~/.teamai/config.yaml` stops workflow commands, the HTTP local agent reads `codexTrustEnabled` from that file, and a stop hook prices with its scope's `modelAliases` (for [#1459](https://github.com/Tencent/teamai-cli/issues/1459)).
|
|
@@ -36,7 +38,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
36
38
|
|
|
37
39
|
### 💥 Breaking Changes
|
|
38
40
|
|
|
39
|
-
- **An HTTP access token is enrolled for one agent at a time.** `teamai init --http --token
|
|
41
|
+
- **An HTTP agent access token (`sk-`) is enrolled for one agent at a time.** `teamai init --http --token sk-<key> --agent claude,codebuddy`, or `--token` with no `--agent` on a machine whose endpoint already holds tokens for several agents, is refused with `An access token works for one agent only. Re-run with --agent <tool> naming the agent it is for`: the backend binds an access token to the first agent instance that reports with it, so one shared by several agents left all but the first at 401 while this machine still reported success. Run `init --http` (or `add-http`) once per tool, with `--agent <tool>` and that tool's own token; each agent then keeps its own, and an agent with no token of its own falls back to the shared token this machine already had. Members who set up several tools with one `sk-` token in a single `init` have to run it once per tool. A user token (`hk-`) still works for every agent: it stays shared, with any number of `--agent`, and each agent named with `--agent` drops a token of its own so it reports with the shared one.
|
|
40
42
|
- **Sessions are archived on teamai-reports on every git-kind team.** `teamai session push`, `session migrate` and `workflow publish --sessions` archive there, as self mode already did. Members on 0.28.0 or earlier do not list, search or resume sessions archived there, and their `workflow resume` does not restore step sessions archived there, until they upgrade. Sessions archived on the default branch before stay readable to both (for [#1385](https://github.com/Tencent/teamai-cli/issues/1385)).
|
|
41
43
|
- **Unattended runs now publish and score their sessions by default.** In CI, on a cloud VM or in a hosted job (`CI` or `TEAMAI_MODE=unattended`), `teamai score --drain`, which the local driver runs at the end of a run and every other driver runs before it ends, archives to teamai-reports, scrubbed: the captured sessions of this machine recorded as unattended, and the step sessions of the workflow runs driven here. Every scorer with `sessions: true` judges a sample of those captured sessions, within `daily_limit`. To keep the old behavior, set `unattended: off`: `sessions: { publish: { unattended: off } }` in `teamai.yaml` and `sessions: { unattended: off }` in `scorers/scoring.yaml` (for [#1385](https://github.com/Tencent/teamai-cli/issues/1385)).
|
|
42
44
|
- **`teamai import --dir` names a checkout with an `origin` after its remote.** Its evidence goes to `teamwiki/evidence/code/<provider>__<owner>__<repo>/`, the slug `--from-repo` and `teamai ci extract-mr` use, instead of the directory name, so two checkouts named `svc` no longer overwrite each other. Evidence of the same repo under the directory name, including what the checkout published before it had an `origin`, moves there; directory-named evidence that names no repository stays, with a warning. Once the old name holds no evidence, a role or project whose `resources.wiki` lists it is named in a warning: change the entry to the slug the import prints as `project:`. An import over evidence that another repository or another directory of the same repository published, a checkout without an origin over a repository's evidence, and a checkout with an origin over the evidence of another checkout without one, now fail instead of replacing it, and `--skip-enrich` keeps the AI-written components. A checkout without an `origin` whose directory name already holds another such checkout's evidence, or evidence that names no source, is published under `<name>-<hash8>` with a warning, and the import (and `--dry-run`) prints that slug as `project:`. That includes a team's own evidence, written by 0.28.0 or earlier, of a checkout without an `origin` or of a directory outside git: its next import publishes a suffixed copy beside `<name>/` instead of updating it. Move the curated docs you want to keep from `<name>/` to the printed slug, remove `<name>/`, and change any `resources.wiki` entry naming `<name>` to that slug (for [#1422](https://github.com/Tencent/teamai-cli/issues/1422)).
|
package/dist/cli.js
CHANGED
|
@@ -55760,24 +55760,40 @@ function processStarts() {
|
|
|
55760
55760
|
function recordGroup(child, dir) {
|
|
55761
55761
|
const start3 = child.pid === void 0 ? void 0 : processStarts()?.get(child.pid);
|
|
55762
55762
|
if (child.pid === void 0 || start3 === void 0) return;
|
|
55763
|
-
const
|
|
55763
|
+
const body = JSON.stringify({ pid: child.pid, start: start3 });
|
|
55764
|
+
writeGroup(path49.join(dir, `${GROUP_PREFIX}${child.pid}.json`), body);
|
|
55765
|
+
writeGroup(path49.join(dir, LEGACY_GROUP_FILE), body);
|
|
55766
|
+
}
|
|
55767
|
+
function writeGroup(file, body) {
|
|
55764
55768
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
55765
55769
|
try {
|
|
55766
|
-
fs30.writeFileSync(temporary,
|
|
55770
|
+
fs30.writeFileSync(temporary, body);
|
|
55767
55771
|
fs30.renameSync(temporary, file);
|
|
55768
55772
|
} catch {
|
|
55769
55773
|
}
|
|
55770
55774
|
}
|
|
55771
55775
|
async function stopRecordedGroup(dir) {
|
|
55772
|
-
const file
|
|
55773
|
-
|
|
55776
|
+
for (const file of await recordedGroups(dir)) {
|
|
55777
|
+
const recorded = await readGroup(file);
|
|
55778
|
+
if (recorded !== void 0) await stopGroup(recorded);
|
|
55779
|
+
await fs30.promises.rm(file, { force: true });
|
|
55780
|
+
}
|
|
55781
|
+
}
|
|
55782
|
+
async function recordedGroups(dir) {
|
|
55783
|
+
let names2;
|
|
55774
55784
|
try {
|
|
55775
|
-
|
|
55785
|
+
names2 = await fs30.promises.readdir(dir);
|
|
55776
55786
|
} catch {
|
|
55777
|
-
return;
|
|
55787
|
+
return [];
|
|
55788
|
+
}
|
|
55789
|
+
return names2.filter((name) => GROUP_FILE.test(name) || name === LEGACY_GROUP_FILE).map((name) => path49.join(dir, name));
|
|
55790
|
+
}
|
|
55791
|
+
async function readGroup(file) {
|
|
55792
|
+
try {
|
|
55793
|
+
return ProcessGroupSchema.parse(JSON.parse(await fs30.promises.readFile(file, "utf8")));
|
|
55794
|
+
} catch {
|
|
55795
|
+
return void 0;
|
|
55778
55796
|
}
|
|
55779
|
-
await stopGroup(recorded);
|
|
55780
|
-
await fs30.promises.rm(file, { force: true });
|
|
55781
55797
|
}
|
|
55782
55798
|
function signalGroup(pid, name) {
|
|
55783
55799
|
try {
|
|
@@ -55892,13 +55908,15 @@ function stopProcess(child, exit, detached) {
|
|
|
55892
55908
|
};
|
|
55893
55909
|
return (initial = "SIGTERM") => stopping ??= stop(initial);
|
|
55894
55910
|
}
|
|
55895
|
-
var ProcessGroupSchema, GROUP_FILE;
|
|
55911
|
+
var ProcessGroupSchema, LEGACY_GROUP_FILE, GROUP_PREFIX, GROUP_FILE;
|
|
55896
55912
|
var init_process_stop = __esm({
|
|
55897
55913
|
"src/tool-launch/process-stop.ts"() {
|
|
55898
55914
|
"use strict";
|
|
55899
55915
|
init_zod();
|
|
55900
55916
|
ProcessGroupSchema = external_exports.object({ pid: external_exports.number().int().positive(), start: external_exports.string().min(1) });
|
|
55901
|
-
|
|
55917
|
+
LEGACY_GROUP_FILE = "group.json";
|
|
55918
|
+
GROUP_PREFIX = "group-";
|
|
55919
|
+
GROUP_FILE = /^group-\d+\.json$/;
|
|
55902
55920
|
}
|
|
55903
55921
|
});
|
|
55904
55922
|
|
|
@@ -81541,13 +81559,13 @@ function run(file, args, env3, cwd, reachesCommand) {
|
|
|
81541
81559
|
child.on("exit", (code, signal) => settle2(signal ? { kind: "signaled", signal } : { kind: "exited", code: code ?? 1 }));
|
|
81542
81560
|
});
|
|
81543
81561
|
}
|
|
81544
|
-
async function stepEnvironment(values, scope) {
|
|
81562
|
+
async function stepEnvironment({ values, facts }, scope) {
|
|
81545
81563
|
const env3 = inheritedEnvironment();
|
|
81546
81564
|
for (const key of scope.withhold) removeKey(env3, key);
|
|
81547
81565
|
for (const key of scope.provide) {
|
|
81548
81566
|
const value = values.get(sameEnvName(values.keys(), key) ?? key);
|
|
81549
81567
|
if (value === void 0) {
|
|
81550
|
-
return { ok: false, failure: { code: "missing_env", message: `Env ${key} has no value on this machine any more
|
|
81568
|
+
return { ok: false, failure: { code: "missing_env", message: `Env ${key} has no value on this machine any more: ${envAdvice([key], facts.declared)}. Then retry the step.` } };
|
|
81551
81569
|
}
|
|
81552
81570
|
setKey(env3, key, value);
|
|
81553
81571
|
}
|
|
@@ -81570,6 +81588,7 @@ var init_env_exec = __esm({
|
|
|
81570
81588
|
init_logger();
|
|
81571
81589
|
init_env_reserved();
|
|
81572
81590
|
init_workspace_children();
|
|
81591
|
+
init_requirements();
|
|
81573
81592
|
FORWARDED_SIGNALS = ["SIGTERM", "SIGHUP"];
|
|
81574
81593
|
TERMINAL_SIGNALS = ["SIGINT", "SIGQUIT"];
|
|
81575
81594
|
SURVIVED_SIGNALS = /* @__PURE__ */ new Set(["SIGPIPE", "SIGUSR1"]);
|
|
@@ -82501,13 +82520,13 @@ async function settle(config, record3) {
|
|
|
82501
82520
|
return ready;
|
|
82502
82521
|
}
|
|
82503
82522
|
async function runPlaceSetup(input) {
|
|
82504
|
-
const { config, run: run3, attempt, mode,
|
|
82523
|
+
const { config, run: run3, attempt, mode, env: env3, signal } = input;
|
|
82505
82524
|
const read4 = await readPlaceRecord(config, run3, attempt);
|
|
82506
82525
|
const recorded = read4.kind === "found" ? read4.record : void 0;
|
|
82507
82526
|
if (recorded?.phase !== "staged") return void 0;
|
|
82508
82527
|
const { setup, expiresAt } = recorded;
|
|
82509
82528
|
const scope = setup.envScope ?? { provide: [], withhold: [] };
|
|
82510
|
-
const scoped = await stepEnvironment(
|
|
82529
|
+
const scoped = await stepEnvironment(env3, scope);
|
|
82511
82530
|
if (!scoped.ok) return setupFailed(config, recorded, scoped.failure);
|
|
82512
82531
|
await markSetup(recorded.dir, "unfinished");
|
|
82513
82532
|
const settingUp = { ...baseOf(recorded), phase: "setting-up" };
|
|
@@ -84398,7 +84417,7 @@ function inProcessClient({ config, env: env3 }) {
|
|
|
84398
84417
|
if (placed.kind !== "refused") return placed;
|
|
84399
84418
|
return request.kind === "adopt" ? { ...ask2, refused: placed.failure.message } : ask2;
|
|
84400
84419
|
},
|
|
84401
|
-
setup: (run3, attempt, mode, signal) => runPlaceSetup({ config, run: run3, attempt, mode,
|
|
84420
|
+
setup: (run3, attempt, mode, signal) => runPlaceSetup({ config, run: run3, attempt, mode, env: env3, ...signal ? { signal } : {} }),
|
|
84402
84421
|
start: async (name, { inputs, checkout, caller }) => {
|
|
84403
84422
|
const cached = await loadCachedWorkflow(config, name);
|
|
84404
84423
|
const refused2 = invokeRefusal(cached?.definition, caller, { kind: "start" });
|
|
@@ -84526,7 +84545,7 @@ async function prepareLeased(input) {
|
|
|
84526
84545
|
}
|
|
84527
84546
|
if (placed.kind === "failed") return failed4(placed.failure);
|
|
84528
84547
|
const mode = (leased.kind === "leased" ? leased.mode : void 0) ?? resolveRunMode(process.env);
|
|
84529
|
-
const failure3 = await runPlaceSetup({ config, run: lock.run, attempt, mode,
|
|
84548
|
+
const failure3 = await runPlaceSetup({ config, run: lock.run, attempt, mode, env: env3 });
|
|
84530
84549
|
if (failure3) return failed4(failure3);
|
|
84531
84550
|
return { data: { ...answer.data, lease: { ...named2.data, cwd: placed.dir, ...placed.prompt !== void 0 ? { prompt: placed.prompt } : {} } } };
|
|
84532
84551
|
}
|
|
@@ -87032,7 +87051,7 @@ async function begin(context, lock, attempt, prepared) {
|
|
|
87032
87051
|
const { dir, job: { lease: lease2 } } = prepared;
|
|
87033
87052
|
const failed4 = (failure3, cause) => fail2(context, lock, { state, attempt, revision: open.revision, failure: failure3, cause });
|
|
87034
87053
|
if (lease2.executor === "command") {
|
|
87035
|
-
const scoped = lease2.envScope ? await stepEnvironment(context.env
|
|
87054
|
+
const scoped = lease2.envScope ? await stepEnvironment(context.env, lease2.envScope) : { ok: true, env: process.env };
|
|
87036
87055
|
if (!scoped.ok) return failed4(scoped.failure, "place");
|
|
87037
87056
|
const running = open.phase === "preparing" ? traced(context, preparedRow(state, attempt))?.state ?? state : state;
|
|
87038
87057
|
await writeSkillState(context.config, lock, running, context.env.secrets);
|
|
@@ -93000,6 +93019,7 @@ var init_api_key = __esm({
|
|
|
93000
93019
|
var local_agent_exports = {};
|
|
93001
93020
|
__export(local_agent_exports, {
|
|
93002
93021
|
DEFAULT_ROUTES: () => DEFAULT_ROUTES,
|
|
93022
|
+
assertNoLocalAgentReplacement: () => assertNoLocalAgentReplacement,
|
|
93003
93023
|
bindCurrentProject: () => bindCurrentProject,
|
|
93004
93024
|
bindWorkspaceToProject: () => bindWorkspaceToProject,
|
|
93005
93025
|
buildAgentIdentityPayload: () => buildAgentIdentityPayload,
|
|
@@ -93349,6 +93369,7 @@ async function loadLocalAgentConfig(options2 = {}) {
|
|
|
93349
93369
|
}
|
|
93350
93370
|
return backfilled;
|
|
93351
93371
|
}
|
|
93372
|
+
if (options2.envFallback === false) return null;
|
|
93352
93373
|
const envEndpoint = process.env.TEAMAI_HTTP_ENDPOINT ?? process.env.TEAMAI_ENDPOINT ?? process.env.TEAMAI_API_BASE_URL;
|
|
93353
93374
|
if (!envEndpoint) return null;
|
|
93354
93375
|
return {
|
|
@@ -96084,6 +96105,34 @@ async function tokenStillWorks(config, token) {
|
|
|
96084
96105
|
return void 0;
|
|
96085
96106
|
}
|
|
96086
96107
|
}
|
|
96108
|
+
function isAgentToken(token) {
|
|
96109
|
+
return token?.trim().startsWith("sk-") === true;
|
|
96110
|
+
}
|
|
96111
|
+
function incomingTokenOwner(existing2, endpoint, token, filterAgents2) {
|
|
96112
|
+
if (!isAgentToken(token)) return void 0;
|
|
96113
|
+
const named2 = filterAgents2 ?? [];
|
|
96114
|
+
if (named2.length === 1) return normalizeAgentType(named2[0]);
|
|
96115
|
+
if (named2.length > 1) return void 0;
|
|
96116
|
+
const sameEndpoint = existing2 !== null && normalizeEndpoint(existing2.endpoint) === endpoint;
|
|
96117
|
+
const held = sameEndpoint ? Object.keys(existing2?.agentTokens ?? {}) : [];
|
|
96118
|
+
return held.length === 1 ? held[0] : void 0;
|
|
96119
|
+
}
|
|
96120
|
+
async function assertNoLocalAgentReplacement(options2) {
|
|
96121
|
+
const existing2 = await loadLocalAgentConfig({ dryRun: true, envFallback: false });
|
|
96122
|
+
if (!existing2) return;
|
|
96123
|
+
const endpoint = normalizeEndpoint(options2.endpoint);
|
|
96124
|
+
if (existing2.endpoint !== endpoint) {
|
|
96125
|
+
throw new Error(
|
|
96126
|
+
`The HTTP local agent already uses ${existing2.endpoint}. Re-run with --force to replace it with ${endpoint}.`
|
|
96127
|
+
);
|
|
96128
|
+
}
|
|
96129
|
+
if (incomingTokenOwner(existing2, endpoint, options2.token, options2.filterAgents)) return;
|
|
96130
|
+
if (options2.token !== void 0 && existing2.token !== options2.token) {
|
|
96131
|
+
throw new Error(
|
|
96132
|
+
`The HTTP local agent already uses ${endpoint} with another token. Re-run with --force to replace the token.`
|
|
96133
|
+
);
|
|
96134
|
+
}
|
|
96135
|
+
}
|
|
96087
96136
|
async function chooseAgentToken(existing2, agent, current2, incoming, spare) {
|
|
96088
96137
|
if (!current2 || current2 === incoming) return incoming;
|
|
96089
96138
|
if (await tokenStillWorks(existing2, current2) === false) {
|
|
@@ -96108,20 +96157,24 @@ async function initLocalAgentHttp(options2) {
|
|
|
96108
96157
|
const token = options2.token?.trim() || void 0;
|
|
96109
96158
|
const sameEndpoint = existing2 !== null && normalizeEndpoint(existing2.endpoint) === endpoint;
|
|
96110
96159
|
const namedCount = options2.filterAgents?.length ?? 0;
|
|
96111
|
-
const namedAgent = namedCount === 1 ? normalizeAgentType(options2.filterAgents[0]) : void 0;
|
|
96112
96160
|
const held = sameEndpoint ? Object.keys(existing2?.agentTokens ?? {}) : [];
|
|
96113
|
-
const
|
|
96114
|
-
const
|
|
96161
|
+
const agentScoped = isAgentToken(token);
|
|
96162
|
+
const inferred = namedCount === 0 && agentScoped && held.length === 1;
|
|
96163
|
+
const agent = agentScoped ? incomingTokenOwner(existing2, endpoint, token, options2.filterAgents) : void 0;
|
|
96115
96164
|
const perAgent = Boolean(agent && token);
|
|
96116
|
-
|
|
96165
|
+
const replaces = !sameEndpoint || token !== void 0 && token !== existing2?.token;
|
|
96166
|
+
if (existing2 && configExisted && !options2.force && replaces && !(perAgent && sameEndpoint)) {
|
|
96117
96167
|
throw new Error("HTTP local agent is already initialized. Re-run with --force to overwrite.");
|
|
96118
96168
|
}
|
|
96119
|
-
if (
|
|
96169
|
+
if (agentScoped && !agent && (namedCount > 1 || held.length > 1)) {
|
|
96120
96170
|
throw new Error(
|
|
96121
96171
|
`An access token works for one agent only. Re-run with --agent <tool> naming the agent it is for${held.length > 1 ? `; this machine already holds credentials for ${held.join(", ")}` : ""}.`
|
|
96122
96172
|
);
|
|
96123
96173
|
}
|
|
96124
96174
|
const agentTokens = { ...sameEndpoint ? existing2?.agentTokens : void 0 };
|
|
96175
|
+
if (token && !agentScoped) {
|
|
96176
|
+
for (const named2 of options2.filterAgents ?? []) delete agentTokens[normalizeAgentType(named2)];
|
|
96177
|
+
}
|
|
96125
96178
|
let sharedToken = perAgent ? sameEndpoint ? existing2?.token : void 0 : token ?? (sameEndpoint ? existing2?.token : void 0);
|
|
96126
96179
|
if (perAgent && sharedToken === token) sharedToken = void 0;
|
|
96127
96180
|
if (perAgent) {
|
|
@@ -96140,6 +96193,7 @@ async function initLocalAgentHttp(options2) {
|
|
|
96140
96193
|
}
|
|
96141
96194
|
const config = {
|
|
96142
96195
|
endpoint,
|
|
96196
|
+
// Never carry a token to another endpoint: a shared one stays only here.
|
|
96143
96197
|
token: sharedToken,
|
|
96144
96198
|
...Object.keys(agentTokens).length > 0 ? { agentTokens } : {},
|
|
96145
96199
|
createdAt: existing2?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -97437,6 +97491,10 @@ async function initHttp(url, options2) {
|
|
|
97437
97491
|
log.info("Initializing teamai (HTTP read-only consumer)...");
|
|
97438
97492
|
const requestedAgents = normalizeAgentList(options2.agent);
|
|
97439
97493
|
warnAboutUncheckedHttpAgentIds(requestedAgents);
|
|
97494
|
+
const { assertNoLocalAgentReplacement: assertNoLocalAgentReplacement2, initLocalAgentHttp: initLocalAgentHttp2 } = await Promise.resolve().then(() => (init_local_agent(), local_agent_exports));
|
|
97495
|
+
if (!options2.force) {
|
|
97496
|
+
await assertNoLocalAgentReplacement2({ endpoint: url, token: options2.token, filterAgents: requestedAgents });
|
|
97497
|
+
}
|
|
97440
97498
|
let scope;
|
|
97441
97499
|
let projectRoot;
|
|
97442
97500
|
let explicit;
|
|
@@ -97553,7 +97611,6 @@ async function initHttp(url, options2) {
|
|
|
97553
97611
|
const filterAgents2 = requestedAgents.length > 0 ? requestedAgents : void 0;
|
|
97554
97612
|
await runInitScript(localConfig2, "preInit", options2.dryRun);
|
|
97555
97613
|
await reconcileHooksForInit(teamConfig, localConfig2, filterAgents2);
|
|
97556
|
-
const { initLocalAgentHttp: initLocalAgentHttp2 } = await Promise.resolve().then(() => (init_local_agent(), local_agent_exports));
|
|
97557
97614
|
let localAgentFailed = false;
|
|
97558
97615
|
try {
|
|
97559
97616
|
await initLocalAgentHttp2({ endpoint: url, token: options2.token, force: options2.force, filterAgents: filterAgents2 });
|
|
@@ -123298,7 +123355,12 @@ async function autoPushTeamRepo(repoPath, message) {
|
|
|
123298
123355
|
await pushRepoDirectly(repoPath, message, ["."]);
|
|
123299
123356
|
} catch (err) {
|
|
123300
123357
|
DetachedTeamRepoError.rethrow(err);
|
|
123301
|
-
|
|
123358
|
+
const lines2 = err.message.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
123359
|
+
const reasonLines = lines2.filter((line) => /^(error|fatal|remote):/.test(line) || /^!\s/.test(line) || /\[(remote )?rejected\]/.test(line));
|
|
123360
|
+
const reason = (reasonLines.length > 0 ? reasonLines : lines2.slice(0, 1)).join("\n") || "unknown error";
|
|
123361
|
+
const stale = /\(fetch first\)|\(non-fast-forward\)/.test(err.message);
|
|
123362
|
+
const advice = stale ? "\nRun `teamai pull`, then rerun this command." : "";
|
|
123363
|
+
throw new Error(`Push to the team repo failed: ${reason}${advice}`, { cause: err });
|
|
123302
123364
|
}
|
|
123303
123365
|
}
|
|
123304
123366
|
async function autoPushViaMR(repoPath, message, files, teamConfig, localConfig2, opts = {}) {
|
|
@@ -124872,9 +124934,35 @@ function copilotRunsEntries(data) {
|
|
|
124872
124934
|
function copilotCopyKey(event, matcher, command) {
|
|
124873
124935
|
return createHash31("sha256").update(JSON.stringify([event, matcher && matcher !== "*" ? matcher : "", command])).digest("hex");
|
|
124874
124936
|
}
|
|
124875
|
-
function
|
|
124876
|
-
|
|
124877
|
-
|
|
124937
|
+
function powershellQuoteValue(value) {
|
|
124938
|
+
return `'${value.replace(/'/g, "''")}'`;
|
|
124939
|
+
}
|
|
124940
|
+
function powershellProjectCopilotCopyCheck(event, matcher, command) {
|
|
124941
|
+
const expectedMatcher = matcher && matcher !== "*" ? matcher : "";
|
|
124942
|
+
return [
|
|
124943
|
+
'$teamaiHooks = Join-Path (Join-Path $env:COPILOT_PROJECT_DIR ".github") "hooks";',
|
|
124944
|
+
'Get-ChildItem -LiteralPath $teamaiHooks -Filter "*.json" -File -ErrorAction SilentlyContinue | ForEach-Object {',
|
|
124945
|
+
"try { $teamaiFile = Get-Content -LiteralPath $_.FullName -Raw -Encoding UTF8 -ErrorAction Stop | ConvertFrom-Json -ErrorAction Stop } catch { return };",
|
|
124946
|
+
"$teamaiVersion = $teamaiFile.version;",
|
|
124947
|
+
"if ($null -eq $teamaiVersion -or $teamaiVersion -is [string] -or $teamaiVersion -is [bool] -or $teamaiVersion -ne 1 -or $teamaiFile.disableAllHooks -or $null -eq $teamaiFile.hooks -or $teamaiFile.hooks -is [array] -or $teamaiFile.hooks -is [string]) { return };",
|
|
124948
|
+
`$teamaiEntries = @($teamaiFile.hooks.PSObject.Properties | Where-Object { $_.Name -ceq ${powershellQuoteValue(event)} } | ForEach-Object { if ($_.Value -is [array]) { $_.Value } });`,
|
|
124949
|
+
"foreach ($teamaiEntry in $teamaiEntries) {",
|
|
124950
|
+
'$teamaiMatcher = if ($null -eq $teamaiEntry.matcher -or $teamaiEntry.matcher -ceq "*") { "" } else { [string]$teamaiEntry.matcher };',
|
|
124951
|
+
`$teamaiCommands = @($teamaiEntry.bash, $teamaiEntry.powershell, $teamaiEntry.command); if ($teamaiEntry.type -ceq "command" -and $teamaiMatcher -ceq ${powershellQuoteValue(expectedMatcher)} -and $teamaiCommands -ccontains ${powershellQuoteValue(command)}) { exit 0 }`,
|
|
124952
|
+
"}",
|
|
124953
|
+
"}; "
|
|
124954
|
+
].join(" ");
|
|
124955
|
+
}
|
|
124956
|
+
function claudeHookUsesPowerShell(platform3 = process.platform, gitBashPath = platform3 === "win32" ? findGitBashWindows() : null) {
|
|
124957
|
+
return platform3 === "win32" && !gitBashPath;
|
|
124958
|
+
}
|
|
124959
|
+
function claudeHookOtherHostSkip(copilotEvent, copilotMatcher, command, platform3 = process.platform, gitBashPath = platform3 === "win32" ? findGitBashWindows() : null) {
|
|
124960
|
+
if (!claudeHookUsesPowerShell(platform3, gitBashPath)) {
|
|
124961
|
+
if (!copilotEvent) return CURSOR_HOOK_SKIP;
|
|
124962
|
+
return CURSOR_HOOK_SKIP + 'if [ -n "$COPILOT_PROJECT_DIR" ] && node -e ' + shellQuoteValue(PROJECT_COPILOT_COPY_CHECK) + ` "$COPILOT_PROJECT_DIR/.github/hooks" ${copilotCopyKey(copilotEvent, copilotMatcher, command)} 2>/dev/null; then exit 0; fi; `;
|
|
124963
|
+
}
|
|
124964
|
+
if (!copilotEvent) return POWERSHELL_CURSOR_HOOK_SKIP;
|
|
124965
|
+
return POWERSHELL_CURSOR_HOOK_SKIP + "if ($env:COPILOT_PROJECT_DIR) { " + powershellProjectCopilotCopyCheck(copilotEvent, copilotMatcher, command) + "}; ";
|
|
124878
124966
|
}
|
|
124879
124967
|
function homeDir(env3) {
|
|
124880
124968
|
const home = env3.HOME?.trim() || env3.USERPROFILE?.trim();
|
|
@@ -124921,11 +125009,12 @@ function claudeHookRunsInAnotherHost(tool, env3 = process.env, includeGlobalCopi
|
|
|
124921
125009
|
if (env3.COPILOT_PROJECT_DIR && copilotCopyInstalled(env3, includeGlobalCopilot)) return true;
|
|
124922
125010
|
return false;
|
|
124923
125011
|
}
|
|
124924
|
-
var CURSOR_MARKER, COPILOT_MARKER, COPILOT_RUNS_ENTRIES_SOURCE, PROJECT_COPILOT_COPY_CHECK, CURSOR_HOOK_SKIP, LEGACY_CLAUDE_HOOK_OTHER_HOST_SKIP;
|
|
125012
|
+
var CURSOR_MARKER, COPILOT_MARKER, COPILOT_RUNS_ENTRIES_SOURCE, PROJECT_COPILOT_COPY_CHECK, POWERSHELL_CURSOR_HOOK_SKIP, CURSOR_HOOK_SKIP, LEGACY_POSIX_CLAUDE_HOOK_OTHER_HOST_SKIP, LEGACY_CLAUDE_HOOK_OTHER_HOST_SKIP;
|
|
124925
125013
|
var init_claude_hook_host = __esm({
|
|
124926
125014
|
"src/claude-hook-host.ts"() {
|
|
124927
125015
|
"use strict";
|
|
124928
125016
|
init_shell_profile();
|
|
125017
|
+
init_bundled_runtime();
|
|
124929
125018
|
CURSOR_MARKER = "--tool cursor";
|
|
124930
125019
|
COPILOT_MARKER = "--tool copilot";
|
|
124931
125020
|
COPILOT_RUNS_ENTRIES_SOURCE = [
|
|
@@ -124946,8 +125035,10 @@ var init_claude_hook_host = __esm({
|
|
|
124946
125035
|
".some(([event, matcher, command]) => key(event, matcher, command) === process.argv[2]);",
|
|
124947
125036
|
"} catch { return false; } }) ? 0 : 1); } catch { process.exit(1); }"
|
|
124948
125037
|
].join(" ");
|
|
125038
|
+
POWERSHELL_CURSOR_HOOK_SKIP = 'if ($env:CURSOR_VERSION) { $teamaiHome = if ($env:HOME) { $env:HOME } else { $env:USERPROFILE }; $files = @(); if ($teamaiHome) { $files += Join-Path (Join-Path $teamaiHome ".cursor") "hooks.json" }; if ($env:CURSOR_PROJECT_DIR) { $files += Join-Path (Join-Path $env:CURSOR_PROJECT_DIR ".cursor") "hooks.json" }; foreach ($file in $files) { if (Select-String -LiteralPath $file -SimpleMatch "--tool cursor" -Quiet -ErrorAction SilentlyContinue) { exit 0 } } }; ';
|
|
124949
125039
|
CURSOR_HOOK_SKIP = `if [ -n "$CURSOR_VERSION" ] && { home="\${HOME:-$USERPROFILE}"; [ -n "$home" ] && { grep -q -- '--tool cursor' "$home/.cursor/hooks.json" 2>/dev/null || { [ -n "$CURSOR_PROJECT_DIR" ] && grep -q -- '--tool cursor' "$CURSOR_PROJECT_DIR/.cursor/hooks.json" 2>/dev/null; }; }; }; then exit 0; fi; `;
|
|
124950
|
-
|
|
125040
|
+
LEGACY_POSIX_CLAUDE_HOOK_OTHER_HOST_SKIP = CURSOR_HOOK_SKIP + `if [ -n "$COPILOT_PROJECT_DIR" ] && grep -q -- '--tool copilot' "$COPILOT_PROJECT_DIR/.github/hooks/teamai.json" 2>/dev/null; then exit 0; fi; `;
|
|
125041
|
+
LEGACY_CLAUDE_HOOK_OTHER_HOST_SKIP = LEGACY_POSIX_CLAUDE_HOOK_OTHER_HOST_SKIP;
|
|
124951
125042
|
}
|
|
124952
125043
|
});
|
|
124953
125044
|
|
|
@@ -125831,6 +125922,23 @@ async function migrateLegacyManagedHooks(localConfig2) {
|
|
|
125831
125922
|
function shellQuote2(value) {
|
|
125832
125923
|
return `'${value.replace(/'/g, `'"'"'`)}'`;
|
|
125833
125924
|
}
|
|
125925
|
+
function powershellQuote(value) {
|
|
125926
|
+
return `'${value.replace(/'/g, "''")}'`;
|
|
125927
|
+
}
|
|
125928
|
+
function powershellPathPrefix(root) {
|
|
125929
|
+
return /[\\/]$/.test(root) ? root : `${root}\\`;
|
|
125930
|
+
}
|
|
125931
|
+
function powershellPathCondition(root) {
|
|
125932
|
+
const quoted2 = powershellQuote(root);
|
|
125933
|
+
const prefix = powershellQuote(powershellPathPrefix(root));
|
|
125934
|
+
return `($teamaiPwd.Equals(${quoted2}, [StringComparison]::OrdinalIgnoreCase) -or $teamaiPwd.StartsWith(${prefix}, [StringComparison]::OrdinalIgnoreCase))`;
|
|
125935
|
+
}
|
|
125936
|
+
function powershellProjectGate(command, projectRoot, childRoots) {
|
|
125937
|
+
const rootCondition = powershellPathCondition(projectRoot);
|
|
125938
|
+
const childCondition = childRoots.map((child) => powershellPathCondition(canonicalProjectRoot(child))).map((condition) => `-not (${condition})`).join(" -and ");
|
|
125939
|
+
const run3 = childCondition ? `if (${childCondition}) { ${command} }` : command;
|
|
125940
|
+
return `$teamaiPwd = $PWD.Path; if (${rootCondition}) { ${run3} }`;
|
|
125941
|
+
}
|
|
125834
125942
|
function canonicalProjectRoot(projectRoot) {
|
|
125835
125943
|
try {
|
|
125836
125944
|
return realpathSync6.native(projectRoot);
|
|
@@ -125850,9 +125958,10 @@ function cmdProjectGate(root) {
|
|
|
125850
125958
|
const literal = cmdLiteral(root.replace(/[\\/]+$/, ""));
|
|
125851
125959
|
return `cd| findstr /i /b /l /c:${literal}\\\\ >nul || cd| findstr /i /e /l /c:${literal} >nul`;
|
|
125852
125960
|
}
|
|
125853
|
-
function gateTeamHookCommand(command, projectRoot, childRoots = []) {
|
|
125961
|
+
function gateTeamHookCommand(command, projectRoot, childRoots = [], shell) {
|
|
125854
125962
|
if (!projectRoot) return command;
|
|
125855
125963
|
const root = canonicalProjectRoot(projectRoot);
|
|
125964
|
+
if (shell === "powershell") return powershellProjectGate(command, root, childRoots);
|
|
125856
125965
|
const msys = msysProjectRoot(root);
|
|
125857
125966
|
const quoted2 = shellQuote2(root);
|
|
125858
125967
|
const childPatterns = childRoots.flatMap((child) => {
|
|
@@ -125870,6 +125979,20 @@ function gateTeamHookCommand(command, projectRoot, childRoots = []) {
|
|
|
125870
125979
|
function regateTeamHookCommand(command, projectRoot, childRoots) {
|
|
125871
125980
|
const codebuddy = regateCodebuddyTeamHookCommand(command, projectRoot, childRoots);
|
|
125872
125981
|
if (codebuddy !== null) return codebuddy;
|
|
125982
|
+
const powershellPrefix = "$teamaiPwd = $PWD.Path; if (";
|
|
125983
|
+
const powershellSuffix = " }";
|
|
125984
|
+
if (command.startsWith(powershellPrefix) && command.endsWith(powershellSuffix)) {
|
|
125985
|
+
const bodyStart = command.indexOf(") { ", powershellPrefix.length);
|
|
125986
|
+
if (bodyStart >= 0) {
|
|
125987
|
+
let payload2 = command.slice(bodyStart + 4, -powershellSuffix.length);
|
|
125988
|
+
const childPrefix = "if (-not (";
|
|
125989
|
+
if (payload2.startsWith(childPrefix)) {
|
|
125990
|
+
const childBody = payload2.indexOf(") { ");
|
|
125991
|
+
if (childBody >= 0 && payload2.endsWith(" }")) payload2 = payload2.slice(childBody + 4, -2);
|
|
125992
|
+
}
|
|
125993
|
+
return gateTeamHookCommand(payload2, projectRoot, childRoots, "powershell");
|
|
125994
|
+
}
|
|
125995
|
+
}
|
|
125873
125996
|
const [head, tail] = gateTeamHookCommand("\0", projectRoot).split("(\0)");
|
|
125874
125997
|
if (!command.startsWith(head) || !command.endsWith(tail)) return null;
|
|
125875
125998
|
const run3 = command.slice(head.length, command.length - tail.length);
|
|
@@ -125921,10 +126044,11 @@ function heldEntryCheck(tool, held, found, byMarker) {
|
|
|
125921
126044
|
}
|
|
125922
126045
|
function isGatedForProject(command, projectRoot) {
|
|
125923
126046
|
const root = canonicalProjectRoot(projectRoot);
|
|
125924
|
-
|
|
126047
|
+
const powershellPrefix = powershellProjectGate("\0", root, []).split("\0")[0];
|
|
126048
|
+
return isCodebuddyTeamGateForProject(command, root) || command.startsWith(powershellPrefix) || command.startsWith(`if [ "$PWD" = ${shellQuote2(root)} ]`) || command.startsWith(cmdProjectGate(root));
|
|
125925
126049
|
}
|
|
125926
126050
|
function isProjectGatedCommand(command) {
|
|
125927
|
-
return parseCodebuddyTeamGate(command) !== null || command.startsWith('if [ "$PWD" = ') || command.startsWith("cd| findstr ");
|
|
126051
|
+
return parseCodebuddyTeamGate(command) !== null || command.startsWith("$teamaiPwd = $PWD.Path; if (") || command.startsWith('if [ "$PWD" = ') || command.startsWith("cd| findstr ");
|
|
125928
126052
|
}
|
|
125929
126053
|
function skipWhenAnotherHostLoadsClaudeSettings(def, tool, legacyGuard = false) {
|
|
125930
126054
|
if (tool !== "claude") return def.command;
|
|
@@ -126261,7 +126385,8 @@ async function staleCheckoutGateRoots(manifestPath2, tool, current2, mainCheckou
|
|
|
126261
126385
|
function scopedTeamDefs(teamDefs, projectRoot, tool, legacyGuard = false, childRoots = [], codebuddyDualRunner = false) {
|
|
126262
126386
|
const prepared = teamDefs.map((def) => ({
|
|
126263
126387
|
...def,
|
|
126264
|
-
command: skipWhenAnotherHostLoadsClaudeSettings(def, tool, legacyGuard)
|
|
126388
|
+
command: skipWhenAnotherHostLoadsClaudeSettings(def, tool, legacyGuard),
|
|
126389
|
+
...tool === "claude" && def.source === "team" && process.platform === "win32" && !legacyGuard && claudeHookUsesPowerShell() ? { shell: "powershell" } : {}
|
|
126265
126390
|
}));
|
|
126266
126391
|
if (!projectRoot) return prepared;
|
|
126267
126392
|
if (tool === "codebuddy" && process.platform === "win32" && codebuddyDualRunner) {
|
|
@@ -126277,7 +126402,7 @@ function scopedTeamDefs(teamDefs, projectRoot, tool, legacyGuard = false, childR
|
|
|
126277
126402
|
)
|
|
126278
126403
|
}));
|
|
126279
126404
|
}
|
|
126280
|
-
return prepared.map((def) => ({ ...def, command: gateTeamHookCommand(def.command, projectRoot, childRoots) }));
|
|
126405
|
+
return prepared.map((def) => ({ ...def, command: gateTeamHookCommand(def.command, projectRoot, childRoots, def.shell) }));
|
|
126281
126406
|
}
|
|
126282
126407
|
function manifestRecordsForTool(teamDefs, tool, removeAll, projectRoot, childRoots = [], codebuddyDualRunner = false) {
|
|
126283
126408
|
if (removeAll) return [];
|
|
@@ -126295,6 +126420,7 @@ function toClaudeEntry(def) {
|
|
|
126295
126420
|
{
|
|
126296
126421
|
type: "command",
|
|
126297
126422
|
command: def.command,
|
|
126423
|
+
...def.shell ? { shell: def.shell } : {},
|
|
126298
126424
|
...def.timeout !== void 0 ? { timeout: def.timeout } : {}
|
|
126299
126425
|
}
|
|
126300
126426
|
],
|
|
@@ -133773,11 +133899,11 @@ function parseLease(raw) {
|
|
|
133773
133899
|
const bare = LeaseWireSchema.safeParse({ ...raw, workspace: void 0 });
|
|
133774
133900
|
return bare.success ? { ...bare.data, unreadableWorkspace: true } : void 0;
|
|
133775
133901
|
}
|
|
133776
|
-
async function stageLease(lease2, { config, lock, root,
|
|
133902
|
+
async function stageLease(lease2, { config, lock, root, env: env3, mode, signal }) {
|
|
133777
133903
|
if (lease2.unreadableWorkspace) return unreadablePlace(lock.run);
|
|
133778
133904
|
await stopRecordedGroup(attemptDir(config, lock.run, lease2.attempt));
|
|
133779
133905
|
if (lease2.envScope) {
|
|
133780
|
-
const scoped = await stepEnvironment(
|
|
133906
|
+
const scoped = await stepEnvironment(env3, lease2.envScope);
|
|
133781
133907
|
if (!scoped.ok) return scoped.failure;
|
|
133782
133908
|
lease2.processEnv = scoped.env;
|
|
133783
133909
|
}
|
|
@@ -133785,7 +133911,7 @@ async function stageLease(lease2, { config, lock, root, values, mode, signal })
|
|
|
133785
133911
|
if (prepared.kind !== "prepared") return prepared.failure;
|
|
133786
133912
|
lease2.cwd = prepared.dir;
|
|
133787
133913
|
if (prepared.prompt !== void 0) lease2.prompt = prepared.prompt;
|
|
133788
|
-
return runPlaceSetup({ config, run: lock.run, attempt: lease2.attempt, mode,
|
|
133914
|
+
return runPlaceSetup({ config, run: lock.run, attempt: lease2.attempt, mode, env: env3, ...signal ? { signal } : {} });
|
|
133789
133915
|
}
|
|
133790
133916
|
async function resumeSession(archive, lease2, tool, cwd) {
|
|
133791
133917
|
const to = AgentSession.platformForTool(tool);
|
|
@@ -134081,7 +134207,7 @@ async function driveRun(config, lock, cwd, options2) {
|
|
|
134081
134207
|
if (forwarded) handle(STOP_SIGNALS);
|
|
134082
134208
|
inFlight2.set(lease2.attempt, { lease: lease2, command: stageThenStart(
|
|
134083
134209
|
lease2,
|
|
134084
|
-
(signal) => stageLease(lease2, { config, lock, root,
|
|
134210
|
+
(signal) => stageLease(lease2, { config, lock, root, env: turn, mode, signal }),
|
|
134085
134211
|
() => {
|
|
134086
134212
|
if (forwarded) handle(forwarded);
|
|
134087
134213
|
return startGroupedCommand({
|
|
@@ -134108,7 +134234,7 @@ async function driveRun(config, lock, cwd, options2) {
|
|
|
134108
134234
|
const controller = new AbortController();
|
|
134109
134235
|
if (maxParallel === 1) handle(STOP_SIGNALS);
|
|
134110
134236
|
prompt = { lease: lease2, controller, exit: (async () => {
|
|
134111
|
-
const failure3 = await stageLease(lease2, { config, lock, root,
|
|
134237
|
+
const failure3 = await stageLease(lease2, { config, lock, root, env: turn, mode, signal: controller.signal });
|
|
134112
134238
|
if (!startable(lease2, controller.signal)) {
|
|
134113
134239
|
await abandonPlace({ config, lock, attempt: lease2.attempt });
|
|
134114
134240
|
return void 0;
|
|
@@ -148275,14 +148401,17 @@ async function readFileSafe2(filePath) {
|
|
|
148275
148401
|
return "";
|
|
148276
148402
|
}
|
|
148277
148403
|
}
|
|
148404
|
+
function symlinkRefusal(linkPath) {
|
|
148405
|
+
return new Error(`Cannot deep-enrich through a symbolic link: ${linkPath}. Replace it with a regular file or directory before retrying.`);
|
|
148406
|
+
}
|
|
148278
148407
|
async function assertSafeOutputDir(dir) {
|
|
148279
148408
|
try {
|
|
148280
148409
|
if ((await lstat5(dir)).isSymbolicLink()) {
|
|
148281
|
-
throw
|
|
148410
|
+
throw symlinkRefusal(dir);
|
|
148282
148411
|
}
|
|
148283
148412
|
for (const entry of await readdir6(dir, { withFileTypes: true })) {
|
|
148284
148413
|
if (entry.isSymbolicLink()) {
|
|
148285
|
-
throw
|
|
148414
|
+
throw symlinkRefusal(path237.join(dir, entry.name));
|
|
148286
148415
|
}
|
|
148287
148416
|
}
|
|
148288
148417
|
} catch (error2) {
|
|
@@ -148294,7 +148423,7 @@ async function assertSafeEvidencePath(wikiRoot, evidenceDir2) {
|
|
|
148294
148423
|
const root = path237.resolve(wikiRoot);
|
|
148295
148424
|
for (let dir = path237.resolve(evidenceDir2); ; dir = path237.dirname(dir)) {
|
|
148296
148425
|
if ((await lstat5(dir)).isSymbolicLink()) {
|
|
148297
|
-
throw
|
|
148426
|
+
throw symlinkRefusal(dir);
|
|
148298
148427
|
}
|
|
148299
148428
|
if (dir === root) break;
|
|
148300
148429
|
}
|
|
@@ -149207,6 +149336,7 @@ var init_rebuild_wiki_index = __esm({
|
|
|
149207
149336
|
// src/import-codebase.ts
|
|
149208
149337
|
var import_codebase_exports = {};
|
|
149209
149338
|
__export(import_codebase_exports, {
|
|
149339
|
+
failIncompleteDeepEnrich: () => failIncompleteDeepEnrich,
|
|
149210
149340
|
importCodebase: () => importCodebase,
|
|
149211
149341
|
importLocalCheckout: () => importLocalCheckout,
|
|
149212
149342
|
localCheckoutSlug: () => localCheckoutSlug,
|
|
@@ -149514,16 +149644,26 @@ async function reconcileAndDeepEnrich(params) {
|
|
|
149514
149644
|
log.debug(`reconcile skipped: ${err.message}`);
|
|
149515
149645
|
}
|
|
149516
149646
|
const evidenceDir2 = path239.join(wikiRoot, "evidence", "code", slug);
|
|
149517
|
-
if (skipEnrich || !await import_fs_extra19.default.pathExists(path239.join(evidenceDir2, "_manifest.json"))) return;
|
|
149647
|
+
if (skipEnrich || !await import_fs_extra19.default.pathExists(path239.join(evidenceDir2, "_manifest.json"))) return true;
|
|
149518
149648
|
try {
|
|
149519
149649
|
const { deepEnrich: deepEnrich2 } = await Promise.resolve().then(() => (init_deep_enrich(), deep_enrich_exports));
|
|
149520
|
-
await deepEnrich2({ project: slug, evidenceDir: evidenceDir2, wikiRoot, cacheDir: sourceDir });
|
|
149521
|
-
log.info(`Deep enrich complete: ${slug}`);
|
|
149650
|
+
const result = await deepEnrich2({ project: slug, evidenceDir: evidenceDir2, wikiRoot, cacheDir: sourceDir });
|
|
149651
|
+
if (result.complete) log.info(`Deep enrich complete: ${slug}`);
|
|
149652
|
+
return result.complete;
|
|
149522
149653
|
} catch (err) {
|
|
149523
149654
|
if (isOverrideInvalid(err)) throw err;
|
|
149524
|
-
log.
|
|
149655
|
+
log.warn(`Deep enrich failed for ${slug}: ${err instanceof Error ? err.message : String(err)}`);
|
|
149656
|
+
return false;
|
|
149525
149657
|
}
|
|
149526
149658
|
}
|
|
149659
|
+
function failIncompleteDeepEnrich({ slug, output, importArgs }) {
|
|
149660
|
+
const retry = output ? `teamai codebase --deep-enrich --project ${slug} --output ${shellArg(output)}` : `teamai import ${importArgs.map(shellArg).join(" ")}`;
|
|
149661
|
+
log.warn(`Deep enrich incomplete: ${slug}. Run \`${retry}\` to retry.`);
|
|
149662
|
+
process.exitCode = 1;
|
|
149663
|
+
}
|
|
149664
|
+
function shellArg(value) {
|
|
149665
|
+
return /^[\w@%+=:,./-]+$/.test(value) ? value : shellQuoteValue(value);
|
|
149666
|
+
}
|
|
149527
149667
|
async function refreshTeamwikiIndexes(wikiRoot) {
|
|
149528
149668
|
try {
|
|
149529
149669
|
const { aggregateGlobalGraph: aggregateGlobalGraph2 } = await Promise.resolve().then(() => (init_graph_aggregate(), graph_aggregate_exports));
|
|
@@ -149555,17 +149695,17 @@ async function importLocalCheckout(opts) {
|
|
|
149555
149695
|
const updated = await importCodebase(opts);
|
|
149556
149696
|
if (!updated) {
|
|
149557
149697
|
log.info(`${opts.slug}: no source changes since the last import, teamwiki unchanged`);
|
|
149558
|
-
return false;
|
|
149698
|
+
return { updated: false };
|
|
149559
149699
|
}
|
|
149560
149700
|
log.info(`teamwiki/ knowledge graph updated: ${opts.slug}`);
|
|
149561
|
-
await reconcileAndDeepEnrich({
|
|
149701
|
+
const deepEnrichComplete = await reconcileAndDeepEnrich({
|
|
149562
149702
|
slug: opts.slug,
|
|
149563
149703
|
wikiRoot: opts.wikiRoot,
|
|
149564
149704
|
sourceDir: opts.sourceDir,
|
|
149565
149705
|
skipEnrich: opts.skipEnrich ?? false
|
|
149566
149706
|
});
|
|
149567
149707
|
await refreshTeamwikiIndexes(opts.wikiRoot);
|
|
149568
|
-
return true;
|
|
149708
|
+
return { updated: true, deepEnrichComplete };
|
|
149569
149709
|
}
|
|
149570
149710
|
var import_fs_extra19, INCREMENTAL_CACHES, CodebaseManifestSchema, PROVIDER_SLUG_PREFIXES, CodebaseSourceSchema;
|
|
149571
149711
|
var init_import_codebase = __esm({
|
|
@@ -149577,6 +149717,7 @@ var init_import_codebase = __esm({
|
|
|
149577
149717
|
init_logger();
|
|
149578
149718
|
init_git2();
|
|
149579
149719
|
init_path_safety();
|
|
149720
|
+
init_shell_profile();
|
|
149580
149721
|
init_call();
|
|
149581
149722
|
INCREMENTAL_CACHES = ["facts-cache.json", "interfaces-cache.json"];
|
|
149582
149723
|
CodebaseManifestSchema = external_exports.object({
|
|
@@ -150311,7 +150452,7 @@ async function importFromRepo(opts) {
|
|
|
150311
150452
|
const skips = previewIncremental && await publishedHead() === head;
|
|
150312
150453
|
const cache = !cacheExists ? `not cached yet, a real run would clone it into ${cacheDir3}` : lastSync?.sha === head ? `cache is current at ${head.slice(0, 8)}${skips ? ", so an incremental run would skip it" : ""}` : `cache would be refreshed from ${lastSync ? lastSync.sha.slice(0, 8) : "an unrecorded commit"} to ${head.slice(0, 8)}`;
|
|
150313
150454
|
log.info(`[dry-run] Would import ${owner}/${repoName2} at ${head.slice(0, 8)} into ${evidenceDest ?? path242.join("teamwiki", "evidence", "code", slug)}; ${cache}`);
|
|
150314
|
-
return;
|
|
150455
|
+
return true;
|
|
150315
150456
|
}
|
|
150316
150457
|
if (!target || !evidenceDest) throw new Error("unreachable: the teamwiki resolves outside a dry run");
|
|
150317
150458
|
const { wikiRoot: teamwikiRoot, team } = target;
|
|
@@ -150367,7 +150508,7 @@ async function importFromRepo(opts) {
|
|
|
150367
150508
|
} catch {
|
|
150368
150509
|
}
|
|
150369
150510
|
log.info(source_default.green(`\u2713 repo ${owner}/${repoName2} unchanged, skipped`));
|
|
150370
|
-
return;
|
|
150511
|
+
return true;
|
|
150371
150512
|
}
|
|
150372
150513
|
log.info(`Scanning repository...`);
|
|
150373
150514
|
let codebaseMd;
|
|
@@ -150437,8 +150578,9 @@ ${aiNarrative}`;
|
|
|
150437
150578
|
} catch (err) {
|
|
150438
150579
|
throw new Error(`Knowledge extraction failed: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
150439
150580
|
}
|
|
150581
|
+
let deepEnrichComplete = true;
|
|
150440
150582
|
if (updated) {
|
|
150441
|
-
await reconcileAndDeepEnrich({ slug, wikiRoot: teamwikiRoot, sourceDir: cacheDir3, skipEnrich });
|
|
150583
|
+
deepEnrichComplete = await reconcileAndDeepEnrich({ slug, wikiRoot: teamwikiRoot, sourceDir: cacheDir3, skipEnrich });
|
|
150442
150584
|
if (!skipAutoPush) {
|
|
150443
150585
|
await refreshTeamwikiIndexes(teamwikiRoot);
|
|
150444
150586
|
if (team) await publishTeamwikiViaMR(team, `[teamai] Import codebase knowledge from ${owner}/${repoName2}`);
|
|
@@ -150451,6 +150593,7 @@ ${aiNarrative}`;
|
|
|
150451
150593
|
} catch (touchErr) {
|
|
150452
150594
|
log.debug(`[cache-index] touchCacheEntry failed: ${String(touchErr)}`);
|
|
150453
150595
|
}
|
|
150596
|
+
return deepEnrichComplete;
|
|
150454
150597
|
} finally {
|
|
150455
150598
|
await releaseImportLock();
|
|
150456
150599
|
}
|
|
@@ -151312,11 +151455,14 @@ var init_codebase_freshness = __esm({
|
|
|
151312
151455
|
// src/recall.ts
|
|
151313
151456
|
var recall_exports = {};
|
|
151314
151457
|
__export(recall_exports, {
|
|
151458
|
+
LEARNINGS_ABSOLUTE_FLOOR: () => LEARNINGS_ABSOLUTE_FLOOR,
|
|
151459
|
+
LEARNINGS_RELEVANCE_RATIO: () => LEARNINGS_RELEVANCE_RATIO,
|
|
151315
151460
|
autoUpvote: () => autoUpvote,
|
|
151316
151461
|
computeIdfBaseline: () => computeIdfBaseline,
|
|
151317
151462
|
formatResults: () => formatResults,
|
|
151318
151463
|
isRelevantScore: () => isRelevantScore,
|
|
151319
151464
|
normalizeLearningsScoreForRanking: () => normalizeLearningsScoreForRanking,
|
|
151465
|
+
rankingScoreOf: () => rankingScoreOf,
|
|
151320
151466
|
recall: () => recall
|
|
151321
151467
|
});
|
|
151322
151468
|
import { randomUUID as randomUUID16 } from "crypto";
|
|
@@ -151352,6 +151498,9 @@ function normalizeLearningsScoreForRanking(score2, idfBaseline) {
|
|
|
151352
151498
|
const threshold = Math.max(baseline * LEARNINGS_RELEVANCE_RATIO, LEARNINGS_ABSOLUTE_FLOOR);
|
|
151353
151499
|
return Math.min(10, Math.max(0, 4 + 2 * Math.log2(score2 / threshold)));
|
|
151354
151500
|
}
|
|
151501
|
+
function rankingScoreOf(result, idfBaseline) {
|
|
151502
|
+
return result.fromCodebase ? result.score * CODE_HIT_RANKING_PENALTY : normalizeLearningsScoreForRanking(result.score, result.idfBaseline ?? idfBaseline);
|
|
151503
|
+
}
|
|
151355
151504
|
function resolveReadablePath(indexedPath, filename, learningsBase) {
|
|
151356
151505
|
if (indexedPath && existsSync10(indexedPath)) return indexedPath;
|
|
151357
151506
|
const underBase = learningsBase ? path246.join(learningsBase, filename) : null;
|
|
@@ -151721,8 +151870,11 @@ async function recall(query, options2) {
|
|
|
151721
151870
|
} catch {
|
|
151722
151871
|
log.warn("recall: code graph retrieval unavailable, run teamai codebase --lint to diagnose");
|
|
151723
151872
|
}
|
|
151724
|
-
const rankingScore = (result) =>
|
|
151873
|
+
const rankingScore = (result) => rankingScoreOf(result, idfBaseline);
|
|
151874
|
+
const relevant = (result) => isRelevantScore(result.score, result.fromCodebase ?? false, result.idfBaseline ?? idfBaseline);
|
|
151725
151875
|
allResults.sort((a, b2) => {
|
|
151876
|
+
const relevanceDelta = Number(relevant(b2)) - Number(relevant(a));
|
|
151877
|
+
if (relevanceDelta !== 0) return relevanceDelta;
|
|
151726
151878
|
const scoreDelta = rankingScore(b2) - rankingScore(a);
|
|
151727
151879
|
if (scoreDelta !== 0) return scoreDelta;
|
|
151728
151880
|
return (b2.entry.date || "").localeCompare(a.entry.date || "");
|
|
@@ -151769,7 +151921,7 @@ async function recall(query, options2) {
|
|
|
151769
151921
|
}
|
|
151770
151922
|
}
|
|
151771
151923
|
}
|
|
151772
|
-
var CODEBASE_RELEVANCE_THRESHOLD, LEARNINGS_RELEVANCE_RATIO, LEARNINGS_ABSOLUTE_FLOOR;
|
|
151924
|
+
var CODEBASE_RELEVANCE_THRESHOLD, CODE_HIT_RANKING_PENALTY, LEARNINGS_RELEVANCE_RATIO, LEARNINGS_ABSOLUTE_FLOOR;
|
|
151773
151925
|
var init_recall = __esm({
|
|
151774
151926
|
"src/recall.ts"() {
|
|
151775
151927
|
"use strict";
|
|
@@ -151785,6 +151937,7 @@ var init_recall = __esm({
|
|
|
151785
151937
|
init_recall_quality();
|
|
151786
151938
|
init_session_id();
|
|
151787
151939
|
CODEBASE_RELEVANCE_THRESHOLD = 4;
|
|
151940
|
+
CODE_HIT_RANKING_PENALTY = 0.8;
|
|
151788
151941
|
LEARNINGS_RELEVANCE_RATIO = 1.35;
|
|
151789
151942
|
LEARNINGS_ABSOLUTE_FLOOR = 4;
|
|
151790
151943
|
}
|
|
@@ -153646,7 +153799,7 @@ async function importFromRepoList(opts) {
|
|
|
153646
153799
|
const isPublic = entry.auth === "public";
|
|
153647
153800
|
const entryForceSsh = entry.auth === "ssh" || forceSsh;
|
|
153648
153801
|
try {
|
|
153649
|
-
await importFromRepo({
|
|
153802
|
+
const deepEnrichComplete = await importFromRepo({
|
|
153650
153803
|
url: entry.url,
|
|
153651
153804
|
forceSsh: entryForceSsh,
|
|
153652
153805
|
forceAnonymous: isPublic,
|
|
@@ -153658,6 +153811,19 @@ async function importFromRepoList(opts) {
|
|
|
153658
153811
|
skipEnrich,
|
|
153659
153812
|
maxFiles
|
|
153660
153813
|
});
|
|
153814
|
+
if (!deepEnrichComplete) {
|
|
153815
|
+
failIncompleteDeepEnrich({
|
|
153816
|
+
slug: repoSlugForUrl(entry.url),
|
|
153817
|
+
output,
|
|
153818
|
+
importArgs: [
|
|
153819
|
+
"--from-repo",
|
|
153820
|
+
entry.url,
|
|
153821
|
+
...entryForceSsh ? ["--ssh"] : [],
|
|
153822
|
+
...entry.domain ? ["--domain", entry.domain] : [],
|
|
153823
|
+
...maxFiles !== void 0 ? ["--max-files", String(maxFiles)] : []
|
|
153824
|
+
]
|
|
153825
|
+
});
|
|
153826
|
+
}
|
|
153661
153827
|
succeeded.push(1);
|
|
153662
153828
|
} catch (err) {
|
|
153663
153829
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -158562,13 +158728,15 @@ async function importCmd(opts) {
|
|
|
158562
158728
|
await tasks.run();
|
|
158563
158729
|
return;
|
|
158564
158730
|
} else if (opts.fromRepo) {
|
|
158731
|
+
const fromRepo = opts.fromRepo;
|
|
158732
|
+
let deepEnrichComplete = true;
|
|
158565
158733
|
const tasks = new Listr2([
|
|
158566
158734
|
{
|
|
158567
158735
|
title: "Import remote repository",
|
|
158568
158736
|
task: async (ctx, task) => {
|
|
158569
|
-
task.output = `Repository: ${
|
|
158570
|
-
await importFromRepo({
|
|
158571
|
-
url:
|
|
158737
|
+
task.output = `Repository: ${fromRepo}`;
|
|
158738
|
+
deepEnrichComplete = await importFromRepo({
|
|
158739
|
+
url: fromRepo,
|
|
158572
158740
|
depth: opts.depth ? parseInt(opts.depth, 10) : 1,
|
|
158573
158741
|
forceSsh: opts.ssh ?? false,
|
|
158574
158742
|
explicitDomain: opts.domain,
|
|
@@ -158586,6 +158754,20 @@ async function importCmd(opts) {
|
|
|
158586
158754
|
exitOnError: true
|
|
158587
158755
|
});
|
|
158588
158756
|
await tasks.run();
|
|
158757
|
+
if (!deepEnrichComplete) {
|
|
158758
|
+
const { failIncompleteDeepEnrich: failIncompleteDeepEnrich2 } = await Promise.resolve().then(() => (init_import_codebase(), import_codebase_exports));
|
|
158759
|
+
failIncompleteDeepEnrich2({
|
|
158760
|
+
slug: repoSlugForUrl(fromRepo),
|
|
158761
|
+
output: opts.output,
|
|
158762
|
+
importArgs: [
|
|
158763
|
+
"--from-repo",
|
|
158764
|
+
fromRepo,
|
|
158765
|
+
...opts.ssh ? ["--ssh"] : [],
|
|
158766
|
+
...opts.domain ? ["--domain", opts.domain] : [],
|
|
158767
|
+
...opts.maxFiles ? ["--max-files", opts.maxFiles] : []
|
|
158768
|
+
]
|
|
158769
|
+
});
|
|
158770
|
+
}
|
|
158589
158771
|
return;
|
|
158590
158772
|
} else if (opts.fromRepoList) {
|
|
158591
158773
|
const tasks = new Listr2([
|
|
@@ -158719,7 +158901,6 @@ async function importCmd(opts) {
|
|
|
158719
158901
|
skip: (ctx) => !ctx.items.some((item) => item.repoUrl) || !!opts.dryRun || !!opts.output,
|
|
158720
158902
|
task: async (ctx, task) => {
|
|
158721
158903
|
const teamwikiRoot = path256.join(localConfig2.repo.localPath, "teamwiki");
|
|
158722
|
-
const { repoSlugForUrl: repoSlugForUrl2 } = await Promise.resolve().then(() => (init_import_repo(), import_repo_exports));
|
|
158723
158904
|
const mrUrlsByRepo = /* @__PURE__ */ new Map();
|
|
158724
158905
|
for (const item of ctx.items) {
|
|
158725
158906
|
if (!item.repoUrl) continue;
|
|
@@ -158728,7 +158909,7 @@ async function importCmd(opts) {
|
|
|
158728
158909
|
const skipped = [];
|
|
158729
158910
|
for (const [repoUrl, sourceMrUrls] of mrUrlsByRepo) {
|
|
158730
158911
|
try {
|
|
158731
|
-
const slug =
|
|
158912
|
+
const slug = repoSlugForUrl(repoUrl);
|
|
158732
158913
|
const evidenceDir2 = path256.join(teamwikiRoot, "evidence", "code", slug);
|
|
158733
158914
|
if (!await import_fs_extra30.default.pathExists(evidenceDir2)) {
|
|
158734
158915
|
skipped.push(`No existing evidence for ${slug}`);
|
|
@@ -158803,7 +158984,12 @@ async function importCmd(opts) {
|
|
|
158803
158984
|
const dirSlug = await defaultProjectSlug2(dirPath);
|
|
158804
158985
|
const checkoutSlug = await checkoutName2(dirPath);
|
|
158805
158986
|
const { lockTeamwiki: lockTeamwiki2, resolveTeamwiki: resolveTeamwiki2 } = await Promise.resolve().then(() => (init_teamwiki_root(), teamwiki_root_exports));
|
|
158806
|
-
const {
|
|
158987
|
+
const {
|
|
158988
|
+
failIncompleteDeepEnrich: failIncompleteDeepEnrich2,
|
|
158989
|
+
importLocalCheckout: importLocalCheckout2,
|
|
158990
|
+
localCheckoutSlug: localCheckoutSlug2,
|
|
158991
|
+
ownLegacySlug: ownLegacySlug2
|
|
158992
|
+
} = await Promise.resolve().then(() => (init_import_codebase(), import_codebase_exports));
|
|
158807
158993
|
if (opts.dryRun) {
|
|
158808
158994
|
const preview = await resolveTeamwiki2({ output: opts.output, dryRun: true }).catch(() => void 0);
|
|
158809
158995
|
const slug = preview ? await localCheckoutSlug2({ sourceDir: dirPath, slug: dirSlug, wikiRoot: preview.wikiRoot }) : dirSlug;
|
|
@@ -158819,7 +159005,7 @@ async function importCmd(opts) {
|
|
|
158819
159005
|
const slug = await localCheckoutSlug2({ sourceDir: dirPath, slug: dirSlug, wikiRoot });
|
|
158820
159006
|
const legacySlug = slug === dirSlug && checkoutSlug !== slug ? await ownLegacySlug2({ sourceDir: dirPath, slug: checkoutSlug, wikiRoot }) : checkoutSlug;
|
|
158821
159007
|
log.info(`Scanning local directory: ${dirPath} (project: ${slug})`);
|
|
158822
|
-
const
|
|
159008
|
+
const imported = await importLocalCheckout2({
|
|
158823
159009
|
sourceDir: dirPath,
|
|
158824
159010
|
slug,
|
|
158825
159011
|
// A suffixed slug is a new codebase; the directory-named evidence is another source's.
|
|
@@ -158834,11 +159020,18 @@ async function importCmd(opts) {
|
|
|
158834
159020
|
}
|
|
158835
159021
|
if (!team) {
|
|
158836
159022
|
log.info(`Output written: ${wikiRoot}`);
|
|
158837
|
-
} else if (updated) {
|
|
159023
|
+
} else if (imported.updated) {
|
|
158838
159024
|
await autoPushTeamRepo(team.localConfig.repo.localPath, `[teamai] Import from local dir: ${slug}`);
|
|
158839
159025
|
log.success(`Pushed to team knowledge repo (${team.localConfig.repo.remote})`);
|
|
158840
159026
|
}
|
|
158841
159027
|
log.success(`Local directory ${slug} import complete`);
|
|
159028
|
+
if (imported.updated && !imported.deepEnrichComplete) {
|
|
159029
|
+
failIncompleteDeepEnrich2({
|
|
159030
|
+
slug,
|
|
159031
|
+
output: opts.output,
|
|
159032
|
+
importArgs: ["--dir", opts.dir, ...opts.maxFiles ? ["--max-files", opts.maxFiles] : []]
|
|
159033
|
+
});
|
|
159034
|
+
}
|
|
158842
159035
|
} finally {
|
|
158843
159036
|
await releaseImportLock();
|
|
158844
159037
|
}
|
|
@@ -158855,10 +159048,10 @@ async function importCmd(opts) {
|
|
|
158855
159048
|
dryRun: opts.dryRun,
|
|
158856
159049
|
outputDir: opts.output
|
|
158857
159050
|
});
|
|
158858
|
-
log.success("Import complete");
|
|
158859
159051
|
if (pushed > 0 && !opts.dryRun && !opts.output) {
|
|
158860
159052
|
await autoPushTeamRepo(localConfig2.repo.localPath, `[teamai] Import from local: claude-rules`);
|
|
158861
159053
|
}
|
|
159054
|
+
log.success("Import complete");
|
|
158862
159055
|
} else {
|
|
158863
159056
|
log.info("Please specify import source: --dir <path>, --from-repo <url>, --from-repo-list <yaml>, --from-org <org>, --from-mr <url>, or --from-iwiki <id>");
|
|
158864
159057
|
return;
|
|
@@ -161545,7 +161738,7 @@ async function importMergedCheckout(teamRepo, repoUrl, mrUrl) {
|
|
|
161545
161738
|
try {
|
|
161546
161739
|
const { repoSlugForUrl: repoSlugForUrl2 } = await Promise.resolve().then(() => (init_import_repo(), import_repo_exports));
|
|
161547
161740
|
const { importLocalCheckout: importLocalCheckout2 } = await Promise.resolve().then(() => (init_import_codebase(), import_codebase_exports));
|
|
161548
|
-
|
|
161741
|
+
const { updated } = await importLocalCheckout2({
|
|
161549
161742
|
sourceDir,
|
|
161550
161743
|
slug: repoSlugForUrl2(repoUrl),
|
|
161551
161744
|
wikiRoot: path262.join(teamRepoDir, "teamwiki"),
|
|
@@ -161553,6 +161746,7 @@ async function importMergedCheckout(teamRepo, repoUrl, mrUrl) {
|
|
|
161553
161746
|
repoUrl,
|
|
161554
161747
|
sourceMrUrl: mrUrl
|
|
161555
161748
|
});
|
|
161749
|
+
return updated;
|
|
161556
161750
|
} catch (err) {
|
|
161557
161751
|
log.warn(`teamwiki update failed (non-blocking): ${err instanceof Error ? err.message : String(err)}`);
|
|
161558
161752
|
return false;
|