@codyswann/lisa 4.81.3 → 4.81.5
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/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +52 -14
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/validate-config.mjs +30 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +15 -8
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/references/runbook-template.md +4 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-manager.mjs +5 -76
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-queue.mjs +9 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-setup.mjs +165 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +36 -9
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/clipboard.mjs +119 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/config.mjs +22 -36
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/launch.mjs +1 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/repo-detect.mjs +205 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/session-manager.mjs +16 -13
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/setup-checks.mjs +168 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/token.mjs +98 -28
- package/plugins/lisa/.codex-plugin/skills/lisa-setup-session-manager/SKILL.md +57 -22
- package/plugins/lisa/rules/reference/config-resolution.md +1 -0
- package/plugins/lisa/scripts/ready-queue-order.mjs +34 -14
- package/plugins/lisa/skills/lisa-secrets-access/scripts/validate-config.mjs +30 -0
- package/plugins/lisa/skills/lisa-session-manager/SKILL.md +15 -8
- package/plugins/lisa/skills/lisa-session-manager/references/runbook-template.md +4 -3
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-manager.mjs +5 -76
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-queue.mjs +9 -3
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-setup.mjs +165 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +36 -9
- package/plugins/lisa/skills/lisa-session-manager/scripts/clipboard.mjs +119 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/config.mjs +22 -36
- package/plugins/lisa/skills/lisa-session-manager/scripts/launch.mjs +1 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/repo-detect.mjs +205 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/session-manager.mjs +16 -13
- package/plugins/lisa/skills/lisa-session-manager/scripts/setup-checks.mjs +168 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/token.mjs +98 -28
- package/plugins/lisa/skills/lisa-setup-session-manager/SKILL.md +57 -22
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/scripts/ready-queue-order.mjs +34 -14
- package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/validate-config.mjs +30 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +15 -8
- package/plugins/lisa-agy/skills/lisa-session-manager/references/runbook-template.md +4 -3
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-manager.mjs +5 -76
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-queue.mjs +9 -3
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-setup.mjs +165 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +36 -9
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/clipboard.mjs +119 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/config.mjs +22 -36
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/launch.mjs +1 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/repo-detect.mjs +205 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/session-manager.mjs +16 -13
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/setup-checks.mjs +168 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/token.mjs +98 -28
- package/plugins/lisa-agy/skills/lisa-setup-session-manager/SKILL.md +57 -22
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/rules/reference/config-resolution.md +1 -0
- package/plugins/lisa-copilot/scripts/ready-queue-order.mjs +34 -14
- package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/validate-config.mjs +30 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +15 -8
- package/plugins/lisa-copilot/skills/lisa-session-manager/references/runbook-template.md +4 -3
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-manager.mjs +5 -76
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-queue.mjs +9 -3
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-setup.mjs +165 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +36 -9
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/clipboard.mjs +119 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/config.mjs +22 -36
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/launch.mjs +1 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/repo-detect.mjs +205 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/session-manager.mjs +16 -13
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/setup-checks.mjs +168 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/token.mjs +98 -28
- package/plugins/lisa-copilot/skills/lisa-setup-session-manager/SKILL.md +57 -22
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/rules/config-resolution-reference.mdc +1 -0
- package/plugins/lisa-cursor/scripts/ready-queue-order.mjs +34 -14
- package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/validate-config.mjs +30 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +15 -8
- package/plugins/lisa-cursor/skills/lisa-session-manager/references/runbook-template.md +4 -3
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-manager.mjs +5 -76
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-queue.mjs +9 -3
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-setup.mjs +165 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +36 -9
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/clipboard.mjs +119 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/config.mjs +22 -36
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/launch.mjs +1 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/repo-detect.mjs +205 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/session-manager.mjs +16 -13
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/setup-checks.mjs +168 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/token.mjs +98 -28
- package/plugins/lisa-cursor/skills/lisa-setup-session-manager/SKILL.md +57 -22
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/rules/reference/config-resolution.md +1 -0
- package/plugins/lisa-devin/scripts/ready-queue-order.mjs +34 -14
- package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/validate-config.mjs +30 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +15 -8
- package/plugins/lisa-devin/skills/lisa-session-manager/references/runbook-template.md +4 -3
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-manager.mjs +5 -76
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-queue.mjs +9 -3
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-setup.mjs +165 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +36 -9
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/clipboard.mjs +119 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/config.mjs +22 -36
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/launch.mjs +1 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/repo-detect.mjs +205 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/session-manager.mjs +16 -13
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/setup-checks.mjs +168 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/token.mjs +98 -28
- package/plugins/lisa-devin/skills/lisa-setup-session-manager/SKILL.md +57 -22
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/rules/reference/config-resolution.md +1 -0
- package/plugins/src/base/scripts/ready-queue-order.mjs +34 -14
- package/plugins/src/base/skills/lisa-secrets-access/scripts/validate-config.mjs +30 -0
- package/plugins/src/base/skills/lisa-session-manager/SKILL.md +15 -8
- package/plugins/src/base/skills/lisa-session-manager/references/runbook-template.md +4 -3
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-manager.mjs +5 -76
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-queue.mjs +9 -3
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-runtime.mjs +1 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-setup.mjs +165 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +36 -9
- package/plugins/src/base/skills/lisa-session-manager/scripts/clipboard.mjs +119 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/config.mjs +22 -36
- package/plugins/src/base/skills/lisa-session-manager/scripts/launch.mjs +1 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/repo-detect.mjs +205 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/session-manager.mjs +16 -13
- package/plugins/src/base/skills/lisa-session-manager/scripts/setup-checks.mjs +168 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/token.mjs +98 -28
- package/plugins/src/base/skills/lisa-setup-session-manager/SKILL.md +57 -22
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The Telegram bot token the manager needs: validated, stored in
|
|
3
3
|
* `<stateDir>/.env` (dir 0700, file 0600), read from the operator's terminal
|
|
4
|
-
* with echo off
|
|
4
|
+
* with echo off or from the clipboard (`--from-clipboard`, for when no TTY is
|
|
5
|
+
* reachable), and never put in argv, a return value, an error message or a
|
|
5
6
|
* log line. An existing token is replaced only on request. Split out of
|
|
6
7
|
* launch.mjs, which re-exports everything here.
|
|
7
8
|
* @module token
|
|
@@ -10,6 +11,7 @@ import { randomUUID } from "node:crypto";
|
|
|
10
11
|
import * as nodeFs from "node:fs";
|
|
11
12
|
import path from "node:path";
|
|
12
13
|
|
|
14
|
+
import { readClipboard } from "./clipboard.mjs";
|
|
13
15
|
import { LaunchError, resolveStateDir } from "./state-dir.mjs";
|
|
14
16
|
|
|
15
17
|
/** The shape of a BotFather token: `<bot id>:<secret>`. */
|
|
@@ -94,41 +96,110 @@ function shellQuote(word) {
|
|
|
94
96
|
* input - Script and project locations, and whether to carry `--replace`
|
|
95
97
|
* @returns {string} One shell line
|
|
96
98
|
*/
|
|
97
|
-
export function buildStoreTokenCommand({
|
|
99
|
+
export function buildStoreTokenCommand({
|
|
100
|
+
scriptsDir,
|
|
101
|
+
projectRoot,
|
|
102
|
+
replace,
|
|
103
|
+
fromClipboard = false,
|
|
104
|
+
}) {
|
|
98
105
|
const script = shellQuote(path.join(scriptsDir, "session-manager.mjs"));
|
|
99
|
-
const
|
|
100
|
-
|
|
106
|
+
const flags =
|
|
107
|
+
(replace ? " --replace" : "") + (fromClipboard ? " --from-clipboard" : "");
|
|
108
|
+
return `node ${script} store-token${flags} --project-root ${shellQuote(projectRoot)}`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Why `store-token` cannot prompt here, and the two ways forward. */
|
|
112
|
+
const NO_TTY_HINT =
|
|
113
|
+
"No terminal to prompt on, and Claude Code's ! prefix has no TTY either. " +
|
|
114
|
+
"Run `command` in a separate terminal app, or copy the token from " +
|
|
115
|
+
"BotFather and run `clipboardCommand`.";
|
|
116
|
+
|
|
117
|
+
/** The `invalid` outcome; names the expected shape, never the input. */
|
|
118
|
+
const INVALID = Object.freeze({
|
|
119
|
+
stored: false,
|
|
120
|
+
reason: "invalid",
|
|
121
|
+
message:
|
|
122
|
+
"That does not look like a Telegram bot token " +
|
|
123
|
+
"(expected <digits>:<30 or more letters, digits, _ or ->).",
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Refuse to overwrite an existing token unless `replace` was asked for: a
|
|
128
|
+
* second project that shares this state dir by mistake would otherwise
|
|
129
|
+
* silently take over the first project's bot.
|
|
130
|
+
* @param {string} stateDir - Resolved state dir
|
|
131
|
+
* @param {boolean} replace - `--replace`
|
|
132
|
+
* @param {{ fs?: { existsSync?: (p: string) => boolean } }} io - Seams
|
|
133
|
+
*/
|
|
134
|
+
function assertReplaceable(stateDir, replace, io) {
|
|
135
|
+
const existing = path.join(stateDir, TOKEN_FILE_NAME);
|
|
136
|
+
const exists = io.fs?.existsSync ?? nodeFs.existsSync;
|
|
137
|
+
if (!replace && exists(existing)) {
|
|
138
|
+
throw new LaunchError(
|
|
139
|
+
`A bot token already exists at ${existing}. Nothing was changed. ` +
|
|
140
|
+
`Re-run store-token with --replace to overwrite it.`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Store the bot token from the system clipboard, with no TTY needed.
|
|
147
|
+
*
|
|
148
|
+
* Same validation and the same existing-token rule as the prompt. The
|
|
149
|
+
* clipboard is cleared only after a successful store, so a failed attempt
|
|
150
|
+
* leaves the operator's copy in place to retry with. The token is never
|
|
151
|
+
* returned, and an invalid value is reported by shape, never echoed.
|
|
152
|
+
* @param {{ stateDir: string, replace?: boolean,
|
|
153
|
+
* env?: Record<string, string | undefined>, homedir?: string,
|
|
154
|
+
* io?: { readClipboard?: typeof readClipboard, fs?: object } }} input -
|
|
155
|
+
* Configured state dir, the `--replace` flag and seams
|
|
156
|
+
* @returns {{ stored: true, path: string, clipboardCleared: boolean } |
|
|
157
|
+
* { stored: false, reason: "empty" | "invalid" | "unsupported" |
|
|
158
|
+
* "unavailable" | "failed", message: string }} Outcome
|
|
159
|
+
*/
|
|
160
|
+
export function storeTokenFromClipboard(input) {
|
|
161
|
+
const { replace = false, io = {} } = input;
|
|
162
|
+
const stateDir = resolveStateDir(input.stateDir, input);
|
|
163
|
+
assertReplaceable(stateDir, replace, io);
|
|
164
|
+
const clip = (io.readClipboard ?? readClipboard)();
|
|
165
|
+
if (!clip.ok) {
|
|
166
|
+
return { stored: false, reason: clip.reason, message: clip.message };
|
|
167
|
+
}
|
|
168
|
+
const token = clip.text.trim();
|
|
169
|
+
if (!token) {
|
|
170
|
+
return {
|
|
171
|
+
stored: false,
|
|
172
|
+
reason: "empty",
|
|
173
|
+
message: "The clipboard is empty.",
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (!validateBotToken(token)) return { ...INVALID };
|
|
177
|
+
const written = writeTokenFile(stateDir, token, io);
|
|
178
|
+
return { stored: true, ...written, clipboardCleared: clip.clear() };
|
|
101
179
|
}
|
|
102
180
|
|
|
103
181
|
/**
|
|
104
182
|
* Prompt for the bot token on the operator's terminal and store it.
|
|
105
183
|
*
|
|
106
|
-
* An existing token is never overwritten without `replace
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* one.
|
|
184
|
+
* An existing token is never overwritten without `replace`. With no TTY this
|
|
185
|
+
* does not prompt and does not fail: it returns the exact command for the
|
|
186
|
+
* operator to run in a separate terminal app, and the `--from-clipboard` form
|
|
187
|
+
* of it, because an agent's Bash (and Claude Code's `!` prefix) can never
|
|
188
|
+
* answer a prompt and a hung setup looks like a slow one.
|
|
112
189
|
* @param {{ stateDir: string, scriptsDir: string, projectRoot: string,
|
|
113
190
|
* replace?: boolean, env?: Record<string, string | undefined>,
|
|
114
191
|
* homedir?: string, io?: { canPrompt?: () => boolean,
|
|
115
192
|
* promptSecret?: (message: string) => string, fs?: object } }} input -
|
|
116
193
|
* Configured state dir, locations, the `--replace` flag and seams
|
|
117
194
|
* @returns {Promise<{ stored: true, path: string } |
|
|
118
|
-
* { stored: false, reason: "no-tty",
|
|
195
|
+
* { stored: false, reason: "no-tty", message: string, command: string,
|
|
196
|
+
* clipboardCommand: string } |
|
|
119
197
|
* { stored: false, reason: "empty" | "invalid", message: string }>} Outcome
|
|
120
198
|
*/
|
|
121
199
|
export async function storeToken(input) {
|
|
122
200
|
const { scriptsDir, projectRoot, replace = false, io = {} } = input;
|
|
123
201
|
const stateDir = resolveStateDir(input.stateDir, input);
|
|
124
|
-
|
|
125
|
-
const exists = io.fs?.existsSync ?? nodeFs.existsSync;
|
|
126
|
-
if (!replace && exists(existing)) {
|
|
127
|
-
throw new LaunchError(
|
|
128
|
-
`A bot token already exists at ${existing}. Nothing was changed. ` +
|
|
129
|
-
`Re-run store-token with --replace to overwrite it.`
|
|
130
|
-
);
|
|
131
|
-
}
|
|
202
|
+
assertReplaceable(stateDir, replace, io);
|
|
132
203
|
const loaded =
|
|
133
204
|
io.canPrompt && io.promptSecret ? null : await loadPromptSecret();
|
|
134
205
|
const canPrompt = io.canPrompt ?? (() => loaded.canPrompt());
|
|
@@ -138,7 +209,14 @@ export async function storeToken(input) {
|
|
|
138
209
|
return {
|
|
139
210
|
stored: false,
|
|
140
211
|
reason: "no-tty",
|
|
212
|
+
message: NO_TTY_HINT,
|
|
141
213
|
command: buildStoreTokenCommand({ scriptsDir, projectRoot, replace }),
|
|
214
|
+
clipboardCommand: buildStoreTokenCommand({
|
|
215
|
+
scriptsDir,
|
|
216
|
+
projectRoot,
|
|
217
|
+
replace,
|
|
218
|
+
fromClipboard: true,
|
|
219
|
+
}),
|
|
142
220
|
};
|
|
143
221
|
}
|
|
144
222
|
const typed = promptSecret(
|
|
@@ -147,15 +225,7 @@ export async function storeToken(input) {
|
|
|
147
225
|
if (!typed) {
|
|
148
226
|
return { stored: false, reason: "empty", message: "Nothing entered." };
|
|
149
227
|
}
|
|
150
|
-
if (!validateBotToken(typed)) {
|
|
151
|
-
return {
|
|
152
|
-
stored: false,
|
|
153
|
-
reason: "invalid",
|
|
154
|
-
message:
|
|
155
|
-
"That does not look like a Telegram bot token " +
|
|
156
|
-
"(expected <digits>:<30 or more letters, digits, _ or ->).",
|
|
157
|
-
};
|
|
158
|
-
}
|
|
228
|
+
if (!validateBotToken(typed)) return { ...INVALID };
|
|
159
229
|
return { stored: true, ...writeTokenFile(stateDir, typed, io) };
|
|
160
230
|
}
|
|
161
231
|
|
|
@@ -44,16 +44,31 @@ writes `$SM`, and pass `--project-root "$ROOT"` (the absolute project root) on e
|
|
|
44
44
|
|
|
45
45
|
1. Preview: `node "$SM/session-manager.mjs" init-config --project-root "$ROOT"`. It detects
|
|
46
46
|
`projects/*/.lisa.config.json` and proposes `name`, `interval`, `repos`, `capacity`, `stall` and a
|
|
47
|
-
per-project `notify.stateDir`.
|
|
47
|
+
per-project `notify.stateDir`. Repo detection leaves out linked worktrees and keeps one checkout
|
|
48
|
+
per remote, so ticket worktrees and second clones under `projects/` are not proposed. Show the
|
|
49
|
+
block to the operator and ask whether any repo is missing or should not be routed.
|
|
48
50
|
2. Write it: the same command with `--write`. It adds only non-secret fields and never overwrites an
|
|
49
51
|
existing block (`reason: "exists"` means keep it).
|
|
50
|
-
3.
|
|
51
|
-
|
|
52
|
+
3. Each repo's `hints` are a draft: its name plus one per well-known dependency (`NestJS`, `Expo`,
|
|
53
|
+
`AWS CDK`, ...). Ask the operator to correct them and add the areas that identify the repo
|
|
54
|
+
(e.g. `api`: `["NestJS","migrations"]`, `web`: `["Expo","screens"]`), and whether to
|
|
52
55
|
set `sessionManager.trustedAuthorIds`. Without it, any author's Ready item reaches a
|
|
53
56
|
bypass-permissions worker; say so plainly. The list holds stable tracker user ids as strings,
|
|
54
57
|
never logins: the GitHub numeric user id (`gh api users/<login> --jq .id`), the Jira
|
|
55
58
|
`accountId`, or the Linear user id. A login matches no one and silently excludes every item.
|
|
56
|
-
4. `
|
|
59
|
+
4. Set `sessionManager.operatorIds` to a non-empty **array** holding the operator's own tracker
|
|
60
|
+
user id, e.g. `"operatorIds": ["<operator-id>"]` (a bare string fails `validate`). Look up the
|
|
61
|
+
OPERATOR, not the credential: `gh api user` / `viewer.id` return whoever the tracker credential
|
|
62
|
+
belongs to, which is the agent account in exactly the case this key exists for. The manager dispatches
|
|
63
|
+
the operator's assigned items first, then items assigned to the tracker credential's identity
|
|
64
|
+
("me"), then unassigned ones, and skips items assigned to anyone else. When the tracker
|
|
65
|
+
credential is not the operator's (an agent or bot account), leaving this unset means the
|
|
66
|
+
operator's own Ready items are never dispatched; say so plainly. Unlike `trustedAuthorIds`, this
|
|
67
|
+
is matched against the assignee, exactly and case-sensitively, so use the same kind of id as
|
|
68
|
+
"me", spelled as the tracker API returns it: the GitHub **login** (`gh api users/<login> --jq
|
|
69
|
+
.login`), the Jira `accountId`, or the Linear user id (the operator's entry in the team's member
|
|
70
|
+
list, or `viewer.id` only when the operator runs the lookup with their own credential).
|
|
71
|
+
5. `node "$SM/session-manager.mjs" validate --project-root "$ROOT"` must print `valid: true`.
|
|
57
72
|
|
|
58
73
|
## Step 3: Store the bot token
|
|
59
74
|
|
|
@@ -63,8 +78,14 @@ The operator creates a bot with @BotFather, one per project. Then run
|
|
|
63
78
|
- `stored: true`: done.
|
|
64
79
|
- Exit 2 because a token already exists: keep it (re-running setup is safe). Only when the operator
|
|
65
80
|
says the stored token is wrong or belongs to another project, re-run with `store-token --replace`.
|
|
66
|
-
- `reason: "no-tty"` (an agent's Bash has no terminal):
|
|
67
|
-
|
|
81
|
+
- `reason: "no-tty"` (an agent's Bash has no terminal): offer the operator both routes, and say
|
|
82
|
+
plainly that Claude Code's `!` prefix has no terminal either, so it fails the same way:
|
|
83
|
+
- **Clipboard (simplest):** they copy the token from the BotFather chat and tell you; then run
|
|
84
|
+
`clipboardCommand` from the output (`store-token --from-clipboard`). It validates the token,
|
|
85
|
+
stores it, never prints it, and clears the clipboard. On `stored: false`, say what `message`
|
|
86
|
+
reports and ask them to copy it again.
|
|
87
|
+
- **Separate terminal app:** print `command` and ask them to run it in Terminal, iTerm or similar,
|
|
88
|
+
outside the agent, where it prompts with echo off. Wait for them to confirm.
|
|
68
89
|
- `empty` / `invalid`: say what was wrong and ask again.
|
|
69
90
|
|
|
70
91
|
Never ask for the token in chat, never echo, log or commit it, and never put it in
|
|
@@ -99,14 +120,24 @@ If `.lisa/automations/session-manager.runbook.md` does not exist, copy
|
|
|
99
120
|
`$SM/../references/runbook-template.md` there. Never overwrite an existing runbook: it is the
|
|
100
121
|
project's. It is checked in, like every automation runbook (`automation-runbook-contract`).
|
|
101
122
|
|
|
102
|
-
## Step 7:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
123
|
+
## Step 7: Check for competing intake loops
|
|
124
|
+
|
|
125
|
+
The scheduled `intake-repair` loop can re-dispatch an item a local worker is still building (it treats
|
|
126
|
+
a claimed item with no tracker activity for `intake.repair.staleAfterHours` as stalled), and
|
|
127
|
+
`intake-tickets` competes for the same Ready items. Find out whether either is running before you
|
|
128
|
+
start the manager; do not leave the operator to check.
|
|
129
|
+
|
|
130
|
+
1. Run `node "$SM/session-manager.mjs" coexistence --project-root "$ROOT"`. For each loop it reports
|
|
131
|
+
the last run recorded in this project's run log and whether that is `recent`. `live` lists the
|
|
132
|
+
loops that ran recently.
|
|
133
|
+
2. A run log is evidence, not proof: also list your runtime's scheduler for those loop names (Claude
|
|
134
|
+
Code: the `/schedule` listing of claude.ai routines; Codex: automations; a `lisa-<loop>.yml`
|
|
135
|
+
workflow with a `schedule:` trigger on GitHub Actions).
|
|
136
|
+
3. Report what you found, per loop, in one line each. Only for a loop that is live (a recent run, or a
|
|
137
|
+
scheduler entry): recommend tearing down `intake-tickets` (`/lisa:tear-down-automations
|
|
138
|
+
intake-tickets`) and either raising `intake.repair.staleAfterHours` above
|
|
139
|
+
`stall.noOutputMinutes × stall.maxAttempts` or tearing down `intake-repair`. When neither is live,
|
|
140
|
+
say so and move on.
|
|
110
141
|
|
|
111
142
|
## Step 8: Accept workspace trust in each worker repo
|
|
112
143
|
|
|
@@ -115,12 +146,15 @@ folder?" prompt: until someone has accepted it in a directory, `claude --bg` ref
|
|
|
115
146
|
and `spawn` exits 2 saying so. Do this once per routed repo (or once for the root on a single-repo
|
|
116
147
|
project), on every machine that runs the manager:
|
|
117
148
|
|
|
118
|
-
1.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
accept
|
|
149
|
+
1. Run `node "$SM/session-manager.mjs" trust-status --project-root "$ROOT"`. It lists every
|
|
150
|
+
directory workers start in (each routed repo, or the root on a single-repo project) with whether
|
|
151
|
+
Claude Code has already recorded trust for it. `needsTrust` lists the ones that are not
|
|
152
|
+
`trusted: true`. When it is empty, this step is done: say so.
|
|
153
|
+
2. For each directory in `needsTrust`, ask the operator, in a separate terminal app (not the agent's
|
|
154
|
+
Bash or Claude Code's `!` prefix), to run `claude` once in that directory, accept the trust prompt,
|
|
155
|
+
then exit. An agent's Bash cannot answer that prompt, so never try to accept it for them. Then
|
|
156
|
+
re-run `trust-status` to confirm. (`trusted: "unknown"` means Claude Code's state file could not be
|
|
157
|
+
read; treat it as needing trust.)
|
|
124
158
|
3. Re-run this step whenever a repo is added to `sessionManager.repos`.
|
|
125
159
|
|
|
126
160
|
## Step 9: Start and pair
|
|
@@ -154,5 +188,6 @@ confirm the "Session manager Telegram isolation?" check is green. Fix every warn
|
|
|
154
188
|
`node "$SM/session-manager.mjs" status --project-root "$ROOT"` should show the manager running.
|
|
155
189
|
|
|
156
190
|
Report: the config block written (or kept), where the token lives (the path, never the value), the
|
|
157
|
-
plugin scope result, the runbook path, which repo dirs
|
|
158
|
-
tmux session name, and the
|
|
191
|
+
plugin scope result, the runbook path, which repo dirs were already trusted and which the operator
|
|
192
|
+
accepted trust in, what the competing-loop check found, the manager's tmux session name, and the
|
|
193
|
+
doctor result.
|
|
@@ -733,6 +733,7 @@ bypassed). `/lisa:setup:session-manager` writes it, detecting a multi-repo layou
|
|
|
733
733
|
| `sessionManager.notify.provider` | no | `telegram` | Only `telegram` is implemented. |
|
|
734
734
|
| `sessionManager.notify.stateDir` | **yes** | — | This project's own Telegram state dir. Never the shared default `~/.claude/channels/telegram`, because one bot per state dir is how projects stay isolated. Setup writes `~/.claude/channels/telegram-<project>`. |
|
|
735
735
|
| `sessionManager.trustedAuthorIds` | no | — | Optional list of **stable tracker user ids**, as strings: the GitHub numeric user id (`gh api users/<login> --jq .id`), the Jira `accountId`, or the Linear user id. Not logins or display names: matching compares ids, so a login silently matches no one and excludes every item. When set, the manager takes only items authored by these people. |
|
|
736
|
+
| `sessionManager.operatorIds` | no | — | Optional, non-empty list of the people the manager works for, as tracker user ids matched against the **assignee** the same way "me" is: the GitHub **login**, the Jira `accountId`, or the Linear user id, spelled exactly as the tracker API returns it (matching is case-sensitive, so look the OPERATOR up rather than typing from memory: `gh api users/<operator-login> --jq .login` returns the canonical GitHub spelling. Do not use `gh api user`, which returns whoever the credential belongs to — the agent account, when that is the case this key exists for). Dispatch order is assigned to an operator, then to "me" (the tracker credential's identity), then unassigned; items assigned to anyone else are skipped. Set it whenever the tracker credential is not the operator's own (an agent account), or the operator's Ready items are never dispatched. |
|
|
736
737
|
|
|
737
738
|
- **Non-secret only.** The bot token lives in `<stateDir>/.env` (directory 0700, file 0600),
|
|
738
739
|
written by setup. A credential-named field or a token-shaped value anywhere in this block is a
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Vendor-neutral Ready-queue normalization and
|
|
3
|
+
* Vendor-neutral Ready-queue normalization and operator-first dispatch order.
|
|
4
4
|
*
|
|
5
5
|
* ## Why this exists
|
|
6
6
|
*
|
|
7
7
|
* Intake has always taken Ready work in whatever order the tracker returned
|
|
8
8
|
* it, and `intake.assignee` only NARROWS a selection — it never ranks one. A
|
|
9
9
|
* dispatcher that runs several workers at once needs a stable answer to "what
|
|
10
|
-
* next?":
|
|
11
|
-
* then
|
|
12
|
-
*
|
|
10
|
+
* next?": work assigned to the operator first (the person the dispatcher works
|
|
11
|
+
* for), then work assigned to me (the identity the tracker credential belongs
|
|
12
|
+
* to, often an agent account rather than the operator), then unassigned work,
|
|
13
|
+
* most urgent and oldest first. Work assigned to anyone else is theirs, so it
|
|
14
|
+
* is excluded, never re-ordered. When the credential IS the operator's, the
|
|
15
|
+
* first two groups coincide. With "me" as the only identity, an operator whose
|
|
16
|
+
* credential is an agent account had every one of their own items excluded as
|
|
17
|
+
* someone else's (CodySwannGT/lisa#4467).
|
|
13
18
|
*
|
|
14
19
|
* The three trackers disagree on every field this needs — GitHub has priority
|
|
15
20
|
* LABELS, Linear a native 0..4 number where 0 means "none", Jira a priority
|
|
@@ -252,12 +257,18 @@ function shape(input) {
|
|
|
252
257
|
* Order matters only for the reason reported: an item can fail several rules,
|
|
253
258
|
* and "someone else owns it" is the most useful thing to say about it.
|
|
254
259
|
* @param {Record<string, any>} item
|
|
255
|
-
* @param {{ me: string | null, trusted: ReadonlySet<string>, humanNeededLabel: string }} context
|
|
260
|
+
* @param {{ me: string | null, operators: ReadonlySet<string>, trusted: ReadonlySet<string>, humanNeededLabel: string }} context
|
|
256
261
|
* @returns {string | null}
|
|
257
262
|
*/
|
|
258
263
|
function exclusionReason(item, context) {
|
|
259
264
|
const assignee = idOrNull(item.assigneeId);
|
|
260
|
-
if (
|
|
265
|
+
if (
|
|
266
|
+
assignee !== null &&
|
|
267
|
+
assignee !== context.me &&
|
|
268
|
+
!context.operators.has(assignee)
|
|
269
|
+
) {
|
|
270
|
+
return "assigned-to-other";
|
|
271
|
+
}
|
|
261
272
|
if (item.isContainer === true) return "container";
|
|
262
273
|
if (
|
|
263
274
|
isHumanGated({
|
|
@@ -293,20 +304,25 @@ function compareWithinGroup(left, right) {
|
|
|
293
304
|
}
|
|
294
305
|
|
|
295
306
|
/**
|
|
296
|
-
* Order normalized Ready items for dispatch, mine
|
|
307
|
+
* Order normalized Ready items for dispatch: the operator's, then mine, then
|
|
308
|
+
* unassigned.
|
|
297
309
|
*
|
|
298
|
-
* Group 0 is assigned to `me`, group
|
|
299
|
-
* rank ascending, then creation time ascending, then
|
|
300
|
-
* tiebreak. Excluded items keep their input order. With no
|
|
301
|
-
* assigned item is someone else's — the safe
|
|
302
|
-
* assigned work steals it.
|
|
310
|
+
* Group 0 is assigned to an operator, group 1 to `me`, group 2 unassigned;
|
|
311
|
+
* within a group, priority rank ascending, then creation time ascending, then
|
|
312
|
+
* ref as a stable tiebreak. Excluded items keep their input order. With no
|
|
313
|
+
* `me` and no operators, every assigned item is someone else's — the safe
|
|
314
|
+
* direction, since claiming assigned work steals it.
|
|
315
|
+
*
|
|
316
|
+
* `operators` match the way `me` does, against the normalized assignee id:
|
|
317
|
+
* GitHub login, Jira accountId, Linear user id.
|
|
303
318
|
* @param {readonly Record<string, any>[]} items - Normalized items
|
|
304
|
-
* @param {{ me?: string | null, trustedAuthorIds?: readonly unknown[], humanNeededLabel?: string }} [options]
|
|
319
|
+
* @param {{ me?: string | null, operators?: readonly unknown[], trustedAuthorIds?: readonly unknown[], humanNeededLabel?: string }} [options]
|
|
305
320
|
* @returns {{ ordered: Record<string, any>[], excluded: { ref: string, reason: string }[] }}
|
|
306
321
|
*/
|
|
307
322
|
export function orderReadyQueue(items, options = {}) {
|
|
308
323
|
const context = {
|
|
309
324
|
me: idOrNull(options.me),
|
|
325
|
+
operators: new Set((options.operators ?? []).map(idOrNull).filter(Boolean)),
|
|
310
326
|
trusted: new Set(
|
|
311
327
|
(options.trustedAuthorIds ?? []).map(idOrNull).filter(Boolean)
|
|
312
328
|
),
|
|
@@ -319,7 +335,11 @@ export function orderReadyQueue(items, options = {}) {
|
|
|
319
335
|
const eligible = judged
|
|
320
336
|
.filter(one => one.reason === null)
|
|
321
337
|
.map(one => one.item);
|
|
322
|
-
const group = item =>
|
|
338
|
+
const group = item => {
|
|
339
|
+
const assignee = idOrNull(item.assigneeId);
|
|
340
|
+
if (assignee === null) return 2;
|
|
341
|
+
return context.operators.has(assignee) ? 0 : 1;
|
|
342
|
+
};
|
|
323
343
|
|
|
324
344
|
return {
|
|
325
345
|
ordered: [...eligible].sort(
|
|
@@ -727,6 +727,35 @@ function findCredentials(value, path) {
|
|
|
727
727
|
);
|
|
728
728
|
}
|
|
729
729
|
|
|
730
|
+
/**
|
|
731
|
+
* Validate `sessionManager.operatorIds`: the people the manager works for,
|
|
732
|
+
* whose assigned items it dispatches first. Matched against the assignee the
|
|
733
|
+
* way "me" is, so the GitHub entry is a login, not the numeric id
|
|
734
|
+
* `trustedAuthorIds` takes. An empty list reads as configured but names no
|
|
735
|
+
* one, so it is refused like an empty `trustedAuthorIds`.
|
|
736
|
+
* @param {unknown} ids The value, if present.
|
|
737
|
+
* @returns {string[]} Problems found.
|
|
738
|
+
*/
|
|
739
|
+
function validateOperatorIds(ids) {
|
|
740
|
+
if (ids === undefined) return [];
|
|
741
|
+
if (
|
|
742
|
+
!Array.isArray(ids) ||
|
|
743
|
+
!ids.every(id => typeof id === "string" && id.trim() !== "")
|
|
744
|
+
) {
|
|
745
|
+
return [
|
|
746
|
+
`sessionManager.operatorIds must be an array of tracker user ids as ` +
|
|
747
|
+
`strings, matched against the assignee: the GitHub login, the Jira ` +
|
|
748
|
+
`accountId or the Linear user id.`,
|
|
749
|
+
];
|
|
750
|
+
}
|
|
751
|
+
return ids.length === 0
|
|
752
|
+
? [
|
|
753
|
+
`sessionManager.operatorIds must name at least one person. Remove ` +
|
|
754
|
+
`the key instead if the manager works only for its own identity.`,
|
|
755
|
+
]
|
|
756
|
+
: [];
|
|
757
|
+
}
|
|
758
|
+
|
|
730
759
|
/**
|
|
731
760
|
* Validate the opt-in `sessionManager` block.
|
|
732
761
|
*
|
|
@@ -786,6 +815,7 @@ export function validateSessionManager(block) {
|
|
|
786
815
|
`if every author's item may be dispatched.`,
|
|
787
816
|
]
|
|
788
817
|
: []),
|
|
818
|
+
...validateOperatorIds(block.operatorIds),
|
|
789
819
|
...findCredentials(block, "sessionManager"),
|
|
790
820
|
];
|
|
791
821
|
}
|
|
@@ -23,9 +23,9 @@ channels (Telegram) and cross-session messaging (`SendMessage`, `crossSessionInb
|
|
|
23
23
|
| Runtime | lisa-setup-session-manager | lisa-session-manager (manager) | `managedBy=` |
|
|
24
24
|
|---|---|---|---|
|
|
25
25
|
| Claude Code | supported | supported (reference). Needs `claude` ≥ 2.1.224, `tmux`, `bun` | supported |
|
|
26
|
-
| Codex | config, token
|
|
26
|
+
| Codex | config, token (prompt or `--from-clipboard`), runbook, `trust-status` and `coexistence` are supported. `trust-status` reads Claude Code's trust record, which is the one that matters (workers are Claude Code); accepting trust needs the `claude` CLI. `coexistence` sees only run logs, so also list Codex automations. `start` launches a Claude Code manager, so it works when the `claude` CLI is installed | the skill ships, but `cycle` refuses to run here (no `/loop`, channels or `SendMessage`); tell the operator to run `start` | rejected with the gap message |
|
|
27
27
|
| Cursor / Antigravity (agy) / Copilot / Devin | same as Codex | same as Codex | rejected |
|
|
28
|
-
| OpenCode |
|
|
28
|
+
| OpenCode | same setup subcommands as Codex, but script resolution relies on the npm rung: the CLI imports plugin-level scripts the skill-folder copy lacks, so every subcommand needs the npm package | gap | rejected |
|
|
29
29
|
|
|
30
30
|
On any runtime other than Claude Code, `cycle` stops with: "The session manager runs on Claude Code
|
|
31
31
|
only (background sessions, channels, cross-session messaging). Run `/lisa:session-manager start`
|
|
@@ -66,7 +66,12 @@ the manager.
|
|
|
66
66
|
claims go through `lisa-tracker-claim`. Never call a vendor API around them.
|
|
67
67
|
- **"Me".** Resolve once per manager run and store it with `ledger control --me <id>`: GitHub
|
|
68
68
|
`gh api user --jq .login`; Jira the accountId from the `lisa-atlassian-access` identity probe;
|
|
69
|
-
Linear `viewer.id` through `lisa-linear-access`.
|
|
69
|
+
Linear `viewer.id` through `lisa-linear-access`. "Me" is whoever the tracker credential belongs
|
|
70
|
+
to, which is often an agent account.
|
|
71
|
+
- **Operators.** `sessionManager.operatorIds` names the people the manager works for (the same
|
|
72
|
+
kind of id as "me": GitHub login, Jira accountId, Linear user id). Their assigned items come
|
|
73
|
+
first, then items assigned to "me", then unassigned. Items assigned to anyone else are never
|
|
74
|
+
dispatched. Never treat an operator's item as someone else's.
|
|
70
75
|
- **Workers** start only through `spawn`. The worker prompt is exactly
|
|
71
76
|
`/lisa:implement <REF> managedBy=<manager-name>`; `lisa-implement` owns what `managedBy=` means.
|
|
72
77
|
Never start a worker another way, and never reuse a worker for another item or a new attempt.
|
|
@@ -207,8 +212,8 @@ Skip while `capacity` reports `paused`. Otherwise:
|
|
|
207
212
|
Raw Jira issues carry `key` and `fields` (summary, priority, assignee, created, labels,
|
|
208
213
|
description, reporter, issuetype, subtasks); raw Linear nodes carry identifier, title, priority,
|
|
209
214
|
createdAt, assignee, labels, description, creator and children with their state type.
|
|
210
|
-
- `ordered` is the dispatch order
|
|
211
|
-
needs no action.
|
|
215
|
+
- `ordered` is the dispatch order: assigned to an operator, then to "me", then unassigned; each
|
|
216
|
+
group by priority, then age. `excluded` needs no action.
|
|
212
217
|
2. **While `capacity` says `can_spawn`** and items remain, take the next item that has no pending
|
|
213
218
|
question in the ledger:
|
|
214
219
|
1. Read it fully (`lisa-tracker-read`): title, description, labels, project, parent, comments.
|
|
@@ -223,9 +228,11 @@ Skip while `capacity` reports `paused`. Otherwise:
|
|
|
223
228
|
`cd "$(node "$SM/session-manager.mjs" repo-dir --repo <key> --raw --project-root "$ROOT")"`
|
|
224
229
|
(omit `--repo` on a single-repo project), invoke `lisa-tracker-claim <ref>`, then
|
|
225
230
|
`cd "$ROOT" && pwd` and confirm the path. Continue only on `claimed` or `reused` with the
|
|
226
|
-
assignee equal to "me"
|
|
227
|
-
|
|
228
|
-
|
|
231
|
+
assignee equal to "me" or to one of `sessionManager.operatorIds` (the claim assigns only an
|
|
232
|
+
unassigned item, so an operator's item keeps the operator); anything else means skip. Then
|
|
233
|
+
re-read the item with `lisa-tracker-read`: if the re-read shows an assignee that is neither
|
|
234
|
+
"me" nor an operator, or shows the state did not change to the `claimed` role, skip it
|
|
235
|
+
(someone else holds it, or the claim did not land).
|
|
229
236
|
Never spawn on the claim's word alone.
|
|
230
237
|
4. **Spawn.** `spawn <ref> [--repo <key>]`.
|
|
231
238
|
- exit 0: post `[<REF>] started in <repo> (<name>)` to Telegram.
|
|
@@ -18,9 +18,10 @@ session list from `claude agents`; and the project's own Telegram chat.
|
|
|
18
18
|
|
|
19
19
|
## Candidate selection
|
|
20
20
|
|
|
21
|
-
Leaf items in the `ready` role, ordered: assigned to
|
|
22
|
-
then
|
|
23
|
-
|
|
21
|
+
Leaf items in the `ready` role, ordered: assigned to an operator (`sessionManager.operatorIds`),
|
|
22
|
+
then to the manager's own tracker identity, then unassigned; within each, by priority, then oldest.
|
|
23
|
+
Items assigned to someone else, containers, human-held items and (when configured) items by
|
|
24
|
+
untrusted authors are skipped. As many as the machine has capacity for.
|
|
24
25
|
|
|
25
26
|
## Scope/bounds
|
|
26
27
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Manager
|
|
3
|
-
*
|
|
2
|
+
* Manager subcommands of the session-manager CLI: start, stop, status,
|
|
3
|
+
* repo-dir and validate. The setup ones (init-config, store-token,
|
|
4
|
+
* trust-status, coexistence) live in cli-setup.mjs.
|
|
4
5
|
*
|
|
5
6
|
* `start` hosts the manager in tmux. It refuses (exit 2) unless the bot
|
|
6
7
|
* token file exists with owner-only permissions in the project's own state
|
|
@@ -11,15 +12,11 @@
|
|
|
11
12
|
* manager's tmux session: workers hold claimed work and keep running.
|
|
12
13
|
* @module session-manager/cli-manager
|
|
13
14
|
*/
|
|
14
|
-
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
15
|
-
import path from "node:path";
|
|
16
|
-
|
|
17
15
|
import {
|
|
18
16
|
CliError,
|
|
19
17
|
EXIT,
|
|
20
18
|
GLOBAL_CONFIG_FILE,
|
|
21
19
|
asSetupError,
|
|
22
|
-
asSetupErrorAsync,
|
|
23
20
|
intFlag,
|
|
24
21
|
listAgents,
|
|
25
22
|
loadProject,
|
|
@@ -28,12 +25,8 @@ import {
|
|
|
28
25
|
requireLisaRepo,
|
|
29
26
|
run,
|
|
30
27
|
} from "./cli-runtime.mjs";
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
defaultProjectSlug,
|
|
34
|
-
probeOwnSession,
|
|
35
|
-
sessionSurvives,
|
|
36
|
-
} from "./isolation.mjs";
|
|
28
|
+
import { resolveRepoDir } from "./config.mjs";
|
|
29
|
+
import { probeOwnSession, sessionSurvives } from "./isolation.mjs";
|
|
37
30
|
import {
|
|
38
31
|
assertTokenPresent,
|
|
39
32
|
buildForegroundCommand,
|
|
@@ -41,7 +34,6 @@ import {
|
|
|
41
34
|
buildManagerLaunch,
|
|
42
35
|
buildStopManager,
|
|
43
36
|
resolveStateDir,
|
|
44
|
-
storeToken as storeTokenFile,
|
|
45
37
|
} from "./launch.mjs";
|
|
46
38
|
import { readLedger } from "./ledger.mjs";
|
|
47
39
|
import { parseWorkerName, scrubWorkerEnv } from "./workers.mjs";
|
|
@@ -208,69 +200,6 @@ export function validate(ctx) {
|
|
|
208
200
|
};
|
|
209
201
|
}
|
|
210
202
|
|
|
211
|
-
/**
|
|
212
|
-
* `init-config [--slug <slug>] [--write]`: the default block for this
|
|
213
|
-
* project, written to `.lisa.config.json` only with `--write` and only when
|
|
214
|
-
* no block exists. Non-secret fields only; the token never goes here.
|
|
215
|
-
* @param {object} ctx - CLI context
|
|
216
|
-
* @returns {{ json: object }} `{written,block,...}`
|
|
217
|
-
*/
|
|
218
|
-
export function initConfig(ctx) {
|
|
219
|
-
const { global } = loadProject(ctx.root);
|
|
220
|
-
if (global?.sessionManager) {
|
|
221
|
-
return {
|
|
222
|
-
json: { written: false, reason: "exists", block: global.sessionManager },
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
const slug =
|
|
226
|
-
ctx.values.slug ?? defaultProjectSlug(ctx.root, global?.github?.repo);
|
|
227
|
-
const block = asSetupError(() =>
|
|
228
|
-
buildDefaultBlock({
|
|
229
|
-
projectSlug: slug,
|
|
230
|
-
detectedRepos: detectRepos(ctx.root),
|
|
231
|
-
})
|
|
232
|
-
);
|
|
233
|
-
if (!ctx.values.write) return { json: { written: false, block } };
|
|
234
|
-
|
|
235
|
-
const file = path.join(ctx.root, GLOBAL_CONFIG_FILE);
|
|
236
|
-
if (!existsSync(file)) {
|
|
237
|
-
throw new CliError(
|
|
238
|
-
`${file} does not exist; set up Lisa in this project first.`,
|
|
239
|
-
EXIT.SETUP
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
const current = JSON.parse(readFileSync(file, "utf8"));
|
|
243
|
-
writeFileSync(
|
|
244
|
-
file,
|
|
245
|
-
`${JSON.stringify({ ...current, sessionManager: block }, null, 2)}\n`
|
|
246
|
-
);
|
|
247
|
-
return { json: { written: true, path: file, block } };
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* `store-token [--replace]`: prompt for the bot token on the operator's
|
|
252
|
-
* terminal and write `<stateDir>/.env`. An existing token is kept (exit 2)
|
|
253
|
-
* unless `--replace` is given. With no TTY it prints the command the operator
|
|
254
|
-
* must run themselves and exits 0 with `stored:false`.
|
|
255
|
-
* @param {object} ctx - CLI context
|
|
256
|
-
* @returns {Promise<{ json: object, exitCode: number }>} Outcome
|
|
257
|
-
*/
|
|
258
|
-
export async function storeToken(ctx) {
|
|
259
|
-
const config = requireConfig(ctx);
|
|
260
|
-
const result = await asSetupErrorAsync(() =>
|
|
261
|
-
storeTokenFile({
|
|
262
|
-
stateDir: config.notify?.stateDir,
|
|
263
|
-
scriptsDir: ctx.scriptsDir,
|
|
264
|
-
projectRoot: ctx.root,
|
|
265
|
-
replace: ctx.values.replace === true,
|
|
266
|
-
env: ctx.env,
|
|
267
|
-
homedir: ctx.homedir,
|
|
268
|
-
})
|
|
269
|
-
);
|
|
270
|
-
const refused = result.stored === false && result.reason !== "no-tty";
|
|
271
|
-
return { json: result, exitCode: refused ? EXIT.SETUP : EXIT.OK };
|
|
272
|
-
}
|
|
273
|
-
|
|
274
203
|
/**
|
|
275
204
|
* `status`: is the manager's tmux session up, and what does the ledger say
|
|
276
205
|
* about each worker it dispatched.
|