@oxagen/cli 3.0.1-802 → 3.0.1-803
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/oxagen.mjs +307 -285
- package/package.json +1 -1
package/oxagen.mjs
CHANGED
|
@@ -29915,7 +29915,7 @@ import { readFileSync as readFileSync10 } from "node:fs";
|
|
|
29915
29915
|
import { dirname as dirname9, resolve as resolve3 } from "node:path";
|
|
29916
29916
|
import { fileURLToPath } from "node:url";
|
|
29917
29917
|
function readVersion() {
|
|
29918
|
-
if (true) return "3.0.1-
|
|
29918
|
+
if (true) return "3.0.1-803";
|
|
29919
29919
|
try {
|
|
29920
29920
|
const here = dirname9(fileURLToPath(import.meta.url));
|
|
29921
29921
|
const pkg = JSON.parse(
|
|
@@ -46739,6 +46739,283 @@ var init_git_lane = __esm({
|
|
|
46739
46739
|
}
|
|
46740
46740
|
});
|
|
46741
46741
|
|
|
46742
|
+
// ../../packages/tacho/src/interjection.ts
|
|
46743
|
+
var digest4, timestamp, count5, configVersion, workspaceSlug, interjectionKeySchema, INTERJECTION_RECEIPT_ID_PATTERN, INTERJECTION_QUESTION_MAX, INTERJECTION_OPEN, INTERJECTION_PATHS, INTERJECTION_ANSWER_SOURCES, SKILLS_RESOLVED_REASONS, repoUnknownBodySchema, interjectLinkPathSchema, interjectCreatePathSchema, INTERJECT_PROVIDERS, interjectBodySchema, answerBodySchema, repoBoundBodySchema, workspaceCreatedBodySchema, skillsResolvedBodySchema, interjectionAnswerPayloadSchema;
|
|
46744
|
+
var init_interjection = __esm({
|
|
46745
|
+
"../../packages/tacho/src/interjection.ts"() {
|
|
46746
|
+
"use strict";
|
|
46747
|
+
init_zod();
|
|
46748
|
+
init_digest();
|
|
46749
|
+
init_timestamp();
|
|
46750
|
+
digest4 = external_exports.string().regex(SHA256_DIGEST_PATTERN);
|
|
46751
|
+
timestamp = external_exports.string().refine(isProtocolTimestamp, "protocol timestamp");
|
|
46752
|
+
count5 = external_exports.number().int().nonnegative();
|
|
46753
|
+
configVersion = external_exports.string().min(1).max(64).nullable();
|
|
46754
|
+
workspaceSlug = external_exports.string().min(1).max(64);
|
|
46755
|
+
interjectionKeySchema = external_exports.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/, "a ULID");
|
|
46756
|
+
INTERJECTION_RECEIPT_ID_PATTERN = /^rcp_[0-9a-z]+$/;
|
|
46757
|
+
INTERJECTION_QUESTION_MAX = 2e3;
|
|
46758
|
+
INTERJECTION_OPEN = "interjection_open";
|
|
46759
|
+
INTERJECTION_PATHS = ["link", "create", "deny"];
|
|
46760
|
+
INTERJECTION_ANSWER_SOURCES = ["person", "timeout"];
|
|
46761
|
+
SKILLS_RESOLVED_REASONS = [
|
|
46762
|
+
"skills_off",
|
|
46763
|
+
"denied",
|
|
46764
|
+
"resolved"
|
|
46765
|
+
];
|
|
46766
|
+
repoUnknownBodySchema = external_exports.object({
|
|
46767
|
+
/** sha256 of `canonicalRemote(origin)`; the remote itself never leaves the host. */
|
|
46768
|
+
remote_digest: digest4,
|
|
46769
|
+
/** sha256 of `foldedRemote(canonicalRemote(origin))`; absent when the host does not fold. */
|
|
46770
|
+
remote_digest_folded: digest4.optional(),
|
|
46771
|
+
head_sha: external_exports.string().max(512).optional(),
|
|
46772
|
+
/** The bundle asked only because the workspace has skills on. */
|
|
46773
|
+
skills_enabled: external_exports.literal(true),
|
|
46774
|
+
/** The bundle's `unbound_repo.policy`. */
|
|
46775
|
+
unbound_repo: external_exports.literal("ask"),
|
|
46776
|
+
/** The skills configuration the bundle carried; null when none was named. */
|
|
46777
|
+
config_version: configVersion
|
|
46778
|
+
}).strict();
|
|
46779
|
+
interjectLinkPathSchema = external_exports.object({
|
|
46780
|
+
path: external_exports.literal("link"),
|
|
46781
|
+
workspace_slug: workspaceSlug,
|
|
46782
|
+
config_version: configVersion,
|
|
46783
|
+
/** Skills the workspace's configuration pins; null when not counted. */
|
|
46784
|
+
skills_pinned: count5.nullable(),
|
|
46785
|
+
/** Repositories the workspace already links; null when not counted. */
|
|
46786
|
+
linked_repositories: count5.nullable()
|
|
46787
|
+
}).strict();
|
|
46788
|
+
interjectCreatePathSchema = external_exports.object({
|
|
46789
|
+
path: external_exports.literal("create"),
|
|
46790
|
+
/** From the repository's name; null when the host could not read one. */
|
|
46791
|
+
proposed_name: external_exports.string().min(1).max(120).nullable(),
|
|
46792
|
+
proposed_slug: workspaceSlug.nullable(),
|
|
46793
|
+
skills_enabled: external_exports.literal(false)
|
|
46794
|
+
}).strict();
|
|
46795
|
+
INTERJECT_PROVIDERS = ["github", "gitlab"];
|
|
46796
|
+
interjectBodySchema = external_exports.object({
|
|
46797
|
+
interjection_key: interjectionKeySchema,
|
|
46798
|
+
reason: external_exports.literal("repo_unknown"),
|
|
46799
|
+
question: external_exports.string().min(1).max(INTERJECTION_QUESTION_MAX),
|
|
46800
|
+
remote_digest: digest4,
|
|
46801
|
+
remote_digest_folded: digest4.optional(),
|
|
46802
|
+
/** How long the host waits, from the bundle's `unbound_repo.timeout_ms`. */
|
|
46803
|
+
timeout_ms: external_exports.number().int().positive(),
|
|
46804
|
+
/** The host's clock plus `timeout_ms`. The control plane keeps its own deadline. */
|
|
46805
|
+
expires_at: timestamp,
|
|
46806
|
+
/** What the timeout answers. */
|
|
46807
|
+
on_timeout: external_exports.literal("deny"),
|
|
46808
|
+
/** The two paths a person can take, link first. Deny needs no path. */
|
|
46809
|
+
paths: external_exports.tuple([interjectLinkPathSchema, interjectCreatePathSchema]),
|
|
46810
|
+
/**
|
|
46811
|
+
* The forge the remote's host names (#4439): `github` for github.com and
|
|
46812
|
+
* `gitlab` for gitlab.com. Absent for any other host, and from a host
|
|
46813
|
+
* built before the field, which the control plane reads as GitHub. The
|
|
46814
|
+
* host string itself stays on the machine. A GitLab project binds through
|
|
46815
|
+
* its own project access token, so the control plane offers no link for
|
|
46816
|
+
* a `gitlab` question.
|
|
46817
|
+
*/
|
|
46818
|
+
provider: external_exports.enum(INTERJECT_PROVIDERS).optional()
|
|
46819
|
+
}).strict();
|
|
46820
|
+
answerBodySchema = external_exports.object({
|
|
46821
|
+
interjection_key: interjectionKeySchema,
|
|
46822
|
+
/** The control plane's row (`inj_…`); absent on a timeout the host answered alone. */
|
|
46823
|
+
interjection_id: external_exports.string().regex(/^inj_[0-9a-z]+$/).optional(),
|
|
46824
|
+
path: external_exports.enum(INTERJECTION_PATHS),
|
|
46825
|
+
source: external_exports.enum(INTERJECTION_ANSWER_SOURCES),
|
|
46826
|
+
/** The receipt the control plane recorded; absent on a host-side timeout. */
|
|
46827
|
+
receipt_id: external_exports.string().regex(INTERJECTION_RECEIPT_ID_PATTERN).optional(),
|
|
46828
|
+
/** The person who answered (`usr_…`); absent on a timeout. */
|
|
46829
|
+
answered_by: external_exports.string().regex(/^usr_[0-9a-z]+$/).optional(),
|
|
46830
|
+
/** The `message` command that carried the answer (`tcm_…`). */
|
|
46831
|
+
command_id: external_exports.string().regex(/^tcm_[0-9a-z]+$/).optional()
|
|
46832
|
+
}).strict();
|
|
46833
|
+
repoBoundBodySchema = external_exports.object({
|
|
46834
|
+
interjection_key: interjectionKeySchema,
|
|
46835
|
+
binding_id: external_exports.string().min(1).max(64),
|
|
46836
|
+
workspace_slug: workspaceSlug,
|
|
46837
|
+
role: external_exports.enum(["linked", "main"])
|
|
46838
|
+
}).strict();
|
|
46839
|
+
workspaceCreatedBodySchema = external_exports.object({
|
|
46840
|
+
interjection_key: interjectionKeySchema,
|
|
46841
|
+
workspace_id: external_exports.string().min(1).max(64),
|
|
46842
|
+
workspace_slug: workspaceSlug,
|
|
46843
|
+
skills_enabled: external_exports.literal(false)
|
|
46844
|
+
}).strict();
|
|
46845
|
+
skillsResolvedBodySchema = external_exports.object({
|
|
46846
|
+
/** The interjection that settled it; absent when no question was asked. */
|
|
46847
|
+
interjection_key: interjectionKeySchema.optional(),
|
|
46848
|
+
config_version: configVersion,
|
|
46849
|
+
/** Skills the session may load. */
|
|
46850
|
+
in_scope: count5,
|
|
46851
|
+
/** Skills the configuration holds back; null until the catalog read counts them (#3098). */
|
|
46852
|
+
withheld: count5.nullable(),
|
|
46853
|
+
reason: external_exports.enum(SKILLS_RESOLVED_REASONS)
|
|
46854
|
+
}).strict();
|
|
46855
|
+
interjectionAnswerPayloadSchema = external_exports.object({
|
|
46856
|
+
key: interjectionKeySchema,
|
|
46857
|
+
path: external_exports.enum(INTERJECTION_PATHS),
|
|
46858
|
+
source: external_exports.enum(INTERJECTION_ANSWER_SOURCES),
|
|
46859
|
+
receipt_id: external_exports.string().regex(INTERJECTION_RECEIPT_ID_PATTERN),
|
|
46860
|
+
/** The person who answered (`usr_…`); null on a timeout. */
|
|
46861
|
+
answered_by: external_exports.string().regex(/^usr_[0-9a-z]+$/).nullable(),
|
|
46862
|
+
/** Set on a link or create answer. */
|
|
46863
|
+
binding_id: external_exports.string().min(1).max(64).optional(),
|
|
46864
|
+
/** Set on a create answer. */
|
|
46865
|
+
workspace_id: external_exports.string().min(1).max(64).optional(),
|
|
46866
|
+
workspace_slug: workspaceSlug.optional()
|
|
46867
|
+
}).strict();
|
|
46868
|
+
}
|
|
46869
|
+
});
|
|
46870
|
+
|
|
46871
|
+
// ../../packages/tacho/src/loops.ts
|
|
46872
|
+
function isMcpTool(tool) {
|
|
46873
|
+
return tool.startsWith(MCP_TOOL_PREFIX) || tool.startsWith(CURSOR_MCP_TOOL_PREFIX);
|
|
46874
|
+
}
|
|
46875
|
+
function slotsOf(steps) {
|
|
46876
|
+
return steps.map((step) => "fileChanged" in step ? null : step);
|
|
46877
|
+
}
|
|
46878
|
+
function sameResult(a, b3) {
|
|
46879
|
+
return a.tool === b3.tool && a.inputHash === b3.inputHash && a.outputHash === b3.outputHash;
|
|
46880
|
+
}
|
|
46881
|
+
function sameFailure(a, b3) {
|
|
46882
|
+
return a.tool === b3.tool && a.inputHash === b3.inputHash && a.errorClass === b3.errorClass;
|
|
46883
|
+
}
|
|
46884
|
+
function hashed(c) {
|
|
46885
|
+
return c.inputHash !== "" && c.outputHash !== "";
|
|
46886
|
+
}
|
|
46887
|
+
function failed(c) {
|
|
46888
|
+
return c.inputHash !== "" && c.errorClass !== null && c.errorClass !== "";
|
|
46889
|
+
}
|
|
46890
|
+
function reaches(loop, length) {
|
|
46891
|
+
const calls = loop.positions.length;
|
|
46892
|
+
return "calls" in length ? calls >= length.calls : Math.floor(calls / loop.period) >= length.cycles;
|
|
46893
|
+
}
|
|
46894
|
+
function streaks(slots, kind, joins, matches2) {
|
|
46895
|
+
const out = [];
|
|
46896
|
+
let run3 = [];
|
|
46897
|
+
let positions = [];
|
|
46898
|
+
const close = () => {
|
|
46899
|
+
const first = run3[0];
|
|
46900
|
+
if (first !== void 0 && run3.length >= 2)
|
|
46901
|
+
out.push({ kind, positions, period: 1, tool: first.tool });
|
|
46902
|
+
run3 = [];
|
|
46903
|
+
positions = [];
|
|
46904
|
+
};
|
|
46905
|
+
slots.forEach((c, i2) => {
|
|
46906
|
+
if (c === null || !joins(c)) {
|
|
46907
|
+
close();
|
|
46908
|
+
return;
|
|
46909
|
+
}
|
|
46910
|
+
const last = run3.at(-1);
|
|
46911
|
+
if (last !== void 0 && !matches2(last, c)) close();
|
|
46912
|
+
run3.push(c);
|
|
46913
|
+
positions.push(i2);
|
|
46914
|
+
});
|
|
46915
|
+
close();
|
|
46916
|
+
return out;
|
|
46917
|
+
}
|
|
46918
|
+
function shortCycles(slots) {
|
|
46919
|
+
const out = [];
|
|
46920
|
+
const segments = [[]];
|
|
46921
|
+
slots.forEach((c, i2) => {
|
|
46922
|
+
if (c === null || !hashed(c)) segments.push([]);
|
|
46923
|
+
else segments.at(-1)?.push({ call: c, at: i2 });
|
|
46924
|
+
});
|
|
46925
|
+
for (const segment of segments) {
|
|
46926
|
+
const same = (k, period) => {
|
|
46927
|
+
const a = segment[k];
|
|
46928
|
+
const b3 = segment[k - period];
|
|
46929
|
+
return a !== void 0 && b3 !== void 0 && sameResult(a.call, b3.call);
|
|
46930
|
+
};
|
|
46931
|
+
for (let period = 2; period <= MAX_PERIOD; period += 1) {
|
|
46932
|
+
let k = period;
|
|
46933
|
+
while (k < segment.length) {
|
|
46934
|
+
if (!same(k, period)) {
|
|
46935
|
+
k += 1;
|
|
46936
|
+
continue;
|
|
46937
|
+
}
|
|
46938
|
+
const start = k - period;
|
|
46939
|
+
let end = k;
|
|
46940
|
+
while (same(end, period)) end += 1;
|
|
46941
|
+
const cycle2 = segment.slice(start, start + period).map((s2) => s2.call);
|
|
46942
|
+
const distinct = cycle2.every(
|
|
46943
|
+
(c, j) => cycle2.slice(j + 1).every((d) => !sameResult(c, d))
|
|
46944
|
+
);
|
|
46945
|
+
const first = cycle2[0];
|
|
46946
|
+
if (first !== void 0 && distinct && end - start >= 2 * period)
|
|
46947
|
+
out.push({
|
|
46948
|
+
kind: "short_cycle",
|
|
46949
|
+
positions: segment.slice(start, end).map((s2) => s2.at),
|
|
46950
|
+
period,
|
|
46951
|
+
tool: first.tool
|
|
46952
|
+
});
|
|
46953
|
+
k = end;
|
|
46954
|
+
}
|
|
46955
|
+
}
|
|
46956
|
+
}
|
|
46957
|
+
return out;
|
|
46958
|
+
}
|
|
46959
|
+
function stagnations(slots) {
|
|
46960
|
+
const out = [];
|
|
46961
|
+
const seen = /* @__PURE__ */ new Map();
|
|
46962
|
+
let run3 = [];
|
|
46963
|
+
let positions = [];
|
|
46964
|
+
const close = () => {
|
|
46965
|
+
const first = run3[0];
|
|
46966
|
+
const inputs = new Set(run3.map((c) => c.inputHash));
|
|
46967
|
+
if (first !== void 0 && run3.length >= 2 && inputs.size >= 2)
|
|
46968
|
+
out.push({ kind: "stagnation", positions, period: 1, tool: first.tool });
|
|
46969
|
+
run3 = [];
|
|
46970
|
+
positions = [];
|
|
46971
|
+
};
|
|
46972
|
+
slots.forEach((c, i2) => {
|
|
46973
|
+
if (c === null || !hashed(c)) {
|
|
46974
|
+
close();
|
|
46975
|
+
return;
|
|
46976
|
+
}
|
|
46977
|
+
const outputs = seen.get(c.tool) ?? /* @__PURE__ */ new Set();
|
|
46978
|
+
const repeated = outputs.has(c.outputHash);
|
|
46979
|
+
outputs.add(c.outputHash);
|
|
46980
|
+
seen.set(c.tool, outputs);
|
|
46981
|
+
if (c.mayWrite || isMcpTool(c.tool)) {
|
|
46982
|
+
close();
|
|
46983
|
+
return;
|
|
46984
|
+
}
|
|
46985
|
+
const first = run3[0];
|
|
46986
|
+
if (first !== void 0 && (first.tool !== c.tool || !repeated)) close();
|
|
46987
|
+
run3.push(c);
|
|
46988
|
+
positions.push(i2);
|
|
46989
|
+
});
|
|
46990
|
+
close();
|
|
46991
|
+
return out;
|
|
46992
|
+
}
|
|
46993
|
+
function findLoops(steps, threshold) {
|
|
46994
|
+
const slots = slotsOf(steps);
|
|
46995
|
+
return [
|
|
46996
|
+
...streaks(slots, "exact_repeat", hashed, sameResult),
|
|
46997
|
+
...streaks(slots, "failing_retry", failed, sameFailure),
|
|
46998
|
+
...shortCycles(slots),
|
|
46999
|
+
...stagnations(slots)
|
|
47000
|
+
].filter((loop) => reaches(loop, threshold[loop.kind])).sort((a, b3) => (a.positions[0] ?? 0) - (b3.positions[0] ?? 0));
|
|
47001
|
+
}
|
|
47002
|
+
var LOOP_NOTICE_REASON_CODE, LOOP_START, MAX_PERIOD, MCP_TOOL_PREFIX, CURSOR_MCP_TOOL_PREFIX;
|
|
47003
|
+
var init_loops = __esm({
|
|
47004
|
+
"../../packages/tacho/src/loops.ts"() {
|
|
47005
|
+
"use strict";
|
|
47006
|
+
LOOP_NOTICE_REASON_CODE = "loop_notice";
|
|
47007
|
+
LOOP_START = {
|
|
47008
|
+
exact_repeat: { calls: 3 },
|
|
47009
|
+
failing_retry: { calls: 3 },
|
|
47010
|
+
short_cycle: { cycles: 3 },
|
|
47011
|
+
stagnation: { calls: 6 }
|
|
47012
|
+
};
|
|
47013
|
+
MAX_PERIOD = 3;
|
|
47014
|
+
MCP_TOOL_PREFIX = "mcp__";
|
|
47015
|
+
CURSOR_MCP_TOOL_PREFIX = "MCP:";
|
|
47016
|
+
}
|
|
47017
|
+
});
|
|
47018
|
+
|
|
46742
47019
|
// ../../packages/tacho/src/collector/steering-manifest.ts
|
|
46743
47020
|
function steeringManifestFrame(manifest, bundle2, delivered) {
|
|
46744
47021
|
const steers = delivered.map((prompt) => ({
|
|
@@ -47275,153 +47552,6 @@ var init_subagent_meta = __esm({
|
|
|
47275
47552
|
}
|
|
47276
47553
|
});
|
|
47277
47554
|
|
|
47278
|
-
// ../../packages/tacho/src/loops.ts
|
|
47279
|
-
function isMcpTool(tool) {
|
|
47280
|
-
return tool.startsWith(MCP_TOOL_PREFIX) || tool.startsWith(CURSOR_MCP_TOOL_PREFIX);
|
|
47281
|
-
}
|
|
47282
|
-
function slotsOf(steps) {
|
|
47283
|
-
return steps.map((step) => "fileChanged" in step ? null : step);
|
|
47284
|
-
}
|
|
47285
|
-
function sameResult(a, b3) {
|
|
47286
|
-
return a.tool === b3.tool && a.inputHash === b3.inputHash && a.outputHash === b3.outputHash;
|
|
47287
|
-
}
|
|
47288
|
-
function sameFailure(a, b3) {
|
|
47289
|
-
return a.tool === b3.tool && a.inputHash === b3.inputHash && a.errorClass === b3.errorClass;
|
|
47290
|
-
}
|
|
47291
|
-
function hashed(c) {
|
|
47292
|
-
return c.inputHash !== "" && c.outputHash !== "";
|
|
47293
|
-
}
|
|
47294
|
-
function failed(c) {
|
|
47295
|
-
return c.inputHash !== "" && c.errorClass !== null && c.errorClass !== "";
|
|
47296
|
-
}
|
|
47297
|
-
function reaches(loop, length) {
|
|
47298
|
-
const calls = loop.positions.length;
|
|
47299
|
-
return "calls" in length ? calls >= length.calls : Math.floor(calls / loop.period) >= length.cycles;
|
|
47300
|
-
}
|
|
47301
|
-
function streaks(slots, kind, joins, matches2) {
|
|
47302
|
-
const out = [];
|
|
47303
|
-
let run3 = [];
|
|
47304
|
-
let positions = [];
|
|
47305
|
-
const close = () => {
|
|
47306
|
-
const first = run3[0];
|
|
47307
|
-
if (first !== void 0 && run3.length >= 2)
|
|
47308
|
-
out.push({ kind, positions, period: 1, tool: first.tool });
|
|
47309
|
-
run3 = [];
|
|
47310
|
-
positions = [];
|
|
47311
|
-
};
|
|
47312
|
-
slots.forEach((c, i2) => {
|
|
47313
|
-
if (c === null || !joins(c)) {
|
|
47314
|
-
close();
|
|
47315
|
-
return;
|
|
47316
|
-
}
|
|
47317
|
-
const last = run3.at(-1);
|
|
47318
|
-
if (last !== void 0 && !matches2(last, c)) close();
|
|
47319
|
-
run3.push(c);
|
|
47320
|
-
positions.push(i2);
|
|
47321
|
-
});
|
|
47322
|
-
close();
|
|
47323
|
-
return out;
|
|
47324
|
-
}
|
|
47325
|
-
function shortCycles(slots) {
|
|
47326
|
-
const out = [];
|
|
47327
|
-
const segments = [[]];
|
|
47328
|
-
slots.forEach((c, i2) => {
|
|
47329
|
-
if (c === null || !hashed(c)) segments.push([]);
|
|
47330
|
-
else segments.at(-1)?.push({ call: c, at: i2 });
|
|
47331
|
-
});
|
|
47332
|
-
for (const segment of segments) {
|
|
47333
|
-
const same = (k, period) => {
|
|
47334
|
-
const a = segment[k];
|
|
47335
|
-
const b3 = segment[k - period];
|
|
47336
|
-
return a !== void 0 && b3 !== void 0 && sameResult(a.call, b3.call);
|
|
47337
|
-
};
|
|
47338
|
-
for (let period = 2; period <= MAX_PERIOD; period += 1) {
|
|
47339
|
-
let k = period;
|
|
47340
|
-
while (k < segment.length) {
|
|
47341
|
-
if (!same(k, period)) {
|
|
47342
|
-
k += 1;
|
|
47343
|
-
continue;
|
|
47344
|
-
}
|
|
47345
|
-
const start = k - period;
|
|
47346
|
-
let end = k;
|
|
47347
|
-
while (same(end, period)) end += 1;
|
|
47348
|
-
const cycle2 = segment.slice(start, start + period).map((s2) => s2.call);
|
|
47349
|
-
const distinct = cycle2.every(
|
|
47350
|
-
(c, j) => cycle2.slice(j + 1).every((d) => !sameResult(c, d))
|
|
47351
|
-
);
|
|
47352
|
-
const first = cycle2[0];
|
|
47353
|
-
if (first !== void 0 && distinct && end - start >= 2 * period)
|
|
47354
|
-
out.push({
|
|
47355
|
-
kind: "short_cycle",
|
|
47356
|
-
positions: segment.slice(start, end).map((s2) => s2.at),
|
|
47357
|
-
period,
|
|
47358
|
-
tool: first.tool
|
|
47359
|
-
});
|
|
47360
|
-
k = end;
|
|
47361
|
-
}
|
|
47362
|
-
}
|
|
47363
|
-
}
|
|
47364
|
-
return out;
|
|
47365
|
-
}
|
|
47366
|
-
function stagnations(slots) {
|
|
47367
|
-
const out = [];
|
|
47368
|
-
const seen = /* @__PURE__ */ new Map();
|
|
47369
|
-
let run3 = [];
|
|
47370
|
-
let positions = [];
|
|
47371
|
-
const close = () => {
|
|
47372
|
-
const first = run3[0];
|
|
47373
|
-
const inputs = new Set(run3.map((c) => c.inputHash));
|
|
47374
|
-
if (first !== void 0 && run3.length >= 2 && inputs.size >= 2)
|
|
47375
|
-
out.push({ kind: "stagnation", positions, period: 1, tool: first.tool });
|
|
47376
|
-
run3 = [];
|
|
47377
|
-
positions = [];
|
|
47378
|
-
};
|
|
47379
|
-
slots.forEach((c, i2) => {
|
|
47380
|
-
if (c === null || !hashed(c)) {
|
|
47381
|
-
close();
|
|
47382
|
-
return;
|
|
47383
|
-
}
|
|
47384
|
-
const outputs = seen.get(c.tool) ?? /* @__PURE__ */ new Set();
|
|
47385
|
-
const repeated = outputs.has(c.outputHash);
|
|
47386
|
-
outputs.add(c.outputHash);
|
|
47387
|
-
seen.set(c.tool, outputs);
|
|
47388
|
-
if (c.mayWrite || isMcpTool(c.tool)) {
|
|
47389
|
-
close();
|
|
47390
|
-
return;
|
|
47391
|
-
}
|
|
47392
|
-
const first = run3[0];
|
|
47393
|
-
if (first !== void 0 && (first.tool !== c.tool || !repeated)) close();
|
|
47394
|
-
run3.push(c);
|
|
47395
|
-
positions.push(i2);
|
|
47396
|
-
});
|
|
47397
|
-
close();
|
|
47398
|
-
return out;
|
|
47399
|
-
}
|
|
47400
|
-
function findLoops(steps, threshold) {
|
|
47401
|
-
const slots = slotsOf(steps);
|
|
47402
|
-
return [
|
|
47403
|
-
...streaks(slots, "exact_repeat", hashed, sameResult),
|
|
47404
|
-
...streaks(slots, "failing_retry", failed, sameFailure),
|
|
47405
|
-
...shortCycles(slots),
|
|
47406
|
-
...stagnations(slots)
|
|
47407
|
-
].filter((loop) => reaches(loop, threshold[loop.kind])).sort((a, b3) => (a.positions[0] ?? 0) - (b3.positions[0] ?? 0));
|
|
47408
|
-
}
|
|
47409
|
-
var LOOP_START, MAX_PERIOD, MCP_TOOL_PREFIX, CURSOR_MCP_TOOL_PREFIX;
|
|
47410
|
-
var init_loops = __esm({
|
|
47411
|
-
"../../packages/tacho/src/loops.ts"() {
|
|
47412
|
-
"use strict";
|
|
47413
|
-
LOOP_START = {
|
|
47414
|
-
exact_repeat: { calls: 3 },
|
|
47415
|
-
failing_retry: { calls: 3 },
|
|
47416
|
-
short_cycle: { cycles: 3 },
|
|
47417
|
-
stagnation: { calls: 6 }
|
|
47418
|
-
};
|
|
47419
|
-
MAX_PERIOD = 3;
|
|
47420
|
-
MCP_TOOL_PREFIX = "mcp__";
|
|
47421
|
-
CURSOR_MCP_TOOL_PREFIX = "MCP:";
|
|
47422
|
-
}
|
|
47423
|
-
});
|
|
47424
|
-
|
|
47425
47555
|
// ../../packages/tacho/src/collector/memory-capture/reflection-ask.ts
|
|
47426
47556
|
function stateOf(record2) {
|
|
47427
47557
|
let state = states.get(record2);
|
|
@@ -47828,7 +47958,7 @@ function loopNoticeBody(notice, boundary) {
|
|
|
47828
47958
|
...notice.callSeq !== void 0 ? { call_seq: notice.callSeq } : {}
|
|
47829
47959
|
};
|
|
47830
47960
|
}
|
|
47831
|
-
var NOTICED_LOOP_KINDS, LOOP_NOTICE_BOUNDARIES,
|
|
47961
|
+
var NOTICED_LOOP_KINDS, LOOP_NOTICE_BOUNDARIES, LOOP_REFUSAL_LEAD, LOOP_WINDOW_CALLS, LOOP_CHAINS_PER_SESSION, NOTICED_PER_CHAIN, TOOL_NAME_MAX_CHARS2, ROOT_CHAIN, states2, loopNoticeBodySchema;
|
|
47832
47962
|
var init_loop_notice = __esm({
|
|
47833
47963
|
"../../packages/tacho/src/collector/loop-notice.ts"() {
|
|
47834
47964
|
"use strict";
|
|
@@ -47844,7 +47974,6 @@ var init_loop_notice = __esm({
|
|
|
47844
47974
|
"PostToolUseFailure",
|
|
47845
47975
|
"PreToolUse"
|
|
47846
47976
|
];
|
|
47847
|
-
LOOP_NOTICE_REASON_CODE = "loop_notice";
|
|
47848
47977
|
LOOP_REFUSAL_LEAD = "This call did not run. ";
|
|
47849
47978
|
LOOP_WINDOW_CALLS = 32;
|
|
47850
47979
|
LOOP_CHAINS_PER_SESSION = 16;
|
|
@@ -47866,134 +47995,6 @@ var init_loop_notice = __esm({
|
|
|
47866
47995
|
}
|
|
47867
47996
|
});
|
|
47868
47997
|
|
|
47869
|
-
// ../../packages/tacho/src/interjection.ts
|
|
47870
|
-
var digest4, timestamp, count5, configVersion, workspaceSlug, interjectionKeySchema, INTERJECTION_RECEIPT_ID_PATTERN, INTERJECTION_QUESTION_MAX, INTERJECTION_PATHS, INTERJECTION_ANSWER_SOURCES, SKILLS_RESOLVED_REASONS, repoUnknownBodySchema, interjectLinkPathSchema, interjectCreatePathSchema, INTERJECT_PROVIDERS, interjectBodySchema, answerBodySchema, repoBoundBodySchema, workspaceCreatedBodySchema, skillsResolvedBodySchema, interjectionAnswerPayloadSchema;
|
|
47871
|
-
var init_interjection = __esm({
|
|
47872
|
-
"../../packages/tacho/src/interjection.ts"() {
|
|
47873
|
-
"use strict";
|
|
47874
|
-
init_zod();
|
|
47875
|
-
init_digest();
|
|
47876
|
-
init_timestamp();
|
|
47877
|
-
digest4 = external_exports.string().regex(SHA256_DIGEST_PATTERN);
|
|
47878
|
-
timestamp = external_exports.string().refine(isProtocolTimestamp, "protocol timestamp");
|
|
47879
|
-
count5 = external_exports.number().int().nonnegative();
|
|
47880
|
-
configVersion = external_exports.string().min(1).max(64).nullable();
|
|
47881
|
-
workspaceSlug = external_exports.string().min(1).max(64);
|
|
47882
|
-
interjectionKeySchema = external_exports.string().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/, "a ULID");
|
|
47883
|
-
INTERJECTION_RECEIPT_ID_PATTERN = /^rcp_[0-9a-z]+$/;
|
|
47884
|
-
INTERJECTION_QUESTION_MAX = 2e3;
|
|
47885
|
-
INTERJECTION_PATHS = ["link", "create", "deny"];
|
|
47886
|
-
INTERJECTION_ANSWER_SOURCES = ["person", "timeout"];
|
|
47887
|
-
SKILLS_RESOLVED_REASONS = [
|
|
47888
|
-
"skills_off",
|
|
47889
|
-
"denied",
|
|
47890
|
-
"resolved"
|
|
47891
|
-
];
|
|
47892
|
-
repoUnknownBodySchema = external_exports.object({
|
|
47893
|
-
/** sha256 of `canonicalRemote(origin)`; the remote itself never leaves the host. */
|
|
47894
|
-
remote_digest: digest4,
|
|
47895
|
-
/** sha256 of `foldedRemote(canonicalRemote(origin))`; absent when the host does not fold. */
|
|
47896
|
-
remote_digest_folded: digest4.optional(),
|
|
47897
|
-
head_sha: external_exports.string().max(512).optional(),
|
|
47898
|
-
/** The bundle asked only because the workspace has skills on. */
|
|
47899
|
-
skills_enabled: external_exports.literal(true),
|
|
47900
|
-
/** The bundle's `unbound_repo.policy`. */
|
|
47901
|
-
unbound_repo: external_exports.literal("ask"),
|
|
47902
|
-
/** The skills configuration the bundle carried; null when none was named. */
|
|
47903
|
-
config_version: configVersion
|
|
47904
|
-
}).strict();
|
|
47905
|
-
interjectLinkPathSchema = external_exports.object({
|
|
47906
|
-
path: external_exports.literal("link"),
|
|
47907
|
-
workspace_slug: workspaceSlug,
|
|
47908
|
-
config_version: configVersion,
|
|
47909
|
-
/** Skills the workspace's configuration pins; null when not counted. */
|
|
47910
|
-
skills_pinned: count5.nullable(),
|
|
47911
|
-
/** Repositories the workspace already links; null when not counted. */
|
|
47912
|
-
linked_repositories: count5.nullable()
|
|
47913
|
-
}).strict();
|
|
47914
|
-
interjectCreatePathSchema = external_exports.object({
|
|
47915
|
-
path: external_exports.literal("create"),
|
|
47916
|
-
/** From the repository's name; null when the host could not read one. */
|
|
47917
|
-
proposed_name: external_exports.string().min(1).max(120).nullable(),
|
|
47918
|
-
proposed_slug: workspaceSlug.nullable(),
|
|
47919
|
-
skills_enabled: external_exports.literal(false)
|
|
47920
|
-
}).strict();
|
|
47921
|
-
INTERJECT_PROVIDERS = ["github", "gitlab"];
|
|
47922
|
-
interjectBodySchema = external_exports.object({
|
|
47923
|
-
interjection_key: interjectionKeySchema,
|
|
47924
|
-
reason: external_exports.literal("repo_unknown"),
|
|
47925
|
-
question: external_exports.string().min(1).max(INTERJECTION_QUESTION_MAX),
|
|
47926
|
-
remote_digest: digest4,
|
|
47927
|
-
remote_digest_folded: digest4.optional(),
|
|
47928
|
-
/** How long the host waits, from the bundle's `unbound_repo.timeout_ms`. */
|
|
47929
|
-
timeout_ms: external_exports.number().int().positive(),
|
|
47930
|
-
/** The host's clock plus `timeout_ms`. The control plane keeps its own deadline. */
|
|
47931
|
-
expires_at: timestamp,
|
|
47932
|
-
/** What the timeout answers. */
|
|
47933
|
-
on_timeout: external_exports.literal("deny"),
|
|
47934
|
-
/** The two paths a person can take, link first. Deny needs no path. */
|
|
47935
|
-
paths: external_exports.tuple([interjectLinkPathSchema, interjectCreatePathSchema]),
|
|
47936
|
-
/**
|
|
47937
|
-
* The forge the remote's host names (#4439): `github` for github.com and
|
|
47938
|
-
* `gitlab` for gitlab.com. Absent for any other host, and from a host
|
|
47939
|
-
* built before the field, which the control plane reads as GitHub. The
|
|
47940
|
-
* host string itself stays on the machine. A GitLab project binds through
|
|
47941
|
-
* its own project access token, so the control plane offers no link for
|
|
47942
|
-
* a `gitlab` question.
|
|
47943
|
-
*/
|
|
47944
|
-
provider: external_exports.enum(INTERJECT_PROVIDERS).optional()
|
|
47945
|
-
}).strict();
|
|
47946
|
-
answerBodySchema = external_exports.object({
|
|
47947
|
-
interjection_key: interjectionKeySchema,
|
|
47948
|
-
/** The control plane's row (`inj_…`); absent on a timeout the host answered alone. */
|
|
47949
|
-
interjection_id: external_exports.string().regex(/^inj_[0-9a-z]+$/).optional(),
|
|
47950
|
-
path: external_exports.enum(INTERJECTION_PATHS),
|
|
47951
|
-
source: external_exports.enum(INTERJECTION_ANSWER_SOURCES),
|
|
47952
|
-
/** The receipt the control plane recorded; absent on a host-side timeout. */
|
|
47953
|
-
receipt_id: external_exports.string().regex(INTERJECTION_RECEIPT_ID_PATTERN).optional(),
|
|
47954
|
-
/** The person who answered (`usr_…`); absent on a timeout. */
|
|
47955
|
-
answered_by: external_exports.string().regex(/^usr_[0-9a-z]+$/).optional(),
|
|
47956
|
-
/** The `message` command that carried the answer (`tcm_…`). */
|
|
47957
|
-
command_id: external_exports.string().regex(/^tcm_[0-9a-z]+$/).optional()
|
|
47958
|
-
}).strict();
|
|
47959
|
-
repoBoundBodySchema = external_exports.object({
|
|
47960
|
-
interjection_key: interjectionKeySchema,
|
|
47961
|
-
binding_id: external_exports.string().min(1).max(64),
|
|
47962
|
-
workspace_slug: workspaceSlug,
|
|
47963
|
-
role: external_exports.enum(["linked", "main"])
|
|
47964
|
-
}).strict();
|
|
47965
|
-
workspaceCreatedBodySchema = external_exports.object({
|
|
47966
|
-
interjection_key: interjectionKeySchema,
|
|
47967
|
-
workspace_id: external_exports.string().min(1).max(64),
|
|
47968
|
-
workspace_slug: workspaceSlug,
|
|
47969
|
-
skills_enabled: external_exports.literal(false)
|
|
47970
|
-
}).strict();
|
|
47971
|
-
skillsResolvedBodySchema = external_exports.object({
|
|
47972
|
-
/** The interjection that settled it; absent when no question was asked. */
|
|
47973
|
-
interjection_key: interjectionKeySchema.optional(),
|
|
47974
|
-
config_version: configVersion,
|
|
47975
|
-
/** Skills the session may load. */
|
|
47976
|
-
in_scope: count5,
|
|
47977
|
-
/** Skills the configuration holds back; null until the catalog read counts them (#3098). */
|
|
47978
|
-
withheld: count5.nullable(),
|
|
47979
|
-
reason: external_exports.enum(SKILLS_RESOLVED_REASONS)
|
|
47980
|
-
}).strict();
|
|
47981
|
-
interjectionAnswerPayloadSchema = external_exports.object({
|
|
47982
|
-
key: interjectionKeySchema,
|
|
47983
|
-
path: external_exports.enum(INTERJECTION_PATHS),
|
|
47984
|
-
source: external_exports.enum(INTERJECTION_ANSWER_SOURCES),
|
|
47985
|
-
receipt_id: external_exports.string().regex(INTERJECTION_RECEIPT_ID_PATTERN),
|
|
47986
|
-
/** The person who answered (`usr_…`); null on a timeout. */
|
|
47987
|
-
answered_by: external_exports.string().regex(/^usr_[0-9a-z]+$/).nullable(),
|
|
47988
|
-
/** Set on a link or create answer. */
|
|
47989
|
-
binding_id: external_exports.string().min(1).max(64).optional(),
|
|
47990
|
-
/** Set on a create answer. */
|
|
47991
|
-
workspace_id: external_exports.string().min(1).max(64).optional(),
|
|
47992
|
-
workspace_slug: workspaceSlug.optional()
|
|
47993
|
-
}).strict();
|
|
47994
|
-
}
|
|
47995
|
-
});
|
|
47996
|
-
|
|
47997
47998
|
// ../../packages/tacho/src/collector/interjection.ts
|
|
47998
47999
|
function showsRefusedPrompt(harness) {
|
|
47999
48000
|
return harness !== "stella";
|
|
@@ -48198,7 +48199,7 @@ function settle2(record2, held, answer, payload, fields) {
|
|
|
48198
48199
|
record2.control.interjection = void 0;
|
|
48199
48200
|
return events;
|
|
48200
48201
|
}
|
|
48201
|
-
var SLUG_PATTERN, SLUG_MIN, SLUG_MAX, NAME_MAX2,
|
|
48202
|
+
var SLUG_PATTERN, SLUG_MIN, SLUG_MAX, NAME_MAX2, INTERJECTION_TIMED_OUT_TEXT, expiredByHook, putBack;
|
|
48202
48203
|
var init_interjection2 = __esm({
|
|
48203
48204
|
"../../packages/tacho/src/collector/interjection.ts"() {
|
|
48204
48205
|
"use strict";
|
|
@@ -48209,7 +48210,6 @@ var init_interjection2 = __esm({
|
|
|
48209
48210
|
SLUG_MIN = 2;
|
|
48210
48211
|
SLUG_MAX = 40;
|
|
48211
48212
|
NAME_MAX2 = 120;
|
|
48212
|
-
INTERJECTION_OPEN = "interjection_open";
|
|
48213
48213
|
INTERJECTION_TIMED_OUT_TEXT = "Oxagen asked a person whether to bind this repository to a workspace, and nobody answered in time. This session goes on without skills.";
|
|
48214
48214
|
expiredByHook = /* @__PURE__ */ new WeakMap();
|
|
48215
48215
|
putBack = /* @__PURE__ */ new WeakSet();
|
|
@@ -49650,6 +49650,8 @@ var init_hook_handler = __esm({
|
|
|
49650
49650
|
init_payload_members();
|
|
49651
49651
|
init_work_order_context();
|
|
49652
49652
|
init_tools();
|
|
49653
|
+
init_interjection();
|
|
49654
|
+
init_loops();
|
|
49653
49655
|
init_steering_manifest();
|
|
49654
49656
|
init_frame_body();
|
|
49655
49657
|
init_harness_limits();
|
|
@@ -73445,7 +73447,7 @@ var init_package = __esm({
|
|
|
73445
73447
|
"package.json"() {
|
|
73446
73448
|
package_default = {
|
|
73447
73449
|
name: "@oxagen/cli",
|
|
73448
|
-
version: "3.0.1-
|
|
73450
|
+
version: "3.0.1-803",
|
|
73449
73451
|
description: "Oxagen governance CLI: spend, source tracking, grounding, credentials, and audit (agentic coding lives in the stella CLI)",
|
|
73450
73452
|
type: "module",
|
|
73451
73453
|
main: "./dist/index.js",
|
|
@@ -88436,6 +88438,15 @@ var init_loop_detected = __esm({
|
|
|
88436
88438
|
}
|
|
88437
88439
|
});
|
|
88438
88440
|
|
|
88441
|
+
// ../../packages/tacho/src/remote-digests.ts
|
|
88442
|
+
var init_remote_digests = __esm({
|
|
88443
|
+
"../../packages/tacho/src/remote-digests.ts"() {
|
|
88444
|
+
"use strict";
|
|
88445
|
+
init_digest();
|
|
88446
|
+
init_remote();
|
|
88447
|
+
}
|
|
88448
|
+
});
|
|
88449
|
+
|
|
88439
88450
|
// ../../packages/tacho/src/evidence/merkle.ts
|
|
88440
88451
|
import { createHash as createHash20 } from "node:crypto";
|
|
88441
88452
|
function digestToBytes(digest6) {
|
|
@@ -92408,6 +92419,7 @@ var init_src4 = __esm({
|
|
|
92408
92419
|
init_loop_detected();
|
|
92409
92420
|
init_record_basis();
|
|
92410
92421
|
init_remote();
|
|
92422
|
+
init_remote_digests();
|
|
92411
92423
|
init_timestamp();
|
|
92412
92424
|
init_wire();
|
|
92413
92425
|
init_evidence();
|
|
@@ -96262,13 +96274,17 @@ var init_finding_shared = __esm({
|
|
|
96262
96274
|
"retry_loops",
|
|
96263
96275
|
"commits_never_shipped",
|
|
96264
96276
|
"overpowered_prompts",
|
|
96265
|
-
"underpowered_prompts"
|
|
96277
|
+
"underpowered_prompts",
|
|
96278
|
+
"repeated_refusals",
|
|
96279
|
+
"recurring_setup_failures",
|
|
96280
|
+
"failing_tool_calls"
|
|
96266
96281
|
]);
|
|
96267
96282
|
findingLevelSchema = external_exports.enum([
|
|
96268
96283
|
"tool",
|
|
96269
96284
|
"agent",
|
|
96270
96285
|
"operator",
|
|
96271
|
-
"workspace"
|
|
96286
|
+
"workspace",
|
|
96287
|
+
"repository"
|
|
96272
96288
|
]);
|
|
96273
96289
|
findingConfidenceSchema = external_exports.enum(["high", "medium"]);
|
|
96274
96290
|
findingStatusSchema = external_exports.enum(["open", "applied", "dismissed"]);
|
|
@@ -98132,7 +98148,7 @@ async function findingsList(opts, writer = stdoutWriter) {
|
|
|
98132
98148
|
if (opts.level !== void 0 && !isLevel(opts.level)) {
|
|
98133
98149
|
process.exitCode = 2;
|
|
98134
98150
|
out.error(
|
|
98135
|
-
`Invalid --level "${opts.level}". Use tool, agent, operator or
|
|
98151
|
+
`Invalid --level "${opts.level}". Use tool, agent, operator, workspace or repository.`,
|
|
98136
98152
|
"usage"
|
|
98137
98153
|
);
|
|
98138
98154
|
return;
|
|
@@ -98235,7 +98251,13 @@ var init_findings = __esm({
|
|
|
98235
98251
|
init_capture_writer();
|
|
98236
98252
|
init_output();
|
|
98237
98253
|
STATUSES = ["open", "applied", "dismissed"];
|
|
98238
|
-
LEVELS = [
|
|
98254
|
+
LEVELS = [
|
|
98255
|
+
"tool",
|
|
98256
|
+
"agent",
|
|
98257
|
+
"operator",
|
|
98258
|
+
"workspace",
|
|
98259
|
+
"repository"
|
|
98260
|
+
];
|
|
98239
98261
|
CURSOR_MAX = 256;
|
|
98240
98262
|
SUBJECT_MAX = 256;
|
|
98241
98263
|
FRAMES_SHOWN = 5;
|
package/package.json
CHANGED