patchwork-os 1.2.0-beta.2.canary.711 → 1.2.0-beta.2.canary.713
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.
|
@@ -41,6 +41,20 @@ export interface Roster {
|
|
|
41
41
|
* decision, the first is the absence of one.
|
|
42
42
|
*/
|
|
43
43
|
implicit: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* True when a roster file EXISTS and could not be understood — unparseable,
|
|
46
|
+
* the wrong shape, or holding no entry that parses.
|
|
47
|
+
*
|
|
48
|
+
* This is the opposite of `implicit` and must never be confused with it. An
|
|
49
|
+
* absent file means nobody has made a membership decision here, and the
|
|
50
|
+
* one-person default is right. An unreadable file means a decision EXISTS
|
|
51
|
+
* and we cannot read it, so the safe answer is nobody — otherwise breaking
|
|
52
|
+
* the file is a way to become the owner.
|
|
53
|
+
*
|
|
54
|
+
* `members` is empty in this state, so `resolvePrincipal` yields `null` and
|
|
55
|
+
* `principalCan` grants nothing.
|
|
56
|
+
*/
|
|
57
|
+
unreadable: boolean;
|
|
44
58
|
/** Entries that failed to parse, by index, so the operator can be told. */
|
|
45
59
|
dropped: number[];
|
|
46
60
|
}
|
package/dist/identity/roster.js
CHANGED
|
@@ -45,7 +45,21 @@ export function implicitOwner() {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
function implicitRoster() {
|
|
48
|
-
return {
|
|
48
|
+
return {
|
|
49
|
+
members: [implicitOwner()],
|
|
50
|
+
implicit: true,
|
|
51
|
+
unreadable: false,
|
|
52
|
+
dropped: [],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A roster file we found and could not read. Deliberately NOT `implicitRoster`:
|
|
57
|
+
* see `Roster.unreadable`. `dropped` carries the entry indices when we got far
|
|
58
|
+
* enough to have any, so the operator can be told what was lost rather than
|
|
59
|
+
* only that something was.
|
|
60
|
+
*/
|
|
61
|
+
function unreadableRoster(dropped = []) {
|
|
62
|
+
return { members: [], implicit: false, unreadable: true, dropped };
|
|
49
63
|
}
|
|
50
64
|
/** Default location: `~/.patchwork/members.json`, honouring `PATCHWORK_HOME`. */
|
|
51
65
|
export function defaultRosterPath() {
|
|
@@ -70,12 +84,15 @@ export function defaultRosterPath() {
|
|
|
70
84
|
export function loadRoster(path = defaultRosterPath()) {
|
|
71
85
|
if (!existsSync(path))
|
|
72
86
|
return implicitRoster();
|
|
87
|
+
// Every `return` below this line is `unreadableRoster`, never
|
|
88
|
+
// `implicitRoster`. The file exists, so a membership decision was made here;
|
|
89
|
+
// failing to read it must not answer with an owner who can do everything.
|
|
73
90
|
let parsed;
|
|
74
91
|
try {
|
|
75
92
|
parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
76
93
|
}
|
|
77
94
|
catch {
|
|
78
|
-
return
|
|
95
|
+
return unreadableRoster();
|
|
79
96
|
}
|
|
80
97
|
const raw = Array.isArray(parsed)
|
|
81
98
|
? parsed
|
|
@@ -83,7 +100,7 @@ export function loadRoster(path = defaultRosterPath()) {
|
|
|
83
100
|
? parsed.members
|
|
84
101
|
: null;
|
|
85
102
|
if (!raw)
|
|
86
|
-
return
|
|
103
|
+
return unreadableRoster();
|
|
87
104
|
const members = [];
|
|
88
105
|
const dropped = [];
|
|
89
106
|
const seen = new Set();
|
|
@@ -98,9 +115,12 @@ export function loadRoster(path = defaultRosterPath()) {
|
|
|
98
115
|
seen.add(m.id);
|
|
99
116
|
members.push(m);
|
|
100
117
|
}
|
|
118
|
+
// A file whose every entry was dropped is unreadable, not one-person: the
|
|
119
|
+
// operator listed members and we understood none of them. `dropped` is
|
|
120
|
+
// carried through so the report says which.
|
|
101
121
|
if (members.length === 0)
|
|
102
|
-
return
|
|
103
|
-
return { members, implicit: false, dropped };
|
|
122
|
+
return unreadableRoster(dropped);
|
|
123
|
+
return { members, implicit: false, unreadable: false, dropped };
|
|
104
124
|
}
|
|
105
125
|
/**
|
|
106
126
|
* One-line summary of a loaded roster, for the startup log.
|
|
@@ -114,6 +134,18 @@ export function describeRoster(roster) {
|
|
|
114
134
|
if (roster.implicit) {
|
|
115
135
|
return "no members.json — running as a single implicit owner";
|
|
116
136
|
}
|
|
137
|
+
// Loud, and deliberately not phrased as a degraded-but-fine state. Without
|
|
138
|
+
// this branch the line below reports "roster loaded: 0 people", which reads
|
|
139
|
+
// like an empty workspace rather than an unreadable file — and this string is
|
|
140
|
+
// the startup log an operator actually sees.
|
|
141
|
+
if (roster.unreadable) {
|
|
142
|
+
const where = roster.dropped.length > 0
|
|
143
|
+
? ` — every entry REJECTED at position ${roster.dropped.join(", ")}`
|
|
144
|
+
: "";
|
|
145
|
+
return (`members.json EXISTS but could not be read${where}. ` +
|
|
146
|
+
"Nobody is identified in this workspace until it is fixed; this is NOT " +
|
|
147
|
+
"the single-owner default, which applies only when the file is absent.");
|
|
148
|
+
}
|
|
117
149
|
const humans = roster.members.filter((m) => m.kind === "human").length;
|
|
118
150
|
const workers = roster.members.length - humans;
|
|
119
151
|
const parts = [`${humans} ${humans === 1 ? "person" : "people"}`];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roster.js","sourceRoot":"","sources":["../../src/identity/roster.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAe,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGnE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"roster.js","sourceRoot":"","sources":["../../src/identity/roster.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,UAAU,EA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|
-
"version": "1.2.0-beta.2.canary.
|
|
3
|
+
"version": "1.2.0-beta.2.canary.713",
|
|
4
4
|
"description": "Your personal AI runtime, local-first. Patchwork OS gives any AI model a consistent set of tools, YAML recipes, a delegation policy with approval queue, and a durable trace memory — all on your machine, all under your policy.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|