instar 1.3.1995 → 1.3.1997

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.
Files changed (61) hide show
  1. package/dashboard/docs/doc-page-model.js +1 -1
  2. package/dist/commands/machine.d.ts.map +1 -1
  3. package/dist/commands/machine.js +9 -0
  4. package/dist/commands/machine.js.map +1 -1
  5. package/dist/core/types.d.ts +10 -0
  6. package/dist/core/types.d.ts.map +1 -1
  7. package/dist/core/types.js.map +1 -1
  8. package/dist/data/standards-guard-index.json +1 -1
  9. package/dist/data/standards-guard-index.meta.json +2 -2
  10. package/dist/data/standards-registry.meta.json +1 -1
  11. package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
  12. package/dist/messaging/TelegramAdapter.js +13 -20
  13. package/dist/messaging/TelegramAdapter.js.map +1 -1
  14. package/dist/messaging/ownerChatTap.d.ts +55 -0
  15. package/dist/messaging/ownerChatTap.d.ts.map +1 -0
  16. package/dist/messaging/ownerChatTap.js +41 -0
  17. package/dist/messaging/ownerChatTap.js.map +1 -0
  18. package/dist/monitoring/GreenPrAutoMerger.d.ts +2 -0
  19. package/dist/monitoring/GreenPrAutoMerger.d.ts.map +1 -1
  20. package/dist/monitoring/GreenPrAutoMerger.js +22 -8
  21. package/dist/monitoring/GreenPrAutoMerger.js.map +1 -1
  22. package/dist/monitoring/greenPrAutomergeWiring.d.ts.map +1 -1
  23. package/dist/monitoring/greenPrAutomergeWiring.js +5 -1
  24. package/dist/monitoring/greenPrAutomergeWiring.js.map +1 -1
  25. package/dist/monitoring/greenPrOpenPrList.d.ts +5 -1
  26. package/dist/monitoring/greenPrOpenPrList.d.ts.map +1 -1
  27. package/dist/monitoring/greenPrOpenPrList.js +38 -6
  28. package/dist/monitoring/greenPrOpenPrList.js.map +1 -1
  29. package/dist/native/InstarWedgeCanary.app/Contents/MacOS/InstarWedgeCanary +0 -0
  30. package/dist/native/instar-desktop-host +0 -0
  31. package/dist/server/AgentServer.d.ts +3 -0
  32. package/dist/server/AgentServer.d.ts.map +1 -1
  33. package/dist/server/AgentServer.js +34 -6
  34. package/dist/server/AgentServer.js.map +1 -1
  35. package/dist/server/documentLinkRoutes.d.ts.map +1 -1
  36. package/dist/server/documentLinkRoutes.js +14 -2
  37. package/dist/server/documentLinkRoutes.js.map +1 -1
  38. package/dist/server/machineRoutes.d.ts +2 -0
  39. package/dist/server/machineRoutes.d.ts.map +1 -1
  40. package/dist/server/machineRoutes.js +5 -0
  41. package/dist/server/machineRoutes.js.map +1 -1
  42. package/dist/server/throwawayOwnerChat.d.ts +174 -0
  43. package/dist/server/throwawayOwnerChat.d.ts.map +1 -0
  44. package/dist/server/throwawayOwnerChat.js +538 -0
  45. package/dist/server/throwawayOwnerChat.js.map +1 -0
  46. package/dist/server/throwawayOwnerChatRoutes.d.ts +19 -0
  47. package/dist/server/throwawayOwnerChatRoutes.d.ts.map +1 -0
  48. package/dist/server/throwawayOwnerChatRoutes.js +32 -0
  49. package/dist/server/throwawayOwnerChatRoutes.js.map +1 -0
  50. package/package.json +1 -1
  51. package/src/data/awareness/throwaway-owner-chat.md +12 -0
  52. package/src/data/builtin-manifest.json +4 -4
  53. package/src/data/standards-guard-index.json +1 -1
  54. package/src/data/standards-guard-index.meta.json +2 -2
  55. package/src/data/standards-registry.meta.json +1 -1
  56. package/src/data/state-coherence-registry.json +17 -0
  57. package/upgrades/1.3.1996.md +24 -0
  58. package/upgrades/1.3.1997.md +28 -0
  59. package/upgrades/side-effects/document-computer-link-owner-refusal.md +19 -0
  60. package/upgrades/side-effects/merge-line-exact-handoff.md +32 -0
  61. package/upgrades/side-effects/throwaway-owner-chat.md +127 -0
@@ -0,0 +1,174 @@
1
+ import { type OwnerApproveHandler, type OwnerChatButton, type OwnerChatSurface, type OwnerDeclineHandler } from '../messaging/ownerChatTap.js';
2
+ export declare const STAND_IN_LOG: string;
3
+ export declare const STAND_IN_STATE: string;
4
+ /** True once this agent home has ever built the stand-in: machine pairing stays refused for its life (§2.4). */
5
+ export declare function standInEverUsed(stateDir: string): boolean;
6
+ /** Telegram's own limits (basis: external-constraint). */
7
+ export declare const MAX_TEXT_UNITS = 4096;
8
+ export declare const MAX_BUTTON_DATA_BYTES = 64;
9
+ export declare const MAX_BUTTONS = 100;
10
+ /** A resource budget with wide margin, not a derived floor: a full run writes under 1 MiB. Refuse, never evict. */
11
+ export declare const LOG_BUDGET_BYTES: number;
12
+ export declare const PAGE_LIMIT = 200;
13
+ /** Room a tap or command needs before it may reach a handler: its result, a confirmation and an edit at the bounds. */
14
+ export declare const ACTION_RESERVE_BYTES: number;
15
+ /** One stored message, serialized, at most this: keeps the reserve above any single action's writes (two messages, intents, results, an edit). */
16
+ export declare const MAX_MESSAGE_BYTES: number;
17
+ export type StandInCondition = 'not-asked' | 'not-throwaway' | 'real-owner' | 'not-single-machine' | 'shut-off-earlier';
18
+ export type StandInVerdict = {
19
+ ok: true;
20
+ } | {
21
+ ok: false;
22
+ unsure: false;
23
+ condition: StandInCondition;
24
+ detail: string;
25
+ } | {
26
+ ok: false;
27
+ unsure: true;
28
+ detail: string;
29
+ };
30
+ export interface StandInFacts {
31
+ projectDir: string;
32
+ stateDir: string;
33
+ /** A messaging adapter this server was started with (Telegram, Slack, WhatsApp, iMessage). */
34
+ adapterStarted: () => boolean;
35
+ now?: () => number;
36
+ /** The account's real home (tests point it elsewhere). */
37
+ accountHome?: string;
38
+ /** The account-wide agent registry files to read (tests point them elsewhere). */
39
+ agentRegistryFiles?: () => string[];
40
+ }
41
+ /**
42
+ * Read the four conditions from the agent's own files (§2). Pure apart from file reads, plus one write:
43
+ * the state file at first build (only when no owner enrolment exists yet), and the adopted genesis.
44
+ */
45
+ export declare function evaluateStandIn(facts: StandInFacts, opts?: {
46
+ firstBuild?: boolean;
47
+ }): StandInVerdict;
48
+ export interface StandInMessage {
49
+ kind: 'message';
50
+ id: number;
51
+ at: string;
52
+ text: string;
53
+ buttons: OwnerChatButton[];
54
+ buttonsLive: boolean;
55
+ }
56
+ export type StandInEntry = StandInMessage | {
57
+ kind: 'tap-intent';
58
+ id: number;
59
+ at: string;
60
+ messageId: number;
61
+ button: number;
62
+ data: string;
63
+ } | {
64
+ kind: 'tap';
65
+ id: number;
66
+ at: string;
67
+ messageId: number;
68
+ button: number;
69
+ data: string;
70
+ outcome: string;
71
+ toast: string;
72
+ intentId?: number;
73
+ } | {
74
+ kind: 'edit';
75
+ id: number;
76
+ at: string;
77
+ messageId: number;
78
+ text?: string;
79
+ buttonsRemoved: true;
80
+ } | {
81
+ kind: 'command-intent';
82
+ id: number;
83
+ at: string;
84
+ text: string;
85
+ } | {
86
+ kind: 'command';
87
+ id: number;
88
+ at: string;
89
+ text: string;
90
+ replyId: number | null;
91
+ intentId?: number;
92
+ } | {
93
+ kind: 'shut-off';
94
+ id: number;
95
+ at: string;
96
+ condition: string;
97
+ detail: string;
98
+ } | {
99
+ kind: 'refused';
100
+ id: number;
101
+ at: string;
102
+ reason: string;
103
+ };
104
+ export type ApproverResetHandler = (args: string) => {
105
+ text: string;
106
+ buttons?: OwnerChatButton[];
107
+ };
108
+ export type RouteAnswer = {
109
+ status: number;
110
+ body: Record<string, unknown>;
111
+ };
112
+ export interface ThrowawayOwnerChatDeps extends StandInFacts {
113
+ log?: (line: string) => void;
114
+ }
115
+ export declare class ThrowawayOwnerChat implements OwnerChatSurface {
116
+ private readonly deps;
117
+ mobileApproveHandler: OwnerApproveHandler | null;
118
+ mobileDeclineHandler: OwnerDeclineHandler | null;
119
+ /** identity-security piece 3d fills this, as it does on TelegramAdapter. */
120
+ approverResetHandler: ApproverResetHandler | null;
121
+ private readonly entries;
122
+ private readonly messagesById;
123
+ private readonly hooks;
124
+ private nextId;
125
+ private bytes;
126
+ /** The log file ends mid-line (a crash during a write): the next append starts on a new line. */
127
+ private tornTail;
128
+ private off;
129
+ /** Whether the stand-in was not definitely off at boot (routes are mounted only then; they gate per use). */
130
+ readonly builtLive: boolean;
131
+ readonly bootVerdict: StandInVerdict;
132
+ constructor(deps: ThrowawayOwnerChatDeps);
133
+ /**
134
+ * Build the stand-in only for a home that asked for it or ran it before (a home that ran it before
135
+ * still needs its shut-off sweep). Anything else: null, and nothing is read further.
136
+ */
137
+ static forBoot(deps: ThrowawayOwnerChatDeps): ThrowawayOwnerChat | null;
138
+ /** Register a piece's shut-off step (named, synchronous; a failing hook is logged and the rest still run). */
139
+ onShutOff(name: string, fn: () => void): void;
140
+ /** True while every condition holds; a definitely-false condition shuts the stand-in off for good. */
141
+ live(): boolean;
142
+ /** Owner presence for the approval path: live or unsure (a failed read never flips the channel); false once off. */
143
+ ownerChatPresent(): boolean;
144
+ /** Definitely off (shut off, or refused at boot); does not re-read the conditions. */
145
+ isOff(): boolean;
146
+ private gate;
147
+ /**
148
+ * Shut off for good (§2): record `off` first, press Decline on every live md:d: button through the
149
+ * decline slot, mark other live buttons removed, run the pieces' hooks.
150
+ */
151
+ private shutOff;
152
+ /** Step 1 of shutting off: record `off` before anything else, so nothing re-enters the stand-in. */
153
+ private recordOff;
154
+ /**
155
+ * The sweep, run once the handlers and hooks are wired (AgentServer calls it after the mobile wiring,
156
+ * and the stand-in runs it again on every later shut-off). Recorded so it runs once per shut-off.
157
+ */
158
+ finishShutOff(): void;
159
+ sendOwnerDMWithButton(text: string, button: OwnerChatButton | OwnerChatButton[] | null): Promise<number | null>;
160
+ /** `admitted`: a result of an action already admitted under the reserve, written even past the budget. */
161
+ private store;
162
+ private routeGate;
163
+ messages(after: number): RouteAnswer;
164
+ tap(messageId: unknown, button: unknown): RouteAnswer;
165
+ command(text: unknown): RouteAnswer;
166
+ private iso;
167
+ /** Results of an admitted action: the reserve guarantees room, and they are written even past the budget. */
168
+ private appendOrFull;
169
+ /** Append one entry (id assigned here); refuses past the budget unless `force` (shut-off records). */
170
+ private append;
171
+ /** Replay the log at boot, so a restart keeps the messages and their live buttons. */
172
+ private loadLog;
173
+ }
174
+ //# sourceMappingURL=throwawayOwnerChat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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