@xenosystem/agent-interface-core 0.1.79 → 0.1.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from './knowledgeBoardProjection.js';
10
10
  export * from './hostBackedCapabilities.js';
11
11
  export * from './sessionMode.js';
12
12
  export * from './writeLease.js';
13
+ export * from './inputLease.js';
13
14
  export * from './landingOverlap.js';
14
15
  export * from './landingQueue.js';
15
16
  export * from './reviewProjection.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,KAAK,qBAAqB,EAC3B,MAAM,sCAAsC,CAAA;AAE7C,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,yCAAyC,CAAA;AACvD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,wCAAwC,CAAA;AACtD,cAAc,kCAAkC,CAAA;AAChD,cAAc,uCAAuC,CAAA;A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,CAAA"}
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ export * from './knowledgeBoardProjection.js';
10
10
  export * from './hostBackedCapabilities.js';
11
11
  export * from './sessionMode.js';
12
12
  export * from './writeLease.js';
13
+ export * from './inputLease.js';
13
14
  export * from './landingOverlap.js';
14
15
  export * from './landingQueue.js';
15
16
  export * from './reviewProjection.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,GAM3B,MAAM,sCAAsC,CAAA;AAE7C,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,yCAAyC,CAAA;AACvD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,mCAAmC,CAAA;AACjD,cAAc,wCAAwC,CAAA;AACtD,cAAc,kCAAkC,CAAA;AAChD,cAAc,uCAAuC,CAAA;AACrD,cAAc,+CAA+C,CAAA;AAE7D,MAAM,CAAC,MAAM,iCAAiC,GAAG;IAC/C,uBAAuB;IACvB,gBAAgB;IAChB,iBAAiB;IACjB,kBAAkB;IAClB,gBAAgB;CACoC,CAAA;AAEtD,MAAM,UAAU,sBAAsB,CACpC,YAAm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,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,eAAe,CAAC,cAAc,CAAC;QACtF,CAAC,CAAC,SAAS,CAAA;IACb,IAAI,qBAAqB,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,EAAE,CAAC;QACnE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,EAAE,UAAU,EAAE,qBAAqB,CAAC,qBAAqB,IAAI,8CAA8C,EAAE,CAAA;IAC5J,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;YACvB,UAAU,EAAE,QAAQ,CAAC,EAAE;YACvB,eAAe,EAAE,QAAQ,CAAC,eAAe;YACzC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnD,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClF,CAAC;KACH,CAAA;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAuD;IAC5E,OAAO,KAAK,CAAC,YAAY,KAAK,WAAW,IAAI,KAAK,CAAC,YAAY,KAAK,UAAU,CAAA;AAChF,CAAC;AACD,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA"}
@@ -0,0 +1,158 @@
1
+ /**
2
+ * Input lease (XENO SPAWN §14.4, required by §10.4 "take over").
3
+ *
4
+ * Moved DOWN from `xeno-shell/packages/core/src/inputLease.ts` so that Spawn and
5
+ * xeno-shell consume ONE copy of the arbitration rules instead of two that drift.
6
+ * The only change from the shell original is the seat dependency: shell's
7
+ * concrete `SeatRegistry` is replaced by the structural port `InputLeaseSeats`
8
+ * below, which that registry satisfies without modification.
9
+ *
10
+ * Two humans driving one PTY needs an arbiter for **who may type right now**.
11
+ * Takeover arbitration already exists one level up (ADE §5.5, `writeLease.ts`)
12
+ * and answers a different question — who owns the RUN. This answers who owns the
13
+ * KEYBOARD, and the two are not the same: a reviewer can take over a run and
14
+ * still need to be handed the input before their keystrokes mean anything.
15
+ *
16
+ * 🔴 WHAT WAS ACTUALLY MISSING, and it is worth stating precisely because the
17
+ * name made it look built: `"input.lease"` already existed as a shell
18
+ * `SeatCapability` — in the union, in `HOST_SEAT_CAPABILITIES`, in the guest
19
+ * defaults, and in a test asserting agent seats do not get it. So the registry
20
+ * could answer *"may this seat hold the lease?"* and nothing anywhere could
21
+ * answer *"who holds it?"*. A permission to hold a thing that did not exist.
22
+ * This module is the thing.
23
+ *
24
+ * Design rules, each with the failure it prevents:
25
+ *
26
+ * 1. **Capability-gated.** Only a seat whose ceiling includes `"input.lease"`
27
+ * may acquire. Agent seats are excluded BY DEFAULT (shell `seats.ts`:
28
+ * "driving the host's real mouse and keyboard is an explicit, separate
29
+ * grant"), so an agent seat cannot take the keyboard from a human without
30
+ * that grant being made deliberately.
31
+ *
32
+ * 2. 🔴 **UNCONTESTED UNTIL CONTENTION IS POSSIBLE.** While at most one seat in
33
+ * the registry *holds the capability*, any capable seat may write without
34
+ * acquiring anything. The moment a second capable seat exists, writes require
35
+ * the lease. This is not laxity — it is what makes the feature shippable:
36
+ * every existing single-user install keeps working BY CONSTRUCTION rather
37
+ * than by someone remembering to call `acquire()` on a path that predates
38
+ * this file. Wave S-B staged the terminal policy the same way and for the
39
+ * same reason. A lease that silently swallowed the only user's keystrokes
40
+ * would be a regression dressed as a security feature.
41
+ *
42
+ * 3. **Takeover is explicit and RECORDED.** `takeOver()` bumps `generation`, so
43
+ * a displaced holder can observe that it lost the lease. The alternative —
44
+ * dropping its writes silently — produces the worst symptom in an interactive
45
+ * product: a terminal that looks alive and ignores you.
46
+ *
47
+ * 4. **Eviction drops leases.** A seat that no longer exists cannot keep the
48
+ * keyboard. `onSeatEvicted` is the hook the host's existing seat-eviction
49
+ * path calls (shell: `SeatRegistry.evict`), so revocation reuses the one code
50
+ * path that already tears a seat down rather than adding a second thing to
51
+ * remember.
52
+ *
53
+ * 5. **Fail closed.** An unknown seat is denied, never treated as uncontested.
54
+ *
55
+ * Environment-agnostic, like the rest of `packages/core` — no node builtins.
56
+ *
57
+ * @unwired-by-design XENO SPAWN §14.4 — moved down from xeno-shell so Spawn and the shell share one copy; nothing in this repo constructs it, the consumers (shell, Spawn) adopt it from the published package, and with one capable seat the lease is uncontested by rule 2 — it gains a real caller when a second capable seat can exist (XENO SESSIONS remote/guest seats, SPAWN §10.4 "take over").
58
+ */
59
+ /** The capability that gates holding a lease at all. */
60
+ export declare const INPUT_LEASE_CAPABILITY: "input.lease";
61
+ export type InputLeaseCapability = typeof INPUT_LEASE_CAPABILITY;
62
+ /**
63
+ * The seat model the lease needs, and nothing more.
64
+ *
65
+ * A structural PORT rather than an import, because the seat model belongs to the
66
+ * host (xeno-shell's `SeatRegistry`, Spawn's own) and core must not depend UP on
67
+ * it. Shell's `SeatRegistry` satisfies this as-is: its `get` returns
68
+ * `Seat | null`, its `list` returns seats with an `id`, and its `hasCapability`
69
+ * accepts a `SeatCapability` union that contains `'input.lease'` — which is why
70
+ * the parameter here is the literal, not `string`: that keeps the assignment
71
+ * sound under `strictFunctionTypes` rather than relying on method bivariance.
72
+ */
73
+ export interface InputLeaseSeats {
74
+ /** Any value other than `null`/`undefined` means the seat exists. */
75
+ get(seatId: string): unknown;
76
+ list(): readonly {
77
+ readonly id: string;
78
+ }[];
79
+ hasCapability(seatId: string, capability: InputLeaseCapability): boolean;
80
+ }
81
+ export interface InputLeaseRecord {
82
+ /** What the lease is over — one PTY, terminal or input surface. */
83
+ readonly targetId: string;
84
+ readonly holderSeatId: string;
85
+ readonly acquiredAt: string;
86
+ /**
87
+ * Bumped on every handover. A writer that observed generation N and sees N+1
88
+ * knows it was displaced, rather than inferring it from its input vanishing.
89
+ */
90
+ readonly generation: number;
91
+ }
92
+ export type InputWriteDenial =
93
+ /** The seat is not in the registry. Denied, never treated as uncontested. */
94
+ 'unknown-seat'
95
+ /** The seat's ceiling does not include `input.lease`. */
96
+ | 'not-capable'
97
+ /** Another seat holds the lease for this target. */
98
+ | 'held-by-another';
99
+ export type InputWriteVerdict = {
100
+ readonly allowed: true;
101
+ readonly reason: 'uncontested' | 'holder';
102
+ } | {
103
+ readonly allowed: false;
104
+ readonly reason: InputWriteDenial;
105
+ /** Present only for `held-by-another`, so a UI can name who has it. */
106
+ readonly holderSeatId?: string;
107
+ };
108
+ export declare class InputLeaseError extends Error {
109
+ }
110
+ export declare class InputLeaseRegistry {
111
+ private readonly leases;
112
+ private readonly seats;
113
+ private readonly now;
114
+ constructor(seats: InputLeaseSeats, now?: () => string);
115
+ /** Seats whose CEILING permits holding a lease. Contention is measured on this, not on holders. */
116
+ capableSeatIds(): readonly string[];
117
+ /**
118
+ * Is input for this target currently arbitrated at all?
119
+ *
120
+ * False while at most one seat could ever hold the lease — see rule 2. Exposed
121
+ * because a UI must not show a "request control" affordance that would be a
122
+ * no-op, and because a test asserting the strict path needs to prove it is in
123
+ * the strict path rather than passing by accident.
124
+ */
125
+ isContested(): boolean;
126
+ holder(targetId: string): InputLeaseRecord | null;
127
+ /**
128
+ * Take the lease if it is free. Throws if the seat may not hold one at all —
129
+ * that is a programming error, not a runtime race. Re-acquiring a lease you
130
+ * already hold is idempotent and does NOT bump the generation: nobody was
131
+ * displaced, so no observer should be told they were.
132
+ */
133
+ acquire(targetId: string, seatId: string): InputLeaseRecord;
134
+ /** Give it up. Returns false if this seat did not hold it — releasing is never an error. */
135
+ release(targetId: string, seatId: string): boolean;
136
+ /**
137
+ * Take the lease from whoever has it. Deliberately a SEPARATE verb from
138
+ * `acquire`: displacing a person is a different act from picking up something
139
+ * nobody holds, and the call site should have to say which one it means.
140
+ */
141
+ takeOver(targetId: string, seatId: string): InputLeaseRecord;
142
+ /** May this seat write to this target right now? */
143
+ canWrite(targetId: string, seatId: string): InputWriteVerdict;
144
+ /**
145
+ * Drop every lease held by an evicted seat. Returns the targets freed so the
146
+ * caller can notify their surfaces — a terminal whose lease vanished should
147
+ * say so rather than appear to still be owned.
148
+ */
149
+ onSeatEvicted(seatId: string): readonly string[];
150
+ /**
151
+ * Existence, read through the port. Shell's registry answers `null` for a
152
+ * missing seat and another host may answer `undefined`; both mean unknown, and
153
+ * unknown fails closed (rule 5).
154
+ */
155
+ private seatExists;
156
+ private assertCapable;
157
+ }
158
+ //# sourceMappingURL=inputLease.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inputLease.d.ts","sourceRoot":"","sources":["../src/inputLease.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,wDAAwD;AACxD,eAAO,MAAM,sBAAsB,EAAG,aAAsB,CAAA;AAE5D,MAAM,MAAM,oBAAoB,GAAG,OAAO,sBAAsB,CAAA;AAEhE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC9B,qEAAqE;IACrE,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;IAC5B,IAAI,IAAI,SAAS;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC1C,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,GAAG,OAAO,CAAA;CACzE;AAED,MAAM,WAAW,gBAAgB;IAC/B,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B;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AAM,EAAE,MAAM,GAAG,iBAAiB;IAiB7D;;;;OAIG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE;IAWhD;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,aAAa;CAUtB"}
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Input lease (XENO SPAWN §14.4, required by §10.4 "take over").
3
+ *
4
+ * Moved DOWN from `xeno-shell/packages/core/src/inputLease.ts` so that Spawn and
5
+ * xeno-shell consume ONE copy of the arbitration rules instead of two that drift.
6
+ * The only change from the shell original is the seat dependency: shell's
7
+ * concrete `SeatRegistry` is replaced by the structural port `InputLeaseSeats`
8
+ * below, which that registry satisfies without modification.
9
+ *
10
+ * Two humans driving one PTY needs an arbiter for **who may type right now**.
11
+ * Takeover arbitration already exists one level up (ADE §5.5, `writeLease.ts`)
12
+ * and answers a different question — who owns the RUN. This answers who owns the
13
+ * KEYBOARD, and the two are not the same: a reviewer can take over a run and
14
+ * still need to be handed the input before their keystrokes mean anything.
15
+ *
16
+ * 🔴 WHAT WAS ACTUALLY MISSING, and it is worth stating precisely because the
17
+ * name made it look built: `"input.lease"` already existed as a shell
18
+ * `SeatCapability` — in the union, in `HOST_SEAT_CAPABILITIES`, in the guest
19
+ * defaults, and in a test asserting agent seats do not get it. So the registry
20
+ * could answer *"may this seat hold the lease?"* and nothing anywhere could
21
+ * answer *"who holds it?"*. A permission to hold a thing that did not exist.
22
+ * This module is the thing.
23
+ *
24
+ * Design rules, each with the failure it prevents:
25
+ *
26
+ * 1. **Capability-gated.** Only a seat whose ceiling includes `"input.lease"`
27
+ * may acquire. Agent seats are excluded BY DEFAULT (shell `seats.ts`:
28
+ * "driving the host's real mouse and keyboard is an explicit, separate
29
+ * grant"), so an agent seat cannot take the keyboard from a human without
30
+ * that grant being made deliberately.
31
+ *
32
+ * 2. 🔴 **UNCONTESTED UNTIL CONTENTION IS POSSIBLE.** While at most one seat in
33
+ * the registry *holds the capability*, any capable seat may write without
34
+ * acquiring anything. The moment a second capable seat exists, writes require
35
+ * the lease. This is not laxity — it is what makes the feature shippable:
36
+ * every existing single-user install keeps working BY CONSTRUCTION rather
37
+ * than by someone remembering to call `acquire()` on a path that predates
38
+ * this file. Wave S-B staged the terminal policy the same way and for the
39
+ * same reason. A lease that silently swallowed the only user's keystrokes
40
+ * would be a regression dressed as a security feature.
41
+ *
42
+ * 3. **Takeover is explicit and RECORDED.** `takeOver()` bumps `generation`, so
43
+ * a displaced holder can observe that it lost the lease. The alternative —
44
+ * dropping its writes silently — produces the worst symptom in an interactive
45
+ * product: a terminal that looks alive and ignores you.
46
+ *
47
+ * 4. **Eviction drops leases.** A seat that no longer exists cannot keep the
48
+ * keyboard. `onSeatEvicted` is the hook the host's existing seat-eviction
49
+ * path calls (shell: `SeatRegistry.evict`), so revocation reuses the one code
50
+ * path that already tears a seat down rather than adding a second thing to
51
+ * remember.
52
+ *
53
+ * 5. **Fail closed.** An unknown seat is denied, never treated as uncontested.
54
+ *
55
+ * Environment-agnostic, like the rest of `packages/core` — no node builtins.
56
+ *
57
+ * @unwired-by-design XENO SPAWN §14.4 — moved down from xeno-shell so Spawn and the shell share one copy; nothing in this repo constructs it, the consumers (shell, Spawn) adopt it from the published package, and with one capable seat the lease is uncontested by rule 2 — it gains a real caller when a second capable seat can exist (XENO SESSIONS remote/guest seats, SPAWN §10.4 "take over").
58
+ */
59
+ /** The capability that gates holding a lease at all. */
60
+ export const INPUT_LEASE_CAPABILITY = 'input.lease';
61
+ export class InputLeaseError extends Error {
62
+ }
63
+ const nowIso = () => new Date().toISOString();
64
+ export class InputLeaseRegistry {
65
+ leases = new Map();
66
+ seats;
67
+ now;
68
+ constructor(seats, now = nowIso) {
69
+ this.seats = seats;
70
+ this.now = now;
71
+ }
72
+ /** Seats whose CEILING permits holding a lease. Contention is measured on this, not on holders. */
73
+ capableSeatIds() {
74
+ return this.seats
75
+ .list()
76
+ .filter((seat) => this.seats.hasCapability(seat.id, INPUT_LEASE_CAPABILITY))
77
+ .map((seat) => seat.id);
78
+ }
79
+ /**
80
+ * Is input for this target currently arbitrated at all?
81
+ *
82
+ * False while at most one seat could ever hold the lease — see rule 2. Exposed
83
+ * because a UI must not show a "request control" affordance that would be a
84
+ * no-op, and because a test asserting the strict path needs to prove it is in
85
+ * the strict path rather than passing by accident.
86
+ */
87
+ isContested() {
88
+ return this.capableSeatIds().length > 1;
89
+ }
90
+ holder(targetId) {
91
+ return this.leases.get(targetId) ?? null;
92
+ }
93
+ /**
94
+ * Take the lease if it is free. Throws if the seat may not hold one at all —
95
+ * that is a programming error, not a runtime race. Re-acquiring a lease you
96
+ * already hold is idempotent and does NOT bump the generation: nobody was
97
+ * displaced, so no observer should be told they were.
98
+ */
99
+ acquire(targetId, seatId) {
100
+ this.assertCapable(seatId);
101
+ const current = this.leases.get(targetId);
102
+ if (current && current.holderSeatId !== seatId) {
103
+ throw new InputLeaseError(`Input lease for ${targetId} is held by ${current.holderSeatId}; take it over explicitly.`);
104
+ }
105
+ if (current)
106
+ return current;
107
+ const record = {
108
+ targetId,
109
+ holderSeatId: seatId,
110
+ acquiredAt: this.now(),
111
+ generation: 1,
112
+ };
113
+ this.leases.set(targetId, record);
114
+ return record;
115
+ }
116
+ /** Give it up. Returns false if this seat did not hold it — releasing is never an error. */
117
+ release(targetId, seatId) {
118
+ const current = this.leases.get(targetId);
119
+ if (!current || current.holderSeatId !== seatId)
120
+ return false;
121
+ this.leases.delete(targetId);
122
+ return true;
123
+ }
124
+ /**
125
+ * Take the lease from whoever has it. Deliberately a SEPARATE verb from
126
+ * `acquire`: displacing a person is a different act from picking up something
127
+ * nobody holds, and the call site should have to say which one it means.
128
+ */
129
+ takeOver(targetId, seatId) {
130
+ this.assertCapable(seatId);
131
+ const current = this.leases.get(targetId);
132
+ if (current && current.holderSeatId === seatId)
133
+ return current;
134
+ const record = {
135
+ targetId,
136
+ holderSeatId: seatId,
137
+ acquiredAt: this.now(),
138
+ generation: (current?.generation ?? 0) + 1,
139
+ };
140
+ this.leases.set(targetId, record);
141
+ return record;
142
+ }
143
+ /** May this seat write to this target right now? */
144
+ canWrite(targetId, seatId) {
145
+ if (!this.seatExists(seatId))
146
+ return { allowed: false, reason: 'unknown-seat' };
147
+ if (!this.seats.hasCapability(seatId, INPUT_LEASE_CAPABILITY)) {
148
+ return { allowed: false, reason: 'not-capable' };
149
+ }
150
+ const current = this.leases.get(targetId);
151
+ if (current) {
152
+ return current.holderSeatId === seatId
153
+ ? { allowed: true, reason: 'holder' }
154
+ : { allowed: false, reason: 'held-by-another', holderSeatId: current.holderSeatId };
155
+ }
156
+ // Rule 2: nobody holds it. Free-for-all only while contention is impossible.
157
+ return this.isContested()
158
+ ? { allowed: false, reason: 'held-by-another' }
159
+ : { allowed: true, reason: 'uncontested' };
160
+ }
161
+ /**
162
+ * Drop every lease held by an evicted seat. Returns the targets freed so the
163
+ * caller can notify their surfaces — a terminal whose lease vanished should
164
+ * say so rather than appear to still be owned.
165
+ */
166
+ onSeatEvicted(seatId) {
167
+ const freed = [];
168
+ for (const [targetId, record] of this.leases) {
169
+ if (record.holderSeatId === seatId) {
170
+ this.leases.delete(targetId);
171
+ freed.push(targetId);
172
+ }
173
+ }
174
+ return freed;
175
+ }
176
+ /**
177
+ * Existence, read through the port. Shell's registry answers `null` for a
178
+ * missing seat and another host may answer `undefined`; both mean unknown, and
179
+ * unknown fails closed (rule 5).
180
+ */
181
+ seatExists(seatId) {
182
+ const seat = this.seats.get(seatId);
183
+ return seat !== null && seat !== undefined;
184
+ }
185
+ assertCapable(seatId) {
186
+ if (!this.seatExists(seatId)) {
187
+ throw new InputLeaseError(`Unknown seat ${seatId} cannot hold an input lease.`);
188
+ }
189
+ if (!this.seats.hasCapability(seatId, INPUT_LEASE_CAPABILITY)) {
190
+ throw new InputLeaseError(`Seat ${seatId} does not hold the ${INPUT_LEASE_CAPABILITY} capability.`);
191
+ }
192
+ }
193
+ }
194
+ //# sourceMappingURL=inputLease.js.map
@@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,CAAC,MAAM,EAAE,CAAC;YAC7C,IAAI,MAAM,CAAC,YAAY,KAAK,MAAM,EAAE,CAAC;gBACnC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;gBAC5B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACtB,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED;;;;OAIG;IACK,UAAU,CAAC,MAAc;QAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QACnC,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,CAAA;IAC5C,CAAC;IAEO,aAAa,CAAC,MAAc;QAClC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,eAAe,CAAC,gBAAgB,MAAM,8BAA8B,CAAC,CAAA;QACjF,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAAE,CAAC;YAC9D,MAAM,IAAI,eAAe,CACvB,QAAQ,MAAM,sBAAsB,sBAAsB,cAAc,CACzE,CAAA;QACH,CAAC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xenosystem/agent-interface-core",
3
- "version": "0.1.79",
3
+ "version": "0.1.81",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -23,8 +23,8 @@
23
23
  "directory": "packages/core"
24
24
  },
25
25
  "dependencies": {
26
- "@xenosystem/agent-interface-contract": "0.1.79"
26
+ "@xenosystem/agent-interface-contract": "0.1.81"
27
27
  },
28
28
  "scripts": {},
29
- "gitHead": "a137552c8970faa5ab6d139998350d1ceb9986c9"
29
+ "gitHead": "8ada0f02883e807eb17ddaf925b73289be09e069"
30
30
  }