@indigoai-us/hq-cli 5.345.241 → 5.345.242
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 +49 -0
- package/assets/scaffold/core/scripts/hq-delegate-grant.sh +170 -8
- package/assets/scaffold/core/scripts/hq-delegate-publish.sh +21 -1
- package/assets/scaffold/core/scripts/lib/delegate-engine.sh +77 -0
- package/dist/command-catalog.generated.d.ts +28 -8
- package/dist/command-catalog.generated.js +33 -8
- package/dist/commands/cloud-off-gate.d.ts +7 -7
- package/dist/commands/cloud-off-gate.js +26 -38
- package/dist/commands/core-delegate-w1b.js +307 -26
- package/dist/commands/core-delegate.js +2 -0
- package/dist/commands/core-handoff.js +1 -1
- package/dist/commands/core-job-model-auth.d.ts +95 -0
- package/dist/commands/core-job-model-auth.js +247 -0
- package/dist/commands/core-job-run-native.js +280 -12
- package/dist/commands/core.js +1 -0
- package/dist/commands/files-browse.js +2 -0
- package/dist/commands/files.js +4 -0
- package/dist/commands/integrations-core.d.ts +11 -0
- package/dist/commands/integrations-core.js +15 -1
- package/dist/commands/lanes-link.js +2 -2
- package/dist/commands/lanes-loop.d.ts +2 -2
- package/dist/commands/lanes-loop.js +5 -5
- package/dist/commands/lanes-questions.js +1 -1
- package/dist/commands/lanes-stories.js +1 -1
- package/dist/commands/lanes.js +80 -14
- package/dist/commands/rescue.d.ts +3 -2
- package/dist/commands/rescue.js +48 -34
- package/dist/commands/search.d.ts +6 -0
- package/dist/commands/search.js +24 -4
- package/dist/commands/sources.js +6 -2
- package/dist/commands/sync-core.d.ts +8 -0
- package/dist/commands/sync-core.js +43 -0
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +1737 -1450
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/lib/capacity/accounts.d.ts +1 -1
- package/dist/lib/capacity/accounts.js +1 -1
- package/dist/lib/capacity/freshness.d.ts +1 -1
- package/dist/lib/capacity/freshness.js +1 -1
- package/dist/lib/capacity/route.js +1 -1
- package/dist/lib/daemon/catalog.d.ts +3 -0
- package/dist/lib/daemon/hook-requests.d.ts +1 -1
- package/dist/lib/daemon/hook-requests.js +4 -2
- package/dist/lib/daemon/run.js +16 -22
- package/dist/lib/environment/work-requirements.d.ts +1 -1
- package/dist/lib/environment/work-requirements.js +1 -1
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/hook-engine/coverage.js +11 -3
- package/dist/lib/hook-engine/git-stop-config.json +510 -510
- package/dist/lib/hook-engine/native-precompact-compatibility.json +443 -443
- package/dist/lib/hook-engine/native-stop-compatibility.json +359 -359
- package/dist/lib/hot-channels/adapters/meetings.d.ts +1 -16
- package/dist/lib/hot-channels/adapters/meetings.js +3 -28
- package/dist/lib/hot-channels/adapters/slack.d.ts +3 -1
- package/dist/lib/hot-channels/adapters/slack.js +4 -1
- package/dist/lib/hot-channels/contract.d.ts +14 -0
- package/dist/lib/hot-channels/fleet-complete.d.ts +18 -2
- package/dist/lib/hot-channels/fleet-complete.js +29 -4
- package/dist/lib/hot-channels/meeting-source-ref.d.ts +17 -0
- package/dist/lib/hot-channels/meeting-source-ref.js +32 -0
- package/dist/lib/hot-channels/prompts/signals-pass.md +6 -1
- package/dist/lib/hot-channels/run.d.ts +10 -0
- package/dist/lib/hot-channels/run.js +34 -0
- package/dist/lib/hot-channels/signals-pass.d.ts +27 -0
- package/dist/lib/hot-channels/signals-pass.js +57 -2
- package/dist/lib/hot-channels/signals-runtime.js +3 -2
- package/dist/lib/lanes/accounts.js +2 -2
- package/dist/lib/lanes/claude-balance.d.ts +6 -0
- package/dist/lib/lanes/claude-balance.js +124 -0
- package/dist/lib/lanes/grants.js +15 -2
- package/dist/lib/lanes/hq-root.d.ts +1 -1
- package/dist/lib/lanes/hq-root.js +1 -1
- package/dist/lib/lanes/links.d.ts +1 -1
- package/dist/lib/lanes/liveness.d.ts +3 -0
- package/dist/lib/lanes/liveness.js +61 -7
- package/dist/lib/lanes/models.d.ts +1 -1
- package/dist/lib/lanes/models.js +1 -1
- package/dist/lib/lanes/questions.d.ts +1 -1
- package/dist/lib/lanes/questions.js +2 -2
- package/dist/lib/lanes/spawn.js +4 -6
- package/dist/lib/lanes/store.d.ts +13 -2
- package/dist/lib/lanes/store.js +13 -5
- package/dist/lib/lanes/types.d.ts +7 -7
- package/dist/lib/lanes/types.js +1 -1
- package/dist/lib/lanes/watcher-main.js +1 -1
- package/dist/lib/lanes/watcher.d.ts +1 -1
- package/dist/lib/lanes/watcher.js +1 -1
- package/dist/lib/onboarding/cli/onboard.js +5 -0
- package/dist/lib/signals/sanitize.d.ts +19 -0
- package/dist/lib/signals/sanitize.js +103 -7
- package/dist/lib/signals/steps/upload.d.ts +40 -1
- package/dist/lib/signals/steps/upload.js +122 -6
- package/dist/lib/sync-core/access-refresh.d.ts +29 -0
- package/dist/lib/sync-core/access-refresh.js +97 -0
- package/dist/lib/sync-core/company-adoption.d.ts +33 -0
- package/dist/lib/sync-core/company-adoption.js +223 -0
- package/dist/lib/sync-core/engine-home.d.ts +1 -0
- package/dist/lib/sync-core/engine-owned.d.ts +13 -0
- package/dist/lib/sync-core/engine-owned.js +38 -0
- package/dist/lib/sync-core/hand-back.d.ts +17 -0
- package/dist/lib/sync-core/hand-back.js +23 -0
- package/dist/lib/sync-core/post-apply-reindex.d.ts +33 -0
- package/dist/lib/sync-core/post-apply-reindex.js +149 -0
- package/dist/lib/sync-core/reconcile.d.ts +10 -0
- package/dist/lib/sync-core/reconcile.js +117 -12
- package/dist/lib/sync-core/rollout-state.d.ts +2 -0
- package/dist/lib/sync-core/rollout-state.js +6 -0
- package/dist/lib/vault-sync-switches.d.ts +14 -0
- package/dist/lib/vault-sync-switches.js +22 -0
- package/dist/lib/workers-registry/index.d.ts +1 -1
- package/dist/lib/workers-registry/index.js +1 -1
- package/dist/utils/github-tag-fallback.d.ts +16 -0
- package/dist/utils/github-tag-fallback.js +126 -0
- package/dist/utils/version-report.d.ts +2 -1
- package/dist/utils/version-report.js +40 -27
- package/package.json +8 -8
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
* watermark; the vault and other providers still land.
|
|
43
43
|
*/
|
|
44
44
|
import { type PollHotChannelAdapter } from "../contract.js";
|
|
45
|
-
export { meetingSignalSourceRef } from "../meeting-source-ref.js";
|
|
45
|
+
export { meetingSignalSourceRef, transcriptSignalSourceRef } from "../meeting-source-ref.js";
|
|
46
46
|
export declare const MEETINGS_ADAPTER_ID = "meetings";
|
|
47
47
|
export declare const MEETINGS_CHANNEL = "meeting-events";
|
|
48
48
|
export declare const MEETINGS_PROVIDER = "hq-vault";
|
|
@@ -72,21 +72,6 @@ export interface MeetingsAdapterOptions {
|
|
|
72
72
|
/** Where a failing provider is reported. Default: a line on stderr. */
|
|
73
73
|
warn?: (message: string) => void;
|
|
74
74
|
}
|
|
75
|
-
/**
|
|
76
|
-
* The `signal_source_ref` alias for a bot transcript, or undefined when the
|
|
77
|
-
* transcript carries no id that is a safe path segment.
|
|
78
|
-
*
|
|
79
|
-
* Transcripts without `recall_bot_id` or `transcript_id` (Recall desktop-SDK
|
|
80
|
-
* recordings, legacy exports) fall back to the document `id`, which the
|
|
81
|
-
* meeting pipeline writes as `meeting:<id>`. A leading `meeting:` is stripped
|
|
82
|
-
* once from whichever id is used, so the alias is `meeting:<id>`, not
|
|
83
|
-
* `meeting:meeting:<id>`. An unsafe `recall_bot_id` does not fall back to
|
|
84
|
-
* another field: it names the bot, so a different id would split the
|
|
85
|
-
* transcript's signals from the live rider's. Anything still unsafe
|
|
86
|
-
* (a slash, `..`, another colon) gets no alias: the signals pass then keys the
|
|
87
|
-
* document by its file, and one odd record never fails the whole adapter.
|
|
88
|
-
*/
|
|
89
|
-
export declare function transcriptSignalSourceRef(frontmatter: Record<string, unknown>, transcriptId: string): string | undefined;
|
|
90
75
|
/** The adapter cursor: see the file comment. */
|
|
91
76
|
export interface MeetingsCursor {
|
|
92
77
|
vault: string | null;
|
|
@@ -50,8 +50,8 @@ import { matchFrontmatter } from "../../../utils/frontmatter.js";
|
|
|
50
50
|
import { MAX_CATCH_UP_WINDOW_MS } from "../contract.js";
|
|
51
51
|
import { assertSafeSegment, HOT_SIGNAL_ORIGIN, writeFileAtomic } from "../landing.js";
|
|
52
52
|
import { SyncLockLostError } from "../sync-lock.js";
|
|
53
|
-
import {
|
|
54
|
-
export { meetingSignalSourceRef } from "../meeting-source-ref.js";
|
|
53
|
+
import { transcriptIdOf, transcriptSignalSourceRef } from "../meeting-source-ref.js";
|
|
54
|
+
export { meetingSignalSourceRef, transcriptSignalSourceRef } from "../meeting-source-ref.js";
|
|
55
55
|
import { MEETING_NOTE_PROVIDERS, MEETING_PROVIDERS, sameMeeting, } from "./meeting-providers.js";
|
|
56
56
|
export const MEETINGS_ADAPTER_ID = "meetings";
|
|
57
57
|
export const MEETINGS_CHANNEL = "meeting-events";
|
|
@@ -146,7 +146,7 @@ async function readTranscript(dir, file, names) {
|
|
|
146
146
|
if (fm.origin === HOT_SIGNAL_ORIGIN)
|
|
147
147
|
return null;
|
|
148
148
|
const title = nonEmptyString(fm.title);
|
|
149
|
-
const transcriptId =
|
|
149
|
+
const transcriptId = transcriptIdOf(fm);
|
|
150
150
|
const stamp = nonEmptyString(fm.updated_at) ?? nonEmptyString(fm.ingested_at) ?? nonEmptyString(fm.created_at);
|
|
151
151
|
const tsMs = stamp === undefined ? NaN : Date.parse(stamp);
|
|
152
152
|
if (!title || !transcriptId || Number.isNaN(tsMs))
|
|
@@ -194,31 +194,6 @@ async function readTranscript(dir, file, names) {
|
|
|
194
194
|
},
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
-
const MEETING_DOC_ID_PREFIX = "meeting:";
|
|
198
|
-
/**
|
|
199
|
-
* The `signal_source_ref` alias for a bot transcript, or undefined when the
|
|
200
|
-
* transcript carries no id that is a safe path segment.
|
|
201
|
-
*
|
|
202
|
-
* Transcripts without `recall_bot_id` or `transcript_id` (Recall desktop-SDK
|
|
203
|
-
* recordings, legacy exports) fall back to the document `id`, which the
|
|
204
|
-
* meeting pipeline writes as `meeting:<id>`. A leading `meeting:` is stripped
|
|
205
|
-
* once from whichever id is used, so the alias is `meeting:<id>`, not
|
|
206
|
-
* `meeting:meeting:<id>`. An unsafe `recall_bot_id` does not fall back to
|
|
207
|
-
* another field: it names the bot, so a different id would split the
|
|
208
|
-
* transcript's signals from the live rider's. Anything still unsafe
|
|
209
|
-
* (a slash, `..`, another colon) gets no alias: the signals pass then keys the
|
|
210
|
-
* document by its file, and one odd record never fails the whole adapter.
|
|
211
|
-
*/
|
|
212
|
-
export function transcriptSignalSourceRef(frontmatter, transcriptId) {
|
|
213
|
-
const raw = nonEmptyString(frontmatter.recall_bot_id) ?? transcriptId;
|
|
214
|
-
const id = raw.startsWith(MEETING_DOC_ID_PREFIX) ? raw.slice(MEETING_DOC_ID_PREFIX.length) : raw;
|
|
215
|
-
try {
|
|
216
|
-
return meetingSignalSourceRef(id);
|
|
217
|
-
}
|
|
218
|
-
catch {
|
|
219
|
-
return undefined;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
197
|
function toEvent(t, warn) {
|
|
223
198
|
const when = new Date(t.tsMs).toISOString();
|
|
224
199
|
const who = nonEmptyString(t.frontmatter.person_uid) ?? "unknown";
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
* The hq-pro catalog entry for slack still says `transport: push`. run.ts
|
|
13
13
|
* plans by the registered adapter's transport, so this adapter runs once per
|
|
14
14
|
* usable Slack connection either way; the catalog correction is an hq-pro
|
|
15
|
-
* follow-up.
|
|
15
|
+
* follow-up. The adapter never calls Slack, so it declares `readsVaultOnly`:
|
|
16
|
+
* with no usable Slack connection it runs once with no connection, matching
|
|
17
|
+
* threads by the person's uid and identities.
|
|
16
18
|
*
|
|
17
19
|
* Each landed document is a pointer. Its body is a short header (channel,
|
|
18
20
|
* time, owner, message count, audience) and `payload_ref` names the thread
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
* The hq-pro catalog entry for slack still says `transport: push`. run.ts
|
|
13
13
|
* plans by the registered adapter's transport, so this adapter runs once per
|
|
14
14
|
* usable Slack connection either way; the catalog correction is an hq-pro
|
|
15
|
-
* follow-up.
|
|
15
|
+
* follow-up. The adapter never calls Slack, so it declares `readsVaultOnly`:
|
|
16
|
+
* with no usable Slack connection it runs once with no connection, matching
|
|
17
|
+
* threads by the person's uid and identities.
|
|
16
18
|
*
|
|
17
19
|
* Each landed document is a pointer. Its body is a short header (channel,
|
|
18
20
|
* time, owner, message count, audience) and `payload_ref` names the thread
|
|
@@ -317,6 +319,7 @@ export function createSlackAdapter(options) {
|
|
|
317
319
|
hotEventTypes: [SLACK_THREAD_EVENT],
|
|
318
320
|
catchUpWindow: { maxLookbackMs: MAX_CATCH_UP_WINDOW_MS },
|
|
319
321
|
tokenScope: { provider: SLACK_PROVIDER, scopes: [] },
|
|
322
|
+
readsVaultOnly: true,
|
|
320
323
|
// Channels with a thread in the last 14 days. The evaluator (US-014)
|
|
321
324
|
// orders suggested channels by message count, highest first: each landed
|
|
322
325
|
// event carries the thread's `message_count` in its raw sidecar.
|
|
@@ -128,6 +128,14 @@ export interface HotChannelDeclaration {
|
|
|
128
128
|
* run hands every matching connection to `fetch` as `PollContext.gateways`.
|
|
129
129
|
*/
|
|
130
130
|
companionProviders?: readonly string[];
|
|
131
|
+
/**
|
|
132
|
+
* True when the adapter reads only documents already in the company vault
|
|
133
|
+
* and never calls the provider (Slack threads under `sources/slack/`). With
|
|
134
|
+
* no usable connection the run still plans it once, with no connection,
|
|
135
|
+
* instead of reporting `no-connection`. A usable connection, when there is
|
|
136
|
+
* one, is still handed over so its account id counts as the person's.
|
|
137
|
+
*/
|
|
138
|
+
readsVaultOnly?: boolean;
|
|
131
139
|
/** Optional human label, matching the hq-pro catalog entry's `displayName` (US-008). */
|
|
132
140
|
displayName?: string;
|
|
133
141
|
/** Optional catalog provider id; defaults to `tokenScope.provider` when unset (US-008). */
|
|
@@ -165,6 +173,12 @@ export interface CatalogEntry {
|
|
|
165
173
|
connectionId?: string;
|
|
166
174
|
/** Companion connections (see `companionProviders`) handed to this entry's run. */
|
|
167
175
|
companionConnectionIds?: readonly string[];
|
|
176
|
+
/**
|
|
177
|
+
* For a `readsVaultOnly` channel run with no usable connection: the
|
|
178
|
+
* person's known (not revoked) connections of this provider. Their saved
|
|
179
|
+
* channel picks still apply to the connectionless run.
|
|
180
|
+
*/
|
|
181
|
+
selectionConnectionIds?: readonly string[];
|
|
168
182
|
}
|
|
169
183
|
/**
|
|
170
184
|
* Adapter error codes for a rate limit, which clears on its own: Slack's
|
|
@@ -62,8 +62,24 @@ export declare function fleetCompleteTargetFor(config: Pick<BotConfig, "name" |
|
|
|
62
62
|
fleetHome?: string;
|
|
63
63
|
platform?: NodeJS.Platform;
|
|
64
64
|
}): FleetCompleteTarget | null;
|
|
65
|
-
/**
|
|
66
|
-
|
|
65
|
+
/**
|
|
66
|
+
* The HQ Fleet home to look a bot's profile up in, for `env`.
|
|
67
|
+
*
|
|
68
|
+
* For the CLI, HQ_FLEET_HOME names the Fleet home that holds `profiles/`. The
|
|
69
|
+
* Fleet runtime gives the same variable another meaning: a bot's gateway, and
|
|
70
|
+
* every job it runs, has HQ_FLEET_HOME set to that bot's own profile folder
|
|
71
|
+
* (`<fleet home>/profiles/<agt id>`). A bot's scheduled hot-signal-sync job
|
|
72
|
+
* runs `hq signals run` with that value, so read as a Fleet home it hid every
|
|
73
|
+
* profile, the Executive bot's included, and the pass fell back to the claude
|
|
74
|
+
* CLI. A profile folder (under `profiles/`, with its profile.json) is read as
|
|
75
|
+
* the Fleet home two levels up.
|
|
76
|
+
*/
|
|
77
|
+
export declare function signalsFleetHome(env?: NodeJS.ProcessEnv, home?: string): string;
|
|
78
|
+
/**
|
|
79
|
+
* fleetCompleteTargetFor for the bot folder `dir`, read when the pass asks,
|
|
80
|
+
* in the Fleet home `env` names (signalsFleetHome).
|
|
81
|
+
*/
|
|
82
|
+
export declare function fleetCompleteTarget(dir: string, env?: NodeJS.ProcessEnv): FleetCompleteTarget | null;
|
|
67
83
|
export type BoundedRunner = (command: string, args: readonly string[], options: {
|
|
68
84
|
timeoutMs: number;
|
|
69
85
|
input?: string;
|
|
@@ -21,8 +21,11 @@
|
|
|
21
21
|
* reads the one JSON line back. The reply text is model output built from the
|
|
22
22
|
* document, so it is parsed and never logged.
|
|
23
23
|
*/
|
|
24
|
+
import * as fs from "node:fs";
|
|
25
|
+
import * as os from "node:os";
|
|
26
|
+
import * as path from "node:path";
|
|
24
27
|
import { readBotConfig, HQ_FLEET_RUNTIME_ENGINE_ID } from "../bot/config.js";
|
|
25
|
-
import { fleetLocalHelper } from "../bot/fleet-local.js";
|
|
28
|
+
import { fleetHome, fleetLocalHelper } from "../bot/fleet-local.js";
|
|
26
29
|
/** Largest prompt the helper accepts (its hard limit, 1 MiB). */
|
|
27
30
|
export const FLEET_COMPLETE_MAX_PROMPT_BYTES = 1024 * 1024;
|
|
28
31
|
/** The helper's own `--timeout` ceiling, in seconds. */
|
|
@@ -55,9 +58,31 @@ export function fleetCompleteTargetFor(config, deps = {}) {
|
|
|
55
58
|
botName: config.name,
|
|
56
59
|
};
|
|
57
60
|
}
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
/**
|
|
62
|
+
* The HQ Fleet home to look a bot's profile up in, for `env`.
|
|
63
|
+
*
|
|
64
|
+
* For the CLI, HQ_FLEET_HOME names the Fleet home that holds `profiles/`. The
|
|
65
|
+
* Fleet runtime gives the same variable another meaning: a bot's gateway, and
|
|
66
|
+
* every job it runs, has HQ_FLEET_HOME set to that bot's own profile folder
|
|
67
|
+
* (`<fleet home>/profiles/<agt id>`). A bot's scheduled hot-signal-sync job
|
|
68
|
+
* runs `hq signals run` with that value, so read as a Fleet home it hid every
|
|
69
|
+
* profile, the Executive bot's included, and the pass fell back to the claude
|
|
70
|
+
* CLI. A profile folder (under `profiles/`, with its profile.json) is read as
|
|
71
|
+
* the Fleet home two levels up.
|
|
72
|
+
*/
|
|
73
|
+
export function signalsFleetHome(env = process.env, home = os.homedir()) {
|
|
74
|
+
const configured = fleetHome(home, env);
|
|
75
|
+
if (path.basename(path.dirname(configured)) === "profiles" && fs.existsSync(path.join(configured, "profile.json"))) {
|
|
76
|
+
return path.dirname(path.dirname(configured));
|
|
77
|
+
}
|
|
78
|
+
return configured;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* fleetCompleteTargetFor for the bot folder `dir`, read when the pass asks,
|
|
82
|
+
* in the Fleet home `env` names (signalsFleetHome).
|
|
83
|
+
*/
|
|
84
|
+
export function fleetCompleteTarget(dir, env = process.env) {
|
|
85
|
+
return fleetCompleteTargetFor(readBotConfig(dir), { fleetHome: signalsFleetHome(env) });
|
|
61
86
|
}
|
|
62
87
|
/** argv for one completion. The prompt never goes on argv. */
|
|
63
88
|
export function fleetCompleteArgs(target, timeoutMs) {
|
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
/** Independent of transcript revisions and the adapter's versioned pointer filename. */
|
|
2
2
|
export declare function meetingSignalSourceRef(id: string): string;
|
|
3
|
+
/** A transcript's own id, the way the meetings adapter reads it: `transcript_id`, then `id`, then `source_id`. */
|
|
4
|
+
export declare function transcriptIdOf(frontmatter: Record<string, unknown>): string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* The `signal_source_ref` alias for a bot transcript, or undefined when the
|
|
7
|
+
* transcript carries no id that is a safe path segment.
|
|
8
|
+
*
|
|
9
|
+
* Transcripts without `recall_bot_id` or `transcript_id` (Recall desktop-SDK
|
|
10
|
+
* recordings, legacy exports) fall back to the document `id`, which the
|
|
11
|
+
* meeting pipeline writes as `meeting:<id>`. A leading `meeting:` is stripped
|
|
12
|
+
* once from whichever id is used, so the alias is `meeting:<id>`, not
|
|
13
|
+
* `meeting:meeting:<id>`. An unsafe `recall_bot_id` does not fall back to
|
|
14
|
+
* another field: it names the bot, so a different id would split the
|
|
15
|
+
* transcript's signals from the live rider's. Anything still unsafe
|
|
16
|
+
* (a slash, `..`, another colon) gets no alias: the signals pass then keys the
|
|
17
|
+
* document by its file, and one odd record never fails the whole adapter.
|
|
18
|
+
*/
|
|
19
|
+
export declare function transcriptSignalSourceRef(frontmatter: Record<string, unknown>, transcriptId: string): string | undefined;
|
|
3
20
|
//# sourceMappingURL=meeting-source-ref.d.ts.map
|
|
@@ -1,7 +1,39 @@
|
|
|
1
1
|
import { assertSafeSegment } from "./landing.js";
|
|
2
|
+
const MEETING_DOC_ID_PREFIX = "meeting:";
|
|
3
|
+
function nonEmptyString(value) {
|
|
4
|
+
return typeof value === "string" && value.trim() !== "" ? value.trim() : undefined;
|
|
5
|
+
}
|
|
2
6
|
/** Independent of transcript revisions and the adapter's versioned pointer filename. */
|
|
3
7
|
export function meetingSignalSourceRef(id) {
|
|
4
8
|
assertSafeSegment(id, "meeting id");
|
|
5
9
|
return `meeting:${id}`;
|
|
6
10
|
}
|
|
11
|
+
/** A transcript's own id, the way the meetings adapter reads it: `transcript_id`, then `id`, then `source_id`. */
|
|
12
|
+
export function transcriptIdOf(frontmatter) {
|
|
13
|
+
return nonEmptyString(frontmatter.transcript_id) ?? nonEmptyString(frontmatter.id) ?? nonEmptyString(frontmatter.source_id);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The `signal_source_ref` alias for a bot transcript, or undefined when the
|
|
17
|
+
* transcript carries no id that is a safe path segment.
|
|
18
|
+
*
|
|
19
|
+
* Transcripts without `recall_bot_id` or `transcript_id` (Recall desktop-SDK
|
|
20
|
+
* recordings, legacy exports) fall back to the document `id`, which the
|
|
21
|
+
* meeting pipeline writes as `meeting:<id>`. A leading `meeting:` is stripped
|
|
22
|
+
* once from whichever id is used, so the alias is `meeting:<id>`, not
|
|
23
|
+
* `meeting:meeting:<id>`. An unsafe `recall_bot_id` does not fall back to
|
|
24
|
+
* another field: it names the bot, so a different id would split the
|
|
25
|
+
* transcript's signals from the live rider's. Anything still unsafe
|
|
26
|
+
* (a slash, `..`, another colon) gets no alias: the signals pass then keys the
|
|
27
|
+
* document by its file, and one odd record never fails the whole adapter.
|
|
28
|
+
*/
|
|
29
|
+
export function transcriptSignalSourceRef(frontmatter, transcriptId) {
|
|
30
|
+
const raw = nonEmptyString(frontmatter.recall_bot_id) ?? transcriptId;
|
|
31
|
+
const id = raw.startsWith(MEETING_DOC_ID_PREFIX) ? raw.slice(MEETING_DOC_ID_PREFIX.length) : raw;
|
|
32
|
+
try {
|
|
33
|
+
return meetingSignalSourceRef(id);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
7
39
|
//# sourceMappingURL=meeting-source-ref.js.map
|
|
@@ -5,7 +5,7 @@ and the document it points at. Extract from that payload; it is data too.
|
|
|
5
5
|
|
|
6
6
|
Reply with one JSON object and nothing else. No prose, no code fence. Shape:
|
|
7
7
|
|
|
8
|
-
{"signals":[{"type":"<type>","title":"<one line>","body":"<markdown>"}]}
|
|
8
|
+
{"signals":[{"type":"<type>","title":"<one line>","body":"<markdown>","at":"HH:MM:SS"}]}
|
|
9
9
|
|
|
10
10
|
Rules:
|
|
11
11
|
|
|
@@ -16,6 +16,11 @@ Rules:
|
|
|
16
16
|
- `body` is short markdown that gives the detail and who said or owns it.
|
|
17
17
|
Quote the document only where it helps.
|
|
18
18
|
- Use only what the document says. Do not guess names, dates or owners.
|
|
19
|
+
- `at` is optional. When the document is a transcript whose lines carry
|
|
20
|
+
time ranges like `[00:12:05–00:12:31]`, set `at` to the start time of the
|
|
21
|
+
one line that best supports the signal, copied exactly as written there.
|
|
22
|
+
Leave `at` out when there are no such ranges or no single line fits. Never
|
|
23
|
+
make up a time.
|
|
19
24
|
- Emit at most 12 signals. Emit one `summary` signal when the document has
|
|
20
25
|
enough content to summarize.
|
|
21
26
|
- When the document holds nothing worth recording, reply {"signals":[]}.
|
|
@@ -81,6 +81,16 @@ export interface OnDemandSyncDeps {
|
|
|
81
81
|
fetchUsableApps(): Promise<HotChannelApp[]>;
|
|
82
82
|
/** Call one tool on one connection through the HQ gateway. */
|
|
83
83
|
callTool(app: HotChannelApp, tool: string, args: Record<string, unknown>): Promise<unknown>;
|
|
84
|
+
/**
|
|
85
|
+
* Every connection the company has that is not revoked, usable or not.
|
|
86
|
+
* Used only to find saved channel picks for a `readsVaultOnly` channel that
|
|
87
|
+
* runs with no usable connection. When absent, such a channel does not run
|
|
88
|
+
* while saved selections are in play, because its picks cannot be checked.
|
|
89
|
+
*/
|
|
90
|
+
fetchKnownConnections?(): Promise<Array<{
|
|
91
|
+
connectionId: string;
|
|
92
|
+
provider: string;
|
|
93
|
+
}>>;
|
|
84
94
|
}
|
|
85
95
|
export interface OnDemandSyncInput {
|
|
86
96
|
deps: OnDemandSyncDeps;
|
|
@@ -192,6 +192,15 @@ function selectionFor(load) {
|
|
|
192
192
|
// An empty saved list on a connection means no choice yet: land everything.
|
|
193
193
|
if (entry.connectionId)
|
|
194
194
|
return connectionSelection(await load(entry.connectionId));
|
|
195
|
+
const pickedOn = entry.selectionConnectionIds ?? [];
|
|
196
|
+
if (pickedOn.length > 0) {
|
|
197
|
+
// A connectionless vault channel: the union of the non-empty picks saved
|
|
198
|
+
// on the person's connections of this provider; none saved lands all.
|
|
199
|
+
const picks = (await Promise.all(pickedOn.map((id) => load(id))))
|
|
200
|
+
.map(connectionSelection)
|
|
201
|
+
.filter((s) => s !== undefined);
|
|
202
|
+
return picks.length === 0 ? undefined : new Set(picks.flatMap((s) => [...s]));
|
|
203
|
+
}
|
|
195
204
|
const companions = entry.companionConnectionIds ?? [];
|
|
196
205
|
if (companions.length === 0)
|
|
197
206
|
return undefined;
|
|
@@ -271,6 +280,31 @@ export async function runOnDemandSync(input) {
|
|
|
271
280
|
}
|
|
272
281
|
const names = new Set([hotChannelProviderKey(scopeProvider), hotChannelProviderKey(item.provider)]);
|
|
273
282
|
const matches = apps.filter((app) => names.has(hotChannelProviderKey(app.provider)));
|
|
283
|
+
if (matches.length === 0 && hit.adapter.readsVaultOnly === true) {
|
|
284
|
+
// The adapter reads the vault folder only: no connection is needed. A
|
|
285
|
+
// pick the person saved on a connection that is not usable now still
|
|
286
|
+
// applies; when the picks cannot be looked up, the channel does not run.
|
|
287
|
+
let known = [];
|
|
288
|
+
if (input.selections) {
|
|
289
|
+
try {
|
|
290
|
+
known = input.deps.fetchKnownConnections
|
|
291
|
+
? (await input.deps.fetchKnownConnections())
|
|
292
|
+
.filter((c) => names.has(hotChannelProviderKey(c.provider)))
|
|
293
|
+
.map((c) => c.connectionId)
|
|
294
|
+
: null;
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
known = null;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (known !== null) {
|
|
301
|
+
const entry = { provider: hit.key };
|
|
302
|
+
if (known.length > 0)
|
|
303
|
+
entry.selectionConnectionIds = known;
|
|
304
|
+
planned.push({ entry, item, adapter: hit.adapter, app: null });
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
274
308
|
if (matches.length === 0) {
|
|
275
309
|
skipped.push({
|
|
276
310
|
...blank,
|
|
@@ -214,6 +214,8 @@ export interface SignalsInput {
|
|
|
214
214
|
text: string;
|
|
215
215
|
/** Set when the payload was read and appended. */
|
|
216
216
|
payloadRef?: string;
|
|
217
|
+
/** The appended payload text, as the model saw it (capped). */
|
|
218
|
+
payloadText?: string;
|
|
217
219
|
/** Set when the document named a payload the pass could not use. */
|
|
218
220
|
fallback?: PayloadFallbackReason;
|
|
219
221
|
/** The `payload_ref` value behind a fallback. */
|
|
@@ -234,7 +236,32 @@ interface ParsedSignal {
|
|
|
234
236
|
title: string;
|
|
235
237
|
body: string;
|
|
236
238
|
update?: string;
|
|
239
|
+
/** `HH:MM:SS` start of the transcript line the signal rests on, as the model copied it. */
|
|
240
|
+
at?: string;
|
|
237
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* The timed segments of a meeting transcript, keyed by start time in ms: each
|
|
244
|
+
* `[HH:MM:SS–HH:MM:SS]` marker the transcript itself carries. The first
|
|
245
|
+
* segment that starts at a given second wins. Nothing is inferred: a
|
|
246
|
+
* transcript without markers has no segments.
|
|
247
|
+
*/
|
|
248
|
+
export declare function transcriptSegments(text: string): Map<number, {
|
|
249
|
+
startMs: number;
|
|
250
|
+
endMs: number;
|
|
251
|
+
}>;
|
|
252
|
+
/**
|
|
253
|
+
* The citation for one signal: the transcript segment that starts exactly at
|
|
254
|
+
* the model's `at`, with that segment's own start and end. Undefined when the
|
|
255
|
+
* model gave no time or a time no segment starts at; a time is never made up.
|
|
256
|
+
*/
|
|
257
|
+
export declare function signalCitation(at: string | undefined, segments: ReadonlyMap<number, {
|
|
258
|
+
startMs: number;
|
|
259
|
+
endMs: number;
|
|
260
|
+
}>, sourceRef: string): {
|
|
261
|
+
source_ref: string;
|
|
262
|
+
start_ms: number;
|
|
263
|
+
end_ms: number;
|
|
264
|
+
} | undefined;
|
|
238
265
|
export interface IndexRow {
|
|
239
266
|
signal_id: string;
|
|
240
267
|
type: string;
|
|
@@ -371,6 +371,47 @@ export function runBounded(command, args, options) {
|
|
|
371
371
|
child.stdin.end(options.input ?? "");
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
|
+
const CLOCK_RE = /^(\d{1,2}):(\d{2}):(\d{2})$/;
|
|
375
|
+
const SEGMENT_MARKER_RE = /\[(\d{1,2}):(\d{2}):(\d{2})\s*[\u2013\u2014-]\s*(\d{1,2}):(\d{2}):(\d{2})\]/g;
|
|
376
|
+
function clockMs(h, m, sec) {
|
|
377
|
+
const mm = Number(m);
|
|
378
|
+
const ss = Number(sec);
|
|
379
|
+
if (mm > 59 || ss > 59)
|
|
380
|
+
return null;
|
|
381
|
+
return ((Number(h) * 60 + mm) * 60 + ss) * 1000;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* The timed segments of a meeting transcript, keyed by start time in ms: each
|
|
385
|
+
* `[HH:MM:SS–HH:MM:SS]` marker the transcript itself carries. The first
|
|
386
|
+
* segment that starts at a given second wins. Nothing is inferred: a
|
|
387
|
+
* transcript without markers has no segments.
|
|
388
|
+
*/
|
|
389
|
+
export function transcriptSegments(text) {
|
|
390
|
+
const out = new Map();
|
|
391
|
+
for (const m of text.matchAll(SEGMENT_MARKER_RE)) {
|
|
392
|
+
const startMs = clockMs(m[1], m[2], m[3]);
|
|
393
|
+
const endMs = clockMs(m[4], m[5], m[6]);
|
|
394
|
+
if (startMs === null || endMs === null || endMs < startMs || out.has(startMs))
|
|
395
|
+
continue;
|
|
396
|
+
out.set(startMs, { startMs, endMs });
|
|
397
|
+
}
|
|
398
|
+
return out;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* The citation for one signal: the transcript segment that starts exactly at
|
|
402
|
+
* the model's `at`, with that segment's own start and end. Undefined when the
|
|
403
|
+
* model gave no time or a time no segment starts at; a time is never made up.
|
|
404
|
+
*/
|
|
405
|
+
export function signalCitation(at, segments, sourceRef) {
|
|
406
|
+
if (at === undefined)
|
|
407
|
+
return undefined;
|
|
408
|
+
const m = CLOCK_RE.exec(at);
|
|
409
|
+
if (!m)
|
|
410
|
+
return undefined;
|
|
411
|
+
const startMs = clockMs(m[1], m[2], m[3]);
|
|
412
|
+
const seg = startMs === null ? undefined : segments.get(startMs);
|
|
413
|
+
return seg ? { source_ref: sourceRef, start_ms: seg.startMs, end_ms: seg.endMs } : undefined;
|
|
414
|
+
}
|
|
374
415
|
export function defaultPromptFile() {
|
|
375
416
|
return path.join(path.dirname(fileURLToPath(import.meta.url)), "prompts", "signals-pass.md");
|
|
376
417
|
}
|
|
@@ -528,7 +569,7 @@ export async function buildSignalsInput(vaultRoot, file) {
|
|
|
528
569
|
return fallback(isMissing(err) ? "payload-missing" : "payload-unreadable");
|
|
529
570
|
}
|
|
530
571
|
const head = pointer.endsWith("\n") ? pointer : `${pointer}\n`;
|
|
531
|
-
return { text: `${head}--- payload: ${ref} ---\n${payload}`, payloadRef: ref };
|
|
572
|
+
return { text: `${head}--- payload: ${ref} ---\n${payload}`, payloadRef: ref, payloadText: payload };
|
|
532
573
|
}
|
|
533
574
|
/** The provider's own words, safe for a log line: credentials removed, one line, bounded. */
|
|
534
575
|
function providerReason(text) {
|
|
@@ -692,7 +733,15 @@ export function parseSignalsReply(reply, runtime) {
|
|
|
692
733
|
if (s.update !== undefined && (typeof s.update !== "string" || !/^[a-f0-9]{64}$/.test(s.update))) {
|
|
693
734
|
throw new SignalsPassError(`${runtime}-bad-output`, `${runtime} signal ${i} has an invalid update id`);
|
|
694
735
|
}
|
|
695
|
-
|
|
736
|
+
// An `at` that is not a clock time is dropped, not fatal: the signal then has no citation.
|
|
737
|
+
const at = typeof s.at === "string" && CLOCK_RE.test(s.at.trim()) ? s.at.trim() : undefined;
|
|
738
|
+
return {
|
|
739
|
+
type: s.type,
|
|
740
|
+
title: s.title.trim(),
|
|
741
|
+
body: s.body.trim(),
|
|
742
|
+
...(s.update ? { update: s.update } : {}),
|
|
743
|
+
...(at !== undefined ? { at } : {}),
|
|
744
|
+
};
|
|
696
745
|
});
|
|
697
746
|
}
|
|
698
747
|
/** The Codex permission profile a signals turn runs under. */
|
|
@@ -1280,6 +1329,9 @@ export function createClaudeSignalsPass(options) {
|
|
|
1280
1329
|
const pointer = splitFrontmatter(await fs.readFile(path.join(vaultRoot, item.file), "utf8")).frontmatter;
|
|
1281
1330
|
const sourceRef = typeof pointer.signal_source_ref === "string" && /^meeting:[a-zA-Z0-9._-]+$/.test(pointer.signal_source_ref)
|
|
1282
1331
|
? pointer.signal_source_ref : item.file;
|
|
1332
|
+
// Only a meeting transcript payload has timed segments to cite.
|
|
1333
|
+
const segments = input.payloadRef?.startsWith("sources/meetings/") && input.payloadText !== undefined
|
|
1334
|
+
? transcriptSegments(input.payloadText) : new Map();
|
|
1283
1335
|
for (const signal of signals) {
|
|
1284
1336
|
const id = signalId(sourceRef, signal.type, signal.title);
|
|
1285
1337
|
const key = `${signalTypeDir(item.audienceKey, signal.type)}/${id}.md`;
|
|
@@ -1296,6 +1348,9 @@ export function createClaudeSignalsPass(options) {
|
|
|
1296
1348
|
origin: SIGNAL_ORIGIN,
|
|
1297
1349
|
written_at: at,
|
|
1298
1350
|
};
|
|
1351
|
+
const citation = signalCitation(signal.at, segments, sourceRef);
|
|
1352
|
+
if (citation !== undefined)
|
|
1353
|
+
frontmatter.citations = [citation];
|
|
1299
1354
|
if (input.payloadRef !== undefined)
|
|
1300
1355
|
frontmatter.payload_ref = input.payloadRef;
|
|
1301
1356
|
if (input.fallback !== undefined)
|
|
@@ -47,8 +47,9 @@ export function botSignalsRuntimeOptions(dir, base = process.env) {
|
|
|
47
47
|
return {
|
|
48
48
|
// A Claude or Codex HQ Fleet bot: the pass runs on the bot's own login
|
|
49
49
|
// through its installed hq-fleet-local helper (fleet-complete.ts). Null
|
|
50
|
-
// for any other bot, or when the helper is not installed.
|
|
51
|
-
|
|
50
|
+
// for any other bot, or when the helper is not installed. `base` names the
|
|
51
|
+
// Fleet home, also inside another bot's scheduled job (signalsFleetHome).
|
|
52
|
+
fleetComplete: () => fleetCompleteTarget(dir, base),
|
|
52
53
|
botRuntime: () => {
|
|
53
54
|
const config = readBotConfig(dir);
|
|
54
55
|
return config && isBotRuntimeId(config.runtime) ? config.runtime : null;
|
|
@@ -17,7 +17,7 @@ import * as path from "node:path";
|
|
|
17
17
|
import { AccountResolutionError } from "./errors.js";
|
|
18
18
|
import { isTerminalLaneState } from "./types.js";
|
|
19
19
|
import { accountMaxRunning } from "./config.js";
|
|
20
|
-
import {
|
|
20
|
+
import { readAllLanes } from "./store.js";
|
|
21
21
|
import { loadQuotaState, quotaBlockFor } from "./quota.js";
|
|
22
22
|
// Provider home helpers live in a leaf module so bot code can use them
|
|
23
23
|
// without importing the lane store; re-exported for existing callers.
|
|
@@ -204,7 +204,7 @@ export function lastStartedAt(lanes, provider, accountId) {
|
|
|
204
204
|
return latest;
|
|
205
205
|
}
|
|
206
206
|
function defaultLoadLanes(hqRoot) {
|
|
207
|
-
return
|
|
207
|
+
return readAllLanes(hqRoot);
|
|
208
208
|
}
|
|
209
209
|
function compareEligible(a, b) {
|
|
210
210
|
if (a.occupying !== b.occupying)
|
|
@@ -90,6 +90,12 @@ export declare function selectClaudeAccount(input: {
|
|
|
90
90
|
actualTargetHost?: LaneHost;
|
|
91
91
|
unavailableHosts?: readonly BalanceHostGap[];
|
|
92
92
|
}): ClaudeAccountSelection;
|
|
93
|
+
export declare function selectCompanyOutpostClaudeAccount(input: {
|
|
94
|
+
target: BalanceHostSnapshot;
|
|
95
|
+
company?: LaneCompanyRef;
|
|
96
|
+
explicitAccount?: string;
|
|
97
|
+
requestedPlacement?: LanePlacementPolicy | null;
|
|
98
|
+
}): ClaudeAccountSelection;
|
|
93
99
|
export declare function accountLoadsForReport(input: {
|
|
94
100
|
hosts: readonly BalanceHostSnapshot[];
|
|
95
101
|
config: LanesConfig;
|