@a-company/paradigm 3.43.0 → 3.44.0
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-YW5OCVKB.js → chunk-FKJUBQU3.js} +14 -1
- package/dist/{symphony-ROEKK7VD.js → chunk-SOBTKFSP.js} +48 -431
- package/dist/{chunk-RGFANZ4Q.js → chunk-ZDHLG5VP.js} +14 -1
- package/dist/{chunk-CZEIK3Y2.js → chunk-ZMQA6SCO.js} +1 -1
- package/dist/{chunk-7WEKMZ46.js → chunk-ZSYVKSY6.js} +1 -1
- package/dist/{commands-LEPFD7S5.js → commands-5N4ILTPH.js} +13 -0
- package/dist/{dist-RVKYUCRU.js → dist-CM3MVWWW.js} +1 -1
- package/dist/{dist-Y7I3CFY5.js → dist-POMVY6WP.js} +2 -2
- package/dist/{habits-O37HTUKE.js → habits-RG5SVKXP.js} +2 -2
- package/dist/index.js +47 -47
- package/dist/mcp.js +19 -9
- package/dist/{platform-server-KK4OCRTV.js → platform-server-KHL6ZPPN.js} +10 -1
- package/dist/{reindex-NZQRGKPN.js → reindex-WIJMCJ4A.js} +1 -1
- package/dist/{sentinel-BKYTBT7M.js → sentinel-UOIGJWHH.js} +1 -1
- package/dist/{sentinel-bridge-IZTXYS5M.js → sentinel-bridge-APDXYAZS.js} +1 -1
- package/dist/sentinel-mcp.js +13 -0
- package/dist/sentinel.js +6 -6
- package/dist/{serve-3V2WXLGM.js → serve-JVXSRSUB.js} +1 -1
- package/dist/{server-OFEJ2HJP.js → server-JV6UFGWZ.js} +1 -1
- package/dist/symphony-EYRGGVNE.js +470 -0
- package/dist/symphony-QWOEKZMC.js +308 -0
- package/dist/{triage-POXJ2TIX.js → triage-IZ4MDYNB.js} +2 -2
- package/package.json +1 -1
- package/platform-ui/dist/assets/{GitSection-DvyJBF_-.js → GitSection-BD3Ze06e.js} +1 -1
- package/platform-ui/dist/assets/{GraphSection-BiQrXqfs.js → GraphSection-SglITfSs.js} +1 -1
- package/platform-ui/dist/assets/{LoreSection-BaH1FaRb.js → LoreSection-bR5Km4Fd.js} +1 -1
- package/platform-ui/dist/assets/{SentinelSection-DemAznjI.js → SentinelSection-QSpAZArG.js} +1 -1
- package/platform-ui/dist/assets/SymphonySection-CobYJgvg.js +1 -0
- package/platform-ui/dist/assets/SymphonySection-zY0C5tFl.css +1 -0
- package/platform-ui/dist/assets/{index-DDKhCt-w.js → index-DbxeSMkV.js} +11 -11
- package/platform-ui/dist/index.html +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// ../sentinel/dist/chunk-
|
|
3
|
+
// ../sentinel/dist/chunk-OKYYIAML.js
|
|
4
4
|
import initSqlJs from "sql.js";
|
|
5
5
|
import { v4 as uuidv4 } from "uuid";
|
|
6
6
|
import * as path from "path";
|
|
@@ -598,6 +598,19 @@ var SentinelStorage = class {
|
|
|
598
598
|
);
|
|
599
599
|
this.save();
|
|
600
600
|
}
|
|
601
|
+
resolveIncident(id, options) {
|
|
602
|
+
this.updateIncident(id, {
|
|
603
|
+
status: "resolved",
|
|
604
|
+
resolvedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
605
|
+
});
|
|
606
|
+
if (options?.notes) {
|
|
607
|
+
this.addIncidentNote(id, {
|
|
608
|
+
author: "system",
|
|
609
|
+
content: options.notes,
|
|
610
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
}
|
|
601
614
|
addIncidentNote(incidentId, note) {
|
|
602
615
|
this.initializeSync();
|
|
603
616
|
const incident = this.getIncident(incidentId);
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./chunk-ZXMDA7VB.js";
|
|
3
|
-
|
|
4
|
-
// src/commands/symphony/index.ts
|
|
5
|
-
import chalk from "chalk";
|
|
6
|
-
import * as net from "net";
|
|
7
2
|
|
|
8
3
|
// ../paradigm-mcp/src/utils/symphony-loader.ts
|
|
9
4
|
import * as fs from "fs";
|
|
@@ -171,12 +166,15 @@ function getMyIdentity(projectDir) {
|
|
|
171
166
|
return null;
|
|
172
167
|
}
|
|
173
168
|
}
|
|
174
|
-
function markAgentPollTime(agentId) {
|
|
169
|
+
function markAgentPollTime(agentId, statusBlurb) {
|
|
175
170
|
const identityPath = path.join(getAgentDir(agentId), "identity.json");
|
|
176
171
|
if (!fs.existsSync(identityPath)) return;
|
|
177
172
|
try {
|
|
178
173
|
const identity = JSON.parse(fs.readFileSync(identityPath, "utf-8"));
|
|
179
174
|
identity.lastPoll = (/* @__PURE__ */ new Date()).toISOString();
|
|
175
|
+
if (statusBlurb !== void 0) {
|
|
176
|
+
identity.statusBlurb = statusBlurb || void 0;
|
|
177
|
+
}
|
|
180
178
|
fs.writeFileSync(identityPath, JSON.stringify(identity, null, 2), "utf-8");
|
|
181
179
|
} catch {
|
|
182
180
|
}
|
|
@@ -561,6 +559,24 @@ function isPathDenied(filePath, config, user) {
|
|
|
561
559
|
}
|
|
562
560
|
return false;
|
|
563
561
|
}
|
|
562
|
+
function expireOldRequests() {
|
|
563
|
+
const requests = listFileRequests("pending");
|
|
564
|
+
let expired = 0;
|
|
565
|
+
for (const record of requests) {
|
|
566
|
+
const age = Date.now() - new Date(record.createdAt).getTime();
|
|
567
|
+
if (age > FILE_REQUEST_TTL_MS) {
|
|
568
|
+
record.status = "expired";
|
|
569
|
+
record.resolvedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
570
|
+
fs.writeFileSync(
|
|
571
|
+
fileRequestPath(record.request.requestId),
|
|
572
|
+
JSON.stringify(record, null, 2),
|
|
573
|
+
"utf-8"
|
|
574
|
+
);
|
|
575
|
+
expired++;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
return expired;
|
|
579
|
+
}
|
|
564
580
|
function isProcessAlive(pid) {
|
|
565
581
|
try {
|
|
566
582
|
process.kill(pid, 0);
|
|
@@ -570,430 +586,31 @@ function isProcessAlive(pid) {
|
|
|
570
586
|
}
|
|
571
587
|
}
|
|
572
588
|
|
|
573
|
-
// src/commands/symphony/index.ts
|
|
574
|
-
async function symphonyJoinCommand(options) {
|
|
575
|
-
const rootDir = process.cwd();
|
|
576
|
-
if (options.remote) {
|
|
577
|
-
console.log(chalk.yellow(`Remote linking to ${options.remote} \u2014 not yet implemented in Phase 0.`));
|
|
578
|
-
console.log(chalk.gray("Remote linking will be available in a future Symphony phase."));
|
|
579
|
-
return;
|
|
580
|
-
}
|
|
581
|
-
const identity = registerAgent(rootDir);
|
|
582
|
-
console.log(chalk.green(`\u2713 Joined as ${chalk.bold(identity.id)}`));
|
|
583
|
-
const sessions = discoverClaudeCodeSessions();
|
|
584
|
-
const others = sessions.filter((s) => s.id !== identity.id);
|
|
585
|
-
if (others.length > 0) {
|
|
586
|
-
console.log(chalk.cyan(`
|
|
587
|
-
Found ${others.length} other session${others.length !== 1 ? "s" : ""}:`));
|
|
588
|
-
for (const s of others) {
|
|
589
|
-
const status = isAgentAsleep(s) ? chalk.yellow("asleep") : chalk.green("awake");
|
|
590
|
-
console.log(` ${chalk.white(s.id)} \u2014 ${s.name} [${status}]`);
|
|
591
|
-
}
|
|
592
|
-
} else {
|
|
593
|
-
console.log(chalk.gray('\n No other sessions found. Open another terminal and run "paradigm symphony join".'));
|
|
594
|
-
}
|
|
595
|
-
console.log(chalk.gray(`
|
|
596
|
-
Tip: Set up polling with: /loop 10s paradigm_symphony_poll`));
|
|
597
|
-
}
|
|
598
|
-
async function symphonyLeaveCommand() {
|
|
599
|
-
const rootDir = process.cwd();
|
|
600
|
-
const agentId = resolveAgentIdentity(rootDir);
|
|
601
|
-
const success = unregisterAgent(agentId);
|
|
602
|
-
if (success) {
|
|
603
|
-
console.log(chalk.green(`\u2713 Left the score: ${agentId}`));
|
|
604
|
-
} else {
|
|
605
|
-
console.log(chalk.yellow(`No active part found for this project.`));
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
async function symphonyWhoamiCommand() {
|
|
609
|
-
const rootDir = process.cwd();
|
|
610
|
-
const identity = getMyIdentity(rootDir);
|
|
611
|
-
if (!identity) {
|
|
612
|
-
console.log(chalk.yellow('Not joined. Run "paradigm symphony join" first.'));
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
const agents = listAgents();
|
|
616
|
-
const others = agents.filter((a) => a.id !== identity.id);
|
|
617
|
-
const threads = listThreads("active");
|
|
618
|
-
const unread = readInbox(identity.id);
|
|
619
|
-
console.log(chalk.cyan(`
|
|
620
|
-
${chalk.bold(identity.id)}`));
|
|
621
|
-
console.log(chalk.gray(` Project: ${identity.project}`));
|
|
622
|
-
console.log(chalk.gray(` Role: ${identity.role}`));
|
|
623
|
-
console.log(chalk.gray(` PID: ${identity.pid}`));
|
|
624
|
-
console.log(chalk.gray(` Started: ${identity.startedAt}`));
|
|
625
|
-
console.log(`
|
|
626
|
-
${chalk.white(`${others.length} linked peer${others.length !== 1 ? "s" : ""}`)} \u2014 ${chalk.white(`${threads.length} active thread${threads.length !== 1 ? "s" : ""}`)} \u2014 ${chalk.white(`${unread.length} unread`)}`);
|
|
627
|
-
}
|
|
628
|
-
async function symphonyListCommand(options) {
|
|
629
|
-
cleanStaleAgents();
|
|
630
|
-
const agents = listAgents();
|
|
631
|
-
if (options.json) {
|
|
632
|
-
console.log(JSON.stringify(agents, null, 2));
|
|
633
|
-
return;
|
|
634
|
-
}
|
|
635
|
-
if (agents.length === 0) {
|
|
636
|
-
console.log(chalk.yellow('No agents joined. Run "paradigm symphony join" in each terminal.'));
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
console.log(chalk.cyan(`
|
|
640
|
-
Symphony Agents (${agents.length})
|
|
641
|
-
`));
|
|
642
|
-
console.log(chalk.gray(` ${"AGENT ID".padEnd(30)} ${"PROJECT".padEnd(15)} ${"ROLE".padEnd(10)} STATUS`));
|
|
643
|
-
console.log(chalk.gray(` ${"\u2500".repeat(30)} ${"\u2500".repeat(15)} ${"\u2500".repeat(10)} ${"\u2500".repeat(8)}`));
|
|
644
|
-
for (const agent of agents) {
|
|
645
|
-
const status = isAgentAsleep(agent) ? chalk.yellow("asleep") : chalk.green("awake");
|
|
646
|
-
console.log(` ${chalk.white(agent.id.padEnd(30))} ${agent.project.padEnd(15)} ${agent.role.padEnd(10)} ${status}`);
|
|
647
|
-
}
|
|
648
|
-
console.log();
|
|
649
|
-
}
|
|
650
|
-
async function symphonySendCommand(messageText, options) {
|
|
651
|
-
const rootDir = process.cwd();
|
|
652
|
-
let identity = getMyIdentity(rootDir);
|
|
653
|
-
if (!identity) {
|
|
654
|
-
identity = registerAgent(rootDir);
|
|
655
|
-
console.log(chalk.gray(`Auto-joined as ${identity.id}`));
|
|
656
|
-
}
|
|
657
|
-
const sender = {
|
|
658
|
-
id: identity.id,
|
|
659
|
-
name: identity.name,
|
|
660
|
-
type: "human",
|
|
661
|
-
// CLI notes come from the human
|
|
662
|
-
project: identity.project,
|
|
663
|
-
role: identity.role
|
|
664
|
-
};
|
|
665
|
-
let recipients;
|
|
666
|
-
if (options.to) {
|
|
667
|
-
recipients = [{ id: options.to, name: options.to, type: "agent" }];
|
|
668
|
-
}
|
|
669
|
-
let threadRoot = options.thread;
|
|
670
|
-
if (!threadRoot) {
|
|
671
|
-
const topic = messageText.length > 60 ? messageText.slice(0, 60) + "..." : messageText;
|
|
672
|
-
const thread = createThread(topic, sender);
|
|
673
|
-
threadRoot = thread.id;
|
|
674
|
-
}
|
|
675
|
-
const message = buildMessage({
|
|
676
|
-
sender,
|
|
677
|
-
recipients,
|
|
678
|
-
intent: "context",
|
|
679
|
-
text: messageText,
|
|
680
|
-
threadRoot
|
|
681
|
-
});
|
|
682
|
-
const deliveryCount = routeMessage(message);
|
|
683
|
-
console.log(chalk.green(`\u2713 Sent to ${deliveryCount} agent${deliveryCount !== 1 ? "s" : ""}`));
|
|
684
|
-
console.log(chalk.gray(` Thread: ${threadRoot}`));
|
|
685
|
-
console.log(chalk.gray(` Note: ${message.id}`));
|
|
686
|
-
}
|
|
687
|
-
async function symphonyReadCommand() {
|
|
688
|
-
const rootDir = process.cwd();
|
|
689
|
-
const identity = getMyIdentity(rootDir);
|
|
690
|
-
if (!identity) {
|
|
691
|
-
console.log(chalk.yellow('Not joined. Run "paradigm symphony join" first.'));
|
|
692
|
-
return;
|
|
693
|
-
}
|
|
694
|
-
markAgentPollTime(identity.id);
|
|
695
|
-
const messages = readInbox(identity.id);
|
|
696
|
-
if (messages.length === 0) {
|
|
697
|
-
console.log(chalk.gray("\n No unread notes.\n"));
|
|
698
|
-
return;
|
|
699
|
-
}
|
|
700
|
-
const byThread = /* @__PURE__ */ new Map();
|
|
701
|
-
for (const msg of messages) {
|
|
702
|
-
const tid = msg.threadRoot || "direct";
|
|
703
|
-
if (!byThread.has(tid)) byThread.set(tid, []);
|
|
704
|
-
byThread.get(tid).push(msg);
|
|
705
|
-
}
|
|
706
|
-
console.log(chalk.cyan(`
|
|
707
|
-
${messages.length} unread note${messages.length !== 1 ? "s" : ""}
|
|
708
|
-
`));
|
|
709
|
-
for (const [threadId, msgs] of byThread) {
|
|
710
|
-
let threadLabel = threadId;
|
|
711
|
-
if (threadId !== "direct") {
|
|
712
|
-
const thread = loadThread(threadId);
|
|
713
|
-
if (thread) threadLabel = `${thread.topic} (${threadId})`;
|
|
714
|
-
}
|
|
715
|
-
console.log(chalk.white(` \u250C\u2500 ${threadLabel}`));
|
|
716
|
-
for (let i = 0; i < msgs.length; i++) {
|
|
717
|
-
const msg = msgs[i];
|
|
718
|
-
const isLast = i === msgs.length - 1;
|
|
719
|
-
const prefix = isLast ? " \u2514\u2500" : " \u251C\u2500";
|
|
720
|
-
const time = new Date(msg.timestamp).toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
|
|
721
|
-
console.log(`${prefix} ${chalk.cyan(msg.sender.name)} ${chalk.gray(`[${msg.intent}]`)} ${chalk.gray(time)}`);
|
|
722
|
-
const textLines = msg.content.text.split("\n");
|
|
723
|
-
const indent = isLast ? " " : " \u2502 ";
|
|
724
|
-
for (const line of textLines) {
|
|
725
|
-
console.log(`${indent}${line}`);
|
|
726
|
-
}
|
|
727
|
-
if (msg.symbols.length > 0) {
|
|
728
|
-
console.log(`${indent}${chalk.gray(`Symbols: ${msg.symbols.join(", ")}`)}`);
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
console.log();
|
|
732
|
-
}
|
|
733
|
-
const lastId = messages[messages.length - 1].id;
|
|
734
|
-
acknowledgeMessages(identity.id, lastId);
|
|
735
|
-
garbageCollect(identity.id);
|
|
736
|
-
}
|
|
737
|
-
async function symphonyThreadsCommand(options) {
|
|
738
|
-
const threads = listThreads();
|
|
739
|
-
if (options.json) {
|
|
740
|
-
console.log(JSON.stringify(threads, null, 2));
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
if (threads.length === 0) {
|
|
744
|
-
console.log(chalk.gray("\n No threads.\n"));
|
|
745
|
-
return;
|
|
746
|
-
}
|
|
747
|
-
console.log(chalk.cyan(`
|
|
748
|
-
Threads (${threads.length})
|
|
749
|
-
`));
|
|
750
|
-
console.log(chalk.gray(` ${"ID".padEnd(14)} ${"TOPIC".padEnd(35)} ${"MSGS".padEnd(6)} ${"STATUS".padEnd(10)} LAST ACTIVITY`));
|
|
751
|
-
console.log(chalk.gray(` ${"\u2500".repeat(14)} ${"\u2500".repeat(35)} ${"\u2500".repeat(6)} ${"\u2500".repeat(10)} ${"\u2500".repeat(20)}`));
|
|
752
|
-
for (const thread of threads) {
|
|
753
|
-
const topic = thread.topic.length > 33 ? thread.topic.slice(0, 33) + ".." : thread.topic;
|
|
754
|
-
const status = thread.status === "active" ? chalk.green("active") : chalk.gray("resolved");
|
|
755
|
-
const lastAct = new Date(thread.lastActivity).toLocaleString(void 0, {
|
|
756
|
-
month: "short",
|
|
757
|
-
day: "numeric",
|
|
758
|
-
hour: "numeric",
|
|
759
|
-
minute: "2-digit"
|
|
760
|
-
});
|
|
761
|
-
console.log(` ${chalk.white(thread.id.padEnd(14))} ${topic.padEnd(35)} ${String(thread.messageCount).padEnd(6)} ${status.padEnd(10)} ${chalk.gray(lastAct)}`);
|
|
762
|
-
}
|
|
763
|
-
console.log();
|
|
764
|
-
}
|
|
765
|
-
async function symphonyThreadCommand(threadId) {
|
|
766
|
-
const thread = loadThread(threadId);
|
|
767
|
-
if (!thread) {
|
|
768
|
-
console.log(chalk.red(`Thread not found: ${threadId}`));
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
const messages = getThreadMessages(threadId);
|
|
772
|
-
console.log(chalk.cyan(`
|
|
773
|
-
Thread: ${thread.topic}`));
|
|
774
|
-
console.log(chalk.gray(` ID: ${thread.id} | Status: ${thread.status} | Notes: ${thread.messageCount}`));
|
|
775
|
-
console.log(chalk.gray(` Participants: ${thread.participants.map((p) => p.name).join(", ")}`));
|
|
776
|
-
if (thread.decision) {
|
|
777
|
-
console.log(chalk.green(` Decision: ${thread.decision}`));
|
|
778
|
-
}
|
|
779
|
-
console.log(chalk.gray(`
|
|
780
|
-
${"\u2500".repeat(60)}
|
|
781
|
-
`));
|
|
782
|
-
for (const msg of messages) {
|
|
783
|
-
const time = new Date(msg.timestamp).toLocaleString(void 0, {
|
|
784
|
-
month: "short",
|
|
785
|
-
day: "numeric",
|
|
786
|
-
hour: "numeric",
|
|
787
|
-
minute: "2-digit"
|
|
788
|
-
});
|
|
789
|
-
console.log(` ${chalk.cyan(msg.sender.name)} ${chalk.gray(`[${msg.intent}]`)} ${chalk.gray(time)}`);
|
|
790
|
-
const textLines = msg.content.text.split("\n");
|
|
791
|
-
for (const line of textLines) {
|
|
792
|
-
console.log(` ${line}`);
|
|
793
|
-
}
|
|
794
|
-
if (msg.symbols.length > 0) {
|
|
795
|
-
console.log(` ${chalk.gray(`Symbols: ${msg.symbols.join(", ")}`)}`);
|
|
796
|
-
}
|
|
797
|
-
if (msg.content.decision) {
|
|
798
|
-
console.log(` ${chalk.green(`Decision: ${msg.content.decision}`)}`);
|
|
799
|
-
}
|
|
800
|
-
console.log();
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
async function symphonyResolveCommand(threadId, options) {
|
|
804
|
-
const thread = loadThread(threadId);
|
|
805
|
-
if (!thread) {
|
|
806
|
-
console.log(chalk.red(`Thread not found: ${threadId}`));
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
const success = resolveThread(threadId, options.decision);
|
|
810
|
-
if (success) {
|
|
811
|
-
console.log(chalk.green(`\u2713 Thread resolved: ${thread.topic}`));
|
|
812
|
-
if (options.decision) {
|
|
813
|
-
console.log(chalk.gray(` Decision: ${options.decision}`));
|
|
814
|
-
}
|
|
815
|
-
console.log(chalk.gray(` Tip: Record this as lore with "paradigm lore record --title 'Thread: ${thread.topic}'"`));
|
|
816
|
-
} else {
|
|
817
|
-
console.log(chalk.red("Failed to resolve thread."));
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
async function symphonyStatusCommand(options) {
|
|
821
|
-
cleanStaleAgents();
|
|
822
|
-
const rootDir = process.cwd();
|
|
823
|
-
const identity = getMyIdentity(rootDir);
|
|
824
|
-
const agents = listAgents();
|
|
825
|
-
const threads = listThreads("active");
|
|
826
|
-
const pendingRequests = listFileRequests("pending");
|
|
827
|
-
const unread = identity ? readInbox(identity.id) : [];
|
|
828
|
-
if (options.json) {
|
|
829
|
-
console.log(JSON.stringify({
|
|
830
|
-
identity: identity ? { id: identity.id, project: identity.project, role: identity.role } : null,
|
|
831
|
-
agents: agents.map((a) => ({ id: a.id, status: isAgentAsleep(a) ? "asleep" : "awake" })),
|
|
832
|
-
activeThreads: threads.length,
|
|
833
|
-
unreadMessages: unread.length,
|
|
834
|
-
pendingFileRequests: pendingRequests.length
|
|
835
|
-
}, null, 2));
|
|
836
|
-
return;
|
|
837
|
-
}
|
|
838
|
-
console.log(chalk.cyan("\n Symphony Status\n"));
|
|
839
|
-
if (identity) {
|
|
840
|
-
console.log(` ${chalk.white("Identity:")} ${identity.id}`);
|
|
841
|
-
} else {
|
|
842
|
-
console.log(` ${chalk.yellow("Not joined.")} Run "paradigm symphony join" to join.`);
|
|
843
|
-
}
|
|
844
|
-
const awake = agents.filter((a) => !isAgentAsleep(a)).length;
|
|
845
|
-
console.log(` ${chalk.white("Agents:")} ${agents.length} joined (${awake} awake)`);
|
|
846
|
-
console.log(` ${chalk.white("Threads:")} ${threads.length} active`);
|
|
847
|
-
console.log(` ${chalk.white("Unread:")} ${unread.length} note${unread.length !== 1 ? "s" : ""}`);
|
|
848
|
-
console.log(` ${chalk.white("File Requests:")} ${pendingRequests.length} pending`);
|
|
849
|
-
console.log();
|
|
850
|
-
}
|
|
851
|
-
async function symphonyServeCommand(options) {
|
|
852
|
-
const port = parseInt(options.port || "3939", 10);
|
|
853
|
-
console.log(chalk.cyan(`
|
|
854
|
-
Starting Symphony TCP server on port ${port}...`));
|
|
855
|
-
console.log(chalk.gray(" Phase 0 stub \u2014 remote linking protocol not yet implemented.\n"));
|
|
856
|
-
const server = net.createServer((socket) => {
|
|
857
|
-
socket.write(JSON.stringify({ type: "hello", version: "0.1.0" }) + "\n");
|
|
858
|
-
socket.on("data", (data) => {
|
|
859
|
-
try {
|
|
860
|
-
const msg = JSON.parse(data.toString().trim());
|
|
861
|
-
socket.write(JSON.stringify({ type: "ack", received: msg.type }) + "\n");
|
|
862
|
-
} catch {
|
|
863
|
-
socket.write(JSON.stringify({ type: "error", message: "Invalid JSON" }) + "\n");
|
|
864
|
-
}
|
|
865
|
-
});
|
|
866
|
-
socket.on("error", () => {
|
|
867
|
-
});
|
|
868
|
-
});
|
|
869
|
-
server.listen(port, "0.0.0.0", () => {
|
|
870
|
-
console.log(chalk.green(` \u2713 Symphony server listening on 0.0.0.0:${port}`));
|
|
871
|
-
console.log(chalk.gray(` Connect from another machine: paradigm symphony join --remote <this-ip>:${port}`));
|
|
872
|
-
});
|
|
873
|
-
server.on("error", (err) => {
|
|
874
|
-
console.log(chalk.red(` Failed to start server: ${err.message}`));
|
|
875
|
-
});
|
|
876
|
-
await new Promise(() => {
|
|
877
|
-
});
|
|
878
|
-
}
|
|
879
|
-
async function symphonyRequestCommand(file, options) {
|
|
880
|
-
const rootDir = process.cwd();
|
|
881
|
-
let identity = getMyIdentity(rootDir);
|
|
882
|
-
if (!identity) {
|
|
883
|
-
identity = registerAgent(rootDir);
|
|
884
|
-
}
|
|
885
|
-
const from = options.from;
|
|
886
|
-
const reason = options.reason || "Needed for current task";
|
|
887
|
-
if (!from) {
|
|
888
|
-
console.log(chalk.red("--from is required. Specify which agent to request from."));
|
|
889
|
-
const agents = listAgents().filter((a) => a.id !== identity.id);
|
|
890
|
-
if (agents.length > 0) {
|
|
891
|
-
console.log(chalk.gray("\nAvailable agents:"));
|
|
892
|
-
for (const a of agents) {
|
|
893
|
-
console.log(chalk.gray(` ${a.id}`));
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
return;
|
|
897
|
-
}
|
|
898
|
-
const trust = loadTrustConfig();
|
|
899
|
-
if (isPathDenied(file, trust)) {
|
|
900
|
-
console.log(chalk.red(`\u2717 "${file}" is on the hard-deny list and cannot be requested.`));
|
|
901
|
-
return;
|
|
902
|
-
}
|
|
903
|
-
const record = createFileRequest({
|
|
904
|
-
filePath: file,
|
|
905
|
-
requester: {
|
|
906
|
-
id: identity.id,
|
|
907
|
-
name: identity.name,
|
|
908
|
-
type: "agent",
|
|
909
|
-
project: identity.project,
|
|
910
|
-
role: identity.role
|
|
911
|
-
},
|
|
912
|
-
reason
|
|
913
|
-
});
|
|
914
|
-
const msg = buildMessage({
|
|
915
|
-
sender: {
|
|
916
|
-
id: identity.id,
|
|
917
|
-
name: identity.name,
|
|
918
|
-
type: "agent",
|
|
919
|
-
project: identity.project,
|
|
920
|
-
role: identity.role
|
|
921
|
-
},
|
|
922
|
-
recipients: [{ id: from, name: from, type: "agent" }],
|
|
923
|
-
intent: "fileRequest",
|
|
924
|
-
text: `File request: ${file}
|
|
925
|
-
Reason: ${reason}`,
|
|
926
|
-
symbols: []
|
|
927
|
-
});
|
|
928
|
-
routeMessage(msg);
|
|
929
|
-
console.log(chalk.green(`\u2713 File request created: ${record.request.requestId}`));
|
|
930
|
-
console.log(chalk.gray(` File: ${file}`));
|
|
931
|
-
console.log(chalk.gray(` From: ${from}`));
|
|
932
|
-
console.log(chalk.gray(` Reason: ${reason}`));
|
|
933
|
-
console.log(chalk.gray(`
|
|
934
|
-
The owning agent's human must approve with:`));
|
|
935
|
-
console.log(chalk.white(` paradigm symphony approve ${record.request.requestId}`));
|
|
936
|
-
}
|
|
937
|
-
async function symphonyRequestsCommand() {
|
|
938
|
-
const requests = listFileRequests("pending");
|
|
939
|
-
if (requests.length === 0) {
|
|
940
|
-
console.log(chalk.gray("\n No pending file requests.\n"));
|
|
941
|
-
return;
|
|
942
|
-
}
|
|
943
|
-
console.log(chalk.cyan(`
|
|
944
|
-
Pending File Requests (${requests.length})
|
|
945
|
-
`));
|
|
946
|
-
for (const req of requests) {
|
|
947
|
-
const age = Date.now() - new Date(req.createdAt).getTime();
|
|
948
|
-
const ageMin = Math.round(age / 6e4);
|
|
949
|
-
console.log(` ${chalk.white(req.request.requestId)}`);
|
|
950
|
-
console.log(` File: ${req.request.filePath}`);
|
|
951
|
-
console.log(` From: ${req.request.requester.name} (${req.request.requester.id})`);
|
|
952
|
-
console.log(` Reason: ${req.request.reason}`);
|
|
953
|
-
console.log(chalk.gray(` ${ageMin}m ago`));
|
|
954
|
-
console.log(chalk.gray(` \u2192 paradigm symphony approve ${req.request.requestId}`));
|
|
955
|
-
console.log(chalk.gray(` \u2192 paradigm symphony deny ${req.request.requestId}`));
|
|
956
|
-
console.log();
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
async function symphonyApproveCommand(requestId, options) {
|
|
960
|
-
const rootDir = process.cwd();
|
|
961
|
-
const result = approveFileRequest(requestId, rootDir, options.redact);
|
|
962
|
-
if (!result.success) {
|
|
963
|
-
console.log(chalk.red(`\u2717 ${result.error}`));
|
|
964
|
-
return;
|
|
965
|
-
}
|
|
966
|
-
const label = options.redact ? "approved (redacted)" : "approved";
|
|
967
|
-
console.log(chalk.green(`\u2713 File request ${label}`));
|
|
968
|
-
console.log(chalk.gray(` File: ${result.delivery?.filePath}`));
|
|
969
|
-
console.log(chalk.gray(` Size: ${result.delivery?.size} bytes`));
|
|
970
|
-
console.log(chalk.gray(` SHA-256: ${result.delivery?.hash?.slice(0, 16)}...`));
|
|
971
|
-
}
|
|
972
|
-
async function symphonyDenyCommand(requestId, options) {
|
|
973
|
-
const success = denyFileRequest(requestId, options.reason);
|
|
974
|
-
if (success) {
|
|
975
|
-
console.log(chalk.green(`\u2713 File request denied: ${requestId}`));
|
|
976
|
-
if (options.reason) {
|
|
977
|
-
console.log(chalk.gray(` Reason: ${options.reason}`));
|
|
978
|
-
}
|
|
979
|
-
} else {
|
|
980
|
-
console.log(chalk.red(`\u2717 File request not found or already resolved: ${requestId}`));
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
589
|
export {
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
590
|
+
resolveAgentIdentity,
|
|
591
|
+
registerAgent,
|
|
592
|
+
unregisterAgent,
|
|
593
|
+
listAgents,
|
|
594
|
+
cleanStaleAgents,
|
|
595
|
+
getMyIdentity,
|
|
596
|
+
markAgentPollTime,
|
|
597
|
+
isAgentAsleep,
|
|
598
|
+
discoverClaudeCodeSessions,
|
|
599
|
+
readInbox,
|
|
600
|
+
acknowledgeMessages,
|
|
601
|
+
garbageCollect,
|
|
602
|
+
createThread,
|
|
603
|
+
loadThread,
|
|
604
|
+
listThreads,
|
|
605
|
+
resolveThread,
|
|
606
|
+
getThreadMessages,
|
|
607
|
+
buildMessage,
|
|
608
|
+
routeMessage,
|
|
609
|
+
loadTrustConfig,
|
|
610
|
+
createFileRequest,
|
|
611
|
+
listFileRequests,
|
|
612
|
+
approveFileRequest,
|
|
613
|
+
denyFileRequest,
|
|
614
|
+
isPathDenied,
|
|
615
|
+
expireOldRequests
|
|
999
616
|
};
|
|
@@ -413,7 +413,7 @@ function enableSentinel(logger, clientOrOptions) {
|
|
|
413
413
|
return transport;
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
// ../sentinel/dist/chunk-
|
|
416
|
+
// ../sentinel/dist/chunk-OKYYIAML.js
|
|
417
417
|
import initSqlJs from "sql.js";
|
|
418
418
|
import { v4 as uuidv42 } from "uuid";
|
|
419
419
|
import * as path from "path";
|
|
@@ -1011,6 +1011,19 @@ var SentinelStorage = class {
|
|
|
1011
1011
|
);
|
|
1012
1012
|
this.save();
|
|
1013
1013
|
}
|
|
1014
|
+
resolveIncident(id, options) {
|
|
1015
|
+
this.updateIncident(id, {
|
|
1016
|
+
status: "resolved",
|
|
1017
|
+
resolvedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1018
|
+
});
|
|
1019
|
+
if (options?.notes) {
|
|
1020
|
+
this.addIncidentNote(id, {
|
|
1021
|
+
author: "system",
|
|
1022
|
+
content: options.notes,
|
|
1023
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1014
1027
|
addIncidentNote(incidentId, note) {
|
|
1015
1028
|
this.initializeSync();
|
|
1016
1029
|
const incident = this.getIncident(incidentId);
|
|
@@ -4405,7 +4405,7 @@ function assertStep(step, event) {
|
|
|
4405
4405
|
async function validateAgainstSentinel(persona, options = {}) {
|
|
4406
4406
|
const steps = [];
|
|
4407
4407
|
try {
|
|
4408
|
-
const { SentinelStorage } = await import("./dist-
|
|
4408
|
+
const { SentinelStorage } = await import("./dist-CM3MVWWW.js");
|
|
4409
4409
|
const storage = new SentinelStorage();
|
|
4410
4410
|
const events = storage.queryEvents?.({
|
|
4411
4411
|
schemaId: "paradigm-personas",
|
|
@@ -599,6 +599,19 @@ var SentinelStorage = class {
|
|
|
599
599
|
);
|
|
600
600
|
this.save();
|
|
601
601
|
}
|
|
602
|
+
resolveIncident(id, options) {
|
|
603
|
+
this.updateIncident(id, {
|
|
604
|
+
status: "resolved",
|
|
605
|
+
resolvedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
606
|
+
});
|
|
607
|
+
if (options?.notes) {
|
|
608
|
+
this.addIncidentNote(id, {
|
|
609
|
+
author: "system",
|
|
610
|
+
content: options.notes,
|
|
611
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
}
|
|
602
615
|
addIncidentNote(incidentId, note) {
|
|
603
616
|
this.initializeSync();
|
|
604
617
|
const incident = this.getIncident(incidentId);
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
loadAllSeedPatterns,
|
|
20
20
|
loadParadigmPatterns,
|
|
21
21
|
loadUniversalPatterns
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ZSYVKSY6.js";
|
|
23
23
|
import {
|
|
24
24
|
DEFAULT_AUTH_CONFIG,
|
|
25
25
|
DEFAULT_RATE_LIMIT_CONFIG,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
loadConfig,
|
|
31
31
|
loadServerConfig,
|
|
32
32
|
writeConfig
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-FKJUBQU3.js";
|
|
34
34
|
import "./chunk-ZXMDA7VB.js";
|
|
35
35
|
export {
|
|
36
36
|
ContextEnricher,
|
|
@@ -934,7 +934,7 @@ async function habitsStatusCommand(options) {
|
|
|
934
934
|
const enabled = getEnabledHabits(habits);
|
|
935
935
|
let practiceData = null;
|
|
936
936
|
try {
|
|
937
|
-
const { SentinelStorage } = await import("./dist-
|
|
937
|
+
const { SentinelStorage } = await import("./dist-POMVY6WP.js");
|
|
938
938
|
const sentinelDir = path3.join(rootDir, ".paradigm", "sentinel");
|
|
939
939
|
if (fs2.existsSync(sentinelDir)) {
|
|
940
940
|
const storage = new SentinelStorage(sentinelDir);
|
|
@@ -1302,7 +1302,7 @@ async function habitsCheckCommand(options) {
|
|
|
1302
1302
|
try {
|
|
1303
1303
|
const sentinelDir = path3.join(rootDir, ".paradigm", "sentinel");
|
|
1304
1304
|
if (fs2.existsSync(sentinelDir)) {
|
|
1305
|
-
const { SentinelStorage } = await import("./dist-
|
|
1305
|
+
const { SentinelStorage } = await import("./dist-POMVY6WP.js");
|
|
1306
1306
|
const storage = new SentinelStorage(sentinelDir);
|
|
1307
1307
|
for (const e of evaluation.evaluations) {
|
|
1308
1308
|
storage.recordPracticeEvent({
|