@chipschat/acp 1.0.29 → 1.0.30
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/README.md +4 -0
- package/dist/THIRD-PARTY-NOTICES.md +3 -3
- package/dist/main.js +286 -49
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -124,6 +124,10 @@ its asks). Then nothing reaches Chips as a card. Put them where they ask:
|
|
|
124
124
|
does without asking, and read-only commands never ask.
|
|
125
125
|
- Codex in `workspace-write` changes its folder freely and asks before the network or anything
|
|
126
126
|
outside it. `read-only` asks before any change.
|
|
127
|
+
- The bridge tells Chips what those settings let through (Chips ADR 0299), for the harness's
|
|
128
|
+
Permissions page: Claude Code's `permissions` lists from your settings and each agent's folder,
|
|
129
|
+
and the mode; for Codex, its mode. It reads them and never writes them. Needs Chips SDK 1.0.10;
|
|
130
|
+
on an older one nothing is sent.
|
|
127
131
|
|
|
128
132
|
## Live
|
|
129
133
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Third-party notices
|
|
2
2
|
|
|
3
|
-
`dist/main.js` in @chipschat/acp 1.0.
|
|
3
|
+
`dist/main.js` in @chipschat/acp 1.0.30 carries these packages, bundled in. Each one's
|
|
4
4
|
licence follows.
|
|
5
5
|
|
|
6
|
-
## @chipschat/harness 1.0.
|
|
6
|
+
## @chipschat/harness 1.0.10 (Apache-2.0)
|
|
7
7
|
|
|
8
8
|
Apache License
|
|
9
9
|
Version 2.0, January 2004
|
|
@@ -207,7 +207,7 @@ Apache License
|
|
|
207
207
|
See the License for the specific language governing permissions and
|
|
208
208
|
limitations under the License.
|
|
209
209
|
|
|
210
|
-
## @chipschat/protocol 1.0.
|
|
210
|
+
## @chipschat/protocol 1.0.10 (Apache-2.0)
|
|
211
211
|
|
|
212
212
|
Apache License
|
|
213
213
|
Version 2.0, January 2004
|
package/dist/main.js
CHANGED
|
@@ -687,9 +687,9 @@ function assertNever(_x) {
|
|
|
687
687
|
}
|
|
688
688
|
function assert(_) {
|
|
689
689
|
}
|
|
690
|
-
function getEnumValues(
|
|
691
|
-
const numericValues = Object.values(
|
|
692
|
-
const values = Object.entries(
|
|
690
|
+
function getEnumValues(entries2) {
|
|
691
|
+
const numericValues = Object.values(entries2).filter((v) => typeof v === "number");
|
|
692
|
+
const values = Object.entries(entries2).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
693
693
|
return values;
|
|
694
694
|
}
|
|
695
695
|
function joinValues(array2, separator = "|") {
|
|
@@ -2524,16 +2524,16 @@ var $ZodCheckProperties = /* @__PURE__ */ $constructor("$ZodCheckProperties", (i
|
|
|
2524
2524
|
hide(inst, Symbol.iterator, function* () {
|
|
2525
2525
|
yield inst;
|
|
2526
2526
|
});
|
|
2527
|
-
let
|
|
2527
|
+
let entries2;
|
|
2528
2528
|
inst._zod.check = (payload) => {
|
|
2529
2529
|
if (payload.value == null) {
|
|
2530
2530
|
payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
|
|
2531
2531
|
return void 0;
|
|
2532
2532
|
}
|
|
2533
|
-
|
|
2533
|
+
entries2 ?? (entries2 = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
|
|
2534
2534
|
const input2 = payload.value;
|
|
2535
2535
|
let proms;
|
|
2536
|
-
for (const [key, schema] of
|
|
2536
|
+
for (const [key, schema] of entries2) {
|
|
2537
2537
|
const result = schema._zod.run({ value: input2[key], issues: [] }, {});
|
|
2538
2538
|
if (result instanceof Promise) {
|
|
2539
2539
|
proms ?? (proms = []);
|
|
@@ -15351,18 +15351,18 @@ function _set(Class2, valueType, params) {
|
|
|
15351
15351
|
}
|
|
15352
15352
|
// @__NO_SIDE_EFFECTS__
|
|
15353
15353
|
function _enum(Class2, values, params) {
|
|
15354
|
-
const
|
|
15354
|
+
const entries2 = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
15355
15355
|
return new Class2({
|
|
15356
15356
|
type: "enum",
|
|
15357
|
-
entries,
|
|
15357
|
+
entries: entries2,
|
|
15358
15358
|
...normalizeParams(params)
|
|
15359
15359
|
});
|
|
15360
15360
|
}
|
|
15361
15361
|
// @__NO_SIDE_EFFECTS__
|
|
15362
|
-
function _nativeEnum(Class2,
|
|
15362
|
+
function _nativeEnum(Class2, entries2, params) {
|
|
15363
15363
|
return new Class2({
|
|
15364
15364
|
type: "enum",
|
|
15365
|
-
entries,
|
|
15365
|
+
entries: entries2,
|
|
15366
15366
|
...normalizeParams(params)
|
|
15367
15367
|
});
|
|
15368
15368
|
}
|
|
@@ -18345,17 +18345,17 @@ var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
18345
18345
|
};
|
|
18346
18346
|
});
|
|
18347
18347
|
function _enum2(values, params) {
|
|
18348
|
-
const
|
|
18348
|
+
const entries2 = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
18349
18349
|
return new ZodEnum({
|
|
18350
18350
|
type: "enum",
|
|
18351
|
-
entries,
|
|
18351
|
+
entries: entries2,
|
|
18352
18352
|
...util_exports.normalizeParams(params)
|
|
18353
18353
|
});
|
|
18354
18354
|
}
|
|
18355
|
-
function nativeEnum(
|
|
18355
|
+
function nativeEnum(entries2, params) {
|
|
18356
18356
|
return new ZodEnum({
|
|
18357
18357
|
type: "enum",
|
|
18358
|
-
entries,
|
|
18358
|
+
entries: entries2,
|
|
18359
18359
|
...util_exports.normalizeParams(params)
|
|
18360
18360
|
});
|
|
18361
18361
|
}
|
|
@@ -19952,9 +19952,17 @@ var policyRule = external_exports.object({
|
|
|
19952
19952
|
made_by: external_exports.string().min(1).max(120).optional().describe("Who made it by answering an ask with Always (ADR 0195). Filled in by Chips."),
|
|
19953
19953
|
made_at: isoTimestamp.optional().describe("When a person's answer made it (ADR 0195): Always, or This session. Filled in by Chips. A rule a person's answer made never allows an action that matters.")
|
|
19954
19954
|
}).describe("A rule the policy engine evaluates.");
|
|
19955
|
+
var policyHold = external_exports.object({
|
|
19956
|
+
until: isoTimestamp.optional().describe("When its asks come back. Absent: when a person turns them back on."),
|
|
19957
|
+
matters: external_exports.boolean().optional().describe("Whether the yes covers asks that matter too: money, a message outside the workspace, anything that can't be undone. Absent or false, those still wait for a person."),
|
|
19958
|
+
by: external_exports.string().min(1).max(120).optional().describe("Who turned its asks off. Filled in by Chips from the credential that sent it."),
|
|
19959
|
+
at: isoTimestamp.optional().describe("When they were turned off. Filled in by Chips.")
|
|
19960
|
+
}).describe("A harness's asks turned off: Chips says yes for it until `until`.");
|
|
19955
19961
|
var policy = external_exports.object({
|
|
19956
19962
|
autonomy: autonomyLevel,
|
|
19957
|
-
rules: external_exports.array(policyRule).max(200).describe("Evaluated in order; the workspace cap always wins.")
|
|
19963
|
+
rules: external_exports.array(policyRule).max(200).describe("Evaluated in order; the workspace cap always wins."),
|
|
19964
|
+
hold: policyHold.nullable().optional().describe("Its asks turned off (ADR 0299), for every space: kept only with no `space_id`. `null` turns them back on; absent leaves it as it was."),
|
|
19965
|
+
chips_rules: external_exports.boolean().optional().describe("Whether Chips's rules answer any of its asks (ADR 0300): off, every ask it sends goes to a person and a don't-ask-again is the harness's own. Kept only with no `space_id`; absent leaves it as it was, and never set it reads as on for a harness with a rule or a hold, or whose workspace has one.")
|
|
19958
19966
|
}).describe("A harness's autonomy level and the rules that fill in the details.");
|
|
19959
19967
|
var cost = external_exports.object({
|
|
19960
19968
|
usd: external_exports.number().nonnegative().describe("An estimate, in US dollars."),
|
|
@@ -21159,6 +21167,7 @@ var approvalResolved = defineEvent({
|
|
|
21159
21167
|
approval_id: id("approval"),
|
|
21160
21168
|
decision: external_exports.enum(["approved", "edited", "denied", "expired"]).describe("`expired` means nobody answered and the fallback applied."),
|
|
21161
21169
|
scope: external_exports.enum(["once", "session", "always"]).default("once").describe("How far the answer reaches. `always` becomes a policy rule."),
|
|
21170
|
+
keeps: external_exports.literal("harness").optional().describe("With `always`: the harness keeps it as its own always, since its Chips's rules are off (ADR 0300), and Chips writes no rule. Filled in by Chips."),
|
|
21162
21171
|
everywhere: external_exports.boolean().optional().describe("With `always`: the rule is the harness's in every space, not only this one (ADR 0239). An owner or an admin only."),
|
|
21163
21172
|
for_minutes: external_exports.number().int().min(5).max(240).optional().describe("With `once` and a yes: for this many minutes, everything the asking agent asks in this space goes ahead without a card (ADR 0239, addendum of 6 November 2026; ADR 0281), commands Chips can't read too. An ask that matters still waits for a person. Chips keeps the rule, so the harness is answered once."),
|
|
21164
21173
|
until_stopped: external_exports.literal(true).optional().describe("With `once` and a yes, instead of `for_minutes`: everything the asking agent asks in this space goes ahead without a card until a person stops it (`approval.held_stopped`, ADR 0281). An ask that matters still waits for a person. Chips keeps the rule, so the harness is answered once."),
|
|
@@ -22460,6 +22469,19 @@ var exchangeLimitsSet = defineEvent({
|
|
|
22460
22469
|
circles: external_exports.boolean().describe("Whether agents going in circles (the same two or three taking turns and saying again what they said) are told to stop then, whatever the count.")
|
|
22461
22470
|
})
|
|
22462
22471
|
});
|
|
22472
|
+
var policyWorkspaceUpdated = defineEvent({
|
|
22473
|
+
type: "policy.workspace_updated",
|
|
22474
|
+
direction: "workspace",
|
|
22475
|
+
sender: "person",
|
|
22476
|
+
summary: "An owner or an admin set the rules for every harness, or turned every harness's asks off for a while (ADR 0299).",
|
|
22477
|
+
requiresRun: false,
|
|
22478
|
+
payload: external_exports.object({
|
|
22479
|
+
rules: external_exports.array(policyRule).max(200).describe("Read before any harness's own, in order. Each rule a person adds is kept with who made it and when."),
|
|
22480
|
+
hold: policyHold.nullable().optional().describe("Every harness's asks turned off. `null` turns them back on; absent leaves it as it was."),
|
|
22481
|
+
workspace_max_autonomy: autonomyLevel.describe("The workspace cap as it stands, which this doesn't change. Filled in by Chips."),
|
|
22482
|
+
changed_by: external_exports.string().min(1).max(120).describe("Who changed them. Filled in by Chips from the credential that sent it.")
|
|
22483
|
+
})
|
|
22484
|
+
});
|
|
22463
22485
|
var workspaceRenamed = defineEvent({
|
|
22464
22486
|
type: "workspace.renamed",
|
|
22465
22487
|
direction: "workspace",
|
|
@@ -22529,7 +22551,8 @@ var WORKSPACE_EVENTS = [
|
|
|
22529
22551
|
attachmentLimitsSet,
|
|
22530
22552
|
exchangeLimitsSet,
|
|
22531
22553
|
workspaceRenamed,
|
|
22532
|
-
relaySet
|
|
22554
|
+
relaySet,
|
|
22555
|
+
policyWorkspaceUpdated
|
|
22533
22556
|
];
|
|
22534
22557
|
|
|
22535
22558
|
// node_modules/@chipschat/protocol/dist/src/events/catalogue.js
|
|
@@ -22967,6 +22990,36 @@ var notificationSettings = external_exports.object({
|
|
|
22967
22990
|
spaces: external_exports.record(external_exports.string().min(1).max(120), spaceNotifications).optional()
|
|
22968
22991
|
});
|
|
22969
22992
|
|
|
22993
|
+
// node_modules/@chipschat/protocol/dist/src/own-rules.js
|
|
22994
|
+
var OWN_RULES_MAX = 200;
|
|
22995
|
+
var OWN_KINDS = ["read", "write", "web", "command", "tool"];
|
|
22996
|
+
var ownKind = external_exports.enum(OWN_KINDS);
|
|
22997
|
+
var ownEntry = external_exports.object({
|
|
22998
|
+
kind: ownKind.describe("What it lets through: reading files, writing them, the web, commands, or another tool."),
|
|
22999
|
+
name: external_exports.string().min(1).max(120).describe("The tool or program as the harness names it: `Read`, `WebFetch`, `git`."),
|
|
23000
|
+
words: external_exports.array(external_exports.string().min(1).max(120)).max(8).optional().describe('For a command: the words every command it lets through starts with, `["git"]`. Absent on a command entry: any command.'),
|
|
23001
|
+
raw: external_exports.string().min(1).max(400).optional().describe("The entry as its settings write it: `Bash(git:*)`.")
|
|
23002
|
+
}).describe("One thing a harness's own settings let through, ask about, or refuse.");
|
|
23003
|
+
var entries = external_exports.array(ownEntry).max(OWN_RULES_MAX);
|
|
23004
|
+
var ownRules = external_exports.object({
|
|
23005
|
+
read_from: external_exports.array(external_exports.string().min(1).max(300)).min(1).max(8).describe("Where it read them, in the order they apply: `~/.claude/settings.json`."),
|
|
23006
|
+
note: external_exports.string().min(1).max(400).optional().describe("A sentence in the harness's own words about them: who else reads the same file, what its mode means."),
|
|
23007
|
+
mode: external_exports.string().min(1).max(80).optional().describe("The mode its sessions run in, as the harness names it: `Default`."),
|
|
23008
|
+
everything: external_exports.boolean().optional().describe("It runs everything without asking, so nothing it does reaches Chips as an ask."),
|
|
23009
|
+
runs: entries.describe("What it runs without asking."),
|
|
23010
|
+
asks: entries.optional().describe("What it always asks about, whatever else it lets through."),
|
|
23011
|
+
refuses: entries.optional().describe("What it never does."),
|
|
23012
|
+
ask_line: external_exports.object({
|
|
23013
|
+
entry: external_exports.string().min(1).max(200).describe("One entry that asks, with `{words}` where a command's start goes."),
|
|
23014
|
+
line: external_exports.string().min(1).max(300).describe("The line those entries go in, with `{entries}` where they go, comma-separated."),
|
|
23015
|
+
where: external_exports.string().min(1).max(300).describe("Where the line goes, in words.")
|
|
23016
|
+
}).optional().describe("How to make a command ask in its own settings, for the page's Copy.")
|
|
23017
|
+
}).describe("What a harness's own settings let through, in its own terms (ADR 0299).");
|
|
23018
|
+
var ownRulesRead = external_exports.object({
|
|
23019
|
+
own_rules: ownRules.nullable().describe("The latest copy; `null` before the harness sent one."),
|
|
23020
|
+
heard_at: isoTimestamp.nullable().describe("When Chips heard it.")
|
|
23021
|
+
}).describe("What a harness last said it runs on its own.");
|
|
23022
|
+
|
|
22970
23023
|
// node_modules/@chipschat/protocol/dist/src/pages.js
|
|
22971
23024
|
var HTML_POLICY = "default-src 'none'; img-src data: blob:; font-src data:; media-src data: blob:; style-src 'unsafe-inline'; script-src 'unsafe-inline'";
|
|
22972
23025
|
var PAGE_SANDBOX = "allow-scripts allow-popups allow-popups-to-escape-sandbox";
|
|
@@ -24032,6 +24085,7 @@ var Run = class {
|
|
|
24032
24085
|
decision: event.decision,
|
|
24033
24086
|
allowed: event.decision === "approved" || event.decision === "edited",
|
|
24034
24087
|
scope: event.scope ?? "once",
|
|
24088
|
+
...event.keeps === "harness" ? { keeps: "harness" } : {},
|
|
24035
24089
|
input: event.decision === "edited" ? event.updated_input : input2.action.input,
|
|
24036
24090
|
reason: event.reason,
|
|
24037
24091
|
by: event.resolved_by,
|
|
@@ -24184,7 +24238,8 @@ var PATHS = {
|
|
|
24184
24238
|
model: (id2) => `/v1/agents/${encodeURIComponent(id2)}/model`,
|
|
24185
24239
|
heartbeat: (id2) => `/v1/agents/${encodeURIComponent(id2)}/heartbeat`,
|
|
24186
24240
|
"context-window": (id2) => `/v1/agents/${encodeURIComponent(id2)}/context-window`,
|
|
24187
|
-
jobs: (id2) => `/v1/harnesses/${encodeURIComponent(id2)}/jobs
|
|
24241
|
+
jobs: (id2) => `/v1/harnesses/${encodeURIComponent(id2)}/jobs`,
|
|
24242
|
+
"own-rules": (id2) => `/v1/harnesses/${encodeURIComponent(id2)}/own-rules`
|
|
24188
24243
|
};
|
|
24189
24244
|
var FRAMES = {
|
|
24190
24245
|
"context.edit": contextEditFrame,
|
|
@@ -24234,6 +24289,15 @@ var Settings = class {
|
|
|
24234
24289
|
jobs(copy) {
|
|
24235
24290
|
return this.send("jobs", this.harnessId(), copy, {});
|
|
24236
24291
|
}
|
|
24292
|
+
/**
|
|
24293
|
+
* What the harness's own settings let through without asking (ADR 0299): where it read them, the
|
|
24294
|
+
* mode it runs in, and each entry. Chips decides nothing from it; a person reads it on the
|
|
24295
|
+
* harness's Permissions page. Send it when connected and whenever the settings are read again;
|
|
24296
|
+
* a copy the same as the last is not sent again. An older Chips has no such page and refuses it.
|
|
24297
|
+
*/
|
|
24298
|
+
ownRules(copy) {
|
|
24299
|
+
return this.send("own-rules", this.harnessId(), copy, {});
|
|
24300
|
+
}
|
|
24237
24301
|
/**
|
|
24238
24302
|
* Runs of its jobs the harness finished (`jobs`), two hundred to a post. A run sent again says
|
|
24239
24303
|
* what it says over the one before, and what it leaves out stays, so send it once more when its
|
|
@@ -25648,10 +25712,10 @@ function keptAtAny(store, accounts) {
|
|
|
25648
25712
|
}
|
|
25649
25713
|
return void 0;
|
|
25650
25714
|
}
|
|
25651
|
-
function rehomed(store, account,
|
|
25652
|
-
const here2 = hereInstead(
|
|
25653
|
-
if (here2 === void 0 || here2 ===
|
|
25654
|
-
return
|
|
25715
|
+
function rehomed(store, account, joined3, env2) {
|
|
25716
|
+
const here2 = hereInstead(joined3.url, env2);
|
|
25717
|
+
if (here2 === void 0 || here2 === joined3.url)
|
|
25718
|
+
return joined3;
|
|
25655
25719
|
if (store !== false) {
|
|
25656
25720
|
try {
|
|
25657
25721
|
const record2 = JSON.parse(store.get(account) ?? "{}");
|
|
@@ -25659,7 +25723,7 @@ function rehomed(store, account, joined2, env2) {
|
|
|
25659
25723
|
} catch {
|
|
25660
25724
|
}
|
|
25661
25725
|
}
|
|
25662
|
-
return { ...
|
|
25726
|
+
return { ...joined3, url: here2 };
|
|
25663
25727
|
}
|
|
25664
25728
|
function keptAt(store, account) {
|
|
25665
25729
|
if (store === false)
|
|
@@ -25776,10 +25840,10 @@ async function join3(options) {
|
|
|
25776
25840
|
throw error62;
|
|
25777
25841
|
}
|
|
25778
25842
|
const answered = joinedOf(answer);
|
|
25779
|
-
const
|
|
25843
|
+
const joined3 = { ...answered, url: hereInstead(answered.url, env2) ?? answered.url };
|
|
25780
25844
|
if (store !== false)
|
|
25781
|
-
keepTheKey(store, account, { ...
|
|
25782
|
-
return
|
|
25845
|
+
keepTheKey(store, account, { ...joined3, from, hello: "due" });
|
|
25846
|
+
return joined3;
|
|
25783
25847
|
}
|
|
25784
25848
|
function keepTheKey(store, account, record2) {
|
|
25785
25849
|
try {
|
|
@@ -25790,12 +25854,12 @@ function keepTheKey(store, account, record2) {
|
|
|
25790
25854
|
`);
|
|
25791
25855
|
}
|
|
25792
25856
|
}
|
|
25793
|
-
async function helloOnce(
|
|
25794
|
-
const { spaceId } =
|
|
25857
|
+
async function helloOnce(joined3, options) {
|
|
25858
|
+
const { spaceId } = joined3;
|
|
25795
25859
|
if (spaceId === void 0)
|
|
25796
25860
|
return false;
|
|
25797
25861
|
const store = options.keep ?? openKeyStore(options.env ?? process.env);
|
|
25798
|
-
const account = accountOf(
|
|
25862
|
+
const account = accountOf(joined3.url, options.name);
|
|
25799
25863
|
let record2;
|
|
25800
25864
|
try {
|
|
25801
25865
|
const kept2 = store === false ? void 0 : store.get(account);
|
|
@@ -25803,7 +25867,7 @@ async function helloOnce(joined2, options) {
|
|
|
25803
25867
|
} catch {
|
|
25804
25868
|
record2 = void 0;
|
|
25805
25869
|
}
|
|
25806
|
-
const due = store === false || record2?.["hello"] === "due" && record2["token"] ===
|
|
25870
|
+
const due = store === false || record2?.["hello"] === "due" && record2["token"] === joined3.token;
|
|
25807
25871
|
if (!due)
|
|
25808
25872
|
return false;
|
|
25809
25873
|
await options.say(spaceId);
|
|
@@ -27021,7 +27085,7 @@ function forgetAdapter(id2, home = homedir5()) {
|
|
|
27021
27085
|
import { randomBytes } from "node:crypto";
|
|
27022
27086
|
import { existsSync as existsSync8 } from "node:fs";
|
|
27023
27087
|
import { mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
|
|
27024
|
-
import { homedir as
|
|
27088
|
+
import { homedir as homedir7 } from "node:os";
|
|
27025
27089
|
import { join as join10 } from "node:path";
|
|
27026
27090
|
|
|
27027
27091
|
// src/claude-settings.ts
|
|
@@ -27405,6 +27469,147 @@ function keepHeard(since, heard) {
|
|
|
27405
27469
|
if (since.length > CONTEXT_BUDGET.lines) since.shift();
|
|
27406
27470
|
}
|
|
27407
27471
|
|
|
27472
|
+
// src/own-rules.ts
|
|
27473
|
+
import { homedir as homedir6 } from "node:os";
|
|
27474
|
+
var MOST = 200;
|
|
27475
|
+
var MOST_PLACES = 8;
|
|
27476
|
+
var LONGEST_NAME = 120;
|
|
27477
|
+
var LONGEST_RAW = 400;
|
|
27478
|
+
var READS = /* @__PURE__ */ new Set(["Read", "Glob", "Grep", "LS", "NotebookRead"]);
|
|
27479
|
+
var WRITES = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
|
|
27480
|
+
var WEB = /* @__PURE__ */ new Set(["WebFetch", "WebSearch"]);
|
|
27481
|
+
var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27482
|
+
var clip = (text, most) => text.length > most ? text.slice(0, most) : text;
|
|
27483
|
+
function bashWords(inner) {
|
|
27484
|
+
if (inner === void 0) return void 0;
|
|
27485
|
+
const pattern = inner.trim().replace(/:\*$/, "").replace(/\s+\*$/, "");
|
|
27486
|
+
if (pattern === "" || pattern === "*") return void 0;
|
|
27487
|
+
const words4 = pattern.split(/\s+/).map((word) => clip(word, LONGEST_NAME));
|
|
27488
|
+
return words4.slice(0, 8);
|
|
27489
|
+
}
|
|
27490
|
+
function claudeEntry(rule) {
|
|
27491
|
+
const said = /^\s*([^()\s]+)\s*(?:\((.*)\))?\s*$/s.exec(rule);
|
|
27492
|
+
const name = said?.[1];
|
|
27493
|
+
if (name === void 0) return void 0;
|
|
27494
|
+
const raw = clip(rule.trim(), LONGEST_RAW);
|
|
27495
|
+
const tool = clip(name, LONGEST_NAME);
|
|
27496
|
+
if (name === "Bash") {
|
|
27497
|
+
const words4 = bashWords(said?.[2]);
|
|
27498
|
+
return { kind: "command", name: tool, ...words4 === void 0 ? {} : { words: words4 }, raw };
|
|
27499
|
+
}
|
|
27500
|
+
const kind2 = READS.has(name) ? "read" : WRITES.has(name) ? "write" : WEB.has(name) ? "web" : "tool";
|
|
27501
|
+
return { kind: kind2, name: tool, raw };
|
|
27502
|
+
}
|
|
27503
|
+
function joined(layers, list) {
|
|
27504
|
+
const seen = /* @__PURE__ */ new Set();
|
|
27505
|
+
const entries2 = [];
|
|
27506
|
+
for (const layer of layers) {
|
|
27507
|
+
const permissions = layer["permissions"];
|
|
27508
|
+
const rules = isRecord2(permissions) ? permissions[list] : void 0;
|
|
27509
|
+
if (!Array.isArray(rules)) continue;
|
|
27510
|
+
for (const rule of rules) {
|
|
27511
|
+
if (typeof rule !== "string" || seen.has(rule.trim())) continue;
|
|
27512
|
+
seen.add(rule.trim());
|
|
27513
|
+
const entry = claudeEntry(rule);
|
|
27514
|
+
if (entry !== void 0) entries2.push(entry);
|
|
27515
|
+
}
|
|
27516
|
+
}
|
|
27517
|
+
return entries2.slice(0, MOST);
|
|
27518
|
+
}
|
|
27519
|
+
function ownDefaultMode(layer) {
|
|
27520
|
+
const permissions = layer?.["permissions"];
|
|
27521
|
+
const mode = isRecord2(permissions) ? permissions["defaultMode"] : void 0;
|
|
27522
|
+
return typeof mode === "string" && mode !== "" ? mode : void 0;
|
|
27523
|
+
}
|
|
27524
|
+
var CLAUDE_MODES = {
|
|
27525
|
+
default: "Default",
|
|
27526
|
+
acceptEdits: "Accept edits",
|
|
27527
|
+
plan: "Plan",
|
|
27528
|
+
bypassPermissions: "Bypass permissions",
|
|
27529
|
+
dontAsk: "Don't ask",
|
|
27530
|
+
auto: "Auto"
|
|
27531
|
+
};
|
|
27532
|
+
function claudeModeName(mode) {
|
|
27533
|
+
return CLAUDE_MODES[mode] ?? mode;
|
|
27534
|
+
}
|
|
27535
|
+
function tilde(path, home = homedir6()) {
|
|
27536
|
+
return path === home ? "~" : path.startsWith(`${home}/`) ? `~${path.slice(home.length)}` : path;
|
|
27537
|
+
}
|
|
27538
|
+
function claudeOwnRules(options) {
|
|
27539
|
+
const home = options.home ?? homedir6();
|
|
27540
|
+
const layers = [...options.user === void 0 ? [] : [options.user], ...options.folders.map((each) => each.layer)];
|
|
27541
|
+
const userPlace = tilde(options.userPath, home);
|
|
27542
|
+
const read_from = [userPlace, ...options.folders.map((each) => tilde(each.path, home))].slice(0, MOST_PLACES);
|
|
27543
|
+
const own2 = ownDefaultMode(options.user);
|
|
27544
|
+
const notes = [
|
|
27545
|
+
"Your own Claude Code reads the same file, so a change there changes both.",
|
|
27546
|
+
own2 !== void 0 && own2 !== options.mode ? `Your own Claude Code runs in ${claudeModeName(own2)} mode; Chips puts each session in ${claudeModeName(options.mode)}.` : void 0
|
|
27547
|
+
].filter((note) => note !== void 0);
|
|
27548
|
+
const ask_line = {
|
|
27549
|
+
entry: '"Bash({words}:*)"',
|
|
27550
|
+
line: '"ask": [{entries}]',
|
|
27551
|
+
where: `\`permissions\` in \`${userPlace}\``
|
|
27552
|
+
};
|
|
27553
|
+
if (options.mode === "bypassPermissions") {
|
|
27554
|
+
return { read_from, note: notes.join(" "), mode: claudeModeName(options.mode), everything: true, runs: [] };
|
|
27555
|
+
}
|
|
27556
|
+
const allowed = joined(layers, "allow");
|
|
27557
|
+
const edits = options.mode === "acceptEdits" ? ["Edit", "Write", "MultiEdit"].filter((name) => !allowed.some((entry) => entry.name === name)).map((name) => ({ kind: "write", name, raw: "acceptEdits" })) : [];
|
|
27558
|
+
return {
|
|
27559
|
+
read_from,
|
|
27560
|
+
note: notes.join(" "),
|
|
27561
|
+
mode: claudeModeName(options.mode),
|
|
27562
|
+
runs: [...allowed, ...edits].slice(0, MOST),
|
|
27563
|
+
asks: joined(layers, "ask"),
|
|
27564
|
+
refuses: joined(layers, "deny"),
|
|
27565
|
+
ask_line
|
|
27566
|
+
};
|
|
27567
|
+
}
|
|
27568
|
+
var CODEX_MODES = {
|
|
27569
|
+
"read-only": "Read only",
|
|
27570
|
+
"workspace-write": "Workspace write",
|
|
27571
|
+
auto: "Auto",
|
|
27572
|
+
"full-access": "Full access",
|
|
27573
|
+
"danger-full-access": "Full access"
|
|
27574
|
+
};
|
|
27575
|
+
function codexOwnRules(mode) {
|
|
27576
|
+
const read_from = ["the mode Chips starts each Codex session in"];
|
|
27577
|
+
const name = CODEX_MODES[mode] ?? mode;
|
|
27578
|
+
if (mode === "full-access" || mode === "danger-full-access") {
|
|
27579
|
+
return {
|
|
27580
|
+
read_from,
|
|
27581
|
+
mode: name,
|
|
27582
|
+
everything: true,
|
|
27583
|
+
note: "Codex runs with full access, so it never asks.",
|
|
27584
|
+
runs: []
|
|
27585
|
+
};
|
|
27586
|
+
}
|
|
27587
|
+
if (mode === "read-only") {
|
|
27588
|
+
return {
|
|
27589
|
+
read_from,
|
|
27590
|
+
mode: name,
|
|
27591
|
+
note: "Codex reads on its own and asks before it changes a file or runs anything else.",
|
|
27592
|
+
runs: []
|
|
27593
|
+
};
|
|
27594
|
+
}
|
|
27595
|
+
return {
|
|
27596
|
+
read_from,
|
|
27597
|
+
mode: name,
|
|
27598
|
+
note: "Codex edits files and runs commands inside the agent's folder in its own sandbox, and asks before the network or anything outside that folder.",
|
|
27599
|
+
runs: []
|
|
27600
|
+
};
|
|
27601
|
+
}
|
|
27602
|
+
async function sendOwnRules(settings, copy) {
|
|
27603
|
+
const send = settings?.ownRules;
|
|
27604
|
+
if (typeof send !== "function") return false;
|
|
27605
|
+
try {
|
|
27606
|
+
await send.call(settings, copy);
|
|
27607
|
+
return true;
|
|
27608
|
+
} catch {
|
|
27609
|
+
return false;
|
|
27610
|
+
}
|
|
27611
|
+
}
|
|
27612
|
+
|
|
27408
27613
|
// src/models.ts
|
|
27409
27614
|
var SETTINGS_LEVEL = "default";
|
|
27410
27615
|
var LEVEL_WORDS = { xhigh: "Extra high" };
|
|
@@ -27615,7 +27820,7 @@ var Bridge = class {
|
|
|
27615
27820
|
this.knew = resolve5;
|
|
27616
27821
|
});
|
|
27617
27822
|
this.env = options.env ?? adapterEnv(options.kind, { ...process.env, ...options.kind.env });
|
|
27618
|
-
this.places = placesOf2(this.env, options.home ??
|
|
27823
|
+
this.places = placesOf2(this.env, options.home ?? homedir7());
|
|
27619
27824
|
this.knownKind = knownIdOf(options.kind);
|
|
27620
27825
|
this.files = this.knownKind === void 0 ? void 0 : new ContextFiles(this.knownKind, options.kind, this.places, codexDocBytes(this.env));
|
|
27621
27826
|
}
|
|
@@ -27680,6 +27885,7 @@ var Bridge = class {
|
|
|
27680
27885
|
await this.know(await chips2.agents.list(), { forget: true });
|
|
27681
27886
|
this.knew();
|
|
27682
27887
|
await this.sendContexts();
|
|
27888
|
+
await this.sendOwnRules();
|
|
27683
27889
|
for (const record2 of this.records()) await this.sendWindow(record2);
|
|
27684
27890
|
await this.sendModels();
|
|
27685
27891
|
await this.run();
|
|
@@ -28317,14 +28523,14 @@ var Bridge = class {
|
|
|
28317
28523
|
project
|
|
28318
28524
|
};
|
|
28319
28525
|
const rules = rulesFor(message, asked);
|
|
28320
|
-
const
|
|
28526
|
+
const joined3 = `${speakerId ?? record2.agentId}|${spaceId}`;
|
|
28321
28527
|
let words4 = promptFor(message, {
|
|
28322
28528
|
...asked,
|
|
28323
28529
|
rulesHeld: this.rules.holds(sessionId, rules),
|
|
28324
28530
|
earlier,
|
|
28325
28531
|
since,
|
|
28326
28532
|
answered: room.answered,
|
|
28327
|
-
before: this.caughtUp.get(
|
|
28533
|
+
before: this.caughtUp.get(joined3),
|
|
28328
28534
|
heldPost: room.heldPost
|
|
28329
28535
|
});
|
|
28330
28536
|
const files = [];
|
|
@@ -28352,7 +28558,7 @@ ${files.join("\n")}`;
|
|
|
28352
28558
|
turn.prompting = false;
|
|
28353
28559
|
if (prompt === words4) {
|
|
28354
28560
|
keepAnswered(room.answered, [...earlier, message]);
|
|
28355
|
-
this.caughtUp.delete(
|
|
28561
|
+
this.caughtUp.delete(joined3);
|
|
28356
28562
|
room.heldPost = void 0;
|
|
28357
28563
|
}
|
|
28358
28564
|
if (turn.cancelled) return;
|
|
@@ -28679,8 +28885,8 @@ ${files.join("\n")}`;
|
|
|
28679
28885
|
}).catch(() => void 0);
|
|
28680
28886
|
}
|
|
28681
28887
|
async planned(turn, update) {
|
|
28682
|
-
const
|
|
28683
|
-
const steps =
|
|
28888
|
+
const entries2 = Array.isArray(update["entries"]) ? update["entries"] : [];
|
|
28889
|
+
const steps = entries2.filter((entry) => entry["status"] !== "completed").slice(0, 20).map((entry, index) => ({ stepId: `plan-${index + 1}`, title: String(entry["content"] ?? "").slice(0, 300) })).filter((step) => step.title !== "");
|
|
28684
28890
|
if (steps.length > 0) await turn.run.plan(steps).catch(() => void 0);
|
|
28685
28891
|
}
|
|
28686
28892
|
// ------------------------------------------------------------------ what the agents read (Chips ADRs 0134, 0238)
|
|
@@ -28691,8 +28897,36 @@ ${files.join("\n")}`;
|
|
|
28691
28897
|
/** The agents came or went: the copies sent again where they changed (Chips takes the same copy once). */
|
|
28692
28898
|
agentsChanged() {
|
|
28693
28899
|
if (this.files !== void 0) void this.sendContexts();
|
|
28900
|
+
void this.sendOwnRules();
|
|
28694
28901
|
void this.sendModels();
|
|
28695
28902
|
}
|
|
28903
|
+
/**
|
|
28904
|
+
* What its own settings let through without asking (Chips ADR 0299), read again with the agents'
|
|
28905
|
+
* folders: Claude Code's lists, Codex's mode. Chips takes the same copy once; an older Chips, or
|
|
28906
|
+
* an SDK before 1.0.10, takes none, and nothing else changes.
|
|
28907
|
+
*/
|
|
28908
|
+
async sendOwnRules() {
|
|
28909
|
+
const copy = this.ownRules();
|
|
28910
|
+
if (copy !== void 0) await sendOwnRules(this.options.chips.settings, copy);
|
|
28911
|
+
}
|
|
28912
|
+
ownRules() {
|
|
28913
|
+
if (this.knownKind === "codex") return codexOwnRules(this.options.kind.mode ?? "workspace-write");
|
|
28914
|
+
if (this.knownKind !== "claude-code") return void 0;
|
|
28915
|
+
const userPath = join10(this.places.claudeHome, "settings.json");
|
|
28916
|
+
const folders = [...new Set(this.records().map((record2) => record2.folder))].flatMap(
|
|
28917
|
+
(folder2) => [join10(folder2, ".claude", "settings.json"), join10(folder2, ".claude", "settings.local.json")].flatMap((path) => {
|
|
28918
|
+
const layer = readLayer(path);
|
|
28919
|
+
return layer === void 0 ? [] : [{ path, layer }];
|
|
28920
|
+
})
|
|
28921
|
+
);
|
|
28922
|
+
return claudeOwnRules({
|
|
28923
|
+
userPath,
|
|
28924
|
+
user: readLayer(userPath),
|
|
28925
|
+
folders,
|
|
28926
|
+
mode: this.options.kind.mode ?? "default",
|
|
28927
|
+
home: this.places.home
|
|
28928
|
+
});
|
|
28929
|
+
}
|
|
28696
28930
|
/** The harness's own set and each agent's files, as they are on disk now. */
|
|
28697
28931
|
async sendContexts() {
|
|
28698
28932
|
const files = this.files;
|
|
@@ -29350,17 +29584,17 @@ function questionFor(title2, input2) {
|
|
|
29350
29584
|
const fields = typeof input2 === "object" && input2 !== null ? input2 : {};
|
|
29351
29585
|
const said = oneLine(fields["description"])?.replace(/[\s.?!:;,]+$/, "");
|
|
29352
29586
|
if (said === void 0 || said === "") return `Allow it to ${lowerFirst(title2)}?`.slice(0, QUESTION_MAX);
|
|
29353
|
-
const asked = `${
|
|
29587
|
+
const asked = `${clip2(said, QUESTION_MAX - 1)}?`;
|
|
29354
29588
|
const command = oneLine(Array.isArray(fields["command"]) ? fields["command"].join(" ") : fields["command"]);
|
|
29355
29589
|
const room = QUESTION_MAX - asked.length - 3;
|
|
29356
29590
|
if (command === void 0 || command.includes("`") || room < 12) return asked;
|
|
29357
|
-
return `${asked} \`${
|
|
29591
|
+
return `${asked} \`${clip2(command, room)}\``;
|
|
29358
29592
|
}
|
|
29359
29593
|
function oneLine(value) {
|
|
29360
29594
|
const line = typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "";
|
|
29361
29595
|
return line === "" ? void 0 : line;
|
|
29362
29596
|
}
|
|
29363
|
-
function
|
|
29597
|
+
function clip2(text, max) {
|
|
29364
29598
|
return text.length <= max ? text : `${text.slice(0, max - 1)}\u2026`;
|
|
29365
29599
|
}
|
|
29366
29600
|
function riskOf(kind2) {
|
|
@@ -29371,7 +29605,10 @@ function riskOf(kind2) {
|
|
|
29371
29605
|
function optionFor(decision, options, command) {
|
|
29372
29606
|
const find = (kind2) => options.find((option) => option.kind === kind2)?.optionId;
|
|
29373
29607
|
if (!decision.allowed) return find("reject_once") ?? find("reject_always");
|
|
29374
|
-
|
|
29608
|
+
const harnessKeeps = decision.keeps === "harness";
|
|
29609
|
+
if (decision.scope === "always" && (!command || harnessKeeps)) {
|
|
29610
|
+
return find("allow_always") ?? find("allow_once");
|
|
29611
|
+
}
|
|
29375
29612
|
return find("allow_once") ?? find("allow_always");
|
|
29376
29613
|
}
|
|
29377
29614
|
function carriesCommand(input2) {
|
|
@@ -29458,7 +29695,7 @@ function keepIfAsked(label2, url2, names, log2, before = () => void 0) {
|
|
|
29458
29695
|
|
|
29459
29696
|
// src/move.ts
|
|
29460
29697
|
import { lstatSync, mkdirSync as mkdirSync5, readdirSync as readdirSync2, readFileSync as readFileSync9, renameSync as renameSync2, rmdirSync, writeFileSync as writeFileSync4 } from "node:fs";
|
|
29461
|
-
import { homedir as
|
|
29698
|
+
import { homedir as homedir8 } from "node:os";
|
|
29462
29699
|
import { basename as basename5, dirname as dirname6, join as join11, resolve as resolve4 } from "node:path";
|
|
29463
29700
|
var there = (path) => {
|
|
29464
29701
|
try {
|
|
@@ -29470,7 +29707,7 @@ var there = (path) => {
|
|
|
29470
29707
|
};
|
|
29471
29708
|
var isFolder = (path) => lstatSync(path).isDirectory();
|
|
29472
29709
|
var shown = (path, home) => path.startsWith(`${home}/`) ? `~${path.slice(home.length)}` : path;
|
|
29473
|
-
function merge2(from, to, log2, home =
|
|
29710
|
+
function merge2(from, to, log2, home = homedir8(), quiet = false) {
|
|
29474
29711
|
if (!there(from)) return;
|
|
29475
29712
|
try {
|
|
29476
29713
|
if (!there(to)) {
|
|
@@ -29496,7 +29733,7 @@ function removeIfEmpty(path) {
|
|
|
29496
29733
|
} catch {
|
|
29497
29734
|
}
|
|
29498
29735
|
}
|
|
29499
|
-
function claudeStoreOf(folder2, env2, home =
|
|
29736
|
+
function claudeStoreOf(folder2, env2, home = homedir8()) {
|
|
29500
29737
|
const name = folder2.replace(/[^a-zA-Z0-9]/g, "-");
|
|
29501
29738
|
if (name.length > 200) return void 0;
|
|
29502
29739
|
return join11(env2["CLAUDE_CONFIG_DIR"] ? resolve4(fromHome(env2["CLAUDE_CONFIG_DIR"], home)) : join11(home, ".claude"), "projects", name);
|
|
@@ -29521,7 +29758,7 @@ var readJson = (path) => {
|
|
|
29521
29758
|
return void 0;
|
|
29522
29759
|
}
|
|
29523
29760
|
};
|
|
29524
|
-
function moveOld(configPath2, log2, home =
|
|
29761
|
+
function moveOld(configPath2, log2, home = homedir8(), env2 = process.env) {
|
|
29525
29762
|
const places = placesOf(home);
|
|
29526
29763
|
const keptIn = join11(dirname6(configPath2), basename5(configPath2, ".json"));
|
|
29527
29764
|
const name = inside2(places.settings, configPath2);
|
|
@@ -29638,7 +29875,7 @@ var refused2 = (error62) => {
|
|
|
29638
29875
|
`);
|
|
29639
29876
|
process.exit(1);
|
|
29640
29877
|
};
|
|
29641
|
-
var
|
|
29878
|
+
var joined2 = await join3({
|
|
29642
29879
|
link,
|
|
29643
29880
|
url: process.env["CHIPS_URL"],
|
|
29644
29881
|
name: kind.name,
|
|
@@ -29656,7 +29893,7 @@ var joined = await join3({
|
|
|
29656
29893
|
],
|
|
29657
29894
|
onCode: (code) => log(`Allow this harness in Chips: ${code}`)
|
|
29658
29895
|
}).catch(refused2);
|
|
29659
|
-
keepIfAsked(LABEL,
|
|
29896
|
+
keepIfAsked(LABEL, joined2.url, ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "CODEX_HOME", "CLAUDE_CONFIG_DIR"], log);
|
|
29660
29897
|
var kept = existsSync10(statePath) ? JSON.parse(readFileSync10(statePath, "utf8")) : {};
|
|
29661
29898
|
var state = {
|
|
29662
29899
|
sessions: kept.sessions ?? {},
|
|
@@ -29673,8 +29910,8 @@ var waitingSaid = (why) => {
|
|
|
29673
29910
|
};
|
|
29674
29911
|
var bridge;
|
|
29675
29912
|
var chips = await connect({
|
|
29676
|
-
url:
|
|
29677
|
-
token:
|
|
29913
|
+
url: joined2.url,
|
|
29914
|
+
token: joined2.token,
|
|
29678
29915
|
client: { name: "chips-acp", version: VERSION },
|
|
29679
29916
|
store: fileStore(join12(folder, "chips-state.json")),
|
|
29680
29917
|
// The copy this machine keeps running starts at login, perhaps before its server is up: it waits
|
|
@@ -29708,7 +29945,7 @@ closing.push(() => bridge?.stop());
|
|
|
29708
29945
|
await bridge.start();
|
|
29709
29946
|
started = true;
|
|
29710
29947
|
log(`connected as ${chips.harnessId} (${kind.name}), ${Object.keys(state.agents).length} agent(s)`);
|
|
29711
|
-
await helloOnce(
|
|
29948
|
+
await helloOnce(joined2, {
|
|
29712
29949
|
name: kind.name,
|
|
29713
29950
|
say: (spaceId) => (
|
|
29714
29951
|
// In the shape every bridge's hello has: "Hi, I'm …", then what to do (the onboarding audit, item 39).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chipschat/acp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"description": "An agent that speaks the Agent Client Protocol, as a Chips harness of its kind: agents made from Chips, each in a folder of its own, each room a session.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"release": "npm run build && npm test && npm pack"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@chipschat/conformance": "1.0.
|
|
37
|
-
"@chipschat/harness": "1.0.
|
|
38
|
-
"@chipschat/protocol": "1.0.
|
|
36
|
+
"@chipschat/conformance": "1.0.10",
|
|
37
|
+
"@chipschat/harness": "1.0.10",
|
|
38
|
+
"@chipschat/protocol": "1.0.10",
|
|
39
39
|
"@types/node": "22.19.0",
|
|
40
40
|
"esbuild": "0.27.7",
|
|
41
41
|
"tsx": "4.21.0",
|