@indigoai-us/hq-cli 5.345.208 → 5.345.211
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 +106 -0
- package/assets/scaffold/core/scripts/derive-trigger-facts.sh +22 -3
- package/assets/scaffold/core/scripts/lib/trigger-fact-text.awk +152 -41
- package/dist/command-catalog.generated.d.ts +33 -8
- package/dist/command-catalog.generated.js +40 -8
- package/dist/command-registration-plan.d.ts +2 -2
- package/dist/command-registration-plan.js +1 -1
- package/dist/commands/access.js +11 -5
- package/dist/commands/agents.d.ts +8 -0
- package/dist/commands/agents.js +5 -0
- package/dist/commands/bot.d.ts +8 -0
- package/dist/commands/bot.js +67 -7
- package/dist/commands/channels.js +4 -0
- package/dist/commands/cloud.d.ts +83 -2
- package/dist/commands/cloud.js +161 -31
- package/dist/commands/company.d.ts +9 -0
- package/dist/commands/company.js +44 -14
- package/dist/commands/core-checkpoint-native.js +21 -0
- package/dist/commands/core-derive-trigger-facts-native.d.ts +1 -0
- package/dist/commands/core-derive-trigger-facts-native.js +75 -14
- package/dist/commands/core-generate-workers-registry-fast.d.ts +1 -1
- package/dist/commands/core-generate-workers-registry-fast.js +7 -1
- package/dist/commands/core-job-run-native.d.ts +8 -0
- package/dist/commands/core-job-run-native.js +11 -3
- package/dist/commands/core-jobs-native.js +1 -1
- package/dist/commands/core-register-project-native.js +31 -1
- package/dist/commands/core-scan-packages-fast.d.ts +1 -1
- package/dist/commands/core-scan-packages-fast.js +8 -1
- package/dist/commands/core-work-mesh-bind-trusted-native.d.ts +14 -2
- package/dist/commands/core-work-mesh-bind-trusted-native.js +62 -8
- package/dist/commands/core.js +12 -3
- package/dist/commands/dm-attach.d.ts +10 -0
- package/dist/commands/dm-attach.js +33 -5
- package/dist/commands/integrations-connect.d.ts +16 -0
- package/dist/commands/integrations-connect.js +70 -6
- package/dist/commands/lanes-session-start.d.ts +17 -0
- package/dist/commands/lanes-session-start.js +281 -13
- package/dist/commands/lanes-watch.js +11 -3
- package/dist/commands/lanes.d.ts +4 -0
- package/dist/commands/lanes.js +95 -22
- package/dist/commands/library.d.ts +10 -0
- package/dist/commands/library.js +30 -3
- package/dist/commands/meetings.d.ts +42 -0
- package/dist/commands/meetings.js +157 -12
- package/dist/commands/mesh.js +3 -0
- package/dist/commands/monitor.d.ts +6 -0
- package/dist/commands/monitor.js +29 -19
- package/dist/commands/onboard.js +8 -1
- package/dist/commands/sources.js +7 -3
- package/dist/index.js +9 -0
- package/dist/lanes-monitor-check-argv.d.ts +1 -1
- package/dist/lanes-monitor-check-argv.js +2 -2
- package/dist/lanes-session-start-argv.d.ts +4 -1
- package/dist/lanes-session-start-argv.js +5 -2
- package/dist/lib/bot/fleet-daemon.d.ts +101 -0
- package/dist/lib/bot/fleet-daemon.js +227 -0
- package/dist/lib/bot/fleet-local.d.ts +26 -0
- package/dist/lib/bot/fleet-local.js +51 -2
- package/dist/lib/bot/index.d.ts +1 -0
- package/dist/lib/bot/index.js +1 -0
- package/dist/lib/bot/jobs/hot-signal-sync.d.ts +4 -0
- package/dist/lib/bot/jobs/hot-signal-sync.js +8 -1
- package/dist/lib/bot/log.js +3 -1
- package/dist/lib/bot/probe.js +2 -0
- package/dist/lib/bot/run.js +28 -3
- package/dist/lib/bot/runtime-failure.d.ts +4 -2
- package/dist/lib/bot/runtime-failure.js +9 -1
- package/dist/lib/bot/status.d.ts +17 -0
- package/dist/lib/bot/status.js +53 -2
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +5 -5
- package/dist/lib/capacity/collectors/claude-oauth.js +6 -6
- package/dist/lib/core-utils/native-scaffold-help.d.ts +16 -0
- package/dist/lib/core-utils/native-scaffold-help.js +26 -0
- package/dist/lib/core-utils/session-company.d.ts +25 -8
- package/dist/lib/core-utils/session-company.js +59 -17
- package/dist/lib/daemon/catalog.d.ts +34 -1
- package/dist/lib/daemon/catalog.js +42 -3
- package/dist/lib/daemon/run.d.ts +5 -4
- package/dist/lib/daemon/run.js +40 -16
- package/dist/lib/daemon/server.js +26 -7
- package/dist/lib/daemon/supervisor.d.ts +2 -0
- package/dist/lib/daemon/supervisor.js +60 -1
- package/dist/lib/daemon/tools.js +17 -1
- package/dist/lib/db/sqlite-binding.js +2 -1
- package/dist/lib/doctor/checks/bots.d.ts +2 -0
- package/dist/lib/doctor/checks/bots.js +11 -0
- package/dist/lib/doctor/checks/runtime-health.js +3 -2
- package/dist/lib/doctor/checks/work-context.js +5 -2
- package/dist/lib/hook-engine/resolve.d.ts +1 -1
- package/dist/lib/hook-engine/resolve.js +4 -1
- package/dist/lib/hot-channels/adapters/meeting-providers.d.ts +2 -0
- package/dist/lib/hot-channels/adapters/meeting-providers.js +13 -2
- package/dist/lib/lanes/index.d.ts +1 -1
- package/dist/lib/lanes/index.js +1 -1
- package/dist/lib/lanes/monitor.d.ts +14 -0
- package/dist/lib/lanes/monitor.js +51 -10
- package/dist/lib/lanes/outpost-dispatch.d.ts +3 -0
- package/dist/lib/lanes/outpost-dispatch.js +1 -0
- package/dist/lib/lanes/store.d.ts +1 -1
- package/dist/lib/lanes/store.js +2 -1
- package/dist/lib/mesh/client.js +7 -1
- package/dist/lib/mesh/live/backfill-held.d.ts +3 -0
- package/dist/lib/mesh/live/backfill-held.js +167 -7
- package/dist/lib/mesh/live/flush.d.ts +7 -0
- package/dist/lib/mesh/live/flush.js +10 -1
- package/dist/lib/monitor.d.ts +9 -0
- package/dist/lib/monitor.js +33 -7
- package/dist/lib/onboarding/orchestrator.js +269 -132
- package/dist/lib/onboarding/types.d.ts +2 -0
- package/dist/lib/scaffold-cli-floor.js +2 -1
- package/dist/lib/signals/failure-alert.js +3 -1
- package/dist/lib/sync-core/reconcile.js +15 -11
- package/dist/lib/work-context/organize.d.ts +6 -0
- package/dist/lib/work-context/organize.js +28 -0
- package/dist/lib/work-context/paths.d.ts +9 -0
- package/dist/lib/work-context/paths.js +15 -0
- package/dist/lib/work-context/prd-sync.js +2 -1
- package/dist/runners-alias.d.ts +54 -0
- package/dist/runners-alias.js +86 -0
- package/dist/utils/install-tree-torn.js +5 -3
- package/dist/utils/npm-install-flags.d.ts +27 -0
- package/dist/utils/npm-install-flags.js +68 -0
- package/dist/utils/package-use-lease.js +1 -1
- package/dist/utils/qmd-native-binding-error.js +2 -1
- package/dist/utils/self-update.js +2 -1
- package/dist/utils/staged-install.js +2 -1
- package/dist/utils/staged-npm-install.js +2 -1
- package/dist/utils/upload-author.d.ts +2 -1
- package/dist/utils/upload-author.js +9 -5
- package/dist/utils/version-check.js +2 -1
- package/dist/utils/version-gate.js +7 -6
- package/package.json +7 -7
- package/scripts/install-hook-engine.mjs +7 -3
package/dist/commands/lanes.js
CHANGED
|
@@ -111,6 +111,7 @@ import { defaultProbe, validateProfileLaneModel, validateLaneModel, } from "../l
|
|
|
111
111
|
import { readLaneClaudeCredential } from "../lib/lanes/claude-credential.js";
|
|
112
112
|
import { parseCliModel, refuseOutpostSelfTarget, resolveLaneModel, FOREGROUND_ONLY_RULE, STANDING_AUTHORIZATION, selfReviewRule, tempHomeRule, spawnLaneWorker, spawnEnvelopeRepairRequest, laneRunDir, readSpawnManifest, stopLaneProcesses, } from "../lib/lanes/spawn.js";
|
|
113
113
|
import { handOffInstallHere } from "../lib/daemon/handoff.js";
|
|
114
|
+
import { LANES_ALIAS, RUNNERS_COMMAND, shouldWriteLanesAliasDeprecation, writeLanesAliasDeprecation } from "../runners-alias.js";
|
|
114
115
|
export { spawnLaneWorker };
|
|
115
116
|
export function openPullRequestsForProject(hqRoot, metadata) {
|
|
116
117
|
const configured = metadata.repos;
|
|
@@ -251,7 +252,7 @@ const monitorLaneMessageApis = new WeakMap();
|
|
|
251
252
|
/** Build the same lane message handlers used by `hq lanes _monitor-message`, without a CLI process boundary. */
|
|
252
253
|
export function createMonitorLaneMessageApi(hqRoot, cwd, env = process.env) {
|
|
253
254
|
const program = new Command();
|
|
254
|
-
|
|
255
|
+
registerRunnersCommand(program, {
|
|
255
256
|
hqRoot: () => hqRoot,
|
|
256
257
|
cwd: () => cwd,
|
|
257
258
|
env: { ...env, HQ_ROOT: hqRoot },
|
|
@@ -1612,6 +1613,13 @@ async function loadHostCapacitySnapshots(ctx, hqRoot, config = loadLanesConfig(h
|
|
|
1612
1613
|
}
|
|
1613
1614
|
const outpostLaneListMemo = new WeakMap();
|
|
1614
1615
|
const MAX_OUTPOST_LANE_LIST_BYTES = 480 * 1024;
|
|
1616
|
+
/** Tails `hq lanes logs` retries with when an Outpost's full logs are clipped. */
|
|
1617
|
+
const REMOTE_LOGS_FALLBACK_TAILS = [200, 20];
|
|
1618
|
+
/** Whether an Outpost exec result hit the inline output limit and was clipped. */
|
|
1619
|
+
function outpostExecOutputClipped(result) {
|
|
1620
|
+
return result.truncated === true ||
|
|
1621
|
+
Buffer.byteLength(result.stdout, "utf8") >= MAX_OUTPOST_LANE_LIST_BYTES;
|
|
1622
|
+
}
|
|
1615
1623
|
function normalizedLaneListQuery(query) {
|
|
1616
1624
|
const laneIds = query.laneIds === undefined
|
|
1617
1625
|
? undefined
|
|
@@ -4922,6 +4930,27 @@ async function dispatchCreatedOutpostLane(ctx, input) {
|
|
|
4922
4930
|
if (isLanesError(err) && err.error === "outpost_delivery_unconfirmed" && err.details.outcome_unknown === true) {
|
|
4923
4931
|
throw err;
|
|
4924
4932
|
}
|
|
4933
|
+
// The pickup exec was submitted, but the wait for its result ended (a
|
|
4934
|
+
// timeout or a failed poll). The Outpost may already run the lane, so this
|
|
4935
|
+
// is an unknown outcome, not a failed dispatch. Writing `failed` here made
|
|
4936
|
+
// `hq lanes watch` report a running Outpost lane as terminal while
|
|
4937
|
+
// `hq lanes show` read it running from its owner (feedback_b929c4a8).
|
|
4938
|
+
if (isLanesError(err) &&
|
|
4939
|
+
err.error === DISPATCH_TERMINAL_REASON &&
|
|
4940
|
+
err.details.outcome_unknown === true &&
|
|
4941
|
+
typeof err.details.command_id === "string" &&
|
|
4942
|
+
err.details.command_id.trim() !== "") {
|
|
4943
|
+
const commandId = err.details.command_id.trim();
|
|
4944
|
+
const retained = retainQueuedOutpostAfterUnknownDelivery(hqRoot, lane.lane_id, outpostId, commandId);
|
|
4945
|
+
throw new LanesError("outpost_delivery_unconfirmed", `Outpost ${outpostId} did not confirm pickup for lane ${lane.lane_id} before the wait ended (${err.message}); the queued lane will be reconciled against its owner`, {
|
|
4946
|
+
outpost_id: outpostId,
|
|
4947
|
+
lane_id: lane.lane_id,
|
|
4948
|
+
command_id: commandId,
|
|
4949
|
+
done: false,
|
|
4950
|
+
outcome_unknown: true,
|
|
4951
|
+
state: retained.state,
|
|
4952
|
+
});
|
|
4953
|
+
}
|
|
4925
4954
|
if (isLanesError(err) &&
|
|
4926
4955
|
err.error === DISPATCH_TERMINAL_REASON &&
|
|
4927
4956
|
readLane(hqRoot, lane.lane_id).state === "failed") {
|
|
@@ -8708,26 +8737,49 @@ async function runLogs(ctx, laneId, opts) {
|
|
|
8708
8737
|
})) {
|
|
8709
8738
|
const outpostId = lane.host.id;
|
|
8710
8739
|
const waitMs = outpostSingleLaneWaitMs(ctx.env);
|
|
8740
|
+
// A finished lane's full streams can pass the Outpost exec output limit.
|
|
8741
|
+
// The clipped stdout is not JSON, so without a tail the read fails as
|
|
8742
|
+
// outpost_lane_logs_invalid (feedback_b929c4a8). When the caller set no
|
|
8743
|
+
// --tail, retry with smaller tails: the completion envelope is at the end.
|
|
8744
|
+
const attempts = tail === undefined
|
|
8745
|
+
? [undefined, ...REMOTE_LOGS_FALLBACK_TAILS]
|
|
8746
|
+
: [tail];
|
|
8711
8747
|
let dispatched;
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8748
|
+
let appliedTail;
|
|
8749
|
+
for (const attemptTail of attempts) {
|
|
8750
|
+
let result;
|
|
8751
|
+
try {
|
|
8752
|
+
result = await ctx.dispatchOutpostExec({
|
|
8753
|
+
outpostId,
|
|
8754
|
+
command: buildOutpostLaneCommand({
|
|
8755
|
+
action: "logs",
|
|
8756
|
+
laneId,
|
|
8757
|
+
hqBinary: outpostCliOverride(ctx, outpostId),
|
|
8758
|
+
...(attemptTail === undefined ? {} : { tail: String(attemptTail) }),
|
|
8759
|
+
json: true,
|
|
8760
|
+
}),
|
|
8761
|
+
timeoutSeconds: Math.ceil(waitMs / 1000),
|
|
8762
|
+
waitMs,
|
|
8763
|
+
});
|
|
8764
|
+
}
|
|
8765
|
+
catch (error) {
|
|
8766
|
+
throw new LanesError("outpost_lane_logs_unavailable", `Could not read logs for lane ${laneId} from Outpost ${outpostId}: ${dispatchErrorMessage(error)}`, { lane_id: laneId, outpost_id: outpostId, wait_ms: waitMs, wait_env: OUTPOST_SINGLE_LANE_WAIT_ENV });
|
|
8767
|
+
}
|
|
8768
|
+
if (result.done !== true || result.status !== "Success" || result.exitCode !== 0) {
|
|
8769
|
+
throw new LanesError("outpost_lane_logs_unavailable", `Outpost ${outpostId} did not return logs for lane ${laneId}`, { lane_id: laneId, outpost_id: outpostId, status: result.status, exit_code: result.exitCode });
|
|
8770
|
+
}
|
|
8771
|
+
if (!outpostExecOutputClipped(result)) {
|
|
8772
|
+
dispatched = result;
|
|
8773
|
+
appliedTail = attemptTail;
|
|
8774
|
+
break;
|
|
8775
|
+
}
|
|
8728
8776
|
}
|
|
8729
|
-
if (dispatched
|
|
8730
|
-
throw new LanesError("
|
|
8777
|
+
if (dispatched === undefined) {
|
|
8778
|
+
throw new LanesError("outpost_lane_logs_too_large", `Logs for lane ${laneId} on Outpost ${outpostId} exceed the ${Math.floor(MAX_OUTPOST_LANE_LIST_BYTES / 1024)} KiB Outpost exec output limit; rerun with a smaller --tail`, {
|
|
8779
|
+
lane_id: laneId,
|
|
8780
|
+
outpost_id: outpostId,
|
|
8781
|
+
...(tail === undefined ? { tried_tails: REMOTE_LOGS_FALLBACK_TAILS } : { tail }),
|
|
8782
|
+
});
|
|
8731
8783
|
}
|
|
8732
8784
|
let body;
|
|
8733
8785
|
try {
|
|
@@ -8743,6 +8795,11 @@ async function runLogs(ctx, laneId, opts) {
|
|
|
8743
8795
|
!Array.isArray(body.streams)) {
|
|
8744
8796
|
throw new LanesError("outpost_lane_logs_invalid", `Outpost ${outpostId} returned a malformed logs payload for lane ${laneId}`, { lane_id: laneId, outpost_id: outpostId });
|
|
8745
8797
|
}
|
|
8798
|
+
if (tail === undefined && appliedTail !== undefined) {
|
|
8799
|
+
process.stderr.write(`hq lanes: full logs for lane ${laneId} exceed the Outpost exec output limit; showing the last ${appliedTail} lines of each stream\n`);
|
|
8800
|
+
printJson({ ...body, tail_applied: appliedTail });
|
|
8801
|
+
return;
|
|
8802
|
+
}
|
|
8746
8803
|
printJson(body);
|
|
8747
8804
|
return;
|
|
8748
8805
|
}
|
|
@@ -10297,7 +10354,9 @@ export async function readLaneReapStopEnabled(hqRoot, lane, env) {
|
|
|
10297
10354
|
defaultValue: true,
|
|
10298
10355
|
});
|
|
10299
10356
|
}
|
|
10300
|
-
|
|
10357
|
+
/** Group help: a runner is the detached CLI machinery behind an advanced-mode conduct lane. */
|
|
10358
|
+
export const RUNNERS_GROUP_DESCRIPTION = "Detached CLI machinery that runs a conduct lane in advanced mode";
|
|
10359
|
+
export function registerRunnersCommand(parent, deps = {}) {
|
|
10301
10360
|
const ctx = resolveDeps(deps);
|
|
10302
10361
|
const storyHandlers = createLaneStoryHandlers({
|
|
10303
10362
|
assertLaneRunsHereForOperatorMutation,
|
|
@@ -10495,8 +10554,18 @@ export function registerLanesCommand(parent, deps = {}) {
|
|
|
10495
10554
|
timeoutPath,
|
|
10496
10555
|
});
|
|
10497
10556
|
const lanes = parent
|
|
10498
|
-
.command(
|
|
10499
|
-
.
|
|
10557
|
+
.command(RUNNERS_COMMAND)
|
|
10558
|
+
.alias(LANES_ALIAS)
|
|
10559
|
+
.description(RUNNERS_GROUP_DESCRIPTION);
|
|
10560
|
+
// `hq lanes` is a deprecated alias: name the replacement once on stderr for
|
|
10561
|
+
// a person at a terminal. The parent hook sees the token Commander matched,
|
|
10562
|
+
// so human subcommands, help forms and the lazy route print it, and
|
|
10563
|
+
// `hq runners` prints nothing. Hook-run subcommands, `--json` and output
|
|
10564
|
+
// that is not a terminal stay silent: HQ core's hooks fail on any stderr.
|
|
10565
|
+
parent.hook("preSubcommand", (thisCommand, subCommand) => {
|
|
10566
|
+
if (subCommand === lanes && shouldWriteLanesAliasDeprecation(thisCommand.args))
|
|
10567
|
+
writeLanesAliasDeprecation();
|
|
10568
|
+
});
|
|
10500
10569
|
registerLaneSessionStartCommand(lanes);
|
|
10501
10570
|
registerLanesLinkCommand(lanes);
|
|
10502
10571
|
registerLaneChecksCommand(lanes, {
|
|
@@ -11392,4 +11461,8 @@ export function registerLanesCommand(parent, deps = {}) {
|
|
|
11392
11461
|
attachJsonNoop(lanes);
|
|
11393
11462
|
return lanes;
|
|
11394
11463
|
}
|
|
11464
|
+
/** Compatibility export for in-process callers during the lanes transition. */
|
|
11465
|
+
export function registerLanesCommand(parent, deps = {}) {
|
|
11466
|
+
return registerRunnersCommand(parent, deps);
|
|
11467
|
+
}
|
|
11395
11468
|
//# sourceMappingURL=lanes.js.map
|
|
@@ -5,6 +5,14 @@ import { type CompaniesManifestMap } from "../lib/work-context/repo-remote.js";
|
|
|
5
5
|
import { type LibraryCompany, type LibraryAddResult } from "./library-add.js";
|
|
6
6
|
/** Mirrors hq-pro's MAX_ASSET_SEARCH_TAGS / tag length bound. */
|
|
7
7
|
export declare const MAX_LIBRARY_SEARCH_TAGS = 20;
|
|
8
|
+
/** Mirrors hq-pro's CONTENT_SEARCH_LIMIT_CAP: the largest page /v1/search returns. */
|
|
9
|
+
export declare const MAX_LIBRARY_SEARCH_COUNT = 50;
|
|
10
|
+
/**
|
|
11
|
+
* `-n, --count`: a whole number of 1 or more. The offline index has no cap, so
|
|
12
|
+
* the parser does not apply the cloud's; the cloud request is capped in
|
|
13
|
+
* runLibrarySearch, which says so in the result.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseLibrarySearchCount(value: string): number;
|
|
8
16
|
export interface LibrarySearchOptions {
|
|
9
17
|
tags: string[];
|
|
10
18
|
company?: string;
|
|
@@ -23,6 +31,8 @@ export interface LibrarySearchResult {
|
|
|
23
31
|
source: "cloud" | "local";
|
|
24
32
|
/** Set on a local result: the transport code that forced the fallback. */
|
|
25
33
|
fallbackReason?: string;
|
|
34
|
+
/** Set on a cloud result when --count asked for more than one server page holds. */
|
|
35
|
+
cappedAt?: number;
|
|
26
36
|
results: LibraryAssetHit[];
|
|
27
37
|
}
|
|
28
38
|
export interface LibrarySearchDeps {
|
package/dist/commands/library.js
CHANGED
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
* can be parsed for its asset metadata.
|
|
21
21
|
*
|
|
22
22
|
* Wire contract (hq-pro US-007):
|
|
23
|
-
* body { query: string, kind: "asset", tags?: string[], company?: string }
|
|
23
|
+
* body { query: string, kind: "asset", tags?: string[], company?: string, limit?: number }
|
|
24
|
+
* `limit` is the page size; the server defaults to 10 and caps at 50.
|
|
24
25
|
* 200 { results: [{ title, snippet, metadata: { asset: {
|
|
25
26
|
* placeholderPath, originalPath, title, tags, mediaKind, vaultKey } } }] }
|
|
26
27
|
* 400 { code: "INVALID_SEARCH_FILTER" }
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
import fs from "node:fs";
|
|
29
30
|
import path from "node:path";
|
|
30
31
|
import { Readable } from "node:stream";
|
|
32
|
+
import { InvalidArgumentError } from "commander";
|
|
31
33
|
import chalk from "chalk";
|
|
32
34
|
import { cloudPlaceholderPathFor, isCloudPlaceholderName, parseCloudPlaceholder, } from "@indigoai-us/hq-cloud";
|
|
33
35
|
import { buildSearchArgs } from "./search.js";
|
|
@@ -44,6 +46,20 @@ import { registerLibraryRemoveCommand } from "./library-remove.js";
|
|
|
44
46
|
import { gatedInteractiveLogin } from "../utils/interactive-caller.js";
|
|
45
47
|
/** Mirrors hq-pro's MAX_ASSET_SEARCH_TAGS / tag length bound. */
|
|
46
48
|
export const MAX_LIBRARY_SEARCH_TAGS = 20;
|
|
49
|
+
/** Mirrors hq-pro's CONTENT_SEARCH_LIMIT_CAP: the largest page /v1/search returns. */
|
|
50
|
+
export const MAX_LIBRARY_SEARCH_COUNT = 50;
|
|
51
|
+
/**
|
|
52
|
+
* `-n, --count`: a whole number of 1 or more. The offline index has no cap, so
|
|
53
|
+
* the parser does not apply the cloud's; the cloud request is capped in
|
|
54
|
+
* runLibrarySearch, which says so in the result.
|
|
55
|
+
*/
|
|
56
|
+
export function parseLibrarySearchCount(value) {
|
|
57
|
+
const count = Number(value);
|
|
58
|
+
if (!Number.isInteger(count) || count < 1) {
|
|
59
|
+
throw new InvalidArgumentError("Count must be a whole number of 1 or more.");
|
|
60
|
+
}
|
|
61
|
+
return count;
|
|
62
|
+
}
|
|
47
63
|
const MAX_TAG_LENGTH = 100;
|
|
48
64
|
/** Split repeatable / comma-listed `--tag` values into a validated tag list. */
|
|
49
65
|
export function normalizeTags(values) {
|
|
@@ -106,6 +122,12 @@ export async function runLibrarySearch(query, options, deps) {
|
|
|
106
122
|
body.tags = options.tags;
|
|
107
123
|
if (options.company)
|
|
108
124
|
body.company = options.company;
|
|
125
|
+
// Without `limit` the server returns its default page of 10, so `-n 35`
|
|
126
|
+
// could never show more than 10 results (feedback_903fdd80). The server
|
|
127
|
+
// caps a page at 50; the offline path below keeps the full count.
|
|
128
|
+
const capped = options.count !== undefined && options.count > MAX_LIBRARY_SEARCH_COUNT;
|
|
129
|
+
if (options.count !== undefined)
|
|
130
|
+
body.limit = Math.min(options.count, MAX_LIBRARY_SEARCH_COUNT);
|
|
109
131
|
let res;
|
|
110
132
|
try {
|
|
111
133
|
const token = await deps.getToken();
|
|
@@ -126,7 +148,9 @@ export async function runLibrarySearch(query, options, deps) {
|
|
|
126
148
|
let results = rows.map(hitFromCloudResult).filter((hit) => hit !== null);
|
|
127
149
|
if (options.count !== undefined)
|
|
128
150
|
results = results.slice(0, options.count);
|
|
129
|
-
return
|
|
151
|
+
return capped
|
|
152
|
+
? { source: "cloud", cappedAt: MAX_LIBRARY_SEARCH_COUNT, results }
|
|
153
|
+
: { source: "cloud", results };
|
|
130
154
|
}
|
|
131
155
|
/** A local hit, or null for a placeholder that is not a company library asset. */
|
|
132
156
|
export function hitFromPlaceholder(placeholder, tags, snippet) {
|
|
@@ -266,6 +290,9 @@ export function formatLibraryResult(result) {
|
|
|
266
290
|
if (result.source === "local") {
|
|
267
291
|
lines.push(chalk.yellow(`HQ cloud unreachable (${result.fallbackReason}); showing local index results.`));
|
|
268
292
|
}
|
|
293
|
+
if (result.cappedAt !== undefined) {
|
|
294
|
+
lines.push(chalk.dim(`HQ cloud returns at most ${result.cappedAt} results per search.`));
|
|
295
|
+
}
|
|
269
296
|
if (result.results.length === 0) {
|
|
270
297
|
lines.push("No library assets found.");
|
|
271
298
|
return lines.join("\n");
|
|
@@ -435,7 +462,7 @@ export function registerLibraryCommand(program) {
|
|
|
435
462
|
.argument("[query...]", "Query terms (joined with spaces)")
|
|
436
463
|
.option("--tag <tag>", "Require a tag (repeatable or comma-separated)", collectTag, [])
|
|
437
464
|
.option("--company <slug>", "Restrict to one company")
|
|
438
|
-
.option("-n, --count <count>",
|
|
465
|
+
.option("-n, --count <count>", `Maximum result count (default 10; HQ cloud returns at most ${MAX_LIBRARY_SEARCH_COUNT})`, parseLibrarySearchCount)
|
|
439
466
|
.option("--json", "Print machine-readable JSON")
|
|
440
467
|
.action(async (queryParts = [], options) => {
|
|
441
468
|
try {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
2
|
import { type PricingPlan } from "../lib/billing/usage-only.js";
|
|
3
|
+
export declare function inviteConflictHint(status: number, body: Record<string, unknown>): string | undefined;
|
|
3
4
|
/** Upper bound on list pages one short-id lookup reads (per cursor chain). */
|
|
4
5
|
export declare const SHORT_ID_MAX_PAGES = 50;
|
|
5
6
|
/**
|
|
@@ -20,5 +21,46 @@ export declare function meetingPaymentRequiredLines(body: Record<string, unknown
|
|
|
20
21
|
* Feedback 04771691-fcbc-4847-899a-6c966c561b52.
|
|
21
22
|
*/
|
|
22
23
|
export declare function sessionCompanySlug(env?: NodeJS.ProcessEnv): string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* The company a read (list, get, search, transcript, notes) is scoped to.
|
|
26
|
+
* `--personal` asks for the caller's own recordings that are not attributed to
|
|
27
|
+
* any company: hq-pro returns those only to a call with no `companyId`, which
|
|
28
|
+
* is what the app's Meetings tab adds to its company lists. Without the flag a
|
|
29
|
+
* bound session's company replaced that call, so such a recording was in the
|
|
30
|
+
* app and in no `hq meetings` view (feedback_abaa0a2e).
|
|
31
|
+
*/
|
|
32
|
+
export declare function meetingsReadCompanySlug(opts: {
|
|
33
|
+
company?: string;
|
|
34
|
+
personal?: boolean;
|
|
35
|
+
}, env?: NodeJS.ProcessEnv): string | undefined;
|
|
36
|
+
/** Printed under a company-scoped list or search. */
|
|
37
|
+
export declare const UNATTRIBUTED_MEETINGS_HINT: string;
|
|
38
|
+
/** The subcommands `--personal` applies to. Any other subcommand refuses it. */
|
|
39
|
+
export declare const PERSONAL_READ_SUBCOMMANDS: ReadonlySet<string>;
|
|
40
|
+
/**
|
|
41
|
+
* True for a list or search row that no company owns. A call with no
|
|
42
|
+
* `companyId` reads the caller's personal vault, but hq-pro keeps the rows
|
|
43
|
+
* there that are attributed to the person's default company
|
|
44
|
+
* (`attributed: true`) and adds that company's HQ Meet calls
|
|
45
|
+
* (`sourceShape: "native-call"`). The default company need not be the one the
|
|
46
|
+
* session is bound to, so `--personal` drops those rows.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isUnattributedMeeting(m: {
|
|
49
|
+
attributed?: boolean;
|
|
50
|
+
sourceShape?: string;
|
|
51
|
+
companyId?: string;
|
|
52
|
+
}): boolean;
|
|
53
|
+
/** The same test for a meeting detail (get, transcript, notes). */
|
|
54
|
+
export declare function isUnattributedMeetingDetail(d: {
|
|
55
|
+
sourceShape?: string;
|
|
56
|
+
companyId?: string;
|
|
57
|
+
source?: {
|
|
58
|
+
frontmatter?: {
|
|
59
|
+
company_id?: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
}): boolean;
|
|
63
|
+
/** Refused under `--personal`: the meeting belongs to a company. */
|
|
64
|
+
export declare const ATTRIBUTED_MEETING_UNDER_PERSONAL: string;
|
|
23
65
|
export declare function registerMeetingsCommand(program: Command): void;
|
|
24
66
|
//# sourceMappingURL=meetings.d.ts.map
|
|
@@ -8,6 +8,29 @@ import { isPlanGateError, planGateErrorFromPayload, } from "../utils/plan-gate-e
|
|
|
8
8
|
import { mapWithConcurrency } from "./sync-manifest.js";
|
|
9
9
|
import { fetchAttendedLiveBots } from "../lib/live-meetings.js";
|
|
10
10
|
import { isUsageOnly, pricingPlanFromBody, resolveCompanyPricingPlan, usageOnlyCardRequiredLines, usagePauseFromBody, } from "../lib/billing/usage-only.js";
|
|
11
|
+
/**
|
|
12
|
+
* The remedy line for an invite the server refused because a bot already
|
|
13
|
+
* holds the meeting (`code: "bot-already-scheduled"`, with that bot's id).
|
|
14
|
+
* Before this, the 409 printed only "A bot is already scheduled for this
|
|
15
|
+
* meeting URL" and the CLI had no way to clear the stuck bot, so a bot that
|
|
16
|
+
* never left `scheduled` blocked the meeting for good. Feedback b6d23d19.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Bot states that mean the bot is live in the meeting. A 409 naming one of
|
|
20
|
+
* these gets no cancel hint, so nobody cancels a meeting that is really being
|
|
21
|
+
* joined or recorded.
|
|
22
|
+
*/
|
|
23
|
+
const LIVE_BOT_STATES = new Set(["joining", "recording"]);
|
|
24
|
+
export function inviteConflictHint(status, body) {
|
|
25
|
+
if (status !== 409 || body.code !== "bot-already-scheduled")
|
|
26
|
+
return undefined;
|
|
27
|
+
if (typeof body.botId !== "string" || body.botId.length === 0)
|
|
28
|
+
return undefined;
|
|
29
|
+
if (typeof body.status === "string" && LIVE_BOT_STATES.has(body.status))
|
|
30
|
+
return undefined;
|
|
31
|
+
const state = typeof body.status === "string" ? ` (status: ${body.status})` : "";
|
|
32
|
+
return `Bot ${body.botId}${state} already holds this meeting. If it is stuck, run \`hq meetings cancel ${body.botId}\`, then invite again.`;
|
|
33
|
+
}
|
|
11
34
|
const LIVE_SNAPSHOT_STATUSES = new Set([
|
|
12
35
|
"joining",
|
|
13
36
|
"recording",
|
|
@@ -247,9 +270,10 @@ export const SHORT_ID_MAX_PAGES = 50;
|
|
|
247
270
|
* missed any meeting past it, so follow `nextToken` (and `nativeNextToken`
|
|
248
271
|
* for HQ Meet calls) until the prefix is found or the list ends. A full
|
|
249
272
|
* 8-character prefix stops at the first page with a match; a shorter prefix
|
|
250
|
-
* reads every page so ambiguity is still reported.
|
|
273
|
+
* reads every page so ambiguity is still reported. `accept` limits which rows
|
|
274
|
+
* can match (`--personal` passes `isUnattributedMeeting`).
|
|
251
275
|
*/
|
|
252
|
-
async function resolveShortId(token, prefix, query) {
|
|
276
|
+
async function resolveShortId(token, prefix, query, accept = () => true) {
|
|
253
277
|
if (prefix.includes("-") && prefix.length > 8)
|
|
254
278
|
return prefix;
|
|
255
279
|
const stopOnFirstMatch = prefix.length >= 8;
|
|
@@ -266,7 +290,7 @@ async function resolveShortId(token, prefix, query) {
|
|
|
266
290
|
}
|
|
267
291
|
const data = (await res.json());
|
|
268
292
|
for (const m of data.meetings ?? []) {
|
|
269
|
-
if (typeof m.meetingId === "string" && m.meetingId.startsWith(prefix))
|
|
293
|
+
if (typeof m.meetingId === "string" && m.meetingId.startsWith(prefix) && accept(m))
|
|
270
294
|
matches.set(m.meetingId, m);
|
|
271
295
|
}
|
|
272
296
|
return data;
|
|
@@ -296,7 +320,7 @@ async function resolveShortId(token, prefix, query) {
|
|
|
296
320
|
}
|
|
297
321
|
console.error(chalk.red(capped
|
|
298
322
|
? `No meeting matches ID "${prefix}" in the newest ${SHORT_ID_MAX_PAGES * Number(MEETINGS_PAGE_SIZE)} meetings. Pass the full meeting id (shown by \`hq meetings list --json\`).`
|
|
299
|
-
: `No meeting matches ID "${prefix}". It may still be processing
|
|
323
|
+
: `No meeting matches ID "${prefix}". It may still be processing, attributed to a different company, or not attributed to any company. Pass the full meeting id, or add --company <slug> or --personal.`));
|
|
300
324
|
process.exit(1);
|
|
301
325
|
}
|
|
302
326
|
/**
|
|
@@ -353,6 +377,9 @@ async function handleApiError(res, json = false) {
|
|
|
353
377
|
}
|
|
354
378
|
else {
|
|
355
379
|
console.error(chalk.red(`API error (${res.status}): ${body.error ?? res.statusText}`));
|
|
380
|
+
const hint = inviteConflictHint(res.status, body);
|
|
381
|
+
if (hint)
|
|
382
|
+
console.error(chalk.dim(` ${hint}`));
|
|
356
383
|
}
|
|
357
384
|
process.exit(1);
|
|
358
385
|
}
|
|
@@ -444,12 +471,81 @@ export function sessionCompanySlug(env = process.env) {
|
|
|
444
471
|
const primary = lock?.companies[0];
|
|
445
472
|
return primary && primary !== "personal" ? primary : undefined;
|
|
446
473
|
}
|
|
474
|
+
/**
|
|
475
|
+
* The company a read (list, get, search, transcript, notes) is scoped to.
|
|
476
|
+
* `--personal` asks for the caller's own recordings that are not attributed to
|
|
477
|
+
* any company: hq-pro returns those only to a call with no `companyId`, which
|
|
478
|
+
* is what the app's Meetings tab adds to its company lists. Without the flag a
|
|
479
|
+
* bound session's company replaced that call, so such a recording was in the
|
|
480
|
+
* app and in no `hq meetings` view (feedback_abaa0a2e).
|
|
481
|
+
*/
|
|
482
|
+
export function meetingsReadCompanySlug(opts, env = process.env) {
|
|
483
|
+
if (opts.personal && opts.company) {
|
|
484
|
+
throw new Error("Pass --company <slug> or --personal, not both.");
|
|
485
|
+
}
|
|
486
|
+
if (opts.personal)
|
|
487
|
+
return undefined;
|
|
488
|
+
return opts.company ?? sessionCompanySlug(env);
|
|
489
|
+
}
|
|
490
|
+
/** Printed under a company-scoped list or search. */
|
|
491
|
+
export const UNATTRIBUTED_MEETINGS_HINT = "Recordings not attributed to a company are not listed here. Add --personal to see them " +
|
|
492
|
+
"(for example `hq meetings list --personal`).";
|
|
493
|
+
/** The subcommands `--personal` applies to. Any other subcommand refuses it. */
|
|
494
|
+
export const PERSONAL_READ_SUBCOMMANDS = new Set([
|
|
495
|
+
"list",
|
|
496
|
+
"get",
|
|
497
|
+
"search",
|
|
498
|
+
"transcript",
|
|
499
|
+
"notes",
|
|
500
|
+
]);
|
|
501
|
+
/**
|
|
502
|
+
* True for a list or search row that no company owns. A call with no
|
|
503
|
+
* `companyId` reads the caller's personal vault, but hq-pro keeps the rows
|
|
504
|
+
* there that are attributed to the person's default company
|
|
505
|
+
* (`attributed: true`) and adds that company's HQ Meet calls
|
|
506
|
+
* (`sourceShape: "native-call"`). The default company need not be the one the
|
|
507
|
+
* session is bound to, so `--personal` drops those rows.
|
|
508
|
+
*/
|
|
509
|
+
export function isUnattributedMeeting(m) {
|
|
510
|
+
if (m.attributed === true || m.sourceShape === "native-call")
|
|
511
|
+
return false;
|
|
512
|
+
return !m.companyId || m.companyId === "unknown";
|
|
513
|
+
}
|
|
514
|
+
/** The same test for a meeting detail (get, transcript, notes). */
|
|
515
|
+
export function isUnattributedMeetingDetail(d) {
|
|
516
|
+
if (d.sourceShape === "native-call")
|
|
517
|
+
return false;
|
|
518
|
+
const attributedTo = (value) => !!value && value !== "unknown";
|
|
519
|
+
return !attributedTo(d.companyId) && !attributedTo(d.source?.frontmatter?.company_id);
|
|
520
|
+
}
|
|
521
|
+
/** Refused under `--personal`: the meeting belongs to a company. */
|
|
522
|
+
export const ATTRIBUTED_MEETING_UNDER_PERSONAL = "This meeting is attributed to a company, so --personal does not read it. " +
|
|
523
|
+
"Use --company <slug> for that company instead.";
|
|
447
524
|
export function registerMeetingsCommand(program) {
|
|
448
525
|
const meetings = program
|
|
449
526
|
.command("meetings")
|
|
450
527
|
.description("View and search meeting recordings, transcripts, and notes")
|
|
451
528
|
.option("--company <slug>", "Company slug (defaults to the company this HQ session is bound to)")
|
|
529
|
+
.option("--personal", "Read your recordings that are not attributed to any company (list, get, search, transcript, notes)")
|
|
452
530
|
.option("--json", "Output raw JSON instead of formatted text");
|
|
531
|
+
const personalRead = () => meetings.opts().personal === true;
|
|
532
|
+
// `--personal` is a group option, so every subcommand would accept it.
|
|
533
|
+
// Refuse it where it would be ignored (live, invite, import, set-company).
|
|
534
|
+
meetings.hook("preAction", (_group, action) => {
|
|
535
|
+
if (personalRead() && !PERSONAL_READ_SUBCOMMANDS.has(action.name())) {
|
|
536
|
+
console.error(chalk.red(`--personal applies only to ${[...PERSONAL_READ_SUBCOMMANDS].join(", ")}; it is not an option of \`hq meetings ${action.name()}\`.`));
|
|
537
|
+
process.exit(1);
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
// Under `--personal`, a get, transcript or notes read stops here when the
|
|
541
|
+
// meeting turns out to belong to a company (a full id skips the list filter).
|
|
542
|
+
const refuseAttributedUnderPersonal = (detail) => {
|
|
543
|
+
if (!personalRead() || isUnattributedMeetingDetail(detail))
|
|
544
|
+
return;
|
|
545
|
+
console.error(chalk.red(ATTRIBUTED_MEETING_UNDER_PERSONAL));
|
|
546
|
+
process.exit(1);
|
|
547
|
+
};
|
|
548
|
+
const shortIdFilter = () => personalRead() ? isUnattributedMeeting : () => true;
|
|
453
549
|
// ── hq meetings list ──────────────────────────────────────────────
|
|
454
550
|
meetings
|
|
455
551
|
.command("list")
|
|
@@ -460,7 +556,7 @@ export function registerMeetingsCommand(program) {
|
|
|
460
556
|
try {
|
|
461
557
|
const token = await ensureCognitoToken();
|
|
462
558
|
const query = {};
|
|
463
|
-
const companySlug = meetings.opts()
|
|
559
|
+
const companySlug = meetingsReadCompanySlug(meetings.opts());
|
|
464
560
|
if (opts.limit)
|
|
465
561
|
query.limit = opts.limit;
|
|
466
562
|
if (opts.next)
|
|
@@ -471,12 +567,21 @@ export function registerMeetingsCommand(program) {
|
|
|
471
567
|
if (!res.ok)
|
|
472
568
|
await handleApiError(res, meetings.opts().json);
|
|
473
569
|
const data = (await res.json());
|
|
570
|
+
if (personalRead()) {
|
|
571
|
+
// Company rows and HQ Meet calls are dropped, so the HQ Meet cursor
|
|
572
|
+
// and pending-authorization ids (company calls) go too.
|
|
573
|
+
data.meetings = (data.meetings ?? []).filter(isUnattributedMeeting);
|
|
574
|
+
delete data.nativeNextToken;
|
|
575
|
+
delete data.nativeAuthorizationPending;
|
|
576
|
+
}
|
|
474
577
|
if (meetings.opts().json) {
|
|
475
578
|
console.log(JSON.stringify(data, null, 2));
|
|
476
579
|
return;
|
|
477
580
|
}
|
|
478
581
|
console.log(chalk.bold(`\nMeetings (${data.meetings.length}):\n`));
|
|
479
582
|
printMeetingTable(data.meetings);
|
|
583
|
+
if (companySlug)
|
|
584
|
+
console.log(chalk.dim(`\n ${UNATTRIBUTED_MEETINGS_HINT}`));
|
|
480
585
|
if (data.nextToken) {
|
|
481
586
|
console.log(chalk.dim(`\n More results available. Run with --next ${data.nextToken}`));
|
|
482
587
|
}
|
|
@@ -709,6 +814,39 @@ export function registerMeetingsCommand(program) {
|
|
|
709
814
|
handleMeetingsCommandError(err);
|
|
710
815
|
}
|
|
711
816
|
});
|
|
817
|
+
// ── hq meetings cancel <botId> ────────────────────────────────────
|
|
818
|
+
meetings
|
|
819
|
+
.command("cancel <botId>")
|
|
820
|
+
.description("Cancel a meeting bot (for example one stuck at scheduled) so the meeting can be invited again. " +
|
|
821
|
+
"A bot from a recurring calendar event cancels the series' upcoming bots too.")
|
|
822
|
+
.action(async (botId) => {
|
|
823
|
+
try {
|
|
824
|
+
const token = await ensureCognitoToken();
|
|
825
|
+
// Bots are owned by the caller; the cancel route needs no company.
|
|
826
|
+
const res = await vaultApiFetch({
|
|
827
|
+
token,
|
|
828
|
+
method: "POST",
|
|
829
|
+
path: `/v1/bot/${encodeURIComponent(botId)}/cancel`,
|
|
830
|
+
});
|
|
831
|
+
if (!res.ok)
|
|
832
|
+
await handleApiError(res, meetings.opts().json);
|
|
833
|
+
const data = (await res.json());
|
|
834
|
+
if (meetings.opts().json) {
|
|
835
|
+
console.log(JSON.stringify(data, null, 2));
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
console.log(chalk.green(`\n✓ Meeting bot ${chalk.cyan(data.botId ?? botId)} cancelled.`));
|
|
839
|
+
if (data.scope === "series") {
|
|
840
|
+
console.log(chalk.dim(` Recurring meeting: cancelled ${data.cancelledCount ?? 1} bot(s) in the series` +
|
|
841
|
+
(data.failedCount ? `, ${data.failedCount} could not be cancelled.` : ".")));
|
|
842
|
+
}
|
|
843
|
+
console.log(chalk.dim(" Run `hq meetings invite <meetingUrl>` to send a new bot."));
|
|
844
|
+
console.log();
|
|
845
|
+
}
|
|
846
|
+
catch (err) {
|
|
847
|
+
handleMeetingsCommandError(err);
|
|
848
|
+
}
|
|
849
|
+
});
|
|
712
850
|
// ── hq meetings get <id> ──────────────────────────────────────────
|
|
713
851
|
meetings
|
|
714
852
|
.command("get <meetingId>")
|
|
@@ -717,10 +855,10 @@ export function registerMeetingsCommand(program) {
|
|
|
717
855
|
try {
|
|
718
856
|
const token = await ensureCognitoToken();
|
|
719
857
|
const query = {};
|
|
720
|
-
const companySlug = meetings.opts()
|
|
858
|
+
const companySlug = meetingsReadCompanySlug(meetings.opts());
|
|
721
859
|
if (companySlug)
|
|
722
860
|
query.companyId = await getCompanyUid(token, companySlug);
|
|
723
|
-
const meetingId = await resolveShortId(token, rawId, query);
|
|
861
|
+
const meetingId = await resolveShortId(token, rawId, query, shortIdFilter());
|
|
724
862
|
const res = await vaultApiFetch({
|
|
725
863
|
token,
|
|
726
864
|
path: `/v1/meetings/${encodeURIComponent(meetingId)}`,
|
|
@@ -729,6 +867,7 @@ export function registerMeetingsCommand(program) {
|
|
|
729
867
|
if (!res.ok)
|
|
730
868
|
await handleApiError(res, meetings.opts().json);
|
|
731
869
|
const detail = (await res.json());
|
|
870
|
+
refuseAttributedUnderPersonal(detail);
|
|
732
871
|
if (meetings.opts().json) {
|
|
733
872
|
console.log(JSON.stringify(detail, null, 2));
|
|
734
873
|
return;
|
|
@@ -842,7 +981,7 @@ export function registerMeetingsCommand(program) {
|
|
|
842
981
|
try {
|
|
843
982
|
const token = await ensureCognitoToken();
|
|
844
983
|
const params = { q: query };
|
|
845
|
-
const companySlug = meetings.opts()
|
|
984
|
+
const companySlug = meetingsReadCompanySlug(meetings.opts());
|
|
846
985
|
if (companySlug)
|
|
847
986
|
params.companyId = await getCompanyUid(token, companySlug);
|
|
848
987
|
const res = await vaultApiFetch({
|
|
@@ -853,12 +992,16 @@ export function registerMeetingsCommand(program) {
|
|
|
853
992
|
if (!res.ok)
|
|
854
993
|
await handleApiError(res, meetings.opts().json);
|
|
855
994
|
const data = (await res.json());
|
|
995
|
+
if (personalRead())
|
|
996
|
+
data.results = (data.results ?? []).filter(isUnattributedMeeting);
|
|
856
997
|
if (meetings.opts().json) {
|
|
857
998
|
console.log(JSON.stringify(data, null, 2));
|
|
858
999
|
return;
|
|
859
1000
|
}
|
|
860
1001
|
console.log(chalk.bold(`\nSearch results for "${data.query}" (${data.results.length}):\n`));
|
|
861
1002
|
printMeetingTable(data.results);
|
|
1003
|
+
if (companySlug)
|
|
1004
|
+
console.log(chalk.dim(`\n ${UNATTRIBUTED_MEETINGS_HINT}`));
|
|
862
1005
|
console.log();
|
|
863
1006
|
}
|
|
864
1007
|
catch (err) {
|
|
@@ -873,10 +1016,10 @@ export function registerMeetingsCommand(program) {
|
|
|
873
1016
|
try {
|
|
874
1017
|
const token = await ensureCognitoToken();
|
|
875
1018
|
const query = {};
|
|
876
|
-
const companySlug = meetings.opts()
|
|
1019
|
+
const companySlug = meetingsReadCompanySlug(meetings.opts());
|
|
877
1020
|
if (companySlug)
|
|
878
1021
|
query.companyId = await getCompanyUid(token, companySlug);
|
|
879
|
-
const meetingId = await resolveShortId(token, rawId, query);
|
|
1022
|
+
const meetingId = await resolveShortId(token, rawId, query, shortIdFilter());
|
|
880
1023
|
const res = await vaultApiFetch({
|
|
881
1024
|
token,
|
|
882
1025
|
path: `/v1/meetings/${encodeURIComponent(meetingId)}`,
|
|
@@ -885,6 +1028,7 @@ export function registerMeetingsCommand(program) {
|
|
|
885
1028
|
if (!res.ok)
|
|
886
1029
|
await handleApiError(res, meetings.opts().json);
|
|
887
1030
|
const detail = (await res.json());
|
|
1031
|
+
refuseAttributedUnderPersonal(detail);
|
|
888
1032
|
if (isMarkdownShape(detail)) {
|
|
889
1033
|
const documentUrl = detail.source.presigned_url;
|
|
890
1034
|
if (!documentUrl) {
|
|
@@ -942,10 +1086,10 @@ export function registerMeetingsCommand(program) {
|
|
|
942
1086
|
try {
|
|
943
1087
|
const token = await ensureCognitoToken();
|
|
944
1088
|
const query = {};
|
|
945
|
-
const companySlug = meetings.opts()
|
|
1089
|
+
const companySlug = meetingsReadCompanySlug(meetings.opts());
|
|
946
1090
|
if (companySlug)
|
|
947
1091
|
query.companyId = await getCompanyUid(token, companySlug);
|
|
948
|
-
const meetingId = await resolveShortId(token, rawId, query);
|
|
1092
|
+
const meetingId = await resolveShortId(token, rawId, query, shortIdFilter());
|
|
949
1093
|
const res = await vaultApiFetch({
|
|
950
1094
|
token,
|
|
951
1095
|
path: `/v1/meetings/${encodeURIComponent(meetingId)}`,
|
|
@@ -954,6 +1098,7 @@ export function registerMeetingsCommand(program) {
|
|
|
954
1098
|
if (!res.ok)
|
|
955
1099
|
await handleApiError(res, meetings.opts().json);
|
|
956
1100
|
const detail = (await res.json());
|
|
1101
|
+
refuseAttributedUnderPersonal(detail);
|
|
957
1102
|
if (isMarkdownShape(detail)) {
|
|
958
1103
|
if (hasSignals(detail.signals)) {
|
|
959
1104
|
if (meetings.opts().json) {
|