@lightupai/polaris 0.0.117 → 0.0.120

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.
@@ -32,22 +32,36 @@ try {
32
32
  } | null;
33
33
  const items = body?.pendingInjects;
34
34
  if (Array.isArray(items) && items.length > 0) {
35
- // Present injects with honest provenance and let the model apply its own
36
- // judgment. NOTE (verified live): the model treats content arriving via
37
- // this channel as not-from-the-developer and will surface/consider it but
38
- // will NOT obey imperative instructions through it — no hook wording
39
- // reliably changes that, nor should it. Use injects to SHARE CONTEXT with
40
- // the agent, not to remote-control its actions. (For trusted imperative
41
- // steering, the claude/channel path is the right mechanism — deferred.)
42
- const formatted =
43
- "Context shared by teammates collaborating in this session via Polaris " +
44
- "(for your awareness; it did not come directly from the developer):\n" +
45
- items.map((i) => `- ${i.from}: ${i.content}`).join("\n");
35
+ const direct = items.filter((i) => i.type === "direct");
36
+ const context = items.filter((i) => i.type !== "direct");
37
+
38
+ const parts: string[] = [];
39
+
40
+ // Direct session-to-session messages: printed verbatim with a loud banner
41
+ // so the receiver sees exactly what was sent, unambiguously attributed.
42
+ const SEP = "━".repeat(48);
43
+ for (const i of direct) {
44
+ parts.push(`${SEP}\n POLARIS — from: ${i.from}\n${SEP}\n${i.content}\n${SEP}`);
45
+ }
46
+
47
+ // Advisor context: presented as background awareness, not direct commands.
48
+ // NOTE (verified live): the model treats content arriving via this channel
49
+ // as not-from-the-developer and will surface/consider it but will NOT obey
50
+ // imperative instructions — no hook wording reliably changes that, nor
51
+ // should it. Use injects to SHARE CONTEXT, not to remote-control actions.
52
+ if (context.length > 0) {
53
+ parts.push(
54
+ "Context shared by teammates collaborating in this session via Polaris " +
55
+ "(for your awareness; it did not come directly from the developer):\n" +
56
+ context.map((i) => `- ${i.from}: ${i.content}`).join("\n")
57
+ );
58
+ }
59
+
46
60
  process.stdout.write(
47
61
  JSON.stringify({
48
62
  hookSpecificOutput: {
49
63
  hookEventName: "UserPromptSubmit",
50
- additionalContext: formatted,
64
+ additionalContext: parts.join("\n\n"),
51
65
  },
52
66
  })
53
67
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightupai/polaris",
3
- "version": "0.0.117",
3
+ "version": "0.0.120",
4
4
  "description": "Record and stream Claude Code sessions to Slack. Like Gong for AI coding — capture every prompt, response, and tool call. Multiplayer collaboration across AI coding agents.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -358,7 +358,9 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
358
358
  try {
359
359
  const res = await daemonPost("/send", { ccSessionId: CC_SESSION_ID, targetSession, message });
360
360
  if (res.ok) {
361
- return { content: [{ type: "text", text: `Message sent to session '${targetSession}'.` }] };
361
+ const SEP = "━".repeat(48);
362
+ const banner = `${SEP}\n POLARIS — sent to: ${currentProject}/${targetSession}\n${SEP}\n${message}\n${SEP}`;
363
+ return { content: [{ type: "text", text: banner }] };
362
364
  }
363
365
  const body = await res.json();
364
366
  return { content: [{ type: "text", text: `Failed to send: ${(body as { error?: string }).error ?? res.status}` }] };
@@ -26,7 +26,7 @@ function generateSessionName(): string {
26
26
  const sessions = new Map<string, SessionMapping>(); // keyed by ccSessionId
27
27
 
28
28
  // Advisor injects queued for delivery via the UserPromptSubmit hook
29
- const injectQueues = new Map<string, Array<{ from: string; content: string; timestamp: string }>>(); // keyed by ccSessionId
29
+ const injectQueues = new Map<string, Array<{ from: string; content: string; timestamp: string; type?: "direct" }>>(); // keyed by ccSessionId
30
30
 
31
31
  // --- Config resolution (env var > config.json > legacy credentials.json > defaults) ---
32
32
 
@@ -1203,7 +1203,7 @@ export function startDaemon(port = Number(process.env.POLARIS_DAEMON_PORT ?? 432
1203
1203
  injectQueues.set(id, queue);
1204
1204
  }
1205
1205
  }
1206
- queue.push({ from: sender.session, content: body.message, timestamp });
1206
+ queue.push({ from: `${sender.project}/${sender.session}`, content: body.message, timestamp, type: "direct" });
1207
1207
 
1208
1208
  await logEvent("/send", body, undefined, { project: sender.project, session: sender.session, ccSessionId: body.ccSessionId });
1209
1209
  return json({ status: "delivered", from: sender.session, to: body.targetSession });