robisie 0.5.53 → 0.6.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/CHANGELOG.md +16 -0
- package/README.md +3 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/engine/build-id.json +1 -1
- package/dist/engine/bundle-report.json +1 -1
- package/dist/engine/tick.cjs +283 -17
- package/dist/installation-update.js +418 -70
- package/dist/roles.d.ts +1 -1
- package/docs/README.en.md +4 -2
- package/docs/README.md +4 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Historia zmian klienta / Client changelog
|
|
2
2
|
|
|
3
|
+
## [0.6.0](https://github.com/chuppa12/robisie-app/compare/client-v0.5.53...client-v0.6.0) (2026-11-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **buzz:** kopia jarvis→reksio do skrzynki hermes ([a297c13](https://github.com/chuppa12/robisie-app/commit/a297c13d6e5fceb512693ff9096f132f042017bc))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Factory Cards
|
|
12
|
+
|
|
13
|
+
* Jedna komenda aktualizacji działa też na hoście: te same gwarancje co dziś daje osobny skrypt (odroczenie przy Workerze, HOLD aktywacji, dwa takty, powrót), bez osobnej drogi ([07d9c8f](https://github.com/chuppa12/robisie-app/commit/07d9c8f741fe258d544941f7de4e3e2945a1a68f))
|
|
14
|
+
* praca workera task-mwkb9gbh-lq8gjj (auto-commit) ([e28bb52](https://github.com/chuppa12/robisie-app/commit/e28bb527e4f5b30d2bd2d0cde2fed553ac037b72))
|
|
15
|
+
* praca workera task-mwkd7409-ohzyfe (auto-commit) ([19e9482](https://github.com/chuppa12/robisie-app/commit/19e94823a89ee9029e64084bed5de42d89cea74b))
|
|
16
|
+
* praca workera task-mwkejwly-gh8cfq (auto-commit) ([b3720b2](https://github.com/chuppa12/robisie-app/commit/b3720b2000c941895fcda0cb9c26cf69fd7c2bff))
|
|
17
|
+
* Worker dostaje w briefie pola akcji i materiały wejściowe karty, bez ukrytych pominięć ([7baa03f](https://github.com/chuppa12/robisie-app/commit/7baa03f275c48c79664383a2d849fa92e483f262))
|
|
18
|
+
|
|
3
19
|
## [0.5.53](https://github.com/chuppa12/robisie-app/compare/client-v0.5.52...client-v0.5.53) (2026-11-17)
|
|
4
20
|
|
|
5
21
|
|
package/README.md
CHANGED
|
@@ -185,7 +185,9 @@ Doctor podaje rzeczywiste wersje starych pomocników i markerów ról oraz wersj
|
|
|
185
185
|
|
|
186
186
|
Kopia i odtworzenie obejmują oba pliki key i review-key z prywatnymi uprawnieniami; przed init/doctor wczytaj oba odtworzone klucze. Uninstall raportuje osobno stan obu plików i usuwa je z zachowaniem dotychczasowej ochrony ewidencji oraz konfiguracji. Nie unieważnia żadnego klucza na serwerze.
|
|
187
187
|
|
|
188
|
-
Zwykła aktualizacja to `npx robisie update` (host: dodaj `--engine-config /absolutna/sciezka/robisie.config.json`). Pierwsze interaktywne wywołanie pyta jawnie o zgodę i zapisuje `update={consentedAt, enabled:true}`, zachowując pozostałe pola konfiguracji. Bez zgody lub przy `enabled:false` wywołanie w tle kończy się kodem 0 bez zmian. Po zgodzie launchd `com.robisie.update` albo `robisie-update.timer` uruchamia tę samą komendę co 120 sekund; fabryka wykonuje `factory run --once` na osobnym cyklu 120 sekund. Paczka przygotowuje dokładną wersję npm w osobnym katalogu, sprawdza build-id i integralność, potem wymienia prywatny wskaźnik current. Zdrowie wymaga dwóch różnych świeżych taktów OK z loaded oczekiwanego build-id w 1200 sekund, odczytywanych co 20 sekund. Przy błędzie powrót ma osobne okno 1200 sekund dla starego wydania; zarówno potwierdzony, jak i niepotwierdzony powrót ma kod niezerowy. Nowa praca blokuje przełączenie lub powrót.
|
|
188
|
+
Zwykła aktualizacja to `npx robisie update` (host: dodaj `--engine-config /absolutna/sciezka/robisie.config.json`). Pierwsze interaktywne wywołanie pyta jawnie o zgodę i zapisuje `update={consentedAt, enabled:true}`, zachowując pozostałe pola konfiguracji. Bez zgody lub przy `enabled:false` wywołanie w tle kończy się kodem 0 bez zmian. Po zgodzie launchd `com.robisie.update` albo `robisie-update.timer` uruchamia tę samą komendę co 120 sekund; fabryka wykonuje `factory run --once` na osobnym cyklu 120 sekund. Paczka przygotowuje dokładną wersję npm w osobnym katalogu, sprawdza build-id i integralność, potem wymienia prywatny wskaźnik current. Zdrowie wymaga dwóch różnych świeżych taktów OK z loaded oczekiwanego build-id w 1200 sekund, odczytywanych co 20 sekund. Przy błędzie powrót ma osobne okno 1200 sekund dla starego wydania; zarówno potwierdzony, jak i niepotwierdzony powrót ma kod niezerowy. Nowa praca blokuje przełączenie lub powrót. Na hoście macOS ta sama komenda aktualizuje paczkę bez dostępu do tablicy i DB. Zachowuje istniejący label `com.robisie.maszynista`, środowisko, logi i interwał; nie tworzy drugiego zegara fabryki. Świeży LAST-TICK z pracującym Workerem albo nieznanym licznikiem wykonań odracza switch. Prywatna kopia bajtów mode i jej SHA-256 chronią HOLD aktywacji (`off`); oryginalny mode musi wrócić ze zgodnym hashem. Awaria odtwarza starą usługę i paczkę pod blokadą taktu; nowa rzeczywista praca powstrzymuje niebezpieczny powrót i wywołuje alarm. Po zdjęciu HOLD update obserwuje checkout do 480 sekund; FF wykonuje istniejący pinned aktywator. Prywatny audyt i próby znajdziesz w `<stateDir>/update/`; błąd przygotowania też zapisuje wersję. Aby ponowić po wyjaśnieniu przyczyny, usuń jedną linię tej wersji z `attempts.jsonl`. Odroczenie nie oznacza nieudanej próby; po 7200 sekund zapisuje jeden alarm. `AUTO-UPDATE.off` w HU_HOME albo katalogu kanonicznego configu hosta zatrzymuje hostowe aktualizacje. Wspólne `auto-update.lock.d` i legacy `auto-update.state` wykluczają też stary aktualizator; przed uzasadnionym ponowieniem rozlicz oba rejestry prób. Powiadomienia hosta korzystają z istniejącej skrzynki CEO i adresu CTO; brak dostawy trafia do audytu. Zachowaj prywatną kopię i osobny awaryjny restore archiwum. Po odświeżeniu ról uruchom ponownie asystenta.
|
|
189
|
+
|
|
190
|
+
Pierwsze przejście z robisie ≤0.5.45 wykonaj ręcznie: `npm install robisie@latest` w instalacji, potem `npx robisie update` (na hoście z jego `--engine-config`). Kolejne wydania obsługuje ta sama komenda update. Aktywacja żywego hosta i wyłączenie starego aktualizatora wymagają osobnego odbioru operatora.
|
|
189
191
|
|
|
190
192
|
<!-- update:start -->
|
|
191
193
|
```sh
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Package identity and the server contract it speaks. */
|
|
2
2
|
export declare const PACKAGE_NAME = "robisie";
|
|
3
|
-
export declare const PACKAGE_VERSION = "0.
|
|
3
|
+
export declare const PACKAGE_VERSION = "0.6.0";
|
|
4
4
|
/**
|
|
5
5
|
* MAJOR of the agent-API contract this package understands.
|
|
6
6
|
* PARITY: src/lib/mcp/contract-version.ts (AGENT_API_CONTRACT_VERSION) on the server.
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Package identity and the server contract it speaks. */
|
|
2
2
|
export const PACKAGE_NAME = "robisie";
|
|
3
|
-
export const PACKAGE_VERSION = "0.
|
|
3
|
+
export const PACKAGE_VERSION = "0.6.0"; // x-release-please-version
|
|
4
4
|
/**
|
|
5
5
|
* MAJOR of the agent-API contract this package understands.
|
|
6
6
|
* PARITY: src/lib/mcp/contract-version.ts (AGENT_API_CONTRACT_VERSION) on the server.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schema":1,"sha":"
|
|
1
|
+
{"schema":1,"sha":"be7f6ca4e26ce46fcd15701010b1b774c42f802f","dirty":false}
|
|
@@ -1725,6 +1725,6 @@
|
|
|
1725
1725
|
"status": 0,
|
|
1726
1726
|
"signal": null,
|
|
1727
1727
|
"stdout": "v24.3.0\n",
|
|
1728
|
-
"stderr": "(node:
|
|
1728
|
+
"stderr": "(node:23248) ExperimentalWarning: SQLite is an experimental feature and might change at any time\n(Use `node --trace-warnings ...` to show where the warning was created)\n"
|
|
1729
1729
|
}
|
|
1730
1730
|
}
|
package/dist/engine/tick.cjs
CHANGED
|
@@ -37652,7 +37652,7 @@ var init_constants = __esm({
|
|
|
37652
37652
|
"packages/client/src/constants.ts"() {
|
|
37653
37653
|
"use strict";
|
|
37654
37654
|
PACKAGE_NAME = "robisie";
|
|
37655
|
-
PACKAGE_VERSION = "0.
|
|
37655
|
+
PACKAGE_VERSION = "0.6.0";
|
|
37656
37656
|
SUPPORTED_CONTRACT_MAJOR = 1;
|
|
37657
37657
|
DEFAULT_ORIGIN = "https://robisie.app";
|
|
37658
37658
|
MCP_SERVER_NAME = "robisie";
|
|
@@ -48232,6 +48232,33 @@ function buildBrief(card, northStar, opts) {
|
|
|
48232
48232
|
const terminalAt = typeof workerAt === "string" ? Date.parse(workerAt) : NaN;
|
|
48233
48233
|
const noteAt = typeof dutyVerdict.at === "string" ? Date.parse(dutyVerdict.at) : NaN;
|
|
48234
48234
|
const dutyHeading = noteAt > terminalAt ? "Aktualna odpowied\u017A CR \u2014 obowi\u0105zuje w tej rundzie" : "Historyczny dopisek \u2014 nie stanowi odpowiedzi CR; wymaga jawnej readmisji";
|
|
48235
|
+
const authorFields = ["boundaries", "input_source", "outcome", "first_deliverable_value"];
|
|
48236
|
+
const handledFields = /* @__PURE__ */ new Set([
|
|
48237
|
+
...authorFields,
|
|
48238
|
+
...seeds,
|
|
48239
|
+
"scope",
|
|
48240
|
+
"codex_effort",
|
|
48241
|
+
"done_when",
|
|
48242
|
+
"doneWhen",
|
|
48243
|
+
"acceptance",
|
|
48244
|
+
"review",
|
|
48245
|
+
"unblock",
|
|
48246
|
+
"maszynista",
|
|
48247
|
+
"obligations",
|
|
48248
|
+
"bench_obligation",
|
|
48249
|
+
"hold",
|
|
48250
|
+
"seed_obligation",
|
|
48251
|
+
"decision_queue",
|
|
48252
|
+
"scope_blocked_at",
|
|
48253
|
+
"seed_scope_sha256",
|
|
48254
|
+
"seed_spec_sha256",
|
|
48255
|
+
"seed_brief_sha256",
|
|
48256
|
+
"reksio_withheld",
|
|
48257
|
+
"admission",
|
|
48258
|
+
"qualification",
|
|
48259
|
+
"base_sha"
|
|
48260
|
+
]);
|
|
48261
|
+
const omittedFields = Object.entries(details2).filter(([key, value]) => value !== void 0 && !handledFields.has(key)).map(([key]) => key).sort();
|
|
48235
48262
|
const lines2 = [
|
|
48236
48263
|
`# Zadanie z tablicy Robisie \u2014 karta ${card.id}`,
|
|
48237
48264
|
``,
|
|
@@ -48253,12 +48280,16 @@ ${JSON.stringify({ verdict: review.verdict ?? null, round: review.round ?? null,
|
|
|
48253
48280
|
hasDutyNote(details2) ? `
|
|
48254
48281
|
## ${dutyHeading}
|
|
48255
48282
|
${String(dutyVerdict.note)}` : ``,
|
|
48283
|
+
...authorFields.flatMap((key) => details2[key] === void 0 ? [] : [`## ${key}
|
|
48284
|
+
${JSON.stringify(details2[key])}`]),
|
|
48285
|
+
...omittedFields.length ? [`## Pomini\u0119te pola autora (tylko nazwy)
|
|
48286
|
+
${JSON.stringify(omittedFields)}`] : [],
|
|
48256
48287
|
``,
|
|
48257
48288
|
`## Kontekst (skr\xF3t \u2014 tylko po to, by\u015B rozpozna\u0142 "ju\u017C zrobione" i "wymaga cz\u0142owieka")`,
|
|
48258
48289
|
northStar.trim(),
|
|
48259
48290
|
``,
|
|
48260
48291
|
`## Zasady pracy`,
|
|
48261
|
-
`- Nie wo\u0142aj MCP Planera (get_task, update_task i pokrewnych). Pe\u0142na karta jest w tym briefie; jobId, pr\xF3b\u0119 i raport dopisuje Maszynista. Brak jobId w Twoim raporcie nie jest blokerem.`,
|
|
48292
|
+
`- Nie wo\u0142aj MCP Planera (get_task, update_task i pokrewnych). ${omittedFields.length ? "" : "Pe\u0142na karta jest w tym briefie; "}jobId, pr\xF3b\u0119 i raport dopisuje Maszynista. Brak jobId w Twoim raporcie nie jest blokerem.`,
|
|
48262
48293
|
`- Pracujesz w worktree \`${opts.worktree}\` na ga\u0142\u0119zi \`${opts.branch}\`. Nie commituj; pozostaw zmiany silnikowi. Nie deklaruj SHA ani HEAD w raporcie. NIE pushuj ani nie merge\u2019uj main; poza zakresem zapisuj wy\u0142\u0105cznie istniej\u0105ce pliki test\xF3w, danych testowych i pliki wyliczane z kodu, kt\xF3re Twoja zmiana uniewa\u017Cnia.`,
|
|
48263
48294
|
`- Je\u015Bli karta opisuje co\u015B, co JU\u017B jest zrobione w repo/produkcji \u2014 nie r\xF3b drugi raz: ZBIERZ DOW\xD3D (\u015Bcie\u017Cki, commity, wynik komendy) i zaraportuj "ju\u017C zrobione" z dowodem. Przed ALREADY_DONE rozlicz ka\u017Cde finding bie\u017C\u0105cej recenzji FAIL: napraw lub wyka\u017C konkretnym dowodem, \u017Ce nie wyst\u0119puje; sam brak nowego commita nie rozlicza FAIL.`,
|
|
48264
48295
|
`- Je\u015Bli zadanie wymaga pieni\u0119dzy, skutku nieodwracalnego, konta/klucza lub zmiany kierunku \u2014 ZATRZYMAJ SI\u0118 i zaraportuj "WYMAGA CZ\u0141OWIEKA: <co>" zamiast robi\u0107.`,
|
|
@@ -71820,9 +71851,9 @@ var require_discriminator = __commonJS({
|
|
|
71820
71851
|
function validateMapping() {
|
|
71821
71852
|
const mapping = getMapping();
|
|
71822
71853
|
gen.if(false);
|
|
71823
|
-
for (const
|
|
71824
|
-
gen.elseIf((0, codegen_1._)`${tag} === ${
|
|
71825
|
-
gen.assign(valid, applyTagSchema(mapping[
|
|
71854
|
+
for (const tagValue2 in mapping) {
|
|
71855
|
+
gen.elseIf((0, codegen_1._)`${tag} === ${tagValue2}`);
|
|
71856
|
+
gen.assign(valid, applyTagSchema(mapping[tagValue2]));
|
|
71826
71857
|
}
|
|
71827
71858
|
gen.else();
|
|
71828
71859
|
cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag, tagName });
|
|
@@ -71866,18 +71897,18 @@ var require_discriminator = __commonJS({
|
|
|
71866
71897
|
if (sch.const) {
|
|
71867
71898
|
addMapping(sch.const, i3);
|
|
71868
71899
|
} else if (sch.enum) {
|
|
71869
|
-
for (const
|
|
71870
|
-
addMapping(
|
|
71900
|
+
for (const tagValue2 of sch.enum) {
|
|
71901
|
+
addMapping(tagValue2, i3);
|
|
71871
71902
|
}
|
|
71872
71903
|
} else {
|
|
71873
71904
|
throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`);
|
|
71874
71905
|
}
|
|
71875
71906
|
}
|
|
71876
|
-
function addMapping(
|
|
71877
|
-
if (typeof
|
|
71907
|
+
function addMapping(tagValue2, i3) {
|
|
71908
|
+
if (typeof tagValue2 != "string" || tagValue2 in oneOfMapping) {
|
|
71878
71909
|
throw new Error(`discriminator: "${tagName}" values must be unique strings`);
|
|
71879
71910
|
}
|
|
71880
|
-
oneOfMapping[
|
|
71911
|
+
oneOfMapping[tagValue2] = i3;
|
|
71881
71912
|
}
|
|
71882
71913
|
}
|
|
71883
71914
|
}
|
|
@@ -90167,6 +90198,148 @@ var init_wrapper = __esm({
|
|
|
90167
90198
|
}
|
|
90168
90199
|
});
|
|
90169
90200
|
|
|
90201
|
+
// services/buzz-wake/protocol.ts
|
|
90202
|
+
function redactDiagnosticSecrets(text9) {
|
|
90203
|
+
return text9.replace(HEX_SECRET, "[redacted]").replace(/\bAuthorization\s*[:=]\s*[^\r\n]+/gi, "Authorization: [redacted]").replace(BEARER_SECRET, "Bearer [redacted]").replace(/\b(?:token|api[_-]?key|password)\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi, "credential=[redacted]").replace(URL_USERINFO, "$1[redacted]@");
|
|
90204
|
+
}
|
|
90205
|
+
function redactAssignment(_match, name3, value) {
|
|
90206
|
+
const quote = value[0] === '"' || value[0] === "'" ? value[0] : "";
|
|
90207
|
+
return `${name3}${quote}[redacted]${quote}`;
|
|
90208
|
+
}
|
|
90209
|
+
function redactCopySecrets(text9) {
|
|
90210
|
+
return text9.slice(0, 16384).replace(/-----BEGIN [^-\r\n]*PRIVATE KEY-----[\s\S]*?(?:-----END [^-\r\n]*-----|$)/g, "[redacted]").replace(/\bnsec1[02-9ac-hj-np-z]{50,}/gi, "[redacted]").replace(/(\bAuthorization["']?\s*[:=]\s*)(?:(?:Bearer|Basic)\s+)?(\[redacted\]|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^\s,;}\]]+)/gi, redactAssignment).replace(BEARER_SECRET, "Bearer [redacted]").replace(
|
|
90211
|
+
/((?:["']?[\w-]{0,64}(?:token|secret|password|passwd|api[_-]?key|private[_-]?key|credential|_SEC|_KEY)[\w-]{0,64}["']?)\s*[:=]\s*)(\[redacted\]|"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[^\s,;}\]]+)/gi,
|
|
90212
|
+
redactAssignment
|
|
90213
|
+
).replace(/(?<![a-z0-9+.-])([a-z][a-z0-9+.-]*:\/\/)[^\s/]*@/gi, "$1[redacted]@").replace(/\b(?:sk-(?:ant-)?[A-Za-z0-9_-]{16,}|xai-[A-Za-z0-9_-]+|gh[pousr]_[A-Za-z0-9_]+|github_pat_[A-Za-z0-9_]+|AKIA[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{30,}|xox[abprs]-[A-Za-z0-9-]+|eyJ[A-Za-z0-9_-]{1,512}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+|npm_[A-Za-z0-9_]+|sbp_[A-Za-z0-9_]+|[MNO][A-Za-z0-9_-]{23,128}\.[A-Za-z0-9_-]{6}\.[A-Za-z0-9_-]{27,})/g, "[redacted]").replace(HEX_SECRET, "[redacted]");
|
|
90214
|
+
}
|
|
90215
|
+
function redactCopyPayload(value) {
|
|
90216
|
+
function redact(item, topLevel) {
|
|
90217
|
+
if (typeof item === "string") return redactCopySecrets(item);
|
|
90218
|
+
if (Array.isArray(item)) return item.map((entry2) => redact(entry2, false));
|
|
90219
|
+
if (typeof item === "object" && item !== null) {
|
|
90220
|
+
return Object.fromEntries(Object.entries(item).map(([key, entry2]) => {
|
|
90221
|
+
const sensitive = entry2 !== null && typeof entry2 !== "boolean" && /token|secret|password|passwd|api[_-]?key|private[_-]?key|credential|_SEC|_KEY|^Authorization$/i.test(key);
|
|
90222
|
+
const identifier = topLevel && typeof entry2 === "string" && (key === "in_reply_to" && /^[a-f0-9]{8,64}$/i.test(entry2) || key === "source_event_id" && /^[a-f0-9]{64}$/.test(entry2));
|
|
90223
|
+
return [redactCopySecrets(key), sensitive ? "[redacted]" : identifier ? entry2 : redact(entry2, false)];
|
|
90224
|
+
}));
|
|
90225
|
+
}
|
|
90226
|
+
return item;
|
|
90227
|
+
}
|
|
90228
|
+
return redact(value, true);
|
|
90229
|
+
}
|
|
90230
|
+
function limitCopyText(text9) {
|
|
90231
|
+
const suffix = " [\u2026uci\u0119to]";
|
|
90232
|
+
if (text9.length <= 4e3) return text9;
|
|
90233
|
+
let cut3 = 4e3 - suffix.length;
|
|
90234
|
+
if (/[\uD800-\uDBFF]/.test(text9[cut3 - 1])) cut3--;
|
|
90235
|
+
return text9.slice(0, cut3) + suffix;
|
|
90236
|
+
}
|
|
90237
|
+
function isCopyableJarvisMessage(payload) {
|
|
90238
|
+
return payload.v === 1 && payload.from_role === "jarvis" && payload.to_role === "reksio" && typeof payload.text === "string" && (payload.kind === "chat" || payload.kind === "pointer" || payload.kind === "decision" || payload.kind === "block");
|
|
90239
|
+
}
|
|
90240
|
+
function isEvent(value) {
|
|
90241
|
+
if (typeof value !== "object" || value === null) return false;
|
|
90242
|
+
const record20 = value;
|
|
90243
|
+
return typeof record20.id === "string" && typeof record20.pubkey === "string" && typeof record20.kind === "number" && typeof record20.created_at === "number" && typeof record20.content === "string" && Array.isArray(record20.tags) && typeof record20.sig === "string";
|
|
90244
|
+
}
|
|
90245
|
+
function shortEventId(value) {
|
|
90246
|
+
if (typeof value !== "object" || value === null) return "unknown";
|
|
90247
|
+
const id2 = value.id;
|
|
90248
|
+
return typeof id2 === "string" && /^[a-f0-9]{64}$/i.test(id2) ? id2.slice(0, 8) : "unknown";
|
|
90249
|
+
}
|
|
90250
|
+
function tagValue(event, name3) {
|
|
90251
|
+
return event.tags.find((tag) => tag[0] === name3 && typeof tag[1] === "string")?.[1];
|
|
90252
|
+
}
|
|
90253
|
+
function isJarvisReksioCopy(event, jarvisPublicKey, hermesPublicKey) {
|
|
90254
|
+
if (jarvisPublicKey === void 0 || event.pubkey !== jarvisPublicKey || event.kind !== 9 || tagValue(event, "t") !== JARVIS_COPY_TAG || tagValue(event, "p") !== hermesPublicKey || tagValue(event, "role") !== "hermes") return false;
|
|
90255
|
+
try {
|
|
90256
|
+
const payload = JSON.parse(event.content);
|
|
90257
|
+
if (typeof payload !== "object" || payload === null) return false;
|
|
90258
|
+
const body = payload;
|
|
90259
|
+
return body.v === 1 && body.from_role === "jarvis" && body.to_role === "hermes" && typeof body.source_event_id === "string" && /^[a-f0-9]{64}$/.test(body.source_event_id) && tagValue(event, "e") === body.source_event_id && typeof body.text === "string" && body.text.startsWith("[KOPIA od jarvis do reksio] ");
|
|
90260
|
+
} catch {
|
|
90261
|
+
return false;
|
|
90262
|
+
}
|
|
90263
|
+
}
|
|
90264
|
+
function isCompleteVersionedEnvelope(payload) {
|
|
90265
|
+
return payload.v === 1 && typeof payload.from_role === "string" && typeof payload.kind === "string" && typeof payload.text === "string" && (typeof payload.to_role === "string" || typeof payload.channel === "string");
|
|
90266
|
+
}
|
|
90267
|
+
function isReplyAck(event, context) {
|
|
90268
|
+
try {
|
|
90269
|
+
const payload = JSON.parse(event.content);
|
|
90270
|
+
if (typeof payload !== "object" || payload === null) return false;
|
|
90271
|
+
const envelope = payload;
|
|
90272
|
+
return isCompleteVersionedEnvelope(envelope) && envelope.kind === "ack" && context.channelRole !== void 0 && envelope.from_role === context.channelRole && typeof envelope.to_role === "string" && tagValue(event, "role") === envelope.to_role && /^[a-f0-9]{64}$/i.test(tagValue(event, "p") ?? "") && tagValue(event, "p") !== context.recipientPublicKey;
|
|
90273
|
+
} catch {
|
|
90274
|
+
return false;
|
|
90275
|
+
}
|
|
90276
|
+
}
|
|
90277
|
+
function addressedRole(event, context) {
|
|
90278
|
+
let payload = null;
|
|
90279
|
+
try {
|
|
90280
|
+
const parsed = JSON.parse(event.content);
|
|
90281
|
+
if (typeof parsed === "object" && parsed !== null) payload = parsed;
|
|
90282
|
+
} catch {
|
|
90283
|
+
payload = null;
|
|
90284
|
+
}
|
|
90285
|
+
if (payload?.v === 1 && !isCompleteVersionedEnvelope(payload)) return null;
|
|
90286
|
+
const declaredRole = typeof payload?.to_role === "string" ? payload.to_role : void 0;
|
|
90287
|
+
const taggedRole = tagValue(event, "role");
|
|
90288
|
+
if (isReplyAck(event, context) && context.channelRole === "jarvis" && event.pubkey === context.jarvisPublicKey && declaredRole === "reksio" && context.reksioPublicKey !== void 0 && tagValue(event, "p") === context.reksioPublicKey) return "reksio";
|
|
90289
|
+
if (declaredRole !== void 0) {
|
|
90290
|
+
const expectedPublicKey = context.recipientPublicKey ?? context.ownPublicKey;
|
|
90291
|
+
const channelMatches = context.channelRole === void 0 || context.channelRole === declaredRole;
|
|
90292
|
+
return taggedRole === declaredRole && tagValue(event, "p") === expectedPublicKey && channelMatches ? declaredRole : null;
|
|
90293
|
+
}
|
|
90294
|
+
if (typeof payload?.channel === "string") {
|
|
90295
|
+
return context.shared === true && context.channelRole === payload.channel ? context.channelRole : null;
|
|
90296
|
+
}
|
|
90297
|
+
if (context.channelRole !== void 0 && context.shared === true) return context.channelRole;
|
|
90298
|
+
if (context.channelRole !== void 0 && taggedRole === context.channelRole && tagValue(event, "p") === context.recipientPublicKey) {
|
|
90299
|
+
return context.channelRole;
|
|
90300
|
+
}
|
|
90301
|
+
return null;
|
|
90302
|
+
}
|
|
90303
|
+
function admitChannelEvent(value, context) {
|
|
90304
|
+
const eventId = shortEventId(value);
|
|
90305
|
+
const candidate = typeof value === "object" && value !== null && (value.kind === 9 || value.kind === 40002);
|
|
90306
|
+
const rejected = (reason) => ({ accepted: false, candidate, reason, eventId });
|
|
90307
|
+
if (!isEvent(value)) return rejected("malformed-event");
|
|
90308
|
+
if (!verifyEvent(value)) return rejected("invalid-signature");
|
|
90309
|
+
if (value.kind !== 9 && value.kind !== 40002) return rejected("unsupported-kind");
|
|
90310
|
+
if (value.pubkey === (context.recipientPublicKey ?? context.ownPublicKey) && !isReplyAck(value, context)) return rejected("own-sender");
|
|
90311
|
+
if (!context.allowedSenders.has(value.pubkey)) return rejected("sender-not-in-roster");
|
|
90312
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
90313
|
+
const historicalCopy = context.channelRole === "hermes" && isJarvisReksioCopy(value, context.jarvisPublicKey, context.recipientPublicKey ?? context.ownPublicKey);
|
|
90314
|
+
if (value.created_at < now - MAX_EVENT_AGE_SECONDS && !historicalCopy) return rejected("expired");
|
|
90315
|
+
if (value.created_at > now + MAX_EVENT_AGE_SECONDS) return rejected("future");
|
|
90316
|
+
if (!value.tags.some((tag) => tag[0] === "h" && tag[1] === context.channelId)) return rejected("wrong-channel");
|
|
90317
|
+
return { accepted: true, message: { id: value.id, from: value.pubkey, text: value.content, receivedAt: value.created_at, recipientRole: addressedRole(value, context) } };
|
|
90318
|
+
}
|
|
90319
|
+
function decodeChannelEvent(value, context) {
|
|
90320
|
+
const result = admitChannelEvent(value, context);
|
|
90321
|
+
return result.accepted ? result.message : null;
|
|
90322
|
+
}
|
|
90323
|
+
function channelMembers(value, channelId, relayAuthorityPublicKey) {
|
|
90324
|
+
if (!isEvent(value) || !verifyEvent(value) || value.kind !== 39002) return null;
|
|
90325
|
+
if (value.pubkey !== relayAuthorityPublicKey) return null;
|
|
90326
|
+
if (!value.tags.some((tag) => tag[0] === "d" && tag[1] === channelId)) return null;
|
|
90327
|
+
const members = value.tags.filter((tag) => tag[0] === "p" && /^[a-f0-9]{64}$/i.test(tag[1] ?? "")).map((tag) => tag[1]);
|
|
90328
|
+
return new Set(members);
|
|
90329
|
+
}
|
|
90330
|
+
var HEX_SECRET, BEARER_SECRET, URL_USERINFO, MAX_EVENT_AGE_SECONDS, JARVIS_COPY_TAG;
|
|
90331
|
+
var init_protocol2 = __esm({
|
|
90332
|
+
"services/buzz-wake/protocol.ts"() {
|
|
90333
|
+
"use strict";
|
|
90334
|
+
init_pure();
|
|
90335
|
+
HEX_SECRET = /[a-f0-9]{64}/gi;
|
|
90336
|
+
BEARER_SECRET = /\bBearer\s+[^\s,;]+/gi;
|
|
90337
|
+
URL_USERINFO = /([a-z][a-z0-9+.-]*:\/\/)[^\s/]*@/gi;
|
|
90338
|
+
MAX_EVENT_AGE_SECONDS = 300;
|
|
90339
|
+
JARVIS_COPY_TAG = "jarvis-reksio-copy";
|
|
90340
|
+
}
|
|
90341
|
+
});
|
|
90342
|
+
|
|
90170
90343
|
// services/buzz-mcp/src/bridge.ts
|
|
90171
90344
|
var bridge_exports = {};
|
|
90172
90345
|
__export2(bridge_exports, {
|
|
@@ -90340,6 +90513,7 @@ var init_bridge = __esm({
|
|
|
90340
90513
|
init_pure();
|
|
90341
90514
|
init_relay();
|
|
90342
90515
|
init_wrapper();
|
|
90516
|
+
init_protocol2();
|
|
90343
90517
|
PAGE_EOSE_DEADLINE_MS = 1e4;
|
|
90344
90518
|
ZERO_EVENT_ID = "0".repeat(64);
|
|
90345
90519
|
BuzzToolError = class extends Error {
|
|
@@ -90457,6 +90631,23 @@ var init_bridge = __esm({
|
|
|
90457
90631
|
const tags = await this.tagsFor(payload);
|
|
90458
90632
|
return this.publish(payload, tags);
|
|
90459
90633
|
}
|
|
90634
|
+
/** Internal wake outbox only: stable source timestamp/content produce the same Nostr ID on every retry. */
|
|
90635
|
+
async copyJarvisToHermes(message3) {
|
|
90636
|
+
const parsed = parseContent(message3.text);
|
|
90637
|
+
if (this.options.role !== "jarvis" || message3.from !== this.publicKey || !/^jarvis-copy:[a-f0-9]{64}$/.test(message3.id) || parsed.kind !== "envelope" || parsed.payload.from_role !== "jarvis" || parsed.payload.to_role !== "hermes" || parsed.payload.source_event_id !== message3.id.slice("jarvis-copy:".length)) {
|
|
90638
|
+
throw new BuzzToolError("Invalid Jarvis copy outbox message");
|
|
90639
|
+
}
|
|
90640
|
+
const safe = redactCopyPayload(parsed.payload);
|
|
90641
|
+
const payload = { ...safe, text: limitCopyText(safe.text), source_event_id: message3.id.slice("jarvis-copy:".length) };
|
|
90642
|
+
const event = finalizeEvent({
|
|
90643
|
+
kind: this.options.config.protocol.messageKind,
|
|
90644
|
+
content: JSON.stringify(payload),
|
|
90645
|
+
tags: [...await this.tagsFor(payload), ["t", JARVIS_COPY_TAG], ["e", payload.source_event_id]],
|
|
90646
|
+
created_at: message3.receivedAt
|
|
90647
|
+
}, this.secret);
|
|
90648
|
+
await this.withRelay(async (relay) => relay.publish(event));
|
|
90649
|
+
return { event_id: event.id };
|
|
90650
|
+
}
|
|
90460
90651
|
async inbox(input = {}) {
|
|
90461
90652
|
const limit = input.limit ?? 50;
|
|
90462
90653
|
if (!Number.isInteger(limit) || limit < 1 || limit > 100) throw new BuzzToolError("limit must be an integer from 1 to 100");
|
|
@@ -90561,11 +90752,22 @@ var init_bridge = __esm({
|
|
|
90561
90752
|
if (!channelId) throw new BuzzToolError("Buzz event has no return channel for acknowledgement");
|
|
90562
90753
|
return [["p", pubkey], ["role", payload.to_role ?? ""], ["h", channelId]];
|
|
90563
90754
|
}
|
|
90564
|
-
inboxFilters() {
|
|
90755
|
+
inboxFilters(identities) {
|
|
90565
90756
|
const filters = [{ kinds: [this.options.config.protocol.messageKind], "#p": [this.publicKey] }];
|
|
90566
90757
|
for (const channelId of this.accessibleChannelIds()) {
|
|
90567
90758
|
filters.push({ kinds: [this.options.config.protocol.messageKind], "#h": [channelId] });
|
|
90568
90759
|
}
|
|
90760
|
+
const jarvisField = this.options.config.roles.jarvis?.pubkeyField;
|
|
90761
|
+
const jarvisKey = jarvisField === void 0 ? void 0 : identities.get(jarvisField);
|
|
90762
|
+
if (this.options.role === "hermes" && jarvisKey && this.options.config.roles.hermes?.inboxChannelId) {
|
|
90763
|
+
filters.push({
|
|
90764
|
+
kinds: [this.options.config.protocol.messageKind],
|
|
90765
|
+
authors: [jarvisKey],
|
|
90766
|
+
"#p": [this.publicKey],
|
|
90767
|
+
"#h": [this.options.config.roles.hermes.inboxChannelId],
|
|
90768
|
+
"#t": [JARVIS_COPY_TAG]
|
|
90769
|
+
});
|
|
90770
|
+
}
|
|
90569
90771
|
return filters;
|
|
90570
90772
|
}
|
|
90571
90773
|
isAddressedToMe(payload, event) {
|
|
@@ -90632,7 +90834,7 @@ var init_bridge = __esm({
|
|
|
90632
90834
|
async collectInbox(relay, limit, sinceCursor, identities) {
|
|
90633
90835
|
const basePageSize = limit * 3;
|
|
90634
90836
|
const scanFloor = sinceCursor === void 0 ? 0 : Math.max(0, sinceCursor.seconds - 300);
|
|
90635
|
-
const pages = this.inboxFilters().map((filter) => ({ filter, queryLimit: basePageSize, exhausted: false }));
|
|
90837
|
+
const pages = this.inboxFilters(identities).map((filter) => ({ historicalCopy: filter["#t"] !== void 0, filter, queryLimit: basePageSize, exhausted: false }));
|
|
90636
90838
|
const visited = /* @__PURE__ */ new Set();
|
|
90637
90839
|
const events = [];
|
|
90638
90840
|
const errors = [];
|
|
@@ -90643,14 +90845,16 @@ var init_bridge = __esm({
|
|
|
90643
90845
|
const filters = [{
|
|
90644
90846
|
...page.filter,
|
|
90645
90847
|
limit: page.queryLimit,
|
|
90646
|
-
...
|
|
90848
|
+
...page.historicalCopy ? {} : { since: scanFloor },
|
|
90647
90849
|
...page.until === void 0 ? {} : { until: page.until }
|
|
90648
90850
|
}];
|
|
90649
90851
|
const relayEvents = await this.collect(relay, filters);
|
|
90650
90852
|
for (const event of relayEvents) {
|
|
90651
90853
|
if (visited.has(event.id)) continue;
|
|
90854
|
+
const jarvisField = this.options.config.roles.jarvis?.pubkeyField;
|
|
90855
|
+
const historicalCopy = page.historicalCopy && this.options.role === "hermes" && isJarvisReksioCopy(event, jarvisField === void 0 ? void 0 : identities.get(jarvisField), this.publicKey);
|
|
90856
|
+
if (event.created_at < scanFloor && !historicalCopy) continue;
|
|
90652
90857
|
visited.add(event.id);
|
|
90653
|
-
if (scanFloor !== void 0 && event.created_at < scanFloor) continue;
|
|
90654
90858
|
scanned = maxInboxCursor(scanned, { seconds: event.created_at, eventId: event.id, value: `${event.created_at}:${event.id}` });
|
|
90655
90859
|
if (this.store.has(event.id)) continue;
|
|
90656
90860
|
const parsed = parseContent(event.content);
|
|
@@ -90895,6 +91099,7 @@ var init_store = __esm({
|
|
|
90895
91099
|
import_node_sqlite2 = require("node:sqlite");
|
|
90896
91100
|
import_node_crypto22 = require("node:crypto");
|
|
90897
91101
|
init_contract();
|
|
91102
|
+
init_protocol2();
|
|
90898
91103
|
GBOT_COPY_MARKER = /\n\[\[BUZZ_GBOT_REPLY:([a-f0-9]{64}):([^\]\r\n]+)\]\]$/;
|
|
90899
91104
|
MAX_QUEUE_ATTEMPTS = 10;
|
|
90900
91105
|
QUEUE_RETRY_DELAYS_MS = [1e3, 5e3, 3e4, 6e4, 3e5];
|
|
@@ -91001,7 +91206,44 @@ var init_store = __esm({
|
|
|
91001
91206
|
if (!(error48 instanceof Error) || !/duplicate column name/i.test(error48.message)) throw error48;
|
|
91002
91207
|
}
|
|
91003
91208
|
}
|
|
91004
|
-
enqueue(message3, now, gbotPublicKey) {
|
|
91209
|
+
enqueue(message3, now, gbotPublicKey, jarvisPublicKey) {
|
|
91210
|
+
if (jarvisPublicKey !== void 0 && message3.from === jarvisPublicKey && message3.recipientRole === "reksio" && /^[a-f0-9]{64}$/.test(message3.id)) {
|
|
91211
|
+
let payload;
|
|
91212
|
+
try {
|
|
91213
|
+
const parsed = JSON.parse(message3.text);
|
|
91214
|
+
payload = typeof parsed === "object" && parsed !== null ? parsed : {};
|
|
91215
|
+
} catch {
|
|
91216
|
+
payload = {};
|
|
91217
|
+
}
|
|
91218
|
+
if (isCopyableJarvisMessage(payload)) {
|
|
91219
|
+
const safe = redactCopyPayload(payload);
|
|
91220
|
+
const copy = {
|
|
91221
|
+
...safe,
|
|
91222
|
+
v: 1,
|
|
91223
|
+
from_role: "jarvis",
|
|
91224
|
+
to_role: "hermes",
|
|
91225
|
+
channel: void 0,
|
|
91226
|
+
kind: safe.kind,
|
|
91227
|
+
mode: "queue",
|
|
91228
|
+
text: limitCopyText(`[KOPIA od jarvis do reksio] ${safe.text}`),
|
|
91229
|
+
source_event_id: message3.id
|
|
91230
|
+
};
|
|
91231
|
+
try {
|
|
91232
|
+
this.database.exec("BEGIN IMMEDIATE");
|
|
91233
|
+
try {
|
|
91234
|
+
this.enqueue(message3, now, gbotPublicKey);
|
|
91235
|
+
this.enqueue({ ...message3, id: `jarvis-copy:${message3.id}`, recipientRole: "hermes", text: JSON.stringify(copy) }, now);
|
|
91236
|
+
this.database.exec("COMMIT");
|
|
91237
|
+
} catch (error48) {
|
|
91238
|
+
this.database.exec("ROLLBACK");
|
|
91239
|
+
throw error48;
|
|
91240
|
+
}
|
|
91241
|
+
} catch (error48) {
|
|
91242
|
+
throw new Error("Jarvis copy durable admission failed", { cause: error48 });
|
|
91243
|
+
}
|
|
91244
|
+
return;
|
|
91245
|
+
}
|
|
91246
|
+
}
|
|
91005
91247
|
if (gbotPublicKey !== void 0 && message3.from === gbotPublicKey && message3.recipientRole === "control-room") {
|
|
91006
91248
|
let payload;
|
|
91007
91249
|
try {
|
|
@@ -92138,7 +92380,7 @@ function codexHome() {
|
|
|
92138
92380
|
function safeStderr(value, external = false) {
|
|
92139
92381
|
const source = value instanceof Error ? value.message : typeof value === "string" ? value : "";
|
|
92140
92382
|
if (!external && source === "") return "";
|
|
92141
|
-
const redacted = source
|
|
92383
|
+
const redacted = redactDiagnosticSecrets(source).replace(/\s+/g, " ");
|
|
92142
92384
|
const internal = /^(?:queue unavailable|ACK refusal notification failed|codex queue could not be started|Buzz mode: (?:invalid mode \(expected queue or steer\)|steer is unsupported for ACK|steer is only supported for Hermes)|(?:ping-window|speedy-send): [A-Z_]+(?: \[redacted\])?|brak trasy wybudzenia dla roli [a-z0-9-]+: rola nie ma skonfigurowanej trasy|(?:permission_denied|authentication_failed|not_found|timeout|connection_refused|symlink_refused|session_queue_full|cli_usage|route_unavailable|diagnostic_unclassified) \[redacted\])$/;
|
|
92143
92385
|
if (external || !internal.test(source)) {
|
|
92144
92386
|
const guard2 = source.match(/(?:(ping-window|speedy-send):\s*)?\b((?:[A-Z][A-Z0-9]*_)*(?:MODAL|INPUT)_DEFERRED)\b/);
|
|
@@ -92202,6 +92444,7 @@ async function writeFailureTraces(message3, attempt, rc, stderr, dependencies) {
|
|
|
92202
92444
|
}
|
|
92203
92445
|
await appendSecure(dependencies.inboxPath, visible);
|
|
92204
92446
|
await appendSecure(dependencies.errorPath, visible);
|
|
92447
|
+
if (/^jarvis-copy:[a-f0-9]{64}$/.test(message3.id)) return;
|
|
92205
92448
|
const payload = parsedJson(message3.text);
|
|
92206
92449
|
const roles = Object.entries(dependencies.rolePublicKeys ?? {}).filter(([, key]) => key === message3.from).map(([role3]) => role3);
|
|
92207
92450
|
const sender = roles.length === 1 && payload?.v === 1 && payload.from_role === roles[0] ? roles[0] : void 0;
|
|
@@ -92299,6 +92542,23 @@ async function processPending(message3, dependencies) {
|
|
|
92299
92542
|
dependencies.store.completeFailureTrace(message3.id, Date.now());
|
|
92300
92543
|
return;
|
|
92301
92544
|
}
|
|
92545
|
+
if (/^jarvis-copy:[a-f0-9]{64}$/.test(message3.id)) {
|
|
92546
|
+
dependencies.store.beginQueueAttempt(message3.id, Date.now());
|
|
92547
|
+
let rc = 0, stderr2 = "";
|
|
92548
|
+
try {
|
|
92549
|
+
if (dependencies.publishJarvisCopy === void 0) throw new Error("Jarvis copy publisher unavailable");
|
|
92550
|
+
await dependencies.publishJarvisCopy(message3);
|
|
92551
|
+
} catch (error48) {
|
|
92552
|
+
rc = 1;
|
|
92553
|
+
stderr2 = safeStderr(error48, true);
|
|
92554
|
+
}
|
|
92555
|
+
const attempt2 = dependencies.store.finishQueueAttempt(message3.id, rc, stderr2, Date.now());
|
|
92556
|
+
if (rc !== 0) {
|
|
92557
|
+
await writeFailureTraces(message3, attempt2.attempt, rc, stderr2, dependencies);
|
|
92558
|
+
dependencies.store.completeFailureTrace(message3.id, Date.now());
|
|
92559
|
+
}
|
|
92560
|
+
return;
|
|
92561
|
+
}
|
|
92302
92562
|
if (message3.queuePickup !== void 0) {
|
|
92303
92563
|
await checkQueuePickup(message3, dependencies);
|
|
92304
92564
|
return;
|
|
@@ -92626,7 +92886,12 @@ async function retryPending(dependencies) {
|
|
|
92626
92886
|
if (pending !== void 0) await processPending(pending, dependencies);
|
|
92627
92887
|
}
|
|
92628
92888
|
async function deliver2(message3, dependencies) {
|
|
92629
|
-
dependencies.store.enqueue(
|
|
92889
|
+
dependencies.store.enqueue(
|
|
92890
|
+
message3,
|
|
92891
|
+
Date.now(),
|
|
92892
|
+
dependencies.gbotPublicKey,
|
|
92893
|
+
dependencies.publishJarvisCopy === void 0 ? void 0 : dependencies.rolePublicKeys?.jarvis
|
|
92894
|
+
);
|
|
92630
92895
|
await retryPending(dependencies);
|
|
92631
92896
|
}
|
|
92632
92897
|
function exactKeys(record20, keys2) {
|
|
@@ -92917,6 +93182,7 @@ var init_delivery = __esm({
|
|
|
92917
93182
|
import_node_path36 = require("node:path");
|
|
92918
93183
|
init_store();
|
|
92919
93184
|
init_agent_route();
|
|
93185
|
+
init_protocol2();
|
|
92920
93186
|
init_lead_admission();
|
|
92921
93187
|
SAFE_DIAGNOSTIC_CATEGORY = /^(permission_denied|authentication_failed|not_found|timeout|connection_refused|symlink_refused|session_queue_full|cli_usage|route_unavailable|queue_item_id_missing|queue_not_picked_up|diagnostic_unclassified)(?: \[redacted\])?$/;
|
|
92922
93188
|
GBOT_READ_INTERVAL_MS = 5e3;
|