@intentic/sandbox-contract 1.421.0 → 1.423.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/chores/chores.d.ts.map +1 -1
- package/dist/chores/chores.js +1 -48
- package/dist/chores/chores.js.map +1 -1
- package/dist/chores/index.d.ts +1 -1
- package/dist/chores/index.d.ts.map +1 -1
- package/dist/chores/index.js +1 -1
- package/dist/chores/index.js.map +1 -1
- package/dist/chores/prompt.d.ts +0 -1
- package/dist/chores/prompt.d.ts.map +1 -1
- package/dist/chores/prompt.js +0 -2
- package/dist/chores/prompt.js.map +1 -1
- package/dist/contracts/capabilities.contract.d.ts +0 -28
- package/dist/contracts/capabilities.contract.d.ts.map +1 -1
- package/dist/contracts/ci.contract.d.ts +30 -0
- package/dist/contracts/ci.contract.d.ts.map +1 -1
- package/dist/contracts/ci.contract.js +10 -1
- package/dist/contracts/ci.contract.js.map +1 -1
- package/dist/contracts/device.contract.d.ts +46 -0
- package/dist/contracts/device.contract.d.ts.map +1 -1
- package/dist/contracts/device.contract.js +2 -0
- package/dist/contracts/device.contract.js.map +1 -1
- package/dist/contracts/issues.contract.d.ts +6 -0
- package/dist/contracts/issues.contract.d.ts.map +1 -1
- package/dist/contracts/offload.contract.d.ts +51 -0
- package/dist/contracts/offload.contract.d.ts.map +1 -1
- package/dist/contracts/offload.contract.js +3 -3
- package/dist/contracts/offload.contract.js.map +1 -1
- package/dist/contracts/panels.contract.d.ts +0 -7
- package/dist/contracts/panels.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.d.ts +48 -0
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/secrets.contract.d.ts +2 -17
- package/dist/contracts/secrets.contract.d.ts.map +1 -1
- package/dist/contracts/secrets.contract.js +2 -2
- package/dist/contracts/secrets.contract.js.map +1 -1
- package/dist/contracts/settings.contract.d.ts +0 -135
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.d.ts +18 -18
- package/dist/contracts/workspace.contract.d.ts +0 -60
- package/dist/contracts/workspace.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.js +1 -11
- package/dist/contracts/workspace.contract.js.map +1 -1
- package/dist/events/requests.js +1 -1
- package/dist/events/requests.js.map +1 -1
- package/dist/ids/project-id.d.ts +3 -0
- package/dist/ids/project-id.d.ts.map +1 -0
- package/dist/ids/project-id.js +25 -0
- package/dist/ids/project-id.js.map +1 -0
- package/dist/ids/tunnel-ids.d.ts +0 -1
- package/dist/ids/tunnel-ids.d.ts.map +1 -1
- package/dist/ids/tunnel-ids.js +0 -1
- package/dist/ids/tunnel-ids.js.map +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/models/account-moves.js +4 -4
- package/dist/models/account-moves.js.map +1 -1
- package/dist/models/model-roles.d.ts +1 -1
- package/dist/models/model-roles.d.ts.map +1 -1
- package/dist/models/model-roles.js +1 -1
- package/dist/models/model-roles.js.map +1 -1
- package/dist/models/plan-pools.d.ts +3 -1
- package/dist/models/plan-pools.d.ts.map +1 -1
- package/dist/models/plan-pools.js +26 -3
- package/dist/models/plan-pools.js.map +1 -1
- package/dist/protocol/doors/runner-protocol.d.ts +42 -0
- package/dist/protocol/doors/runner-protocol.d.ts.map +1 -1
- package/dist/protocol/doors/runner-protocol.js +23 -0
- package/dist/protocol/doors/runner-protocol.js.map +1 -1
- package/dist/protocol/doors/sandbox-pass.d.ts +22 -0
- package/dist/protocol/doors/sandbox-pass.d.ts.map +1 -0
- package/dist/protocol/doors/sandbox-pass.js +72 -0
- package/dist/protocol/doors/sandbox-pass.js.map +1 -0
- package/dist/protocol/raw/raw-json-routes.d.ts +96 -9
- package/dist/protocol/raw/raw-json-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-json-routes.js +6 -2
- package/dist/protocol/raw/raw-json-routes.js.map +1 -1
- package/dist/protocol/raw/raw-routes.d.ts +24 -7
- package/dist/protocol/raw/raw-routes.d.ts.map +1 -1
- package/dist/protocol/raw/raw-routes.js +6 -2
- package/dist/protocol/raw/raw-routes.js.map +1 -1
- package/dist/schemas/capabilities.d.ts +0 -14
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/capabilities.js +0 -4
- package/dist/schemas/capabilities.js.map +1 -1
- package/dist/schemas/certificate-request.d.ts +0 -2
- package/dist/schemas/certificate-request.d.ts.map +1 -1
- package/dist/schemas/ci.d.ts +69 -0
- package/dist/schemas/ci.d.ts.map +1 -1
- package/dist/schemas/ci.js +30 -0
- package/dist/schemas/ci.js.map +1 -1
- package/dist/schemas/device-files.d.ts +71 -0
- package/dist/schemas/device-files.d.ts.map +1 -0
- package/dist/schemas/device-files.js +53 -0
- package/dist/schemas/device-files.js.map +1 -0
- package/dist/schemas/devices.d.ts.map +1 -1
- package/dist/schemas/devices.js.map +1 -1
- package/dist/schemas/hosts.d.ts +3 -0
- package/dist/schemas/hosts.d.ts.map +1 -1
- package/dist/schemas/hosts.js +3 -0
- package/dist/schemas/hosts.js.map +1 -1
- package/dist/schemas/issues.d.ts +133 -0
- package/dist/schemas/issues.d.ts.map +1 -1
- package/dist/schemas/issues.js +34 -0
- package/dist/schemas/issues.js.map +1 -1
- package/dist/schemas/maintenance.d.ts.map +1 -1
- package/dist/schemas/maintenance.js +16 -10
- package/dist/schemas/maintenance.js.map +1 -1
- package/dist/schemas/metrics.d.ts.map +1 -1
- package/dist/schemas/metrics.js.map +1 -1
- package/dist/schemas/offload.d.ts +40 -0
- package/dist/schemas/offload.d.ts.map +1 -1
- package/dist/schemas/offload.js +21 -0
- package/dist/schemas/offload.js.map +1 -1
- package/dist/schemas/panels.d.ts +0 -14
- package/dist/schemas/panels.d.ts.map +1 -1
- package/dist/schemas/panels.js +0 -6
- package/dist/schemas/panels.js.map +1 -1
- package/dist/schemas/personas.d.ts.map +1 -1
- package/dist/schemas/personas.js +0 -6
- package/dist/schemas/personas.js.map +1 -1
- package/dist/schemas/providers/plan-limits.d.ts +1 -0
- package/dist/schemas/providers/plan-limits.d.ts.map +1 -1
- package/dist/schemas/providers/plan-limits.js +5 -1
- package/dist/schemas/providers/plan-limits.js.map +1 -1
- package/dist/schemas/providers/usage.d.ts +0 -12
- package/dist/schemas/providers/usage.d.ts.map +1 -1
- package/dist/schemas/providers/usage.js +0 -5
- package/dist/schemas/providers/usage.js.map +1 -1
- package/dist/schemas/secrets.d.ts +1 -22
- package/dist/schemas/secrets.d.ts.map +1 -1
- package/dist/schemas/secrets.js +3 -13
- package/dist/schemas/secrets.js.map +1 -1
- package/dist/schemas/settings-experiments.d.ts +0 -4
- package/dist/schemas/settings-experiments.d.ts.map +1 -1
- package/dist/schemas/settings-experiments.js +0 -12
- package/dist/schemas/settings-experiments.js.map +1 -1
- package/dist/schemas/settings-history.d.ts +1 -1
- package/dist/schemas/settings-history.d.ts.map +1 -1
- package/dist/schemas/settings-history.js +1 -0
- package/dist/schemas/settings-history.js.map +1 -1
- package/dist/schemas/settings-savings.d.ts +0 -144
- package/dist/schemas/settings-savings.d.ts.map +1 -1
- package/dist/schemas/settings-savings.js +1 -3
- package/dist/schemas/settings-savings.js.map +1 -1
- package/dist/schemas/settings.d.ts +0 -4
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +3 -4
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/short-codes.d.ts +0 -10
- package/dist/schemas/short-codes.d.ts.map +1 -1
- package/dist/schemas/short-codes.js +1 -9
- package/dist/schemas/short-codes.js.map +1 -1
- package/dist/schemas/workspace/workspace-search.d.ts +0 -12
- package/dist/schemas/workspace/workspace-search.d.ts.map +1 -1
- package/dist/schemas/workspace/workspace-search.js +5 -12
- package/dist/schemas/workspace/workspace-search.js.map +1 -1
- package/dist/state/definition.d.ts +0 -24
- package/dist/state/definition.d.ts.map +1 -1
- package/dist/state/update-probation.d.ts +1 -1
- package/dist/state/update-probation.d.ts.map +1 -1
- package/dist/state/update-probation.js +1 -1
- package/dist/state/update-probation.js.map +1 -1
- package/dist/state/workspace-state.d.ts +6 -1
- package/dist/state/workspace-state.d.ts.map +1 -1
- package/dist/state/workspace-state.js +7 -1
- package/dist/state/workspace-state.js.map +1 -1
- package/package.json +27 -5
- package/src/chores/chores.test.ts +1 -2
- package/src/chores/chores.ts +2 -62
- package/src/chores/index.ts +1 -1
- package/src/chores/prompt.ts +1 -6
- package/src/chores/verdict.test.ts +3 -44
- package/src/contracts/ci.contract.ts +13 -0
- package/src/contracts/device.contract.ts +5 -0
- package/src/contracts/offload.contract.ts +3 -2
- package/src/contracts/secrets.contract.ts +4 -5
- package/src/contracts/workspace.contract.ts +2 -14
- package/src/events/requests.ts +1 -1
- package/src/events/system-events.ts +2 -2
- package/src/ids/project-id.test.ts +26 -0
- package/src/ids/project-id.ts +34 -0
- package/src/ids/tunnel-ids.test.ts +2 -23
- package/src/ids/tunnel-ids.ts +0 -4
- package/src/index.ts +0 -6
- package/src/models/account-moves.ts +6 -6
- package/src/models/model-roles.ts +3 -1
- package/src/models/plan-pools.test.ts +57 -20
- package/src/models/plan-pools.ts +48 -8
- package/src/policy/persona-capability.ts +1 -1
- package/src/protocol/doors/runner-protocol.ts +42 -2
- package/src/protocol/doors/sandbox-pass.test.ts +51 -0
- package/src/protocol/doors/sandbox-pass.ts +119 -0
- package/src/protocol/headers.ts +2 -2
- package/src/protocol/member-reach.test.ts +0 -1
- package/src/protocol/raw/raw-json-routes.ts +14 -2
- package/src/protocol/raw/raw-routes.ts +14 -5
- package/src/protocol/routes.test.ts +0 -4
- package/src/schemas/automations.ts +3 -3
- package/src/schemas/capabilities.ts +0 -6
- package/src/schemas/ci.ts +42 -0
- package/src/schemas/device-files.ts +90 -0
- package/src/schemas/devices.ts +5 -4
- package/src/schemas/hosts.ts +15 -3
- package/src/schemas/issues.ts +54 -0
- package/src/schemas/maintenance.ts +20 -12
- package/src/schemas/metrics.ts +2 -0
- package/src/schemas/offload.ts +39 -2
- package/src/schemas/panels.ts +0 -8
- package/src/schemas/personas.ts +2 -6
- package/src/schemas/providers/plan-limits.ts +7 -1
- package/src/schemas/providers/usage.ts +5 -14
- package/src/schemas/secrets.ts +8 -20
- package/src/schemas/settings-experiments.ts +0 -17
- package/src/schemas/settings-history.ts +3 -0
- package/src/schemas/settings-savings.ts +2 -9
- package/src/schemas/settings.test.ts +16 -9
- package/src/schemas/settings.ts +5 -5
- package/src/schemas/short-codes.ts +2 -14
- package/src/schemas/version-seam.test.ts +2 -2
- package/src/schemas/workspace/workspace-search.ts +12 -25
- package/src/state/update-probation.ts +4 -3
- package/src/state/workspace-state.test.ts +2 -2
- package/src/state/workspace-state.ts +10 -1
- package/src/text/path-refs.test.ts +1 -1
- package/dist/contracts/intentic.contract.d.ts +0 -30
- package/dist/contracts/intentic.contract.d.ts.map +0 -1
- package/dist/contracts/intentic.contract.js +0 -34
- package/dist/contracts/intentic.contract.js.map +0 -1
- package/dist/contracts/inventory.contract.d.ts +0 -138
- package/dist/contracts/inventory.contract.d.ts.map +0 -1
- package/dist/contracts/inventory.contract.js +0 -31
- package/dist/contracts/inventory.contract.js.map +0 -1
- package/dist/schemas/codebase-health.d.ts +0 -56
- package/dist/schemas/codebase-health.d.ts.map +0 -1
- package/dist/schemas/codebase-health.js +0 -43
- package/dist/schemas/codebase-health.js.map +0 -1
- package/dist/schemas/intentic.d.ts +0 -5
- package/dist/schemas/intentic.d.ts.map +0 -1
- package/dist/schemas/intentic.js +0 -3
- package/dist/schemas/intentic.js.map +0 -1
- package/dist/schemas/inventory.d.ts +0 -175
- package/dist/schemas/inventory.d.ts.map +0 -1
- package/dist/schemas/inventory.js +0 -62
- package/dist/schemas/inventory.js.map +0 -1
- package/src/contracts/intentic.contract.ts +0 -45
- package/src/contracts/inventory.contract.ts +0 -35
- package/src/schemas/codebase-health.ts +0 -60
- package/src/schemas/intentic.ts +0 -2
- package/src/schemas/inventory.ts +0 -83
package/src/chores/chores.ts
CHANGED
|
@@ -446,65 +446,6 @@ const documentation: Chore = {
|
|
|
446
446
|
done: `Done when every package you named has a document that a newcomer could use to find the file they need, and no other file changed.`,
|
|
447
447
|
};
|
|
448
448
|
|
|
449
|
-
// Reports only the two shapes worth arguing about in a hotspot ranking:
|
|
450
|
-
// - volatile and depended-on: a hotspot that is also a key module, every edit ripples outward.
|
|
451
|
-
// - out of proportion: branching three times the median of its own ranking.
|
|
452
|
-
const COMPLEXITY_MULTIPLE = 3;
|
|
453
|
-
|
|
454
|
-
const median = (values: readonly number[]): number => {
|
|
455
|
-
if (values.length === 0) {
|
|
456
|
-
return 0;
|
|
457
|
-
}
|
|
458
|
-
const sorted = values.toSorted((left, right) => left - right);
|
|
459
|
-
const middle = Math.floor(sorted.length / 2);
|
|
460
|
-
return sorted.length % 2 === 0 ? ((sorted[middle - 1] ?? 0) + (sorted[middle] ?? 0)) / 2 : (sorted[middle] ?? 0);
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
const complexity: Chore = {
|
|
464
|
-
id: `complexity`,
|
|
465
|
-
title: `Simplify what everything waits on`,
|
|
466
|
-
icon: `wave-pulse`,
|
|
467
|
-
description: `Files that both churn and carry the repository, where edits are slow and ripple outward.`,
|
|
468
|
-
kind: `accruing`,
|
|
469
|
-
criterion: `A file in the hotspot ranking is also a key module, or its branching is three times the median of that ranking.`,
|
|
470
|
-
stance: `act`,
|
|
471
|
-
needs: [],
|
|
472
|
-
cadenceMs: 30 * DAY_MS,
|
|
473
|
-
assess: (context) => {
|
|
474
|
-
// A half-built index ranks whatever it has finished reading, not the repository; better to say nothing than
|
|
475
|
-
// target the wrong file.
|
|
476
|
-
if (!context.signals.indexed || context.signals.hotspots.length === 0) {
|
|
477
|
-
return undefined;
|
|
478
|
-
}
|
|
479
|
-
const keyModules = new Set(context.signals.keyModules.map((module) => module.path));
|
|
480
|
-
const middle = median(context.signals.hotspots.map((hotspot) => hotspot.complexity));
|
|
481
|
-
const found = context.signals.hotspots.filter(
|
|
482
|
-
(hotspot) => keyModules.has(hotspot.path) || hotspot.complexity >= middle * COMPLEXITY_MULTIPLE,
|
|
483
|
-
);
|
|
484
|
-
if (found.length === 0) {
|
|
485
|
-
return undefined;
|
|
486
|
-
}
|
|
487
|
-
const reason = (path: string, branches: number): string =>
|
|
488
|
-
keyModules.has(path) ? `churns and the rest of the repository imports it` : `${branches} branch points against a median of ${middle}`;
|
|
489
|
-
return {
|
|
490
|
-
headline: `${plural(found.length, `file`)} where every edit is slow and ripples outward`,
|
|
491
|
-
detail: found.map((hotspot) => `${hotspot.path}, ${hotspot.commits} commits, ${reason(hotspot.path, hotspot.complexity)}`),
|
|
492
|
-
digest: digestOf(...found.map((hotspot) => hotspot.path).toSorted()),
|
|
493
|
-
severity: `info`,
|
|
494
|
-
why:
|
|
495
|
-
`${plural(found.length, `file`)} in ${repoLabel(context.repo)} are both change magnets and structurally tangled: ` +
|
|
496
|
-
`${found.map((hotspot) => `${hotspot.path} (${hotspot.commits} commits, ${hotspot.complexity} branch points)`).join(`; `)}.`,
|
|
497
|
-
};
|
|
498
|
-
},
|
|
499
|
-
diagnosis: `A file that changes constantly and branches heavily makes every edit near it slow and easy to get wrong.`,
|
|
500
|
-
goal:
|
|
501
|
-
`Take ONE file: the worst of them, and no more. Read it first. If the rest of the repository imports it, separate the stable ` +
|
|
502
|
-
`contract from the churn: a narrow surface for importers, the volatile implementation private behind it. If it is simply ` +
|
|
503
|
-
`tangled, flatten it where it stands: edge cases as early returns, compound conditions behind named predicates, long chains as ` +
|
|
504
|
-
`lookups, and extract a unit only if a cohesive one falls out. Behaviour stays identical, and no re-export shims are left behind.`,
|
|
505
|
-
done: `Done when \`iq hotspots\` reports materially fewer branch points for that file, the checks of what it changed pass, and no importer changed meaning.`,
|
|
506
|
-
};
|
|
507
|
-
|
|
508
449
|
// A static table, current only as of this file's last edit; no network call. Source: nodejs/Release.
|
|
509
450
|
const NODE_EOL: Readonly<Record<number, string>> = {
|
|
510
451
|
16: `2023-09-11`,
|
|
@@ -937,7 +878,7 @@ const survey = ({ id, title, icon, description, diagnosis, goal, done, cadenceDa
|
|
|
937
878
|
done,
|
|
938
879
|
});
|
|
939
880
|
|
|
940
|
-
// Below this a repo is too small for cross-cutting patterns to have diverged; counted in
|
|
881
|
+
// Below this a repo is too small for cross-cutting patterns to have diverged; counted in code files so a config-only
|
|
941
882
|
// scaffold doesn't pass by accident.
|
|
942
883
|
const PATTERNS_FLOOR = 25;
|
|
943
884
|
|
|
@@ -956,7 +897,7 @@ const patterns = survey({
|
|
|
956
897
|
cadenceDays: 90,
|
|
957
898
|
// The one cause that is a measurement, not an absence; every size-gated chore uses this same string so they group
|
|
958
899
|
// together.
|
|
959
|
-
applies: (signals) => (signals.totals.files >= PATTERNS_FLOOR ? undefined : `only ${signals.totals.files}
|
|
900
|
+
applies: (signals) => (signals.totals.files >= PATTERNS_FLOOR ? undefined : `only ${signals.totals.files} code files`),
|
|
960
901
|
});
|
|
961
902
|
|
|
962
903
|
const deprecated = survey({
|
|
@@ -1051,7 +992,6 @@ const BOOK: readonly Chore[] = [
|
|
|
1051
992
|
runtime,
|
|
1052
993
|
dependencies,
|
|
1053
994
|
deadCode,
|
|
1054
|
-
complexity,
|
|
1055
995
|
testStrength,
|
|
1056
996
|
bundleWeight,
|
|
1057
997
|
frameworkIdiom,
|
package/src/chores/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { CHORE_KINDS, CHORES, choreAutomationPrompt, choreById, chorePrompt, repoLabel, repoName } from "./chores.js";
|
|
2
2
|
export type { Chore, ChoreContext, ChoreFinding, ChoreKind, ChoreKindSpec, ChoreStance } from "./chores.js";
|
|
3
3
|
export { bucketOf, digestOf } from "./digest.js";
|
|
4
|
-
export { CHORE_INVARIANTS, composeAsk,
|
|
4
|
+
export { CHORE_INVARIANTS, composeAsk, REPORT_INVARIANTS, TRIAGE_NOTE } from "./prompt.js";
|
|
5
5
|
export type { Ask } from "./prompt.js";
|
|
6
6
|
export { updateBrief } from "./extension-update.js";
|
|
7
7
|
export type { UpdateBrief } from "./extension-update.js";
|
package/src/chores/prompt.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// subject — what is being worked on.
|
|
3
3
|
// why — the measurement's numbers, quoted exactly, then what they mean.
|
|
4
4
|
// goal — a direction to move in, not a prescribed design.
|
|
5
|
-
// done — falsifiable; checkable
|
|
5
|
+
// done — falsifiable; checkable in the agent's own worktree.
|
|
6
6
|
// Invariants sit between goal and done: constraints on how, restated in full each time.
|
|
7
7
|
|
|
8
8
|
export interface Ask {
|
|
@@ -34,8 +34,3 @@ export const CHORE_INVARIANTS =
|
|
|
34
34
|
export const REPORT_INVARIANTS =
|
|
35
35
|
`Change nothing. This is a survey: the output is your findings, cited file:line, and a recommendation the owner ` +
|
|
36
36
|
`can act on or dismiss. Where you would propose an edit, describe it and where it would go instead of making it.`;
|
|
37
|
-
|
|
38
|
-
// Constraints for a one-file refactor turn; scope covers whatever it splits into, not just this one file.
|
|
39
|
-
export const REFACTOR_INVARIANTS =
|
|
40
|
-
`Read it first. Behaviour stays identical. Changes affect only this file, whatever it splits into, and the ` +
|
|
41
|
-
`importers that must follow. Leave no re-export shims behind.`;
|
|
@@ -44,8 +44,8 @@ const signals = (over: Partial<ChoreSignals> = {}): ChoreSignals => ({
|
|
|
44
44
|
shape: shape(),
|
|
45
45
|
hotspots: [],
|
|
46
46
|
keyModules: [],
|
|
47
|
-
totals: { files: 100, symbols:
|
|
48
|
-
indexed:
|
|
47
|
+
totals: { files: 100, symbols: 0, complexity: 0, hotspots: 0 },
|
|
48
|
+
indexed: false,
|
|
49
49
|
...over,
|
|
50
50
|
});
|
|
51
51
|
|
|
@@ -305,47 +305,6 @@ describe(`the badge speaks about transitions, not about statistics`, () => {
|
|
|
305
305
|
});
|
|
306
306
|
|
|
307
307
|
describe(`the findings themselves`, () => {
|
|
308
|
-
test(`complexity reports only files that are load-bearing or out of proportion, never just the ranking's top`, () => {
|
|
309
|
-
const hotspot = (path: string, complexity: number) => ({
|
|
310
|
-
path,
|
|
311
|
-
commits: 20,
|
|
312
|
-
adds: 100,
|
|
313
|
-
dels: 50,
|
|
314
|
-
complexity,
|
|
315
|
-
score: complexity * 20,
|
|
316
|
-
latestMs: NOW,
|
|
317
|
-
});
|
|
318
|
-
// An even ranking has no outlier and no key module: a healthy repository, an empty finding.
|
|
319
|
-
const even = report({
|
|
320
|
-
repos: [{ repo: `app`, probes: [], signals: signals({ hotspots: [hotspot(`a.ts`, 30), hotspot(`b.ts`, 28), hotspot(`c.ts`, 26)] }) }],
|
|
321
|
-
});
|
|
322
|
-
expect(verdictFor(even, `complexity`).state).toBe(`clear`);
|
|
323
|
-
|
|
324
|
-
const outlier = report({
|
|
325
|
-
repos: [{ repo: `app`, probes: [], signals: signals({ hotspots: [hotspot(`a.ts`, 200), hotspot(`b.ts`, 28), hotspot(`c.ts`, 26)] }) }],
|
|
326
|
-
});
|
|
327
|
-
const verdict = verdictFor(outlier, `complexity`);
|
|
328
|
-
expect(verdict.state).toBe(`due`);
|
|
329
|
-
expect(verdict.detail).toHaveLength(1);
|
|
330
|
-
expect(verdict.detail[0]).toContain(`a.ts`);
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
test(`a half-built index says nothing rather than ranking what it has read so far`, () => {
|
|
334
|
-
const partial = report({
|
|
335
|
-
repos: [
|
|
336
|
-
{
|
|
337
|
-
repo: `app`,
|
|
338
|
-
probes: [],
|
|
339
|
-
signals: signals({
|
|
340
|
-
indexed: false,
|
|
341
|
-
hotspots: [{ path: `a.ts`, commits: 9, adds: 1, dels: 1, complexity: 900, score: 8100, latestMs: NOW }],
|
|
342
|
-
}),
|
|
343
|
-
},
|
|
344
|
-
],
|
|
345
|
-
});
|
|
346
|
-
expect(verdictFor(partial, `complexity`).state).toBe(`clear`);
|
|
347
|
-
});
|
|
348
|
-
|
|
349
308
|
test(`two libraries for one job is the finding; one is not`, () => {
|
|
350
309
|
const one = report({ repos: [{ repo: `app`, probes: [], signals: signals({ packages: [pkg({ dependencies: [`zod`] })] }) }] });
|
|
351
310
|
expect(verdictFor(one, `library-overlap`).state).toBe(`clear`);
|
|
@@ -481,7 +440,7 @@ describe(`what does not apply here`, () => {
|
|
|
481
440
|
test(`a tiny repository is not surveyed for cross-cutting patterns it cannot have`, () => {
|
|
482
441
|
const fileCount = 4;
|
|
483
442
|
const tiny = report({
|
|
484
|
-
repos: [{ repo: `app`, probes: [], signals: signals({ totals: { files: fileCount, symbols:
|
|
443
|
+
repos: [{ repo: `app`, probes: [], signals: signals({ totals: { files: fileCount, symbols: 0, complexity: 0, hotspots: 0 } }) }],
|
|
485
444
|
});
|
|
486
445
|
const verdict = verdictFor(tiny, `standardize-patterns`);
|
|
487
446
|
expect(verdict.state).toBe(`not-applicable`);
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
CiFixResponseSchema,
|
|
5
5
|
CiForgetParamSchema,
|
|
6
6
|
CiJobsResponseSchema,
|
|
7
|
+
CiMainResponseSchema,
|
|
7
8
|
CiRunParamSchema,
|
|
8
9
|
CiRunsResponseSchema,
|
|
9
10
|
} from "../schemas/ci.js";
|
|
@@ -24,6 +25,18 @@ export const ciContract = {
|
|
|
24
25
|
"What the forges are reporting for every workspace repo that has a remote, served from a cache and filled in on demand. Repos whose notifications are not wired up say so.",
|
|
25
26
|
})
|
|
26
27
|
.output(CiRunsResponseSchema),
|
|
28
|
+
// The agent token reaches it (`agents ci`): what an agent meeting a failure asks before blaming itself or re-running
|
|
29
|
+
// main. Read from the CI store alone, never the forge, so any number of agents asking costs no API call.
|
|
30
|
+
main: procedure
|
|
31
|
+
.route({
|
|
32
|
+
method: "GET",
|
|
33
|
+
path: "/ci/main",
|
|
34
|
+
summary: "What main's CI is known to fail on now",
|
|
35
|
+
description:
|
|
36
|
+
"Each job failing on a workspace repository's main line, with the run and commit it last failed in, when the daemon read it, and the failing tests and errors its log named. Answered from the runs already heard, without asking the forge; a main line nothing is known of says so.",
|
|
37
|
+
})
|
|
38
|
+
.meta({ agent: true })
|
|
39
|
+
.output(CiMainResponseSchema),
|
|
27
40
|
rerun: procedure
|
|
28
41
|
.route({
|
|
29
42
|
method: "POST",
|
|
@@ -8,6 +8,7 @@ import { LoopbackCatchEventSchema, LoopbackCatchSchema } from "../schemas/loopba
|
|
|
8
8
|
import { OkSchema } from "../schemas/shared.js";
|
|
9
9
|
import { ProjectDeliveryResultSchema, ProjectDeliverySchema } from "../schemas/project-delivery.js";
|
|
10
10
|
import { DialLoopbackSchema, StageArtifactResultSchema, StageArtifactSchema } from "../schemas/device-artifacts.js";
|
|
11
|
+
import { CopyFileResultSchema, CopyFileSchema } from "../schemas/device-files.js";
|
|
11
12
|
import {
|
|
12
13
|
KeyringCaptureItemSchema,
|
|
13
14
|
KeyringCaptureResultSchema,
|
|
@@ -66,6 +67,10 @@ export const deviceContract = {
|
|
|
66
67
|
// Only the daemon calls it, for the agent's `devices push`, and only on an agent advertising `programs`; the machine
|
|
67
68
|
// refuses every op unless "Run programs this sandbox sends" is on.
|
|
68
69
|
stageArtifact: oc.input(StageArtifactSchema).output(StageArtifactResultSchema),
|
|
70
|
+
// A file or a folder copied to or from a path the agent names (schemas/device-files.ts), in chunks. Only the daemon
|
|
71
|
+
// calls it, for the agent's `devices copy`, and only on an agent advertising `file-copy`; the machine holds every op
|
|
72
|
+
// to its folders, and a copy onto it to "Create and change files" as well, as its file tools are.
|
|
73
|
+
copyFile: oc.input(CopyFileSchema).output(CopyFileResultSchema),
|
|
69
74
|
// A connection to the sandbox side of a `devices reach` tunnel: the machine dials its own 127.0.0.1:<port> and, once
|
|
70
75
|
// that answered, opens a WebSocket back to /system/hosts/tunnel with the ticket. Answers once the local port took
|
|
71
76
|
// the connection, or throws (nothing listening there, the switch is off). Advertised with `programs`; the machine
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
OffloadKindSchema,
|
|
9
9
|
OffloadRecordSchema,
|
|
10
10
|
OffloadRunSchema,
|
|
11
|
+
OffloadTargetInputSchema,
|
|
11
12
|
OffloadTargetSchema,
|
|
12
13
|
} from "../schemas/offload.js";
|
|
13
14
|
import { OkSchema } from "../schemas/shared.js";
|
|
@@ -24,9 +25,9 @@ export const offloadContract = {
|
|
|
24
25
|
path: "/offload/runners/{runner}",
|
|
25
26
|
summary: "Whether a runner can take a heavy command",
|
|
26
27
|
description:
|
|
27
|
-
"Answers whether the runner a kind of heavy work is sent to is connected and able to run it, before anything is copied to it. When it is not, the command runs in this sandbox and says why.",
|
|
28
|
+
"Answers whether the runner a kind of heavy work is sent to is connected and able to run it, before anything is copied to it. When it is not, the command runs in this sandbox and says why. Naming what the command needs (memory, a GPU) rules out a machine short of it; for \"auto\" it picks the machine with room that fits.",
|
|
28
29
|
})
|
|
29
|
-
.input(
|
|
30
|
+
.input(OffloadTargetInputSchema)
|
|
30
31
|
.output(OffloadTargetSchema),
|
|
31
32
|
run: offloadRoute
|
|
32
33
|
.route({
|
|
@@ -36,9 +36,8 @@ const secretRoute = procedure.meta({ floor: "maintainer", control: "never", righ
|
|
|
36
36
|
// someone does not reach them, and the handlers hold them to the owner.
|
|
37
37
|
const ownerKeyringRoute = procedure.meta({ floor: "maintainer", control: "never" });
|
|
38
38
|
|
|
39
|
-
// User-supplied secrets, in the
|
|
40
|
-
//
|
|
41
|
-
// returns a value, owner-only, POST so the key avoids the URL.
|
|
39
|
+
// User-supplied secrets, in the sandbox's own store; a set value resolves with no restart. `inventory` aggregates every
|
|
40
|
+
// store (never values) and always answers. `reveal` alone returns a value, owner-only, POST so the key avoids the URL.
|
|
42
41
|
export const secretsContract = {
|
|
43
42
|
set: secretRoute
|
|
44
43
|
.route({
|
|
@@ -46,7 +45,7 @@ export const secretsContract = {
|
|
|
46
45
|
path: "/secrets",
|
|
47
46
|
summary: "Store a secret",
|
|
48
47
|
description:
|
|
49
|
-
"Writes one name and value where the agent's references resolve it, without a restart
|
|
48
|
+
"Writes one name and value into the sandbox's own secret store, where the agent's references resolve it, without a restart.",
|
|
50
49
|
})
|
|
51
50
|
.input(SecretSetSchema)
|
|
52
51
|
.output(OkSchema),
|
|
@@ -95,7 +94,7 @@ export const secretsContract = {
|
|
|
95
94
|
path: "/secrets/inventory",
|
|
96
95
|
summary: "Every secret this sandbox holds, from everywhere",
|
|
97
96
|
description:
|
|
98
|
-
"One view across all the places secrets live here: what exists, where it came from and whether it is working. Never any values. This one always answers, even before
|
|
97
|
+
"One view across all the places secrets live here: what exists, where it came from and whether it is working. Never any values. This one always answers, even before anything has been stored.",
|
|
99
98
|
})
|
|
100
99
|
.output(SecretInventorySchema),
|
|
101
100
|
reveal: secretRoute
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { procedure } from "../protocol/route-meta.js";
|
|
2
2
|
import { streamOf } from "../protocol/stream-of.js";
|
|
3
|
-
import { WorkspaceHealthQuerySchema, WorkspaceHealthSchema } from "../schemas/codebase-health.js";
|
|
4
3
|
import { WorkspaceModulesSchema } from "../schemas/git/git.js";
|
|
5
4
|
import { OkSchema } from "../schemas/shared.js";
|
|
6
5
|
import {
|
|
@@ -194,14 +193,14 @@ export const workspaceContract = {
|
|
|
194
193
|
.meta({ guest: true })
|
|
195
194
|
.input(WorkspaceResolveQuerySchema)
|
|
196
195
|
.output(WorkspaceResolveSchema),
|
|
197
|
-
// `mode`
|
|
196
|
+
// `mode` picks text (the default) or file names; both are ripgrep walks of the tree as it is on disk.
|
|
198
197
|
search: procedure
|
|
199
198
|
.route({
|
|
200
199
|
method: "GET",
|
|
201
200
|
path: "/workspace/search",
|
|
202
201
|
summary: "Search the code",
|
|
203
202
|
description:
|
|
204
|
-
"
|
|
203
|
+
"Matching lines across the whole workspace grouped by file, or with the files mode the files whose names match, best first. Both read the tree as it is on disk, with no index in between. Long result sets resume from the cursor it hands back.",
|
|
205
204
|
})
|
|
206
205
|
.meta({ guest: true, control: "editor" })
|
|
207
206
|
.input(WorkspaceSearchQuerySchema)
|
|
@@ -219,17 +218,6 @@ export const workspaceContract = {
|
|
|
219
218
|
.meta({ floor: "viewer", guest: true, stream: true, control: "editor" })
|
|
220
219
|
.input(WorkspaceSearchQuerySchema)
|
|
221
220
|
.output(streamOf(WorkspaceSearchFrameSchema)),
|
|
222
|
-
// Per-file churn × complexity, index totals, top modules; scoped to a repo, not the whole /work drop.
|
|
223
|
-
health: procedure
|
|
224
|
-
.route({
|
|
225
|
-
method: "GET",
|
|
226
|
-
path: "/workspace/health",
|
|
227
|
-
summary: "A repo's shape in numbers",
|
|
228
|
-
description:
|
|
229
|
-
"Where one repo's risk sits: the files that change often and are complicated at once, what the index holds, and which modules the rest of the code leans on most. Scoped to a repo, because a codebase is a repo rather than the whole drop.",
|
|
230
|
-
})
|
|
231
|
-
.input(WorkspaceHealthQuerySchema)
|
|
232
|
-
.output(WorkspaceHealthSchema),
|
|
233
221
|
// Deterministic, no-LLM classification into coarse buckets; read-only, applied only via the move route.
|
|
234
222
|
classify: procedure
|
|
235
223
|
.route({
|
package/src/events/requests.ts
CHANGED
|
@@ -68,7 +68,7 @@ export const ChildRunSchema = z.object({
|
|
|
68
68
|
account: z
|
|
69
69
|
.string()
|
|
70
70
|
.optional()
|
|
71
|
-
.describe("Which of that provider's connected accounts pays for it. Absent is
|
|
71
|
+
.describe("Which of that provider's connected accounts pays for it. Absent is the sandbox's pick when it starts: the one whose allowance renews first among those not nearly out, then the most room."),
|
|
72
72
|
effort: z.string().optional().describe("How hard it thinks, where the model offers a choice. Absent is the model's own default."),
|
|
73
73
|
thinking: z.boolean().optional().describe("Whether it reasons before it answers, where the model offers the choice."),
|
|
74
74
|
fast: z.boolean().optional().describe("Whether it asks for the faster rate, at the higher price."),
|
|
@@ -8,8 +8,8 @@ import { WorkspaceTreeDeltaSchema } from "../schemas/workspace/workspace-tree.js
|
|
|
8
8
|
// Frames about the sandbox rather than a turn: liveness, boot progress, what moved (repos, refs, running processes,
|
|
9
9
|
// presence, the fleet), and account headroom. One stream carries them all.
|
|
10
10
|
|
|
11
|
-
// One
|
|
12
|
-
//
|
|
11
|
+
// One progress line a streamed run yields (a capability's apply, an exit's start, a disk's mount); open-ended, so any
|
|
12
|
+
// string `kind` plus extra fields pass through.
|
|
13
13
|
export const IntenticLineSchema = z.looseObject({ kind: z.string() });
|
|
14
14
|
export type IntenticLine = z.infer<typeof IntenticLineSchema>;
|
|
15
15
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { normalizeProjectId } from "./project-id.js";
|
|
2
|
+
|
|
3
|
+
describe("project id", () => {
|
|
4
|
+
it("reads every remote spelling of one repository as one project", () => {
|
|
5
|
+
for (const remote of [
|
|
6
|
+
"git@github.com:Acme/App.git",
|
|
7
|
+
"https://github.com/acme/app",
|
|
8
|
+
"https://user:token@github.com/acme/app.git",
|
|
9
|
+
"ssh://git@github.com:22/acme/app.git",
|
|
10
|
+
"github.com/acme/app/",
|
|
11
|
+
" GitHub.com/Acme/App ",
|
|
12
|
+
]) {
|
|
13
|
+
expect(normalizeProjectId(remote)).toBe("github.com/acme/app");
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("keeps nested groups", () => {
|
|
18
|
+
expect(normalizeProjectId("git@gitlab.com:group/sub/repo.git")).toBe("gitlab.com/group/sub/repo");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("refuses what names no repository", () => {
|
|
22
|
+
for (const text of ["", "app", "github.com", "/local/path/repo", "file:///tmp/repo", "github.com/acme app"]) {
|
|
23
|
+
expect(normalizeProjectId(text)).toBeUndefined();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// One spelling for "a project" across account-level report routing: the platform keys claims by it, the sending daemon
|
|
2
|
+
// resolves by it, the receiving daemon checks a pass against it. A project is a repository, named the way its remote
|
|
3
|
+
// names it, so `git@github.com:Acme/App.git`, `https://github.com/acme/app` and `github.com/acme/app/` are one project:
|
|
4
|
+
// `github.com/acme/app`. Host and path are lowercased; the hosts people use are case-insensitive about owners and repos.
|
|
5
|
+
|
|
6
|
+
// host + at least one path segment, each a conservative charset; nothing that could be a URL with a query or a port.
|
|
7
|
+
const PROJECT_ID = /^[a-z0-9.-]+\.[a-z]{2,}(\/[a-z0-9._~-]+)+$/;
|
|
8
|
+
|
|
9
|
+
export const PROJECT_ID_MAX = 200;
|
|
10
|
+
|
|
11
|
+
// The normalized id, or undefined when the text does not name a repository.
|
|
12
|
+
export const normalizeProjectId = (raw: string): string | undefined => {
|
|
13
|
+
let text = raw.trim();
|
|
14
|
+
if (text === "") {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
// scp-like ssh: user@host:path
|
|
18
|
+
const scp = /^[^@/\s]+@([^:/\s]+):(.+)$/.exec(text);
|
|
19
|
+
if (scp !== null) {
|
|
20
|
+
text = `${scp[1]}/${scp[2]}`;
|
|
21
|
+
} else {
|
|
22
|
+
text = text.replace(/^[a-z+]+:\/\//i, "");
|
|
23
|
+
// credentials and ports never belong to a project's identity
|
|
24
|
+
text = text.replace(/^[^@/]*@/, "");
|
|
25
|
+
text = text.replace(/^([^/:]+):\d+\//, "$1/");
|
|
26
|
+
}
|
|
27
|
+
text = text
|
|
28
|
+
.replace(/[?#].*$/, "")
|
|
29
|
+
.replace(/\/+$/, "")
|
|
30
|
+
.replace(/\.git$/i, "")
|
|
31
|
+
.replace(/\/+/g, "/")
|
|
32
|
+
.toLowerCase();
|
|
33
|
+
return text.length <= PROJECT_ID_MAX && PROJECT_ID.test(text) ? text : undefined;
|
|
34
|
+
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { repoRoot } from "@intentic/constants/node";
|
|
4
|
-
import {
|
|
4
|
+
import { PORT_SLOT_COUNT, portSlotsFromToken, sandboxIdFromToken } from "./tunnel-ids.js";
|
|
5
5
|
|
|
6
|
-
// The digests every language spells again (ic's util.rs,
|
|
6
|
+
// The digests every language spells again (ic's util.rs, sandbox-run's Web Crypto twin) are held to the
|
|
7
7
|
// run contract's names.fixture.json, which each of them is tested against. SAFETY: the fixture is this repository's own
|
|
8
8
|
// file; the assertions below fail on any field it lacks.
|
|
9
9
|
const SHARED = JSON.parse(readFileSync(join(repoRoot(import.meta.url), "_shared/sandbox-run/src/names.fixture.json"), "utf8")) as {
|
|
10
10
|
readonly sandboxIds: { readonly vectors: { readonly token: string; readonly id: string }[] };
|
|
11
|
-
readonly hostSshIds: { readonly vectors: { readonly token: string; readonly hostName: string; readonly id: string }[] };
|
|
12
11
|
};
|
|
13
12
|
|
|
14
13
|
const TOKEN = "connect-token-one";
|
|
@@ -21,11 +20,6 @@ test("the sandbox id is a stable 12-hex digest of the connect token, and absent
|
|
|
21
20
|
expect(sandboxIdFromToken("")).toBeUndefined();
|
|
22
21
|
});
|
|
23
22
|
|
|
24
|
-
test("a host ssh id is salted per host, so two deploy targets never collide", () => {
|
|
25
|
-
expect(hostSshIdFromToken(TOKEN, "web-1")).toMatch(/^[0-9a-f]{12}$/);
|
|
26
|
-
expect(hostSshIdFromToken(TOKEN, "web-1")).not.toBe(hostSshIdFromToken(TOKEN, "web-2"));
|
|
27
|
-
});
|
|
28
|
-
|
|
29
23
|
test("port slots are a fixed-size pool of DNS-safe labels, stable per token", () => {
|
|
30
24
|
const slots = portSlotsFromToken(TOKEN);
|
|
31
25
|
expect(slots).toHaveLength(PORT_SLOT_COUNT);
|
|
@@ -50,18 +44,3 @@ test("slots are not derivable from the sandbox id: only from the token behind it
|
|
|
50
44
|
test.each(SHARED.sandboxIds.vectors)("the sandbox id of $token is $id, the digest ic and the browser derive too", ({ token, id }) => {
|
|
51
45
|
expect(sandboxIdFromToken(token)).toBe(id);
|
|
52
46
|
});
|
|
53
|
-
|
|
54
|
-
test.each(SHARED.hostSshIds.vectors)("the host ssh id of $token on $hostName is $id", ({ token, hostName, id }) => {
|
|
55
|
-
expect(hostSshIdFromToken(token, hostName)).toBe(id);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// connect-host.ps1 digests a server's id itself when a code's answer carries no HOST_ID, and no PowerShell runs in the
|
|
59
|
-
// suites. What can be held is its source: the same salted input (`<token>:<host name>`), the same hash, the same cut, over
|
|
60
|
-
// UTF-8 bytes, so a change to one half reads as a change to the other here.
|
|
61
|
-
test("connect-host.ps1 digests the host ssh id the way hostSshIdFromToken does", () => {
|
|
62
|
-
const script = readFileSync(join(repoRoot(import.meta.url), "_site/site/public/scripts/connect-host.ps1"), "utf8");
|
|
63
|
-
expect(script).toContain("$slugInput = '{0}:{1}' -f $ConnectToken, $HostName");
|
|
64
|
-
expect(script).toContain("[System.Security.Cryptography.SHA256]::Create()");
|
|
65
|
-
expect(script).toContain("[System.Text.Encoding]::UTF8.GetBytes($slugInput)");
|
|
66
|
-
expect(script).toContain("-replace '-', '').Substring(0, 12).ToLower()");
|
|
67
|
-
});
|
package/src/ids/tunnel-ids.ts
CHANGED
|
@@ -11,10 +11,6 @@ export { SANDBOX_ID } from "./sandbox-id.js";
|
|
|
11
11
|
export const sandboxIdFromToken = (connectToken: string): string | undefined =>
|
|
12
12
|
connectToken === "" ? undefined : sha256Hex(connectToken).slice(0, 12);
|
|
13
13
|
|
|
14
|
-
// A per-host SSH tunnel's stable 12-hex id, salted with the host name so each enrolled deploy target gets its own
|
|
15
|
-
// ssh-<id>.<zone>. Shared by the CLI and the platform API, which must derive the identical id.
|
|
16
|
-
export const hostSshIdFromToken = (connectToken: string, hostName: string): string => sha256Hex(`${connectToken}:${hostName}`).slice(0, 12);
|
|
17
|
-
|
|
18
14
|
// Eight is enough for a monorepo's dev servers, and the hard cap on preview DNS records one sandbox can cost.
|
|
19
15
|
export const PORT_SLOT_COUNT = 8;
|
|
20
16
|
|
package/src/index.ts
CHANGED
|
@@ -23,8 +23,6 @@ import { extensionsContract } from "./contracts/extensions.contract.js";
|
|
|
23
23
|
import { gitContract } from "./contracts/git.contract.js";
|
|
24
24
|
import { historyContract } from "./contracts/history.contract.js";
|
|
25
25
|
import { hubContract } from "./contracts/hub.contract.js";
|
|
26
|
-
import { intenticContract } from "./contracts/intentic.contract.js";
|
|
27
|
-
import { inventoryContract } from "./contracts/inventory.contract.js";
|
|
28
26
|
import { issuesContract } from "./contracts/issues.contract.js";
|
|
29
27
|
import { logsContract } from "./contracts/logs.contract.js";
|
|
30
28
|
import { loopsContract } from "./contracts/loops.contract.js";
|
|
@@ -82,8 +80,6 @@ export const sandboxContract: {
|
|
|
82
80
|
git: typeof gitContract;
|
|
83
81
|
history: typeof historyContract;
|
|
84
82
|
hub: typeof hubContract;
|
|
85
|
-
intentic: typeof intenticContract;
|
|
86
|
-
inventory: typeof inventoryContract;
|
|
87
83
|
issues: typeof issuesContract;
|
|
88
84
|
logs: typeof logsContract;
|
|
89
85
|
loops: typeof loopsContract;
|
|
@@ -135,8 +131,6 @@ export const sandboxContract: {
|
|
|
135
131
|
git: gitContract,
|
|
136
132
|
history: historyContract,
|
|
137
133
|
hub: hubContract,
|
|
138
|
-
intentic: intenticContract,
|
|
139
|
-
inventory: inventoryContract,
|
|
140
134
|
issues: issuesContract,
|
|
141
135
|
logs: logsContract,
|
|
142
136
|
loops: loopsContract,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AccountState } from "../schemas/providers/plan-limits.js";
|
|
2
|
-
import {
|
|
2
|
+
import { bestWithRoom, preferredAccount } from "./plan-pools.js";
|
|
3
3
|
|
|
4
4
|
/* WHERE A TURN GOES OFF AN ACCOUNT THAT CANNOT SERVE IT, for every provider whose accounts a turn can name. Read by the
|
|
5
5
|
daemon's limit move (sibling-account.ts) and its move off a blocked account (blocked-account.ts), and by the editor's
|
|
@@ -27,14 +27,14 @@ interface MovableAccount {
|
|
|
27
27
|
const refused = (state: AccountState): boolean => state.kind === "spent" || state.kind === "blocked";
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* The account a turn moves to among `others` (the account it leaves already left out). That is the
|
|
31
|
-
* room, else the steadiest unmeasured one where `readable` is false (the provider publishes no allowance) or every
|
|
30
|
+
* The account a turn moves to among `others` (the account it leaves already left out). That is the best with proven room
|
|
31
|
+
* (plan-pools.ts bestWithRoom: the first to renew unless nearly out, then the most room), else the steadiest unmeasured one where `readable` is false (the provider publishes no allowance) or every
|
|
32
32
|
* account with a reading is refused. Ties keep the caller's order. Undefined: nowhere to go.
|
|
33
33
|
*/
|
|
34
34
|
export const moveDestination = <T extends MovableAccount>(others: readonly T[], readable: boolean): T | undefined => {
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
return
|
|
35
|
+
const withRoom = bestWithRoom(others);
|
|
36
|
+
if (withRoom !== undefined) {
|
|
37
|
+
return withRoom;
|
|
38
38
|
}
|
|
39
39
|
const open = !readable || others.every((entry) => entry.state.kind === "unknown" || refused(entry.state));
|
|
40
40
|
return open ? preferredAccount(others.filter((entry) => entry.state.kind === "unknown")) : undefined;
|
|
@@ -142,7 +142,9 @@ export const MODEL_ROLES = [
|
|
|
142
142
|
{
|
|
143
143
|
id: "refactor-run",
|
|
144
144
|
label: "Refactors",
|
|
145
|
-
|
|
145
|
+
// Started from the Health tab, removed with iq (2026-11-18). The id stays: every saved roleSetups names it, and a
|
|
146
|
+
// newer editor reads an older daemon's settings with this enum.
|
|
147
|
+
blurb: "Kept so settings saved before the Health tab was removed still read; nothing starts a refactor run now.",
|
|
146
148
|
kind: "run",
|
|
147
149
|
icon: "hammer",
|
|
148
150
|
setup: "high",
|