gcf-board 0.9.1 → 0.10.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.
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>GCF board</title>
7
- <script type="module" crossorigin src="/assets/index-m10Wkvhe.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-UzVgbCWq.css">
7
+ <script type="module" crossorigin src="/assets/index-Ds-_gzfR.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-BlCYzxb6.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="root"></div>
@@ -260,24 +260,32 @@ function requested(e) {
260
260
  input,
261
261
  title: String(title),
262
262
  reason: typeof e.request.description === 'string' ? e.request.description : null,
263
- always: alwaysOf(e.request.permission_suggestions),
263
+ ...alwaysOf(e.request.permission_suggestions),
264
264
  },
265
265
  ];
266
266
  }
267
267
 
268
+ // One tool of one MCP server, as claude names it (letters, digits, - and _): it suggests it
269
+ // bare, with no content to narrow it.
270
+ const MCP_TOOL = /^mcp__[A-Za-z0-9-][\w-]*__[A-Za-z0-9-][\w-]*$/;
271
+
268
272
  /**
269
273
  * The rule "always" would save (AD-2): claude's suggestion of an allow rule for the local
270
- * settings, as `Tool(content)`; null for none, for a bare tool or a bare `*`: too wide.
274
+ * settings, as `Tool(content)`; `always: null` for none, a bare `*`, or a bare tool, which is too
275
+ * wide, except one tool of an MCP server: the operator sees its name and decides, and the card
276
+ * says it holds for any arguments (`always_wide`).
271
277
  */
272
278
  function alwaysOf(suggestions) {
273
279
  const add = (Array.isArray(suggestions) ? suggestions : []).find(
274
280
  (s) => s?.type === 'addRules' && s.behavior === 'allow' && s.destination === 'localSettings',
275
281
  );
276
282
  const r = add?.rules?.[0];
283
+ const tool = typeof r?.toolName === 'string' ? r.toolName : '';
277
284
  const content = typeof r?.ruleContent === 'string' ? r.ruleContent.trim() : '';
278
- if (typeof r?.toolName !== 'string' || !content || /^\**$/.test(content)) return null;
285
+ if (!tool || /^\*+$/.test(content)) return { always: null };
286
+ if (!content) return MCP_TOOL.test(tool) ? { always: tool, always_wide: true } : { always: null };
279
287
 
280
- return `${r.toolName}(${content})`;
288
+ return { always: `${tool}(${content})` };
281
289
  }
282
290
 
283
291
  /** @returns {Neutral[]} */
@@ -624,6 +624,8 @@ function permit(c, e) {
624
624
  title: e.title,
625
625
  ...(e.reason ? { reason: e.reason } : {}),
626
626
  ...(always ? { always } : {}),
627
+ // The rule holds for any arguments of the tool: the card says so before Always.
628
+ ...(always && e.always_wide ? { always_wide: true } : {}),
627
629
  });
628
630
  waitCards(c);
629
631
  }
@@ -109,12 +109,14 @@ const pickFile = (td) => path.join(td, 'agent.json');
109
109
  const wordOf = (v) =>
110
110
  typeof v === 'string' && v !== AGENT_DEFAULT && PICK_WORD.test(v) ? v : null;
111
111
 
112
+ /** The plain words of a pick, `{model?, effort?}`; a bad word left out. */
113
+ const wordsOf = (v) =>
114
+ Object.fromEntries(PICKS.flatMap((k) => (wordOf(v?.[k]) ? [[k, v[k]]] : [])));
115
+
112
116
  /** What `agent.json` of folder `td` picks, `{model?, effort?}`; a hand edit's bad word left out. */
113
117
  function pickIn(td) {
114
118
  try {
115
- const v = JSON.parse(readFileSync(pickFile(td), 'utf8'));
116
-
117
- return Object.fromEntries(PICKS.flatMap((k) => (wordOf(v?.[k]) ? [[k, v[k]]] : [])));
119
+ return wordsOf(JSON.parse(readFileSync(pickFile(td), 'utf8')));
118
120
  } catch {
119
121
  return {};
120
122
  }
@@ -341,8 +343,8 @@ function flagsOf({ dir, td, spec, adapter }, settings) {
341
343
  * Run thread `t` of project `dir` until its session idles out, is stopped, or ends: a job of
342
344
  * sessions (AD-41), each resumed from the one before, a fresh one after a handoff (AD-42).
343
345
  * `spec` (its `spec.json`): `agent`, `rules` `{deny, ask, allow}`, `mcp` (config files),
344
- * `answerMin`, `handoffPct`, `window`, `skill`, `mainLock`, `timeoutMin`. `stopped()` says the
345
- * operator stopped it.
346
+ * `answerMin`, `handoffPct`, `window`, `skill`, `mainLock`, `timeoutMin`, `pick` (the project's
347
+ * model and effort, under the thread's own). `stopped()` says the operator stopped it.
346
348
  * @param {{stopped?: () => boolean}} [opts]
347
349
  */
348
350
  export async function runThread(dir, t, spec, opts = {}) {
@@ -578,7 +580,8 @@ function jobOf(s, record) {
578
580
  prompt: (kind, _caps, rec) => (rec?.ended === 'limit' ? AFTER_LIMIT : null),
579
581
  // The flags come before the chat of each session (job.js): the chat says what they picked.
580
582
  flags: (kind) => {
581
- s.pick = pickIn(s.td);
583
+ // The thread's own pick over the project's (`spec.pick`, as the thread's agent started).
584
+ s.pick = { ...wordsOf(spec.pick), ...pickIn(s.td) };
582
585
 
583
586
  return s.flags(kind, s.summary, s.pick);
584
587
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gcf-session",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "private": true,
5
5
  "description": "The session engine of GCF: one agent session and a run as a chain of them, the chat protocol, the provider adapters. Bundled by gcf-harness-aif-ext and gcf-board, never published.",
6
6
  "type": "module",
@@ -71,6 +71,8 @@ export type ChatEvent = At &
71
71
  title: string;
72
72
  reason?: string;
73
73
  always?: string;
74
+ /** `always` holds for any arguments of the tool (one MCP tool, bare). */
75
+ always_wide?: boolean;
74
76
  }
75
77
  | { type: 'allowed'; request_id: string; by: 'operator'; always: boolean; rule?: string }
76
78
  | {
@@ -150,6 +152,8 @@ export interface ThreadSpec {
150
152
  skill?: string;
151
153
  mainLock?: string | null;
152
154
  timeoutMin?: number;
155
+ /** The project's model and effort: a session takes them where the thread picked none. */
156
+ pick?: AgentPick;
153
157
  }
154
158
 
155
159
  /** The model and effort an operator picked, `chats/<t>/agent.json`: none, the agent's own. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gcf-board",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "A local web board for GCF game projects: shows `gcf board --json` and runs the same ai-factory gcf commands an operator runs in a console",
5
5
  "type": "module",
6
6
  "license": "MIT",