@commonlyai/cli 0.1.34 → 0.1.35

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonlyai/cli",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Commonly CLI — connect agents, manage pods, iterate fast",
6
6
  "type": "module",
@@ -50,6 +50,7 @@ import {
50
50
  createClaimHandicap,
51
51
  createClaimKeeper,
52
52
  deliverChatReply,
53
+ frameDecisionForkRule,
53
54
  peerHoldsFrame,
54
55
  resolveCascadeSettings,
55
56
  } from '../lib/enforcement.js';
@@ -694,6 +695,18 @@ const extractPrompt = (event) => {
694
695
  'Only post a concise pod update if a human needs it; otherwise return NO_REPLY.',
695
696
  ].join('\n');
696
697
  }
698
+ if (event.type === 'decision.ruled') {
699
+ if (!p.decisionId || !p.pick || !p.ruledAt) return null;
700
+ const ruler = p.ruledBy?.username || 'A human';
701
+ return [
702
+ '[Decision ruled]',
703
+ `${ruler} chose: ${String(p.pick)}`,
704
+ `Decision: ${String(p.decisionId)}`,
705
+ `Ruled at: ${String(p.ruledAt)}`,
706
+ '',
707
+ 'Continue with this ruling. Post a concise update only if it materially helps the pod; otherwise return NO_REPLY.',
708
+ ].join('\n');
709
+ }
697
710
  return null;
698
711
  };
699
712
 
@@ -1050,7 +1063,7 @@ export const performRun = ({
1050
1063
  const memoryLongTerm = await readLongTerm(client, { onError });
1051
1064
 
1052
1065
  log(`[${event.type}] spawning ${adapter.name}`);
1053
- const result = await adapter.spawn(prompt, {
1066
+ const result = await adapter.spawn(frameDecisionForkRule(prompt), {
1054
1067
  sessionId,
1055
1068
  cwd: agentCwd,
1056
1069
  env: process.env,
@@ -28,6 +28,20 @@ export const CLAIMABLE_EVENT_TYPES = new Set([
28
28
  'dm.message',
29
29
  ]);
30
30
 
31
+ // A decision card is the durable path for a real human choice. This lives in
32
+ // wrapper enforcement, rather than only in the MCP tool description, because
33
+ // a task-shaped prompt can otherwise make an agent phrase the same fork as a
34
+ // prose @ask. The rule is framing, not a classifier: the agent still judges
35
+ // whether the work genuinely cannot continue without a human ruling.
36
+ export const DECISION_FORK_FRAME = [
37
+ '[Decision forks]',
38
+ 'If you are blocked on a genuine fork that needs a human choice, call commonly_request_decision; do not post a prose @ask.',
39
+ 'Use it only when you cannot safely continue before a ruling. Give 2–4 concrete options and mark one recommendation.',
40
+ 'Use ordinary pod messages for status, factual questions, and coordination that do not require a human choice.',
41
+ ].join('\n');
42
+
43
+ export const frameDecisionForkRule = (prompt) => `${DECISION_FORK_FRAME}\n\n${prompt}`;
44
+
31
45
  // ── trigger classification ──────────────────────────────────────────────────
32
46
 
33
47
  /**