flyspace-cli 0.1.48 → 0.1.49
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/{chunk-F5CXKDZV.js → chunk-HTFQL66T.js} +5 -7
- package/dist/{chunk-ETFEQSMF.js → chunk-PIAF4FJX.js} +1 -1
- package/dist/{chunk-2V33REYC.js → chunk-YPKJR5LT.js} +172 -95
- package/dist/cli.js +755 -242
- package/dist/index.js +2 -2
- package/dist/{threads-S4L5QX7T.js → threads-QAVO2Z4L.js} +89 -4
- package/package.json +1 -1
- package/system.capabilities.md +5 -4
|
@@ -437,13 +437,11 @@ async function postToDashboardChannel(opts) {
|
|
|
437
437
|
}
|
|
438
438
|
const parentId = threadId ?? await createThread(supabase, channelId, text, title);
|
|
439
439
|
const body = await uploadLocalImages(text);
|
|
440
|
-
const { error } = await supabase.from("thread_replies").insert({
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}
|
|
445
|
-
if (error) throw new Error(`failed to write dashboard reply: ${error.message}`);
|
|
446
|
-
return parentId;
|
|
440
|
+
const { data, error } = await supabase.from("thread_replies").insert({ thread_id: parentId, author: AGENT_AUTHOR, body }).select("id").single();
|
|
441
|
+
if (error || !data) {
|
|
442
|
+
throw new Error(`failed to write dashboard reply: ${error?.message ?? "no row returned"}`);
|
|
443
|
+
}
|
|
444
|
+
return { threadId: parentId, replyId: data["id"] };
|
|
447
445
|
}
|
|
448
446
|
async function createThread(supabase, channelId, text, title) {
|
|
449
447
|
const { data, error } = await supabase.from("threads").insert({
|
|
@@ -3,7 +3,7 @@ import { createRequire as __flyspaceCreateRequire } from 'node:module';
|
|
|
3
3
|
const require = __flyspaceCreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
getSupabaseClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HTFQL66T.js";
|
|
7
7
|
|
|
8
8
|
// src/store/chat-admin-store.ts
|
|
9
9
|
async function listChannels(profile) {
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
setSupabaseClientFactory,
|
|
17
17
|
sweepScratchDir,
|
|
18
18
|
syncPostToDashboard
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-HTFQL66T.js";
|
|
20
20
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
import { execFile, spawn as spawn4 } from "child_process";
|
|
@@ -275,6 +275,9 @@ function stopAutomationRegistryPolling() {
|
|
|
275
275
|
import { existsSync as existsSync2, mkdirSync, realpathSync, statSync } from "fs";
|
|
276
276
|
import { homedir } from "os";
|
|
277
277
|
import { isAbsolute, relative, resolve as resolve2, sep } from "path";
|
|
278
|
+
function isPermissionMode(value) {
|
|
279
|
+
return value === "bypass" || value === "ask";
|
|
280
|
+
}
|
|
278
281
|
function isLogicalCwd(p) {
|
|
279
282
|
return /^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/.test(p);
|
|
280
283
|
}
|
|
@@ -282,6 +285,14 @@ function logicalRoot() {
|
|
|
282
285
|
return process.env["FLYSPACE_ROOT"] || resolve2(homedir(), "Flyspace");
|
|
283
286
|
}
|
|
284
287
|
var workspaceRoots = /* @__PURE__ */ new Map();
|
|
288
|
+
var workspacePermissionModes = /* @__PURE__ */ new Map();
|
|
289
|
+
async function refreshWorkspacePermissionModes() {
|
|
290
|
+
const { data, error } = await getSupabaseClient().from("workspaces").select("slug, permission_mode");
|
|
291
|
+
if (error) return;
|
|
292
|
+
workspacePermissionModes = new Map(
|
|
293
|
+
(data ?? []).filter((w) => isPermissionMode(w.permission_mode)).map((w) => [w.slug, w.permission_mode])
|
|
294
|
+
);
|
|
295
|
+
}
|
|
285
296
|
async function refreshWorkspaceRoots() {
|
|
286
297
|
const { data, error } = await getSupabaseClient().from("workspaces").select("slug, root_path");
|
|
287
298
|
if (error) return;
|
|
@@ -366,6 +377,7 @@ function rowToChannel(row) {
|
|
|
366
377
|
// isn't a clean string array reads as "no mounts", which exposes less
|
|
367
378
|
// rather than more.
|
|
368
379
|
mounts: Array.isArray(row.mounts) ? row.mounts.filter((p) => typeof p === "string").map(expandPath) : [],
|
|
380
|
+
permissionMode: isPermissionMode(row.permission_mode) ? row.permission_mode : null,
|
|
369
381
|
position: row.position,
|
|
370
382
|
automations: row.automations ?? void 0,
|
|
371
383
|
agentName: row.agent_name,
|
|
@@ -392,7 +404,7 @@ function indexRegistry(list) {
|
|
|
392
404
|
}
|
|
393
405
|
async function refreshChannelRegistry() {
|
|
394
406
|
const rootsBefore = JSON.stringify([...workspaceRoots]);
|
|
395
|
-
await refreshWorkspaceRoots();
|
|
407
|
+
await Promise.all([refreshWorkspaceRoots(), refreshWorkspacePermissionModes()]);
|
|
396
408
|
if (JSON.stringify([...workspaceRoots]) !== rootsBefore) lastSnapshot2 = void 0;
|
|
397
409
|
const { data, error } = await getSupabaseClient().from("channels").select("*").order("position", { ascending: true });
|
|
398
410
|
if (error) {
|
|
@@ -519,6 +531,10 @@ function resolveChannelEffort(channelId) {
|
|
|
519
531
|
if (!channelId) return void 0;
|
|
520
532
|
return findChannel(channelId)?.effort ?? void 0;
|
|
521
533
|
}
|
|
534
|
+
function resolveChannelPermissionMode(channelId) {
|
|
535
|
+
const channel = channelId ? findChannel(channelId) : void 0;
|
|
536
|
+
return channel?.permissionMode ?? workspacePermissionModes.get(channel?.profile ?? getProfile()) ?? "bypass";
|
|
537
|
+
}
|
|
522
538
|
function resolveChannelPrompt(channelId) {
|
|
523
539
|
if (!channelId) return void 0;
|
|
524
540
|
return findChannel(channelId)?.prompt?.trim() || void 0;
|
|
@@ -562,6 +578,7 @@ function toRow(input) {
|
|
|
562
578
|
if (input.mounts !== void 0) {
|
|
563
579
|
row["mounts"] = input.mounts.map((p) => p.trim()).filter(Boolean).map(expandPath);
|
|
564
580
|
}
|
|
581
|
+
if (input.permissionMode !== void 0) row["permission_mode"] = input.permissionMode;
|
|
565
582
|
if (input.position !== void 0) row["position"] = input.position;
|
|
566
583
|
if (input.automations !== void 0) row["automations"] = input.automations;
|
|
567
584
|
if (input.agentName !== void 0) row["agent_name"] = input.agentName;
|
|
@@ -851,6 +868,105 @@ import { resolve as resolve4, resolve as resolvePath } from "path";
|
|
|
851
868
|
import { homedir as homedir3 } from "os";
|
|
852
869
|
import { randomUUID } from "crypto";
|
|
853
870
|
|
|
871
|
+
// ../api/src/claude/models.ts
|
|
872
|
+
var GATEWAY_MODEL_OPTIONS = [
|
|
873
|
+
{ value: "deepseek-chat", label: "DeepSeek Flash \xB7 cheapest", provider: "claude", gateway: "deepseek" },
|
|
874
|
+
{ value: "deepseek-v4-pro", label: "DeepSeek Pro \xB7 smarter", provider: "claude", gateway: "deepseek" }
|
|
875
|
+
];
|
|
876
|
+
function gatewayForModel(value) {
|
|
877
|
+
if (!value) return void 0;
|
|
878
|
+
return value.toLowerCase().startsWith("deepseek") ? "deepseek" : void 0;
|
|
879
|
+
}
|
|
880
|
+
function effectiveModel(model, pinnedModel) {
|
|
881
|
+
if (!pinnedModel) return model ?? "";
|
|
882
|
+
return model && gatewayForModel(model) === gatewayForModel(pinnedModel) ? model : pinnedModel;
|
|
883
|
+
}
|
|
884
|
+
var MODEL_OPTIONS = [
|
|
885
|
+
{ value: "opus", label: "Opus", provider: "claude" },
|
|
886
|
+
{ value: "sonnet", label: "Sonnet", provider: "claude" },
|
|
887
|
+
{ value: "haiku", label: "Haiku", provider: "claude" },
|
|
888
|
+
{ value: "fable", label: "Fable", provider: "claude" }
|
|
889
|
+
];
|
|
890
|
+
var CODEX_MODEL_OPTIONS = [
|
|
891
|
+
{ value: "gpt-5.6-sol", label: "Sol \xB7 frontier", provider: "codex" },
|
|
892
|
+
{ value: "gpt-5.6-terra", label: "Terra \xB7 everyday", provider: "codex" },
|
|
893
|
+
{ value: "gpt-5.6-luna", label: "Luna \xB7 fast", provider: "codex" },
|
|
894
|
+
{ value: "gpt-5.5", label: "GPT-5.5", provider: "codex" },
|
|
895
|
+
{ value: "gpt-5.4", label: "GPT-5.4", provider: "codex" },
|
|
896
|
+
{ value: "gpt-5.4-mini", label: "GPT-5.4 Mini", provider: "codex" }
|
|
897
|
+
];
|
|
898
|
+
var RETIRED_MODELS = {};
|
|
899
|
+
function upgradeModel(value) {
|
|
900
|
+
let current = value;
|
|
901
|
+
for (let hops = 0; current && RETIRED_MODELS[current] && hops < 10; hops++) {
|
|
902
|
+
current = RETIRED_MODELS[current];
|
|
903
|
+
}
|
|
904
|
+
return current;
|
|
905
|
+
}
|
|
906
|
+
var BY_VALUE = new Map(
|
|
907
|
+
[...MODEL_OPTIONS, ...CODEX_MODEL_OPTIONS, ...GATEWAY_MODEL_OPTIONS].map((m) => [m.value, m])
|
|
908
|
+
);
|
|
909
|
+
var CLAUDE_FAMILY_LABELS = {
|
|
910
|
+
opus: "Opus",
|
|
911
|
+
sonnet: "Sonnet",
|
|
912
|
+
haiku: "Haiku",
|
|
913
|
+
// Mythos is the same model at the same price behind a different id — see
|
|
914
|
+
// the `matches` comment on the fable rate card in `store/rate-cards.ts`.
|
|
915
|
+
fable: "Fable",
|
|
916
|
+
mythos: "Fable"
|
|
917
|
+
};
|
|
918
|
+
var LONG_CONTEXT_SUFFIX = "[1m]";
|
|
919
|
+
function parseClaudeModelId(id) {
|
|
920
|
+
const undated = id.replace(/-\d{8}$/, "");
|
|
921
|
+
const match = /^claude-(opus|sonnet|haiku|fable|mythos)-([\d-]+)$/.exec(undated);
|
|
922
|
+
if (!match) return void 0;
|
|
923
|
+
const [, family, versionParts] = match;
|
|
924
|
+
return { family, version: versionParts.replace(/-/g, ".") };
|
|
925
|
+
}
|
|
926
|
+
function runnerForModel(value) {
|
|
927
|
+
if (!value) return "claude";
|
|
928
|
+
value = upgradeModel(value);
|
|
929
|
+
const known = BY_VALUE.get(value);
|
|
930
|
+
if (known) return known.provider;
|
|
931
|
+
return value.startsWith("gpt-") ? "codex" : "claude";
|
|
932
|
+
}
|
|
933
|
+
function isCodexModel(value) {
|
|
934
|
+
return !!value && runnerForModel(value) === "codex";
|
|
935
|
+
}
|
|
936
|
+
function agentLabel(agent) {
|
|
937
|
+
return agent === "codex" ? "Codex" : "Claude";
|
|
938
|
+
}
|
|
939
|
+
function modelOptionsFor(agent) {
|
|
940
|
+
return agent === "codex" ? CODEX_MODEL_OPTIONS : MODEL_OPTIONS;
|
|
941
|
+
}
|
|
942
|
+
var ALL_MODEL_OPTIONS = [
|
|
943
|
+
...MODEL_OPTIONS,
|
|
944
|
+
...CODEX_MODEL_OPTIONS,
|
|
945
|
+
...GATEWAY_MODEL_OPTIONS
|
|
946
|
+
];
|
|
947
|
+
function isAllowedModel(value) {
|
|
948
|
+
return BY_VALUE.has(upgradeModel(value));
|
|
949
|
+
}
|
|
950
|
+
function modelQuotaKey(value) {
|
|
951
|
+
const known = BY_VALUE.get(value);
|
|
952
|
+
if (known) return known.value;
|
|
953
|
+
const bare = value.endsWith(LONG_CONTEXT_SUFFIX) ? value.slice(0, -LONG_CONTEXT_SUFFIX.length) : value;
|
|
954
|
+
const parsed = parseClaudeModelId(bare);
|
|
955
|
+
if (!parsed) return value;
|
|
956
|
+
return parsed.family === "mythos" ? "fable" : parsed.family;
|
|
957
|
+
}
|
|
958
|
+
function modelLabel(value) {
|
|
959
|
+
if (!value) return "Default";
|
|
960
|
+
const known = BY_VALUE.get(value);
|
|
961
|
+
if (known) return known.label;
|
|
962
|
+
const longContext = value.endsWith(LONG_CONTEXT_SUFFIX);
|
|
963
|
+
const bare = longContext ? value.slice(0, -LONG_CONTEXT_SUFFIX.length) : value;
|
|
964
|
+
const parsed = parseClaudeModelId(bare);
|
|
965
|
+
if (!parsed) return value;
|
|
966
|
+
const label = `${CLAUDE_FAMILY_LABELS[parsed.family]} ${parsed.version}`;
|
|
967
|
+
return longContext ? `${label} \xB7 1M context` : label;
|
|
968
|
+
}
|
|
969
|
+
|
|
854
970
|
// src/claude/container.ts
|
|
855
971
|
import { execFileSync } from "child_process";
|
|
856
972
|
import { createHash } from "crypto";
|
|
@@ -1343,78 +1459,6 @@ function setOutputStyleDefault(claudeConfigDir, id) {
|
|
|
1343
1459
|
return true;
|
|
1344
1460
|
}
|
|
1345
1461
|
|
|
1346
|
-
// ../api/src/claude/models.ts
|
|
1347
|
-
var MODEL_OPTIONS = [
|
|
1348
|
-
{ value: "opus", label: "Opus", provider: "claude" },
|
|
1349
|
-
{ value: "sonnet", label: "Sonnet", provider: "claude" },
|
|
1350
|
-
{ value: "haiku", label: "Haiku", provider: "claude" },
|
|
1351
|
-
{ value: "fable", label: "Fable", provider: "claude" }
|
|
1352
|
-
];
|
|
1353
|
-
var CODEX_MODEL_OPTIONS = [
|
|
1354
|
-
{ value: "gpt-5.6-sol", label: "Sol \xB7 frontier", provider: "codex" },
|
|
1355
|
-
{ value: "gpt-5.6-terra", label: "Terra \xB7 everyday", provider: "codex" },
|
|
1356
|
-
{ value: "gpt-5.6-luna", label: "Luna \xB7 fast", provider: "codex" },
|
|
1357
|
-
{ value: "gpt-5.5", label: "GPT-5.5", provider: "codex" },
|
|
1358
|
-
{ value: "gpt-5.4", label: "GPT-5.4", provider: "codex" },
|
|
1359
|
-
{ value: "gpt-5.4-mini", label: "GPT-5.4 Mini", provider: "codex" }
|
|
1360
|
-
];
|
|
1361
|
-
var BY_VALUE = new Map([...MODEL_OPTIONS, ...CODEX_MODEL_OPTIONS].map((m) => [m.value, m]));
|
|
1362
|
-
var CLAUDE_FAMILY_LABELS = {
|
|
1363
|
-
opus: "Opus",
|
|
1364
|
-
sonnet: "Sonnet",
|
|
1365
|
-
haiku: "Haiku",
|
|
1366
|
-
// Mythos is the same model at the same price behind a different id — see
|
|
1367
|
-
// the `matches` comment on the fable rate card in `store/rate-cards.ts`.
|
|
1368
|
-
fable: "Fable",
|
|
1369
|
-
mythos: "Fable"
|
|
1370
|
-
};
|
|
1371
|
-
var LONG_CONTEXT_SUFFIX = "[1m]";
|
|
1372
|
-
function parseClaudeModelId(id) {
|
|
1373
|
-
const undated = id.replace(/-\d{8}$/, "");
|
|
1374
|
-
const match = /^claude-(opus|sonnet|haiku|fable|mythos)-([\d-]+)$/.exec(undated);
|
|
1375
|
-
if (!match) return void 0;
|
|
1376
|
-
const [, family, versionParts] = match;
|
|
1377
|
-
return { family, version: versionParts.replace(/-/g, ".") };
|
|
1378
|
-
}
|
|
1379
|
-
function runnerForModel(value) {
|
|
1380
|
-
if (!value) return "claude";
|
|
1381
|
-
const known = BY_VALUE.get(value);
|
|
1382
|
-
if (known) return known.provider;
|
|
1383
|
-
return value.startsWith("gpt-") ? "codex" : "claude";
|
|
1384
|
-
}
|
|
1385
|
-
function isCodexModel(value) {
|
|
1386
|
-
return !!value && runnerForModel(value) === "codex";
|
|
1387
|
-
}
|
|
1388
|
-
function agentLabel(agent) {
|
|
1389
|
-
return agent === "codex" ? "Codex" : "Claude";
|
|
1390
|
-
}
|
|
1391
|
-
function modelOptionsFor(agent) {
|
|
1392
|
-
return agent === "codex" ? CODEX_MODEL_OPTIONS : MODEL_OPTIONS;
|
|
1393
|
-
}
|
|
1394
|
-
var ALL_MODEL_OPTIONS = [...MODEL_OPTIONS, ...CODEX_MODEL_OPTIONS];
|
|
1395
|
-
function isAllowedModel(value) {
|
|
1396
|
-
return BY_VALUE.has(value);
|
|
1397
|
-
}
|
|
1398
|
-
function modelQuotaKey(value) {
|
|
1399
|
-
const known = BY_VALUE.get(value);
|
|
1400
|
-
if (known) return known.value;
|
|
1401
|
-
const bare = value.endsWith(LONG_CONTEXT_SUFFIX) ? value.slice(0, -LONG_CONTEXT_SUFFIX.length) : value;
|
|
1402
|
-
const parsed = parseClaudeModelId(bare);
|
|
1403
|
-
if (!parsed) return value;
|
|
1404
|
-
return parsed.family === "mythos" ? "fable" : parsed.family;
|
|
1405
|
-
}
|
|
1406
|
-
function modelLabel(value) {
|
|
1407
|
-
if (!value) return "Default";
|
|
1408
|
-
const known = BY_VALUE.get(value);
|
|
1409
|
-
if (known) return known.label;
|
|
1410
|
-
const longContext = value.endsWith(LONG_CONTEXT_SUFFIX);
|
|
1411
|
-
const bare = longContext ? value.slice(0, -LONG_CONTEXT_SUFFIX.length) : value;
|
|
1412
|
-
const parsed = parseClaudeModelId(bare);
|
|
1413
|
-
if (!parsed) return value;
|
|
1414
|
-
const label = `${CLAUDE_FAMILY_LABELS[parsed.family]} ${parsed.version}`;
|
|
1415
|
-
return longContext ? `${label} \xB7 1M context` : label;
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
1462
|
// ../api/src/agents/usage-limit.ts
|
|
1419
1463
|
var USAGE_LIMIT_PATTERNS = [
|
|
1420
1464
|
/usage limit reached/i,
|
|
@@ -1845,6 +1889,10 @@ The instructions above are your primary identity for this entire conversation \u
|
|
|
1845
1889
|
|
|
1846
1890
|
${base}`;
|
|
1847
1891
|
}
|
|
1892
|
+
function permissionArgs(mode, promptTool) {
|
|
1893
|
+
if (mode !== "ask") return ["--dangerously-skip-permissions"];
|
|
1894
|
+
return promptTool ? ["--permission-mode", "auto", "--permission-prompt-tool", promptTool] : ["--permission-mode", "auto", "--permission-prompts", "none"];
|
|
1895
|
+
}
|
|
1848
1896
|
function docsAccessDisallowedTools(access) {
|
|
1849
1897
|
const writers = ["Write", "Edit", "MultiEdit", "NotebookEdit"];
|
|
1850
1898
|
if (access === "read") return writers;
|
|
@@ -1895,7 +1943,7 @@ function buildArgs(prompt, botName, options, resumeSessionId, isolatedStyle) {
|
|
|
1895
1943
|
// activity); plain json emits one blob on completion. stream-json with
|
|
1896
1944
|
// --print requires --verbose.
|
|
1897
1945
|
...options.onActivity ? ["--output-format", "stream-json", "--verbose"] : ["--output-format", "json"],
|
|
1898
|
-
|
|
1946
|
+
...permissionArgs(options.permissionMode, options.permissionPromptTool),
|
|
1899
1947
|
"--no-chrome",
|
|
1900
1948
|
// `=` form: the flag is variadic and would otherwise swallow the next token.
|
|
1901
1949
|
...docsAccessDisallowedTools(options.docsAccess).length > 0 ? [`--disallowedTools=${docsAccessDisallowedTools(options.docsAccess).join(",")}`] : [],
|
|
@@ -1931,8 +1979,9 @@ function buildArgs(prompt, botName, options, resumeSessionId, isolatedStyle) {
|
|
|
1931
1979
|
if (options.mcpConfigPath) {
|
|
1932
1980
|
args.push("--mcp-config", options.mcpConfigPath);
|
|
1933
1981
|
}
|
|
1934
|
-
|
|
1935
|
-
|
|
1982
|
+
const model = upgradeModel(options.model);
|
|
1983
|
+
if (model && isModelForGateway(model, process.env["ANTHROPIC_MODEL"])) {
|
|
1984
|
+
args.push("--model", resolveModelAlias(model));
|
|
1936
1985
|
}
|
|
1937
1986
|
if (options.effort) {
|
|
1938
1987
|
args.push("--effort", resolveClaudeEffort(options.effort));
|
|
@@ -1972,6 +2021,7 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
|
|
|
1972
2021
|
);
|
|
1973
2022
|
const env = resolveMiseEnv(cwd);
|
|
1974
2023
|
env["FLYSPACE_SCRATCH_DIR"] = paths.SCRATCH_DIR;
|
|
2024
|
+
if (options.permissionPromptTool && !env["MCP_TOOL_TIMEOUT"]) env["MCP_TOOL_TIMEOUT"] = "360000";
|
|
1975
2025
|
env["CLAUDE_CODE_ARTIFACT"] = "1";
|
|
1976
2026
|
if (options.disableAutoMemory) env["CLAUDE_CODE_DISABLE_AUTO_MEMORY"] = "1";
|
|
1977
2027
|
else delete env["CLAUDE_CODE_DISABLE_AUTO_MEMORY"];
|
|
@@ -2292,6 +2342,11 @@ var featureFlags = {
|
|
|
2292
2342
|
title: "Autocomplete",
|
|
2293
2343
|
description: "Gray inline suggestions in the message composer that continue what you are typing, based on the channel. Press Tab to accept, Esc to dismiss. Your draft is sent to an AI model.",
|
|
2294
2344
|
stage: "beta"
|
|
2345
|
+
},
|
|
2346
|
+
languages: {
|
|
2347
|
+
title: "Languages",
|
|
2348
|
+
description: "Pick the interface language in your user settings (13 languages, machine translated). Off: the interface is always English.",
|
|
2349
|
+
stage: "beta"
|
|
2295
2350
|
}
|
|
2296
2351
|
};
|
|
2297
2352
|
var featureFlagIds = Object.keys(featureFlags);
|
|
@@ -2703,7 +2758,7 @@ var TRIAL_DAYS = 14;
|
|
|
2703
2758
|
async function listWorkspaceSummaries() {
|
|
2704
2759
|
const db = getSupabaseClient();
|
|
2705
2760
|
const [workspaces, settings, channels, memberships, activity] = await Promise.all([
|
|
2706
|
-
db.from("workspaces").select("id, slug, created_at, agent_connected_at, plan, plan_status, archived_at"),
|
|
2761
|
+
db.from("workspaces").select("id, slug, created_at, agent_connected_at, plan, plan_status, trial_ends_at, archived_at"),
|
|
2707
2762
|
db.from("workspace_settings").select("profile, display_name, logo"),
|
|
2708
2763
|
db.from("channels").select("profile, is_default").is("archived_at", null),
|
|
2709
2764
|
db.from("memberships").select("workspace_id, user_id, email, handle, role, accepted_at").eq("status", "active").eq("is_support", false).order("invited_at", { ascending: true }),
|
|
@@ -2750,7 +2805,7 @@ async function listWorkspaceSummaries() {
|
|
|
2750
2805
|
agentConnectedAt: w.agent_connected_at,
|
|
2751
2806
|
plan: w.plan ?? null,
|
|
2752
2807
|
planStatus,
|
|
2753
|
-
trialEndsAt: planStatus === "trialing" ?
|
|
2808
|
+
trialEndsAt: planStatus === "trialing" ? w.trial_ends_at ?? null : null,
|
|
2754
2809
|
archivedAt: w.archived_at ?? null,
|
|
2755
2810
|
displayName: displayNames.get(w.slug) || null,
|
|
2756
2811
|
logo: logos.get(w.slug) || null,
|
|
@@ -2784,7 +2839,8 @@ async function setWorkspaceStripeSubscription(workspaceId, fields) {
|
|
|
2784
2839
|
plan: fields.plan,
|
|
2785
2840
|
stripe_customer_id: fields.stripeCustomerId,
|
|
2786
2841
|
stripe_subscription_id: fields.stripeSubscriptionId,
|
|
2787
|
-
plan_status: fields.planStatus
|
|
2842
|
+
plan_status: fields.planStatus,
|
|
2843
|
+
trial_ends_at: fields.trialEndsAt
|
|
2788
2844
|
}).eq("id", workspaceId);
|
|
2789
2845
|
if (error) throw new Error(`setWorkspaceStripeSubscription(${workspaceId}): ${error.message}`);
|
|
2790
2846
|
}
|
|
@@ -2831,8 +2887,8 @@ async function getWorkspaceBilling(workspaceId) {
|
|
|
2831
2887
|
stripeSubscriptionId: row["stripe_subscription_id"] ?? null
|
|
2832
2888
|
};
|
|
2833
2889
|
}
|
|
2834
|
-
async function updateWorkspacePlanStatus(workspaceId, planStatus) {
|
|
2835
|
-
const { error } = await getSupabaseClient().from("workspaces").update({ plan_status: planStatus }).eq("id", workspaceId);
|
|
2890
|
+
async function updateWorkspacePlanStatus(workspaceId, planStatus, trialEndsAt) {
|
|
2891
|
+
const { error } = await getSupabaseClient().from("workspaces").update({ plan_status: planStatus, trial_ends_at: trialEndsAt }).eq("id", workspaceId);
|
|
2836
2892
|
if (error) throw new Error(`updateWorkspacePlanStatus(${workspaceId}): ${error.message}`);
|
|
2837
2893
|
planStatusCache.delete(workspaceId);
|
|
2838
2894
|
}
|
|
@@ -2992,6 +3048,15 @@ async function setAllowGuestAccess(workspaceId, allow) {
|
|
|
2992
3048
|
const { error } = await getSupabaseClient().from("workspaces").update({ allow_guest_access: allow }).eq("id", workspaceId);
|
|
2993
3049
|
if (error) throw new Error(`setAllowGuestAccess(${workspaceId}): ${error.message}`);
|
|
2994
3050
|
}
|
|
3051
|
+
async function getWorkspacePermissionMode(workspaceId) {
|
|
3052
|
+
const { data, error } = await getSupabaseClient().from("workspaces").select("permission_mode").eq("id", workspaceId).maybeSingle();
|
|
3053
|
+
if (error) throw new Error(`getWorkspacePermissionMode(${workspaceId}): ${error.message}`);
|
|
3054
|
+
return isPermissionMode(data?.["permission_mode"]) ? data["permission_mode"] : "bypass";
|
|
3055
|
+
}
|
|
3056
|
+
async function setWorkspacePermissionMode(workspaceId, mode) {
|
|
3057
|
+
const { error } = await getSupabaseClient().from("workspaces").update({ permission_mode: mode }).eq("id", workspaceId);
|
|
3058
|
+
if (error) throw new Error(`setWorkspacePermissionMode(${workspaceId}): ${error.message}`);
|
|
3059
|
+
}
|
|
2995
3060
|
async function getAgentPaused(workspaceId) {
|
|
2996
3061
|
const { data, error } = await getSupabaseClient().from("workspaces").select("agent_paused").eq("id", workspaceId).maybeSingle();
|
|
2997
3062
|
if (error) throw new Error(`getAgentPaused(${workspaceId}): ${error.message}`);
|
|
@@ -3336,7 +3401,8 @@ function normalizeProviders(entries) {
|
|
|
3336
3401
|
for (const entry of entries) {
|
|
3337
3402
|
if (!KNOWN_RUNNERS.includes(entry.runner) || seen.has(entry.runner)) continue;
|
|
3338
3403
|
seen.add(entry.runner);
|
|
3339
|
-
const
|
|
3404
|
+
const upgraded = upgradeModel(entry.model);
|
|
3405
|
+
const model = upgraded && isAllowedModel(upgraded) && runnerForModel(upgraded) === entry.runner ? upgraded : void 0;
|
|
3340
3406
|
chain.push({ runner: entry.runner, ...model ? { model } : {} });
|
|
3341
3407
|
}
|
|
3342
3408
|
for (const runner of KNOWN_RUNNERS) {
|
|
@@ -3631,7 +3697,7 @@ function buildArgs2(prompt, options, lastMessageFile, resumeSessionId) {
|
|
|
3631
3697
|
} else if (!resumeSessionId) {
|
|
3632
3698
|
args.push("-s", sandbox);
|
|
3633
3699
|
}
|
|
3634
|
-
if (options.model) args.push("-m", options.model);
|
|
3700
|
+
if (options.model) args.push("-m", upgradeModel(options.model));
|
|
3635
3701
|
if (options.effort) args.push("-c", `model_reasoning_effort=${resolveCodexEffort(options.effort)}`);
|
|
3636
3702
|
if (resumeSessionId) args.push(resumeSessionId);
|
|
3637
3703
|
args.push(applySystemPrompt(prompt, options, resumeSessionId));
|
|
@@ -4457,6 +4523,8 @@ async function runAutomation(opts) {
|
|
|
4457
4523
|
model,
|
|
4458
4524
|
maxBudgetUsd,
|
|
4459
4525
|
channelPrompt: resolveChannelPrompt(channel),
|
|
4526
|
+
// Nobody is watching a scheduled run: in `ask` mode a blocked call is denied.
|
|
4527
|
+
permissionMode: resolveChannelPermissionMode(channel),
|
|
4460
4528
|
...memory.memoryPrompt ? { memoryPrompt: memory.memoryPrompt } : {},
|
|
4461
4529
|
...memory.enabled ? { disableAutoMemory: true } : {},
|
|
4462
4530
|
// No userId: nobody triggered this. The schedule's name is the
|
|
@@ -6101,8 +6169,9 @@ function collectFrom(root, source, maxDepth, namePrefix) {
|
|
|
6101
6169
|
const fm = parseFrontmatter(file);
|
|
6102
6170
|
const name = fm.name?.trim() || basename2(dirname2(file));
|
|
6103
6171
|
const plugin = source === "plugin" ? pluginNameFor(file, root) : void 0;
|
|
6172
|
+
const prefix = namePrefix ?? plugin;
|
|
6104
6173
|
return {
|
|
6105
|
-
name:
|
|
6174
|
+
name: prefix ? `${prefix}:${name}` : name,
|
|
6106
6175
|
description: (fm.description ?? "").trim(),
|
|
6107
6176
|
source,
|
|
6108
6177
|
...plugin && { plugin },
|
|
@@ -6176,7 +6245,9 @@ function findSkillDetail(configDir, cwd, name, sources) {
|
|
|
6176
6245
|
for (const file of files) {
|
|
6177
6246
|
const fm = parseFrontmatter(file);
|
|
6178
6247
|
const rawName = fm.name?.trim() || basename2(dirname2(file));
|
|
6179
|
-
const
|
|
6248
|
+
const plugin = source === "plugin" ? pluginNameFor(file, root) : void 0;
|
|
6249
|
+
const prefix = namePrefix ?? plugin;
|
|
6250
|
+
const skillName = prefix ? `${prefix}:${rawName}` : rawName;
|
|
6180
6251
|
if (skillName !== name) continue;
|
|
6181
6252
|
let raw;
|
|
6182
6253
|
let mtime;
|
|
@@ -6187,7 +6258,6 @@ function findSkillDetail(configDir, cwd, name, sources) {
|
|
|
6187
6258
|
continue;
|
|
6188
6259
|
}
|
|
6189
6260
|
const { body } = splitFrontmatter(raw);
|
|
6190
|
-
const plugin = source === "plugin" ? pluginNameFor(file, root) : void 0;
|
|
6191
6261
|
return {
|
|
6192
6262
|
name: skillName,
|
|
6193
6263
|
description: (fm.description ?? "").trim(),
|
|
@@ -6671,12 +6741,12 @@ ${trimmedDetail.slice(0, 1500)}
|
|
|
6671
6741
|
const threadEffortOverride = store.getEffortOverride(channelId, sessionKey);
|
|
6672
6742
|
const effectiveEffort = resolveEffort(threadEffortOverride, channelId, config.effort);
|
|
6673
6743
|
const threadModelOverride = store.getModelOverride(channelId, sessionKey);
|
|
6674
|
-
const
|
|
6744
|
+
const effectiveModel2 = resolveModel(threadModelOverride, channelId, model);
|
|
6675
6745
|
const runner = threadModelOverride ? runnerForModel(threadModelOverride) : runnerForModel(loadDashboardSettings().agent);
|
|
6676
6746
|
if (runner === "codex") {
|
|
6677
6747
|
const stored = store.getSession(channelId, sessionKey);
|
|
6678
6748
|
const resumeId = stored?.runner === "codex" ? stored.sessionId : void 0;
|
|
6679
|
-
const codexModel = isCodexModel(
|
|
6749
|
+
const codexModel = isCodexModel(effectiveModel2) ? effectiveModel2 : config.codexModel;
|
|
6680
6750
|
const codexOptions = {
|
|
6681
6751
|
...codexModel ? { model: codexModel } : {},
|
|
6682
6752
|
...effectiveEffort ? { effort: effectiveEffort } : {},
|
|
@@ -6777,13 +6847,15 @@ ${trimmedDetail.slice(0, 1500)}
|
|
|
6777
6847
|
return;
|
|
6778
6848
|
}
|
|
6779
6849
|
const askOptions = {
|
|
6780
|
-
model:
|
|
6850
|
+
model: effectiveModel2,
|
|
6781
6851
|
effort: effectiveEffort,
|
|
6782
6852
|
maxBudgetUsd,
|
|
6783
6853
|
// Channel-level instructions (channels.prompt), appended to the
|
|
6784
6854
|
// workspace prompt for this channel only — same source the dashboard
|
|
6785
6855
|
// chat path reads through resolveChannelConfig().
|
|
6786
6856
|
channelPrompt: resolveChannelPrompt(channelId),
|
|
6857
|
+
// No prompt tool here: in `ask` mode a blocked call is just denied.
|
|
6858
|
+
permissionMode: resolveChannelPermissionMode(channelId),
|
|
6787
6859
|
signal: abortController.signal,
|
|
6788
6860
|
// Attribution for the usage row each spawn writes. Sharing one options
|
|
6789
6861
|
// object across every attempt is deliberate: the retries below are
|
|
@@ -9169,6 +9241,7 @@ export {
|
|
|
9169
9241
|
loadConfig,
|
|
9170
9242
|
refreshAutomationRegistry,
|
|
9171
9243
|
startAutomationRegistryPolling,
|
|
9244
|
+
isPermissionMode,
|
|
9172
9245
|
isLogicalCwd,
|
|
9173
9246
|
isUnderLogicalRoot,
|
|
9174
9247
|
ensureLogicalCwdDir,
|
|
@@ -9184,6 +9257,7 @@ export {
|
|
|
9184
9257
|
auditChannelCwds,
|
|
9185
9258
|
warnOnBrokenChannelCwds,
|
|
9186
9259
|
resolveCwd,
|
|
9260
|
+
resolveChannelPermissionMode,
|
|
9187
9261
|
resolveChannelPrompt,
|
|
9188
9262
|
ChannelCwdError,
|
|
9189
9263
|
createChannel,
|
|
@@ -9197,6 +9271,12 @@ export {
|
|
|
9197
9271
|
DEFAULT_TIMEZONE,
|
|
9198
9272
|
loadAutomations,
|
|
9199
9273
|
loadEffectiveAutomations,
|
|
9274
|
+
effectiveModel,
|
|
9275
|
+
runnerForModel,
|
|
9276
|
+
isCodexModel,
|
|
9277
|
+
agentLabel,
|
|
9278
|
+
isAllowedModel,
|
|
9279
|
+
modelLabel,
|
|
9200
9280
|
BUILT_IN_OUTPUT_STYLES,
|
|
9201
9281
|
OutputStyleConflictError,
|
|
9202
9282
|
listOutputStyles,
|
|
@@ -9206,11 +9286,6 @@ export {
|
|
|
9206
9286
|
resolveSelectedOutputStyle,
|
|
9207
9287
|
getOutputStyleDefault,
|
|
9208
9288
|
setOutputStyleDefault,
|
|
9209
|
-
runnerForModel,
|
|
9210
|
-
isCodexModel,
|
|
9211
|
-
agentLabel,
|
|
9212
|
-
isAllowedModel,
|
|
9213
|
-
modelLabel,
|
|
9214
9289
|
usageLimitedUntil,
|
|
9215
9290
|
usageLimitedModels,
|
|
9216
9291
|
clearClaudeAuthFailed,
|
|
@@ -9285,6 +9360,8 @@ export {
|
|
|
9285
9360
|
transferWorkspaceAdmin,
|
|
9286
9361
|
getAllowGuestAccess,
|
|
9287
9362
|
setAllowGuestAccess,
|
|
9363
|
+
getWorkspacePermissionMode,
|
|
9364
|
+
setWorkspacePermissionMode,
|
|
9288
9365
|
getAgentPaused,
|
|
9289
9366
|
setAgentPaused,
|
|
9290
9367
|
loadAgentMemory,
|