clavarium 0.2.101-next.1 → 0.2.105-next.1

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.101-next.1",
3
+ "version": "0.2.105-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.101-next.1",
9
+ "version": "0.2.105-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.101-next.1",
3
+ "version": "0.2.105-next.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
@@ -696,7 +696,11 @@ export class GitKeeper {
696
696
  /* Its machine did not run them: tried again later, when it may. */
697
697
  if (checks.status !== 'unavailable') held.done.set(b, tip.id);
698
698
  const why = checks.status === 'failed' ? `the checks failed in the machine of ${conversation}` : checks.status === 'none' ? 'automatic sending needs passing checks, and none is set (no pre-push hook, no check command)' : `the checks could not run: the machine of ${conversation} does not run`;
699
- return once(`checks-${checks.status}`, { what: `Not sent: ${why}.`, tell: true, ...(checks.status === 'failed' ? { ai: `the checks failed for ${plain(b)}, it was not sent` } : {}) }), false;
699
+ /* On a failure the agent is given the END OF THE CHECK OUTPUT, not only
700
+ that it failed: it is the one that can fix it, and guessing without the
701
+ output wastes its time. */
702
+ const tail = String(checks.output ?? '').trim();
703
+ return once(`checks-${checks.status}`, { what: `Not sent: ${why}.`, tell: true, ...(checks.status === 'failed' ? { ai: `the checks failed for ${plain(b)}, it was not sent${tail ? `. The end of the output:\n\n${tail}` : ''}` } : {}) }), false;
700
704
  }
701
705
  }
702
706
  const checked = s.checks ? 'checks passed' : 'no checks asked for';
@@ -75,15 +75,25 @@ function improbableWord(s, floor = ENTROPY_MIN) {
75
75
  export const secretRef = (name, at) => `⟨secret:${name}${Number.isFinite(at) ? `@${at}` : ''}⟩`;
76
76
  export const SECRET_REF = /⟨secret:(SECRET_[0-9A-F]{10})(?:@(\d+))?⟩/g;
77
77
 
78
+ /* A URL left alone: the entropy nets skip what falls inside one, so a long
79
+ random-looking path or query (a tracking link, a LinkedIn profile) is not
80
+ taken for a secret. A token with a known shape (sk-..., a JWT) is still
81
+ caught, in a URL or not, because the SHAPES run everywhere. */
82
+ const URL = /\bhttps?:\/\/[^\s<>"'`)\]}]+/gi;
83
+
78
84
  export function scan(text) {
79
85
  const str = String(text ?? '');
80
86
  const found = [];
87
+ const urlSpans = [];
88
+ URL.lastIndex = 0;
89
+ for (let m; (m = URL.exec(str));) urlSpans.push([m.index, m.index + m[0].length]);
90
+ const inUrl = (start, end) => urlSpans.some(([s, e]) => start >= s && end <= e);
81
91
  for (const { kind, re } of SHAPES) {
82
92
  re.lastIndex = 0;
83
93
  for (let m; (m = re.exec(str));) found.push({ start: m.index, end: m.index + m[0].length, value: m[0], kind });
84
94
  }
85
95
  for (let m; (m = BLOB.exec(str));) {
86
- if (looksRandom(m[0])) found.push({ start: m.index, end: m.index + m[0].length, value: m[0], kind: 'high-entropy' });
96
+ if (looksRandom(m[0]) && !inUrl(m.index, m.index + m[0].length)) found.push({ start: m.index, end: m.index + m[0].length, value: m[0], kind: 'high-entropy' });
87
97
  }
88
98
  BLOB.lastIndex = 0;
89
99
  /* A word nearby that announces a secret widens the net to shorter runs, on a lower floor. */
@@ -91,7 +101,7 @@ export function scan(text) {
91
101
  const wordRe = near ? SHORT_WORD : WORD;
92
102
  const floor = near ? ENTROPY_SHORT : ENTROPY_MIN;
93
103
  for (let m; (m = wordRe.exec(str));) {
94
- if (improbableWord(m[0], floor)) found.push({ start: m.index, end: m.index + m[0].length, value: m[0], kind: 'high-entropy' });
104
+ if (improbableWord(m[0], floor) && !inUrl(m.index, m.index + m[0].length)) found.push({ start: m.index, end: m.index + m[0].length, value: m[0], kind: 'high-entropy' });
95
105
  }
96
106
  wordRe.lastIndex = 0;
97
107
  /* Keep left-to-right, and when two matches overlap keep the one that starts
@@ -35,7 +35,10 @@ export class Tethers {
35
35
  constructor({ dataDir, resources, conversations, secrets, connectors, now = () => Date.now() }) {
36
36
  this.#resources = resources; this.#conversations = conversations; this.#secrets = secrets;
37
37
  this.#keeper = keeper(`${dataDir}/tether`, { sides: () => this.#sides(), secrets: (name) => this.#reveal(name), now, ...(connectors ? { connectors } : {}) });
38
- this.#keeper.store.onChange(() => { this.#changes++; });
38
+ /* Every change a page shows -- a new approval waiting, one decided, the targets,
39
+ the journal -- bumps the counter the client watches, so the approvals screen
40
+ sees them all at once, not only when a store change happens to wake it. */
41
+ this.#keeper.onChange(() => { this.#changes++; });
39
42
  }
40
43
 
41
44
  /* A secret's value for a connector, by name, from this server's vault; never seen by the agent.