@askexenow/exe-os 0.9.295 → 0.9.296
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/deploy/compose/cloudflared/config.yml.example +14 -9
- package/deploy/compose/docker-compose.yml +86 -8
- package/deploy/compose/sso-edge/default.conf.template +87 -0
- package/deploy/compose/sso-edge/entrypoint.sh +23 -0
- package/deploy/compose/sso-edge/sso-redirect.conf +63 -0
- package/deploy/stack-manifests/v0.9.json +1 -1
- package/dist/active-agent-AFX2FODG.js +28 -0
- package/dist/active-agent-E2IJA7YX.js +27 -0
- package/dist/agentic-ontology-A2YUZK5O.js +25 -0
- package/dist/assets/com.askexe.exed.plist +4 -1
- package/dist/backfill-metadata-OC7EOD5U.js +600 -0
- package/dist/behaviors-H5ZOVHDH.js +46 -0
- package/dist/bin/agentic-ontology-backfill.js +5 -5
- package/dist/bin/agentic-reflection-backfill.js +6 -6
- package/dist/bin/agentic-semantic-label.js +5 -5
- package/dist/bin/backfill-conversations.js +6 -6
- package/dist/bin/backfill-responses.js +6 -6
- package/dist/bin/backfill-vectors.js +8 -8
- package/dist/bin/bulk-sync-postgres.js +7 -7
- package/dist/bin/cc-doctor.js +4 -4
- package/dist/bin/cleanup-stale-review-tasks.js +11 -11
- package/dist/bin/cli.js +16 -16
- package/dist/bin/deferred-daemon-restart.js +1 -1
- package/dist/bin/exe-agent-config.js +2 -2
- package/dist/bin/exe-agent.js +4 -4
- package/dist/bin/exe-assign.js +8 -8
- package/dist/bin/exe-boot.js +21 -18
- package/dist/bin/exe-call.js +4 -4
- package/dist/bin/exe-cloud.js +7 -7
- package/dist/bin/exe-dispatch.js +11 -11
- package/dist/bin/exe-doctor.js +3 -2
- package/dist/bin/exe-export-behaviors.js +7 -7
- package/dist/bin/exe-forget.js +6 -6
- package/dist/bin/exe-gateway.js +7 -7
- package/dist/bin/exe-healthcheck.js +6 -4
- package/dist/bin/exe-heartbeat.js +11 -11
- package/dist/bin/exe-kill.js +14 -14
- package/dist/bin/exe-launch-agent.js +18 -18
- package/dist/bin/exe-new-employee.js +6 -6
- package/dist/bin/exe-pending-messages.js +12 -12
- package/dist/bin/exe-pending-notifications.js +11 -11
- package/dist/bin/exe-pending-reviews.js +11 -11
- package/dist/bin/exe-rename.js +4 -4
- package/dist/bin/exe-review.js +13 -13
- package/dist/bin/exe-search.js +5 -5
- package/dist/bin/exe-session-cleanup.js +16 -16
- package/dist/bin/exe-settings.js +39 -9
- package/dist/bin/exe-start-codex.js +11 -11
- package/dist/bin/exe-start-opencode.js +8 -8
- package/dist/bin/exe-status.js +12 -12
- package/dist/bin/exe-team.js +3 -3
- package/dist/bin/git-sweep.js +12 -12
- package/dist/bin/graph-backfill.js +4 -4
- package/dist/bin/graph-export.js +5 -5
- package/dist/bin/import-history.js +7 -7
- package/dist/bin/install-launchd.js +13 -6
- package/dist/bin/install.js +26 -14
- package/dist/bin/intercom-check.js +4 -4
- package/dist/bin/mcp-sessions.js +2 -2
- package/dist/bin/orchestration-metrics.js +4 -4
- package/dist/bin/postgres-agentic-reflection-backfill.js +2 -2
- package/dist/bin/postgres-agentic-semantic-backfill.js +1 -1
- package/dist/bin/scan-tasks.js +11 -11
- package/dist/bin/setup.js +1 -1
- package/dist/bin/shard-migrate.js +4 -4
- package/dist/bin/stack-update.js +2 -2
- package/dist/bin/vps-health-gate.js +1 -1
- package/dist/capability-cards-4USI7CUW.js +89 -0
- package/dist/capacity-monitor-WLCBTEYR.js +51 -0
- package/dist/catchup-brief-ZR3NX6LZ.js +175 -0
- package/dist/chunk-22TVSRQQ.js +226 -0
- package/dist/chunk-2E43UXRH.js +395 -0
- package/dist/chunk-2PIGT6UJ.js +460 -0
- package/dist/chunk-3XTMW2MZ.js +535 -0
- package/dist/chunk-465PQFTH.js +262 -0
- package/dist/chunk-5CCXU2AW.js +129 -0
- package/dist/chunk-5D6MPWR7.js +1094 -0
- package/dist/chunk-5Q4MR6SL.js +123 -0
- package/dist/chunk-6327RBWR.js +345 -0
- package/dist/chunk-6MZZREZY.js +199 -0
- package/dist/chunk-7DI2Q4O5.js +1186 -0
- package/dist/chunk-7PW5VNIY.js +122 -0
- package/dist/chunk-7T7Y56HW.js +43 -0
- package/dist/chunk-7UHCWCLT.js +128 -0
- package/dist/chunk-A2ZUMF6L.js +1350 -0
- package/dist/chunk-AKV44JEH.js +185 -0
- package/dist/chunk-ANHWGX5N.js +735 -0
- package/dist/chunk-BQ3P4TKD.js +97 -0
- package/dist/chunk-BUZMT3KZ.js +604 -0
- package/dist/chunk-C2SBESBO.js +210 -0
- package/dist/chunk-CLSXZUZW.js +51 -0
- package/dist/chunk-CONHLVAR.js +1079 -0
- package/dist/chunk-D3WTZPFX.js +456 -0
- package/dist/chunk-DE6SOIYL.js +197 -0
- package/dist/chunk-EIVNMA3Q.js +284 -0
- package/dist/chunk-EJIF4FNT.js +12 -0
- package/dist/chunk-FDFOW564.js +171 -0
- package/dist/chunk-GZUBJ5EC.js +127 -0
- package/dist/chunk-HGZITN22.js +105 -0
- package/dist/chunk-HSRKDU6X.js +362 -0
- package/dist/chunk-IIEN2PHV.js +85 -0
- package/dist/chunk-JQ56VLMM.js +567 -0
- package/dist/chunk-JVHHXRFY.js +280 -0
- package/dist/chunk-JXCXGZ3S.js +55 -0
- package/dist/chunk-K5ZO532Q.js +4388 -0
- package/dist/chunk-K6CAAMXF.js +97 -0
- package/dist/chunk-KA26YTNU.js +81 -0
- package/dist/chunk-KMUW5C3R.js +381 -0
- package/dist/chunk-KOO3J5PV.js +20 -0
- package/dist/chunk-LSV7OFIH.js +290 -0
- package/dist/chunk-LSVFDVNY.js +1158 -0
- package/dist/chunk-LXDQTW32.js +230 -0
- package/dist/chunk-MEP7OUVZ.js +181 -0
- package/dist/chunk-MN2B2LKS.js +240 -0
- package/dist/chunk-N2EAYPYQ.js +1352 -0
- package/dist/chunk-N7I2A667.js +70 -0
- package/dist/chunk-NLZHVIOP.js +630 -0
- package/dist/chunk-NUH5TRZL.js +227 -0
- package/dist/chunk-OAHEIH3G.js +167 -0
- package/dist/chunk-OBHRQGCK.js +58 -0
- package/dist/chunk-ODFA7B2V.js +54 -0
- package/dist/chunk-OSNUP45F.js +731 -0
- package/dist/chunk-OTPRHBTO.js +33 -0
- package/dist/chunk-P6MUA4QU.js +157 -0
- package/dist/chunk-PGIOFKSK.js +2093 -0
- package/dist/chunk-PSE7VHWK.js +50 -0
- package/dist/chunk-QIFUVZFW.js +331 -0
- package/dist/chunk-RDPXKTVK.js +221 -0
- package/dist/chunk-RKYTYJGB.js +76 -0
- package/dist/chunk-RXLR6EFM.js +348 -0
- package/dist/chunk-SDB67PQJ.js +159 -0
- package/dist/chunk-SF2T7MP3.js +402 -0
- package/dist/chunk-SLU3FRFQ.js +2133 -0
- package/dist/chunk-SNDZJ5IV.js +214 -0
- package/dist/chunk-STEEAABW.js +448 -0
- package/dist/chunk-TUTWNHIQ.js +244 -0
- package/dist/chunk-UDP35QBR.js +30 -0
- package/dist/chunk-UKFHNJBI.js +85 -0
- package/dist/chunk-VC2DTK2X.js +382 -0
- package/dist/chunk-VRRAE5JX.js +836 -0
- package/dist/chunk-VVJTBQPR.js +38 -0
- package/dist/chunk-W3EQ362K.js +581 -0
- package/dist/chunk-WHIXIFHC.js +2242 -0
- package/dist/chunk-WRNGJJNR.js +377 -0
- package/dist/chunk-WUKHLCBE.js +3313 -0
- package/dist/chunk-WVPLHGDG.js +150 -0
- package/dist/chunk-XJZBSTL5.js +204 -0
- package/dist/chunk-Y3PMNUM5.js +304 -0
- package/dist/chunk-YHVS4QOV.js +14597 -0
- package/dist/chunk-YJ2OYAOC.js +668 -0
- package/dist/chunk-YYAD2GXX.js +128 -0
- package/dist/chunk-ZQML7EWE.js +333 -0
- package/dist/co-activation-XJLH46OX.js +74 -0
- package/dist/co-occurrence-GNN2X526.js +95 -0
- package/dist/code-context-index-OCPRLFG5.js +30 -0
- package/dist/core-memory-J4W2IYOF.js +110 -0
- package/dist/crdt-sync-QCBTSHIH.js +33 -0
- package/dist/crm-webhook-EM442VUW.js +10 -0
- package/dist/cto-delegation-gate-MLJMVHBK.js +280 -0
- package/dist/daemon-orchestration-2VNLZVTW.js +139 -0
- package/dist/db-backup-VUGFTPJ4.js +43 -0
- package/dist/doc-graph-extractor-PNRSFPSS.js +133 -0
- package/dist/dreaming-SK5VEQRF.js +34 -0
- package/dist/entity-boost-TQWWJUC2.js +375 -0
- package/dist/exe-drift-N34UPO7S.js +70 -0
- package/dist/exe-export-KACBKGVV.js +77 -0
- package/dist/exe-import-GXGDWACG.js +80 -0
- package/dist/exe-key-XPDOZBWW.js +673 -0
- package/dist/exe-snapshot-32GQKGQ5.js +338 -0
- package/dist/fast-db-init-F3TDD5VV.js +7 -0
- package/dist/gateway/index.js +8 -8
- package/dist/git-staleness-J45WNYRF.js +112 -0
- package/dist/git-task-sweep-BTGVQPFB.js +42 -0
- package/dist/global-procedures-6JCQWU4D.js +22 -0
- package/dist/graph-auto-extract-3ZQNXTPC.js +183 -0
- package/dist/hooks/bug-report-worker.js +13 -13
- package/dist/hooks/codex-stop-task-finalizer.js +13 -13
- package/dist/hooks/commit-complete.js +13 -13
- package/dist/hooks/error-recall.js +6 -6
- package/dist/hooks/exe-heartbeat-hook.js +3 -3
- package/dist/hooks/ingest-worker.js +3 -3
- package/dist/hooks/ingest.js +6 -6
- package/dist/hooks/instructions-loaded.js +4 -4
- package/dist/hooks/manifest.json +20 -20
- package/dist/hooks/notification.js +4 -4
- package/dist/hooks/post-compact.js +12 -12
- package/dist/hooks/post-tool-combined.js +6 -6
- package/dist/hooks/pre-compact.js +16 -16
- package/dist/hooks/pre-tool-use.js +16 -16
- package/dist/hooks/prompt-submit.js +24 -24
- package/dist/hooks/session-end.js +21 -21
- package/dist/hooks/session-start.js +12 -12
- package/dist/hooks/stop.js +19 -19
- package/dist/hooks/subagent-stop.js +12 -12
- package/dist/hooks/summary-worker.js +19 -19
- package/dist/index.js +19 -19
- package/dist/installer-5VPFY7SB.js +298 -0
- package/dist/installer-OENFPMA2.js +344 -0
- package/dist/installer-OIX4QOG5.js +40 -0
- package/dist/lib/cloud-sync.js +7 -7
- package/dist/lib/consolidation.js +6 -5
- package/dist/lib/database.js +2 -2
- package/dist/lib/db-daemon-client.js +2 -2
- package/dist/lib/db.js +2 -2
- package/dist/lib/embed-worker.js +1 -0
- package/dist/lib/embedder.js +7 -3
- package/dist/lib/employee-templates.js +4 -4
- package/dist/lib/employees.js +2 -2
- package/dist/lib/exe-daemon-client.js +2 -2
- package/dist/lib/exe-daemon.js +160 -79
- package/dist/lib/hybrid-search.js +5 -5
- package/dist/lib/identity.js +2 -2
- package/dist/lib/messaging.js +11 -11
- package/dist/lib/reminders.js +3 -3
- package/dist/lib/schedules.js +5 -5
- package/dist/lib/session-registry.js +4 -4
- package/dist/lib/skill-learning.js +6 -6
- package/dist/lib/store.js +4 -4
- package/dist/lib/task-router.js +3 -3
- package/dist/lib/tasks.js +12 -12
- package/dist/lib/tmux-routing.js +12 -10
- package/dist/lib/tmux-transport.js +1 -1
- package/dist/lib/token-spend.js +3 -3
- package/dist/lib/transport.js +2 -2
- package/dist/mcp/register-tools.js +62 -61
- package/dist/mcp/server.js +63 -62
- package/dist/mcp/tools/complete-reminder.js +4 -4
- package/dist/mcp/tools/create-reminder.js +4 -4
- package/dist/mcp/tools/create-task.js +14 -14
- package/dist/mcp/tools/deactivate-behavior.js +7 -7
- package/dist/mcp/tools/list-reminders.js +4 -4
- package/dist/mcp/tools/list-tasks.js +14 -14
- package/dist/mcp/tools/send-message.js +13 -13
- package/dist/mcp/tools/update-task.js +13 -13
- package/dist/mcp-http-config-PQTOLCTP.js +29 -0
- package/dist/memory-cards-4RVDZIY2.js +180 -0
- package/dist/memory-graph-extractor-L6YC7G4M.js +22 -0
- package/dist/memory-poisoning-defense-4YVJYH4G.js +224 -0
- package/dist/memory-queue-client-MVAUOZNJ.js +16 -0
- package/dist/memory-reflection-SHHDQNOH.js +244 -0
- package/dist/message-queue-client-DCKZT6X2.js +92 -0
- package/dist/notifications-JFR3G42W.js +47 -0
- package/dist/orchestration-events-MGCGPTDN.js +27 -0
- package/dist/orchestrator-DAFL2YZB.js +35 -0
- package/dist/pipeline-router-WWSZVPCH.js +15 -0
- package/dist/plan-limits-C7XCSDZC.js +28 -0
- package/dist/project-boot-N3NTBVLE.js +299 -0
- package/dist/projection-worker-MTPAPCWX.js +1084 -0
- package/dist/prospective-memory-BTIVUJSB.js +232 -0
- package/dist/reranker-UA6WVESJ.js +19 -0
- package/dist/retrieval-health-7XNZJEBF.js +12 -0
- package/dist/review-polling-4ALGMXC3.js +126 -0
- package/dist/runtime/index.js +13 -13
- package/dist/self-query-router-MROFQLQB.js +192 -0
- package/dist/session-events-CK44XOU4.js +38 -0
- package/dist/session-kill-telemetry-MT6ITDOG.js +31 -0
- package/dist/session-scope-3XDBWV65.js +88 -0
- package/dist/setup-wizard-X6DOD7MC.js +12 -0
- package/dist/skill-refinement-G2CCY3GM.js +159 -0
- package/dist/stack-update-JF7F56AS.js +84 -0
- package/dist/steward-gate-YF2CYXE7.js +15 -0
- package/dist/task-enforcement-YN6HK7NE.js +506 -0
- package/dist/task-scope-CVK6ISCZ.js +37 -0
- package/dist/tasks-crud-NTNET4JE.js +79 -0
- package/dist/tasks-notify-4LJVFPCV.js +40 -0
- package/dist/tasks-review-3V4WOIRG.js +49 -0
- package/dist/telemetry-upload-5PNUKGTM.js +741 -0
- package/dist/token-budget-E46G7ZAQ.js +86 -0
- package/dist/tool-capability-index-JDSMKJER.js +10 -0
- package/dist/tool-telemetry-J3NLS3LJ.js +17 -0
- package/dist/tui/App.js +18 -18
- package/dist/tui-data-6DOMUUCM.js +260 -0
- package/dist/wiki-acl-5UK37LKF.js +111 -0
- package/dist/worker-gate-FM7AEC7G.js +21 -0
- package/dist/workflow-engine-2EDUHUIY.js +28 -0
- package/dist/worktree-7YKKJIYR.js +28 -0
- package/dist/worktree-sweep-C3ELFGDN.js +21 -0
- package/package.json +1 -1
- package/release-notes.json +23 -23
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getClient
|
|
3
|
+
} from "./chunk-WUKHLCBE.js";
|
|
4
|
+
import "./chunk-2I23RPSI.js";
|
|
5
|
+
import "./chunk-2E43UXRH.js";
|
|
6
|
+
import "./chunk-PNQDP3OA.js";
|
|
7
|
+
import "./chunk-7HLWBYH7.js";
|
|
8
|
+
import "./chunk-FXU7JOXK.js";
|
|
9
|
+
import "./chunk-R36FAN53.js";
|
|
10
|
+
import "./chunk-LYH5HE24.js";
|
|
11
|
+
import "./chunk-MLKGABMK.js";
|
|
12
|
+
|
|
13
|
+
// src/lib/token-budget.ts
|
|
14
|
+
var WARN_THRESHOLD = 0.8;
|
|
15
|
+
function createTokenBudgetMiddleware(taskId) {
|
|
16
|
+
return {
|
|
17
|
+
async onTokenUsed(inputTokens, outputTokens) {
|
|
18
|
+
const client = getClient();
|
|
19
|
+
const row = await client.execute({
|
|
20
|
+
sql: `SELECT budget_tokens, budget_fallback_model, tokens_used, tokens_warned_at
|
|
21
|
+
FROM tasks WHERE id = ?`,
|
|
22
|
+
args: [taskId]
|
|
23
|
+
});
|
|
24
|
+
if (row.rows.length === 0) {
|
|
25
|
+
return { exceeded: false, warned: false, fallback: null, percentUsed: 0 };
|
|
26
|
+
}
|
|
27
|
+
const r = row.rows[0];
|
|
28
|
+
const budgetTokens = r.budget_tokens !== null ? Number(r.budget_tokens) : null;
|
|
29
|
+
const budgetFallbackModel = r.budget_fallback_model !== null ? String(r.budget_fallback_model) : null;
|
|
30
|
+
const currentUsed = Number(r.tokens_used ?? 0);
|
|
31
|
+
const tokensWarnedAt = r.tokens_warned_at !== null ? Number(r.tokens_warned_at) : null;
|
|
32
|
+
const newUsed = currentUsed + inputTokens + outputTokens;
|
|
33
|
+
await client.execute({
|
|
34
|
+
sql: `UPDATE tasks SET tokens_used = ? WHERE id = ?`,
|
|
35
|
+
args: [newUsed, taskId]
|
|
36
|
+
});
|
|
37
|
+
if (budgetTokens === null) {
|
|
38
|
+
return { exceeded: false, warned: false, fallback: null, percentUsed: 0 };
|
|
39
|
+
}
|
|
40
|
+
const percentUsed = Math.round(newUsed / budgetTokens * 100);
|
|
41
|
+
const alreadyWarned = tokensWarnedAt !== null;
|
|
42
|
+
const atWarnThreshold = newUsed >= Math.floor(budgetTokens * WARN_THRESHOLD);
|
|
43
|
+
const warned = atWarnThreshold && !alreadyWarned;
|
|
44
|
+
if (warned) {
|
|
45
|
+
await client.execute({
|
|
46
|
+
sql: `UPDATE tasks SET tokens_warned_at = ? WHERE id = ?`,
|
|
47
|
+
args: [Math.floor(Date.now() / 1e3), taskId]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const exceeded = newUsed >= budgetTokens;
|
|
51
|
+
return {
|
|
52
|
+
exceeded,
|
|
53
|
+
warned,
|
|
54
|
+
fallback: exceeded ? budgetFallbackModel ?? null : null,
|
|
55
|
+
percentUsed
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
async getBudgetStatus() {
|
|
59
|
+
const client = getClient();
|
|
60
|
+
const row = await client.execute({
|
|
61
|
+
sql: `SELECT budget_tokens, budget_fallback_model, tokens_used, tokens_warned_at
|
|
62
|
+
FROM tasks WHERE id = ?`,
|
|
63
|
+
args: [taskId]
|
|
64
|
+
});
|
|
65
|
+
if (row.rows.length === 0) return null;
|
|
66
|
+
const r = row.rows[0];
|
|
67
|
+
const budgetTokens = r.budget_tokens !== null ? Number(r.budget_tokens) : null;
|
|
68
|
+
if (budgetTokens === null) return null;
|
|
69
|
+
const budgetFallbackModel = r.budget_fallback_model !== null ? String(r.budget_fallback_model) : null;
|
|
70
|
+
const tokensUsed = Number(r.tokens_used ?? 0);
|
|
71
|
+
const tokensWarnedAt = r.tokens_warned_at !== null ? Number(r.tokens_warned_at) : null;
|
|
72
|
+
const percentUsed = Math.round(tokensUsed / budgetTokens * 100);
|
|
73
|
+
return {
|
|
74
|
+
budgetTokens,
|
|
75
|
+
budgetFallbackModel,
|
|
76
|
+
tokensUsed,
|
|
77
|
+
percentUsed,
|
|
78
|
+
warned: tokensWarnedAt !== null,
|
|
79
|
+
exceeded: tokensUsed >= budgetTokens
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
createTokenBudgetMiddleware
|
|
86
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getToolUsageStats,
|
|
3
|
+
getToolUsageSummary,
|
|
4
|
+
resetToolUsageStats,
|
|
5
|
+
startToolTelemetryFlush,
|
|
6
|
+
stopToolTelemetryFlush,
|
|
7
|
+
wrapServerWithTelemetry
|
|
8
|
+
} from "./chunk-7UHCWCLT.js";
|
|
9
|
+
import "./chunk-MLKGABMK.js";
|
|
10
|
+
export {
|
|
11
|
+
getToolUsageStats,
|
|
12
|
+
getToolUsageSummary,
|
|
13
|
+
resetToolUsageStats,
|
|
14
|
+
startToolTelemetryFlush,
|
|
15
|
+
stopToolTelemetryFlush,
|
|
16
|
+
wrapServerWithTelemetry
|
|
17
|
+
};
|
package/dist/tui/App.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
getSessionPrompt
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-YJ2OYAOC.js";
|
|
5
|
+
import "../chunk-IIEN2PHV.js";
|
|
6
6
|
import "../chunk-VUH67PT4.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionScopeFilter
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-K5ZO532Q.js";
|
|
10
|
+
import "../chunk-JVHHXRFY.js";
|
|
11
11
|
import "../chunk-4JERP7NT.js";
|
|
12
12
|
import "../chunk-4FVVJ7ME.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-Y3PMNUM5.js";
|
|
14
|
+
import "../chunk-KOO3J5PV.js";
|
|
15
|
+
import "../chunk-22TVSRQQ.js";
|
|
16
16
|
import "../chunk-SSTLTIF3.js";
|
|
17
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-NLZHVIOP.js";
|
|
18
18
|
import "../chunk-QRTJNSKU.js";
|
|
19
19
|
import "../chunk-NGP6LSV2.js";
|
|
20
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-5CCXU2AW.js";
|
|
21
21
|
import "../chunk-CVYC6DUW.js";
|
|
22
22
|
import "../chunk-OPU3NYOO.js";
|
|
23
23
|
import "../chunk-GJV3WDWM.js";
|
|
24
24
|
import {
|
|
25
25
|
orgBus
|
|
26
26
|
} from "../chunk-MP2AFCGL.js";
|
|
27
|
-
import "../chunk-
|
|
27
|
+
import "../chunk-N7I2A667.js";
|
|
28
28
|
import "../chunk-HYZV25LY.js";
|
|
29
29
|
import {
|
|
30
30
|
DEFAULT_COORDINATOR_TEMPLATE_NAME,
|
|
31
31
|
isCoordinatorName
|
|
32
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-WUKHLCBE.js";
|
|
33
33
|
import "../chunk-2I23RPSI.js";
|
|
34
|
-
import "../chunk-
|
|
34
|
+
import "../chunk-2E43UXRH.js";
|
|
35
35
|
import "../chunk-PNQDP3OA.js";
|
|
36
36
|
import "../chunk-7HLWBYH7.js";
|
|
37
37
|
import "../chunk-FXU7JOXK.js";
|
|
@@ -7408,7 +7408,7 @@ function useOrchestrator(enabled = true) {
|
|
|
7408
7408
|
let cancelled = false;
|
|
7409
7409
|
async function init() {
|
|
7410
7410
|
try {
|
|
7411
|
-
const { MultiAgentOrchestrator } = await import("../orchestrator-
|
|
7411
|
+
const { MultiAgentOrchestrator } = await import("../orchestrator-DAFL2YZB.js");
|
|
7412
7412
|
const { getCoordinatorName, isCoordinatorRole, loadEmployees } = await import("../lib/employees.js");
|
|
7413
7413
|
const { isExeSession } = await import("../lib/tmux-routing.js");
|
|
7414
7414
|
const { listTmuxSessions, inTmux } = await import("../lib/tmux-status.js");
|
|
@@ -7449,7 +7449,7 @@ function useOrchestrator(enabled = true) {
|
|
|
7449
7449
|
setTotalInProgress(health.totalInProgress);
|
|
7450
7450
|
try {
|
|
7451
7451
|
const { getClient } = await import("../lib/database.js");
|
|
7452
|
-
const { sessionScopeFilter: sessionScopeFilter2 } = await import("../task-scope-
|
|
7452
|
+
const { sessionScopeFilter: sessionScopeFilter2 } = await import("../task-scope-CVK6ISCZ.js");
|
|
7453
7453
|
const client = getClient();
|
|
7454
7454
|
const uoScope = sessionScopeFilter2();
|
|
7455
7455
|
const result = await client.execute({
|
|
@@ -7481,7 +7481,7 @@ function useOrchestrator(enabled = true) {
|
|
|
7481
7481
|
const spawnSession = useCallback5(
|
|
7482
7482
|
async (agentId) => {
|
|
7483
7483
|
try {
|
|
7484
|
-
const { createTaskCore } = await import("../tasks-crud-
|
|
7484
|
+
const { createTaskCore } = await import("../tasks-crud-NTNET4JE.js");
|
|
7485
7485
|
const { ensureEmployee } = await import("../lib/tmux-routing.js");
|
|
7486
7486
|
const { getCoordinatorName } = await import("../lib/employees.js");
|
|
7487
7487
|
await createTaskCore({
|
|
@@ -8105,7 +8105,7 @@ function TasksView({ onBack }) {
|
|
|
8105
8105
|
const { withTrace } = await import("../telemetry-43X3GT3R.js");
|
|
8106
8106
|
return withTrace("tui.tasks.loadTasks", async () => {
|
|
8107
8107
|
try {
|
|
8108
|
-
const { loadTaskList } = await import("../tui-data-
|
|
8108
|
+
const { loadTaskList } = await import("../tui-data-6DOMUUCM.js");
|
|
8109
8109
|
const tasks = await loadTaskList();
|
|
8110
8110
|
setAllTasks(
|
|
8111
8111
|
tasks.map((task) => ({
|
|
@@ -8938,7 +8938,7 @@ function TeamView({ onBack, onViewSessions }) {
|
|
|
8938
8938
|
let projectsByEmployee = /* @__PURE__ */ new Map();
|
|
8939
8939
|
let currentTaskByEmployee = /* @__PURE__ */ new Map();
|
|
8940
8940
|
try {
|
|
8941
|
-
const { loadTeamBadgeCounts, loadTeamDetailMetrics } = await import("../tui-data-
|
|
8941
|
+
const { loadTeamBadgeCounts, loadTeamDetailMetrics } = await import("../tui-data-6DOMUUCM.js");
|
|
8942
8942
|
setBadgeInFlight(true);
|
|
8943
8943
|
const badgeCountsPromise = loadTeamBadgeCounts();
|
|
8944
8944
|
const detailsPromise = loadTeamDetailMetrics(roster.map((emp) => emp.name));
|
|
@@ -9304,7 +9304,7 @@ function WikiView({ onBack }) {
|
|
|
9304
9304
|
}
|
|
9305
9305
|
setSearchLoading(true);
|
|
9306
9306
|
try {
|
|
9307
|
-
const { searchWikiMemoryRows } = await import("../tui-data-
|
|
9307
|
+
const { searchWikiMemoryRows } = await import("../tui-data-6DOMUUCM.js");
|
|
9308
9308
|
setSearchResults(await searchWikiMemoryRows(query));
|
|
9309
9309
|
} catch {
|
|
9310
9310
|
setSearchResults([]);
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sessionScopeFilter
|
|
3
|
+
} from "./chunk-K5ZO532Q.js";
|
|
4
|
+
import "./chunk-JVHHXRFY.js";
|
|
5
|
+
import "./chunk-4JERP7NT.js";
|
|
6
|
+
import "./chunk-4FVVJ7ME.js";
|
|
7
|
+
import "./chunk-Y3PMNUM5.js";
|
|
8
|
+
import "./chunk-KOO3J5PV.js";
|
|
9
|
+
import "./chunk-22TVSRQQ.js";
|
|
10
|
+
import "./chunk-SSTLTIF3.js";
|
|
11
|
+
import "./chunk-NLZHVIOP.js";
|
|
12
|
+
import "./chunk-QRTJNSKU.js";
|
|
13
|
+
import "./chunk-NGP6LSV2.js";
|
|
14
|
+
import "./chunk-5CCXU2AW.js";
|
|
15
|
+
import "./chunk-CVYC6DUW.js";
|
|
16
|
+
import "./chunk-OPU3NYOO.js";
|
|
17
|
+
import "./chunk-GJV3WDWM.js";
|
|
18
|
+
import "./chunk-MP2AFCGL.js";
|
|
19
|
+
import "./chunk-N7I2A667.js";
|
|
20
|
+
import "./chunk-HYZV25LY.js";
|
|
21
|
+
import {
|
|
22
|
+
getClient
|
|
23
|
+
} from "./chunk-WUKHLCBE.js";
|
|
24
|
+
import "./chunk-2I23RPSI.js";
|
|
25
|
+
import "./chunk-2E43UXRH.js";
|
|
26
|
+
import "./chunk-PNQDP3OA.js";
|
|
27
|
+
import "./chunk-7HLWBYH7.js";
|
|
28
|
+
import "./chunk-FXU7JOXK.js";
|
|
29
|
+
import "./chunk-YTKVJJSU.js";
|
|
30
|
+
import "./chunk-R36FAN53.js";
|
|
31
|
+
import "./chunk-LYH5HE24.js";
|
|
32
|
+
import "./chunk-MLKGABMK.js";
|
|
33
|
+
|
|
34
|
+
// src/lib/tui-data.ts
|
|
35
|
+
async function loadMemoryDashboard(limit) {
|
|
36
|
+
const client = getClient();
|
|
37
|
+
const [countResult, recentResult, agentResult] = await Promise.all([
|
|
38
|
+
client.execute("SELECT COUNT(*) as cnt FROM memories"),
|
|
39
|
+
client.execute({
|
|
40
|
+
sql: "SELECT agent_id, tool_name, project_name, raw_text, timestamp FROM memories ORDER BY timestamp DESC LIMIT ?",
|
|
41
|
+
args: [limit]
|
|
42
|
+
}),
|
|
43
|
+
client.execute("SELECT agent_id, COUNT(*) as cnt FROM memories GROUP BY agent_id ORDER BY cnt DESC")
|
|
44
|
+
]);
|
|
45
|
+
return {
|
|
46
|
+
total: Number(countResult.rows[0]?.cnt ?? 0),
|
|
47
|
+
recent: recentResult.rows.map((row) => ({
|
|
48
|
+
agentId: String(row.agent_id ?? "unknown"),
|
|
49
|
+
toolName: String(row.tool_name ?? ""),
|
|
50
|
+
projectName: String(row.project_name ?? ""),
|
|
51
|
+
rawText: String(row.raw_text ?? ""),
|
|
52
|
+
timestamp: String(row.timestamp ?? "")
|
|
53
|
+
})),
|
|
54
|
+
byAgent: agentResult.rows.map((row) => ({
|
|
55
|
+
agentId: String(row.agent_id ?? "unknown"),
|
|
56
|
+
count: Number(row.cnt ?? 0)
|
|
57
|
+
}))
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
async function loadTeamBadgeCounts() {
|
|
61
|
+
const client = getClient();
|
|
62
|
+
const memoryCounts = /* @__PURE__ */ new Map();
|
|
63
|
+
const memResult = await client.execute("SELECT agent_id, COUNT(*) as cnt FROM memories GROUP BY agent_id");
|
|
64
|
+
for (const row of memResult.rows) {
|
|
65
|
+
memoryCounts.set(String(row.agent_id), Number(row.cnt));
|
|
66
|
+
}
|
|
67
|
+
return memoryCounts;
|
|
68
|
+
}
|
|
69
|
+
async function loadTeamDetailMetrics(employeeNames) {
|
|
70
|
+
const client = getClient();
|
|
71
|
+
const projectsByEmployee = /* @__PURE__ */ new Map();
|
|
72
|
+
const currentTaskByEmployee = /* @__PURE__ */ new Map();
|
|
73
|
+
const scope = sessionScopeFilter();
|
|
74
|
+
for (const employeeName of employeeNames) {
|
|
75
|
+
const [projectResult, taskResult] = await Promise.all([
|
|
76
|
+
client.execute({
|
|
77
|
+
sql: `SELECT DISTINCT project_name,
|
|
78
|
+
MAX(CASE WHEN status = 'in_progress' THEN 1 WHEN status = 'open' THEN 2 ELSE 3 END) as urgency
|
|
79
|
+
FROM tasks
|
|
80
|
+
WHERE assigned_to = ? AND status IN ('open','in_progress','done')${scope.sql}
|
|
81
|
+
GROUP BY project_name
|
|
82
|
+
ORDER BY urgency ASC
|
|
83
|
+
LIMIT 5`,
|
|
84
|
+
args: [employeeName, ...scope.args]
|
|
85
|
+
}),
|
|
86
|
+
client.execute({
|
|
87
|
+
sql: `SELECT title FROM tasks
|
|
88
|
+
WHERE assigned_to = ? AND status = 'in_progress'${scope.sql}
|
|
89
|
+
ORDER BY updated_at DESC
|
|
90
|
+
LIMIT 1`,
|
|
91
|
+
args: [employeeName, ...scope.args]
|
|
92
|
+
})
|
|
93
|
+
]);
|
|
94
|
+
const projects = projectResult.rows.map((row) => {
|
|
95
|
+
const urgency = Number(row.urgency);
|
|
96
|
+
return {
|
|
97
|
+
name: String(row.project_name),
|
|
98
|
+
status: urgency === 1 ? "active" : urgency === 2 ? "has_tasks" : "idle"
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
if (projects.length > 0) projectsByEmployee.set(employeeName, projects);
|
|
102
|
+
if (taskResult.rows.length > 0) {
|
|
103
|
+
currentTaskByEmployee.set(employeeName, String(taskResult.rows[0].title));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { projectsByEmployee, currentTaskByEmployee };
|
|
107
|
+
}
|
|
108
|
+
async function loadTeamMetrics(employeeNames) {
|
|
109
|
+
const [memoryCounts, { projectsByEmployee, currentTaskByEmployee }] = await Promise.all([
|
|
110
|
+
loadTeamBadgeCounts(),
|
|
111
|
+
loadTeamDetailMetrics(employeeNames)
|
|
112
|
+
]);
|
|
113
|
+
return { memoryCounts, projectsByEmployee, currentTaskByEmployee };
|
|
114
|
+
}
|
|
115
|
+
async function loadTaskList() {
|
|
116
|
+
const client = getClient();
|
|
117
|
+
const scope = sessionScopeFilter();
|
|
118
|
+
const result = await client.execute({
|
|
119
|
+
sql: `SELECT id, title, priority, assigned_to, assigned_by, status, project_name, created_at, result
|
|
120
|
+
FROM tasks
|
|
121
|
+
WHERE 1=1${scope.sql}
|
|
122
|
+
ORDER BY
|
|
123
|
+
CASE status WHEN 'in_progress' THEN 0 WHEN 'open' THEN 1 WHEN 'blocked' THEN 2 WHEN 'needs_review' THEN 3 WHEN 'done' THEN 4 ELSE 5 END,
|
|
124
|
+
CASE priority WHEN 'p0' THEN 0 WHEN 'p1' THEN 1 WHEN 'p2' THEN 2 ELSE 3 END,
|
|
125
|
+
created_at DESC`,
|
|
126
|
+
args: [...scope.args]
|
|
127
|
+
});
|
|
128
|
+
return result.rows.map((row) => ({
|
|
129
|
+
id: String(row.id ?? ""),
|
|
130
|
+
title: String(row.title ?? ""),
|
|
131
|
+
priority: String(row.priority ?? "p2").toUpperCase(),
|
|
132
|
+
assignedTo: String(row.assigned_to ?? ""),
|
|
133
|
+
assignedBy: String(row.assigned_by ?? ""),
|
|
134
|
+
status: String(row.status ?? "open"),
|
|
135
|
+
projectName: String(row.project_name ?? ""),
|
|
136
|
+
createdAt: String(row.created_at ?? ""),
|
|
137
|
+
result: String(row.result ?? "")
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
async function searchWikiMemoryRows(query) {
|
|
141
|
+
const client = getClient();
|
|
142
|
+
const result = await client.execute({
|
|
143
|
+
sql: `SELECT id, agent_id, raw_text, timestamp, project_name
|
|
144
|
+
FROM memories
|
|
145
|
+
WHERE raw_text LIKE ? AND COALESCE(status, 'active') = 'active'
|
|
146
|
+
ORDER BY timestamp DESC LIMIT 20`,
|
|
147
|
+
args: [`%${query}%`]
|
|
148
|
+
});
|
|
149
|
+
return result.rows.map((row) => ({
|
|
150
|
+
id: String(row.id),
|
|
151
|
+
agentId: String(row.agent_id),
|
|
152
|
+
rawText: String(row.raw_text),
|
|
153
|
+
timestamp: String(row.timestamp),
|
|
154
|
+
projectName: String(row.project_name ?? "")
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
async function loadEntityProfile(entityName) {
|
|
158
|
+
const client = getClient();
|
|
159
|
+
const { getEntityByName, getRelationships, getEntityTimeline } = await import("./graph-query-AP5R6ZHO.js");
|
|
160
|
+
const entity = await getEntityByName(client, entityName);
|
|
161
|
+
if (!entity) return null;
|
|
162
|
+
const [relationships, timelineRaw] = await Promise.all([
|
|
163
|
+
getRelationships(client, entity.id, { direction: "both" }),
|
|
164
|
+
getEntityTimeline(client, entity.id)
|
|
165
|
+
]);
|
|
166
|
+
const neighbors = relationships.map((r) => {
|
|
167
|
+
const isOutgoing = r.sourceEntityId === entity.id;
|
|
168
|
+
return {
|
|
169
|
+
name: isOutgoing ? r.targetName : r.sourceName,
|
|
170
|
+
type: isOutgoing ? "target" : "source",
|
|
171
|
+
relType: r.type,
|
|
172
|
+
direction: isOutgoing ? "outgoing" : "incoming",
|
|
173
|
+
weight: r.weight,
|
|
174
|
+
confidence: r.confidence
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
const timeline = timelineRaw.slice(0, 20).map((t) => {
|
|
178
|
+
const isOutgoing = t.relationship.sourceEntityId === entity.id;
|
|
179
|
+
return {
|
|
180
|
+
timestamp: t.timestamp,
|
|
181
|
+
relType: t.relationship.type,
|
|
182
|
+
partnerName: isOutgoing ? t.relationship.targetName : t.relationship.sourceName,
|
|
183
|
+
direction: isOutgoing ? "outgoing" : "incoming"
|
|
184
|
+
};
|
|
185
|
+
});
|
|
186
|
+
const relationshipTypes = {};
|
|
187
|
+
for (const r of relationships) {
|
|
188
|
+
relationshipTypes[r.type] = (relationshipTypes[r.type] ?? 0) + 1;
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
entity,
|
|
192
|
+
neighbors,
|
|
193
|
+
timeline,
|
|
194
|
+
stats: {
|
|
195
|
+
totalRelationships: relationships.length,
|
|
196
|
+
relationshipTypes
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
async function searchEntitiesList(query, limit = 20) {
|
|
201
|
+
const client = getClient();
|
|
202
|
+
const { searchEntities } = await import("./graph-query-AP5R6ZHO.js");
|
|
203
|
+
const entities = await searchEntities(client, query, limit);
|
|
204
|
+
if (entities.length === 0) return [];
|
|
205
|
+
const placeholders = entities.map(() => "?").join(",");
|
|
206
|
+
const ids = entities.map((e) => e.id);
|
|
207
|
+
const countResult = await client.execute({
|
|
208
|
+
sql: `SELECT source_entity_id as eid, COUNT(*) as cnt FROM relationships WHERE source_entity_id IN (${placeholders}) AND valid_until IS NULL GROUP BY source_entity_id
|
|
209
|
+
UNION ALL
|
|
210
|
+
SELECT target_entity_id as eid, COUNT(*) as cnt FROM relationships WHERE target_entity_id IN (${placeholders}) AND valid_until IS NULL GROUP BY target_entity_id`,
|
|
211
|
+
args: [...ids, ...ids]
|
|
212
|
+
});
|
|
213
|
+
const countMap = /* @__PURE__ */ new Map();
|
|
214
|
+
for (const row of countResult.rows) {
|
|
215
|
+
const eid = String(row.eid);
|
|
216
|
+
countMap.set(eid, (countMap.get(eid) ?? 0) + Number(row.cnt));
|
|
217
|
+
}
|
|
218
|
+
return entities.map((e) => ({
|
|
219
|
+
id: e.id,
|
|
220
|
+
name: e.name,
|
|
221
|
+
type: e.type,
|
|
222
|
+
lastSeen: e.lastSeen,
|
|
223
|
+
relationshipCount: countMap.get(e.id) ?? 0
|
|
224
|
+
}));
|
|
225
|
+
}
|
|
226
|
+
async function loadHotEntities(limit = 15) {
|
|
227
|
+
const client = getClient();
|
|
228
|
+
const { getHotEntities } = await import("./graph-query-AP5R6ZHO.js");
|
|
229
|
+
const since = new Date(Date.now() - 7 * 24 * 60 * 60 * 1e3);
|
|
230
|
+
const hot = await getHotEntities(client, since, limit);
|
|
231
|
+
return hot.map((h) => ({
|
|
232
|
+
id: h.entity.id,
|
|
233
|
+
name: h.entity.name,
|
|
234
|
+
type: h.entity.type,
|
|
235
|
+
lastSeen: h.entity.lastSeen,
|
|
236
|
+
relationshipCount: h.newRelationships
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
async function loadGraphOverview() {
|
|
240
|
+
const client = getClient();
|
|
241
|
+
const { getGraphStats } = await import("./graph-query-AP5R6ZHO.js");
|
|
242
|
+
const stats = await getGraphStats(client);
|
|
243
|
+
return {
|
|
244
|
+
totalEntities: stats.entities,
|
|
245
|
+
totalRelationships: stats.relationships,
|
|
246
|
+
entityTypes: stats.types
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
export {
|
|
250
|
+
loadEntityProfile,
|
|
251
|
+
loadGraphOverview,
|
|
252
|
+
loadHotEntities,
|
|
253
|
+
loadMemoryDashboard,
|
|
254
|
+
loadTaskList,
|
|
255
|
+
loadTeamBadgeCounts,
|
|
256
|
+
loadTeamDetailMetrics,
|
|
257
|
+
loadTeamMetrics,
|
|
258
|
+
searchEntitiesList,
|
|
259
|
+
searchWikiMemoryRows
|
|
260
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import "./chunk-MLKGABMK.js";
|
|
2
|
+
|
|
3
|
+
// src/lib/wiki-acl.ts
|
|
4
|
+
async function checkWikiAccess(userId, workspace, requiredLevel = "read") {
|
|
5
|
+
if (!userId) {
|
|
6
|
+
return {
|
|
7
|
+
allowed: requiredLevel === "read",
|
|
8
|
+
actualLevel: "read"
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
const { getClient } = await import("./lib/database.js");
|
|
13
|
+
const client = getClient();
|
|
14
|
+
const result = await client.execute({
|
|
15
|
+
sql: `SELECT access_level FROM wiki_acl WHERE user_id = ? AND workspace = ?`,
|
|
16
|
+
args: [userId, workspace]
|
|
17
|
+
});
|
|
18
|
+
if (result.rows.length > 0) {
|
|
19
|
+
const actualLevel = String(result.rows[0].access_level);
|
|
20
|
+
return {
|
|
21
|
+
allowed: accessLevelSatisfies(actualLevel, requiredLevel),
|
|
22
|
+
actualLevel
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const wildcardResult = await client.execute({
|
|
26
|
+
sql: `SELECT access_level FROM wiki_acl WHERE user_id = ? AND workspace = '*'`,
|
|
27
|
+
args: [userId]
|
|
28
|
+
});
|
|
29
|
+
if (wildcardResult.rows.length > 0) {
|
|
30
|
+
const actualLevel = String(wildcardResult.rows[0].access_level);
|
|
31
|
+
return {
|
|
32
|
+
allowed: accessLevelSatisfies(actualLevel, requiredLevel),
|
|
33
|
+
actualLevel
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
allowed: requiredLevel === "read",
|
|
38
|
+
actualLevel: "read"
|
|
39
|
+
};
|
|
40
|
+
} catch {
|
|
41
|
+
return {
|
|
42
|
+
allowed: requiredLevel === "read",
|
|
43
|
+
actualLevel: "read"
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function grantWikiAccess(userId, workspace, accessLevel, grantedBy) {
|
|
48
|
+
const { getClient } = await import("./lib/database.js");
|
|
49
|
+
const client = getClient();
|
|
50
|
+
await client.execute({
|
|
51
|
+
sql: `INSERT OR REPLACE INTO wiki_acl (user_id, workspace, access_level, granted_by, created_at)
|
|
52
|
+
VALUES (?, ?, ?, ?, ?)`,
|
|
53
|
+
args: [userId, workspace, accessLevel, grantedBy, (/* @__PURE__ */ new Date()).toISOString()]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async function revokeWikiAccess(userId, workspace) {
|
|
57
|
+
const { getClient } = await import("./lib/database.js");
|
|
58
|
+
const client = getClient();
|
|
59
|
+
const result = await client.execute({
|
|
60
|
+
sql: `DELETE FROM wiki_acl WHERE user_id = ? AND workspace = ?`,
|
|
61
|
+
args: [userId, workspace]
|
|
62
|
+
});
|
|
63
|
+
return (result.rowsAffected ?? 0) > 0;
|
|
64
|
+
}
|
|
65
|
+
async function listUserWikiAccess(userId) {
|
|
66
|
+
const { getClient } = await import("./lib/database.js");
|
|
67
|
+
const client = getClient();
|
|
68
|
+
const result = await client.execute({
|
|
69
|
+
sql: `SELECT user_id, workspace, access_level, granted_by, created_at
|
|
70
|
+
FROM wiki_acl WHERE user_id = ? ORDER BY workspace`,
|
|
71
|
+
args: [userId]
|
|
72
|
+
});
|
|
73
|
+
return result.rows.map((r) => ({
|
|
74
|
+
userId: String(r.user_id),
|
|
75
|
+
workspace: String(r.workspace),
|
|
76
|
+
accessLevel: String(r.access_level),
|
|
77
|
+
grantedBy: String(r.granted_by),
|
|
78
|
+
createdAt: String(r.created_at)
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
async function listWorkspaceUsers(workspace) {
|
|
82
|
+
const { getClient } = await import("./lib/database.js");
|
|
83
|
+
const client = getClient();
|
|
84
|
+
const result = await client.execute({
|
|
85
|
+
sql: `SELECT user_id, workspace, access_level, granted_by, created_at
|
|
86
|
+
FROM wiki_acl WHERE workspace = ? OR workspace = '*' ORDER BY user_id`,
|
|
87
|
+
args: [workspace]
|
|
88
|
+
});
|
|
89
|
+
return result.rows.map((r) => ({
|
|
90
|
+
userId: String(r.user_id),
|
|
91
|
+
workspace: String(r.workspace),
|
|
92
|
+
accessLevel: String(r.access_level),
|
|
93
|
+
grantedBy: String(r.granted_by),
|
|
94
|
+
createdAt: String(r.created_at)
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
var ACCESS_HIERARCHY = {
|
|
98
|
+
read: 1,
|
|
99
|
+
write: 2,
|
|
100
|
+
admin: 3
|
|
101
|
+
};
|
|
102
|
+
function accessLevelSatisfies(actual, required) {
|
|
103
|
+
return (ACCESS_HIERARCHY[actual] ?? 0) >= (ACCESS_HIERARCHY[required] ?? 0);
|
|
104
|
+
}
|
|
105
|
+
export {
|
|
106
|
+
checkWikiAccess,
|
|
107
|
+
grantWikiAccess,
|
|
108
|
+
listUserWikiAccess,
|
|
109
|
+
listWorkspaceUsers,
|
|
110
|
+
revokeWikiAccess
|
|
111
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MAX_CONCURRENT_WORKERS,
|
|
3
|
+
cleanupWorkerPid,
|
|
4
|
+
getTaskAwareCapacity,
|
|
5
|
+
registerWorkerPid,
|
|
6
|
+
releaseBackfillLock,
|
|
7
|
+
tryAcquireBackfillLock,
|
|
8
|
+
tryAcquireWorkerSlot
|
|
9
|
+
} from "./chunk-OAHEIH3G.js";
|
|
10
|
+
import "./chunk-R36FAN53.js";
|
|
11
|
+
import "./chunk-LYH5HE24.js";
|
|
12
|
+
import "./chunk-MLKGABMK.js";
|
|
13
|
+
export {
|
|
14
|
+
MAX_CONCURRENT_WORKERS,
|
|
15
|
+
cleanupWorkerPid,
|
|
16
|
+
getTaskAwareCapacity,
|
|
17
|
+
registerWorkerPid,
|
|
18
|
+
releaseBackfillLock,
|
|
19
|
+
tryAcquireBackfillLock,
|
|
20
|
+
tryAcquireWorkerSlot
|
|
21
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
advanceWorkflow,
|
|
3
|
+
approveWorkflowStep,
|
|
4
|
+
createWorkflowDefinition,
|
|
5
|
+
getWorkflowDefinition,
|
|
6
|
+
getWorkflowInstance,
|
|
7
|
+
listWorkflowDefinitions,
|
|
8
|
+
listWorkflowInstances,
|
|
9
|
+
loadWorkflows,
|
|
10
|
+
persistWorkflows,
|
|
11
|
+
runWorkflow,
|
|
12
|
+
startWorkflow
|
|
13
|
+
} from "./chunk-ZQML7EWE.js";
|
|
14
|
+
import "./chunk-VC2DTK2X.js";
|
|
15
|
+
import "./chunk-MLKGABMK.js";
|
|
16
|
+
export {
|
|
17
|
+
advanceWorkflow,
|
|
18
|
+
approveWorkflowStep,
|
|
19
|
+
createWorkflowDefinition,
|
|
20
|
+
getWorkflowDefinition,
|
|
21
|
+
getWorkflowInstance,
|
|
22
|
+
listWorkflowDefinitions,
|
|
23
|
+
listWorkflowInstances,
|
|
24
|
+
loadWorkflows,
|
|
25
|
+
persistWorkflows,
|
|
26
|
+
runWorkflow,
|
|
27
|
+
startWorkflow
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cleanupWorktree,
|
|
3
|
+
ensureWorktree,
|
|
4
|
+
getGitRoot,
|
|
5
|
+
getMainRepoRoot,
|
|
6
|
+
isWorktreeDirty,
|
|
7
|
+
worktreeBranch,
|
|
8
|
+
worktreePath
|
|
9
|
+
} from "./chunk-JVHHXRFY.js";
|
|
10
|
+
import "./chunk-NLZHVIOP.js";
|
|
11
|
+
import "./chunk-WUKHLCBE.js";
|
|
12
|
+
import "./chunk-2I23RPSI.js";
|
|
13
|
+
import "./chunk-2E43UXRH.js";
|
|
14
|
+
import "./chunk-PNQDP3OA.js";
|
|
15
|
+
import "./chunk-7HLWBYH7.js";
|
|
16
|
+
import "./chunk-FXU7JOXK.js";
|
|
17
|
+
import "./chunk-R36FAN53.js";
|
|
18
|
+
import "./chunk-LYH5HE24.js";
|
|
19
|
+
import "./chunk-MLKGABMK.js";
|
|
20
|
+
export {
|
|
21
|
+
cleanupWorktree,
|
|
22
|
+
ensureWorktree,
|
|
23
|
+
getGitRoot,
|
|
24
|
+
getMainRepoRoot,
|
|
25
|
+
isWorktreeDirty,
|
|
26
|
+
worktreeBranch,
|
|
27
|
+
worktreePath
|
|
28
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cleanupAgentWorktree,
|
|
3
|
+
discoverRepoPaths,
|
|
4
|
+
sweepWorktrees
|
|
5
|
+
} from "./chunk-D3WTZPFX.js";
|
|
6
|
+
import "./chunk-JVHHXRFY.js";
|
|
7
|
+
import "./chunk-NLZHVIOP.js";
|
|
8
|
+
import "./chunk-WUKHLCBE.js";
|
|
9
|
+
import "./chunk-2I23RPSI.js";
|
|
10
|
+
import "./chunk-2E43UXRH.js";
|
|
11
|
+
import "./chunk-PNQDP3OA.js";
|
|
12
|
+
import "./chunk-7HLWBYH7.js";
|
|
13
|
+
import "./chunk-FXU7JOXK.js";
|
|
14
|
+
import "./chunk-R36FAN53.js";
|
|
15
|
+
import "./chunk-LYH5HE24.js";
|
|
16
|
+
import "./chunk-MLKGABMK.js";
|
|
17
|
+
export {
|
|
18
|
+
cleanupAgentWorktree,
|
|
19
|
+
discoverRepoPaths,
|
|
20
|
+
sweepWorktrees
|
|
21
|
+
};
|