@supa-media/tex-contract 0.0.0-stage → 0.3.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.
Files changed (227) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +33 -2
  3. package/package.json +16 -4
  4. package/texContract/aboutLines.cjs +117 -0
  5. package/texContract/aboutLines.d.cts +14 -0
  6. package/texContract/aboutNoteLimits.cjs +41 -0
  7. package/texContract/aboutNoteLimits.d.cts +5 -0
  8. package/texContract/actionManual.cjs +104 -0
  9. package/texContract/activityHint.cjs +40 -0
  10. package/texContract/activityHint.d.cts +4 -0
  11. package/texContract/asks.cjs +16 -0
  12. package/texContract/asks.d.cts +6 -0
  13. package/texContract/asksToFile.cjs +20 -0
  14. package/texContract/asksToFile.d.cts +2 -0
  15. package/texContract/attention.cjs +138 -0
  16. package/texContract/attention.d.cts +20 -0
  17. package/texContract/browserHandback.cjs +13 -0
  18. package/texContract/browserHandback.d.cts +3 -0
  19. package/texContract/browserOwner.cjs +31 -0
  20. package/texContract/browserOwner.d.cts +2 -0
  21. package/texContract/bytes.cjs +12 -0
  22. package/texContract/capabilities.cjs +47 -0
  23. package/texContract/capabilities.d.cts +27 -0
  24. package/texContract/capabilities.generated.json +77 -0
  25. package/texContract/chatHistoryPath.cjs +38 -0
  26. package/texContract/chatHistoryPath.d.cts +5 -0
  27. package/texContract/chatLedger.cjs +91 -0
  28. package/texContract/chatLedger.d.cts +21 -0
  29. package/texContract/computerTool.cjs +102 -0
  30. package/texContract/computerTool.d.cts +16 -0
  31. package/texContract/consentYes.cjs +22 -0
  32. package/texContract/consentYes.d.cts +5 -0
  33. package/texContract/contextGateway.cjs +52 -0
  34. package/texContract/contextGateway.d.cts +19 -0
  35. package/texContract/deskEligible.cjs +20 -0
  36. package/texContract/deskEligible.d.cts +3 -0
  37. package/texContract/downloads.cjs +129 -0
  38. package/texContract/downloads.d.cts +15 -0
  39. package/texContract/egressLedger.cjs +114 -0
  40. package/texContract/egressLedger.d.cts +14 -0
  41. package/texContract/emailRead.cjs +38 -0
  42. package/texContract/emailRead.d.cts +5 -0
  43. package/texContract/eventWords.cjs +35 -0
  44. package/texContract/eventWords.d.cts +4 -0
  45. package/texContract/fileParts.cjs +43 -0
  46. package/texContract/fileParts.d.cts +6 -0
  47. package/texContract/fileTables.cjs +243 -0
  48. package/texContract/fileWords.cjs +169 -0
  49. package/texContract/folded.cjs +16 -0
  50. package/texContract/folded.d.cts +3 -0
  51. package/texContract/googleAiAccess.cjs +12 -0
  52. package/texContract/googleAiAccess.d.cts +2 -0
  53. package/texContract/graphWires.cjs +18 -0
  54. package/texContract/graphWires.d.cts +5 -0
  55. package/texContract/groupSession.cjs +28 -0
  56. package/texContract/groupSession.d.cts +7 -0
  57. package/texContract/guestNames.cjs +136 -0
  58. package/texContract/guestNames.d.cts +35 -0
  59. package/texContract/heard.cjs +19 -0
  60. package/texContract/heard.d.cts +4 -0
  61. package/texContract/heldOffer.cjs +57 -0
  62. package/texContract/heldOffer.d.cts +8 -0
  63. package/texContract/helperCallers.cjs +29 -0
  64. package/texContract/helperCallers.d.cts +4 -0
  65. package/texContract/identity.cjs +179 -0
  66. package/texContract/identity.d.cts +8 -0
  67. package/texContract/jobLogEntries.cjs +93 -0
  68. package/texContract/jobLogEntries.d.cts +12 -0
  69. package/texContract/judgedActions.cjs +20 -0
  70. package/texContract/judgedActions.d.cts +4 -0
  71. package/texContract/labSandboxGate.cjs +63 -0
  72. package/texContract/labSandboxGate.d.cts +9 -0
  73. package/texContract/ledgerReadChars.cjs +4 -0
  74. package/texContract/ledgerReadChars.d.cts +3 -0
  75. package/texContract/mailCheck.cjs +90 -0
  76. package/texContract/mailCheck.d.cts +12 -0
  77. package/texContract/mailEntries.cjs +64 -0
  78. package/texContract/mailEntries.d.cts +13 -0
  79. package/texContract/mailHealth.cjs +60 -0
  80. package/texContract/mailHealth.d.cts +10 -0
  81. package/texContract/notePath.cjs +99 -0
  82. package/texContract/notePath.d.cts +4 -0
  83. package/texContract/noteRunFacts.cjs +136 -0
  84. package/texContract/noteRunFacts.d.cts +32 -0
  85. package/texContract/objectEtag.cjs +84 -0
  86. package/texContract/objectEtag.d.cts +4 -0
  87. package/texContract/objectPlace.cjs +32 -0
  88. package/texContract/objectPlace.d.cts +5 -0
  89. package/texContract/pageJobs.cjs +226 -0
  90. package/texContract/pageJobs.d.cts +13 -0
  91. package/texContract/pdfLinks.cjs +135 -0
  92. package/texContract/pdfLinks.d.cts +4 -0
  93. package/texContract/personHub.cjs +38 -0
  94. package/texContract/personHub.d.cts +5 -0
  95. package/texContract/personNameText.cjs +18 -0
  96. package/texContract/personNameText.d.cts +3 -0
  97. package/texContract/pinnedContext.cjs +12 -0
  98. package/texContract/pinnedContext.d.cts +3 -0
  99. package/texContract/quietHoursWindow.cjs +36 -0
  100. package/texContract/quietHoursWindow.d.cts +3 -0
  101. package/texContract/reactEmoji.cjs +79 -0
  102. package/texContract/reactEmoji.d.cts +2 -0
  103. package/texContract/scopeClamp.cjs +117 -0
  104. package/texContract/scopeClamp.d.cts +5 -0
  105. package/texContract/scopes.cjs +29 -0
  106. package/texContract/scopes.d.cts +7 -0
  107. package/texContract/searchSettings.cjs +54 -0
  108. package/texContract/searchSettings.d.cts +6 -0
  109. package/texContract/settingHabits.cjs +87 -0
  110. package/texContract/settingHabits.d.cts +20 -0
  111. package/texContract/settingsNotes.cjs +217 -0
  112. package/texContract/settingsNotes.d.cts +26 -0
  113. package/texContract/shownEmail.cjs +181 -0
  114. package/texContract/texClients.cjs +53 -0
  115. package/texContract/texClients.d.cts +12 -0
  116. package/texContract/texGraph.cjs +593 -0
  117. package/texContract/texGraph.d.cts +55 -0
  118. package/texContract/texKeys.cjs +100 -0
  119. package/texContract/texKeys.d.cts +13 -0
  120. package/texContract/texNumber.cjs +20 -0
  121. package/texContract/texNumber.d.cts +3 -0
  122. package/texContract/texOwnSources.cjs +9 -0
  123. package/texContract/texOwnSources.d.cts +3 -0
  124. package/texContract/texSettings.cjs +22 -0
  125. package/texContract/texSettings.d.cts +20 -0
  126. package/texContract/texSettings.generated.json +25 -0
  127. package/texContract/texStateFiles.cjs +22 -0
  128. package/texContract/texStateFiles.d.cts +9 -0
  129. package/texContract/texSteps.cjs +27 -0
  130. package/texContract/texSteps.d.cts +14 -0
  131. package/texContract/texSteps.generated.json +41 -0
  132. package/texContract/texStoreNames.cjs +26 -0
  133. package/texContract/texStoreNames.d.cts +12 -0
  134. package/texContract/texStoreWire.cjs +306 -0
  135. package/texContract/texStoreWire.d.cts +32 -0
  136. package/texContract/threadsFold.cjs +75 -0
  137. package/texContract/threadsFold.d.cts +22 -0
  138. package/texContract/toolActions.cjs +253 -0
  139. package/texContract/toolCatalog.cjs +49 -0
  140. package/texContract/toolCatalog.generated.json +90 -0
  141. package/texContract/toolContract.cjs +52 -0
  142. package/texContract/toolContract.d.cts +12 -0
  143. package/texContract/toolShapes.cjs +14 -0
  144. package/texContract/transcription.cjs +101 -0
  145. package/texContract/transcription.d.cts +3 -0
  146. package/texContract/treeJobs.cjs +31 -0
  147. package/texContract/treeJobs.d.cts +3 -0
  148. package/texContract/turnSession.cjs +90 -0
  149. package/texContract/turnSession.d.cts +19 -0
  150. package/texContract/turnWords.cjs +90 -0
  151. package/texContract/turnWords.d.cts +9 -0
  152. package/texContract/uploadImages.cjs +131 -0
  153. package/texContract/uploadImages.d.cts +13 -0
  154. package/texContract/v2Names.cjs +41 -0
  155. package/texContract/v2SearchFetch.cjs +316 -0
  156. package/texContract/v2Translate.cjs +123 -0
  157. package/texContract/vaultTools.cjs +112 -0
  158. package/texContract/vaultTools.d.cts +15 -0
  159. package/texContract/yesWords.cjs +91 -0
  160. package/texShared/argumentCoercion.cjs +93 -0
  161. package/texShared/cellComments.cjs +122 -0
  162. package/texShared/cellComments.d.cts +21 -0
  163. package/texShared/comments.cjs +586 -0
  164. package/texShared/comments.d.cts +115 -0
  165. package/texShared/contentTypes.cjs +85 -0
  166. package/texShared/fileKinds.cjs +123 -0
  167. package/texShared/flags.cjs +159 -0
  168. package/texShared/flags.d.cts +23 -0
  169. package/texShared/folderJobInfo.cjs +301 -0
  170. package/texShared/folderJobInfo.d.cts +40 -0
  171. package/texShared/folderRoles.cjs +512 -0
  172. package/texShared/folderRoles.d.cts +73 -0
  173. package/texShared/githubOidc.ts +98 -0
  174. package/texShared/groupRunQuestions.cjs +98 -0
  175. package/texShared/groupRunQuestions.d.cts +4 -0
  176. package/texShared/inboxFolders.cjs +49 -0
  177. package/texShared/inboxFolders.d.cts +5 -0
  178. package/texShared/ink/drawing.cjs +474 -0
  179. package/texShared/ink/texFigure.cjs +252 -0
  180. package/texShared/ink/texFigure.d.cts +36 -0
  181. package/texShared/ink/texPoses.cjs +180 -0
  182. package/texShared/ink/texPoses.d.cts +20 -0
  183. package/texShared/jobPartEnd.cjs +133 -0
  184. package/texShared/jobPartEnd.d.cts +13 -0
  185. package/texShared/jobResume.cjs +31 -0
  186. package/texShared/jobResume.d.cts +5 -0
  187. package/texShared/jobSplit.cjs +90 -0
  188. package/texShared/jobSplit.d.cts +6 -0
  189. package/texShared/jobStart.cjs +56 -0
  190. package/texShared/jobStart.d.cts +9 -0
  191. package/texShared/mail.cjs +400 -0
  192. package/texShared/mail.d.cts +56 -0
  193. package/texShared/messageAnchors.cjs +38 -0
  194. package/texShared/models/aiKeys.cjs +137 -0
  195. package/texShared/models/aiKeys.d.cts +42 -0
  196. package/texShared/models/aiKeys.json +56 -0
  197. package/texShared/models/creditRest.cjs +269 -0
  198. package/texShared/models/promptBudget.cjs +295 -0
  199. package/texShared/models/promptSections.cjs +29 -0
  200. package/texShared/noteAppLink.cjs +23 -0
  201. package/texShared/notePreview.cjs +219 -0
  202. package/texShared/notePreview.d.cts +21 -0
  203. package/texShared/pages/blocks.cjs +215 -0
  204. package/texShared/pages/cover.cjs +164 -0
  205. package/texShared/pages/css.cjs +181 -0
  206. package/texShared/pages/cssBlocks.cjs +264 -0
  207. package/texShared/pages/draw.cjs +212 -0
  208. package/texShared/pages/drawRich.cjs +232 -0
  209. package/texShared/pages/html.cjs +168 -0
  210. package/texShared/pages/inline.cjs +251 -0
  211. package/texShared/pages/layout.cjs +76 -0
  212. package/texShared/pages/parse.cjs +418 -0
  213. package/texShared/pages/render.cjs +200 -0
  214. package/texShared/pages/skill.cjs +147 -0
  215. package/texShared/pages/skill.d.cts +5 -0
  216. package/texShared/pages/templates.cjs +336 -0
  217. package/texShared/r2Store.cjs +163 -0
  218. package/texShared/remoteImage.cjs +177 -0
  219. package/texShared/routines.cjs +656 -0
  220. package/texShared/routines.d.cts +86 -0
  221. package/texShared/servedListing.cjs +250 -0
  222. package/texShared/servedListing.d.cts +17 -0
  223. package/texShared/sheetCsv.cjs +566 -0
  224. package/texShared/sheetCsv.d.cts +91 -0
  225. package/texShared/storageLayout.cjs +88 -0
  226. package/texShared/storeKeys.cjs +144 -0
  227. package/texShared/toolArguments.cjs +323 -0
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The shapes of the keys Tex's Durable Objects keep, and whose object each one
3
+ * names: pure rules both the gateway (`apps/mcp/src/store/texRouting.js`,
4
+ * `privacy/engine.js`) and Tex read, so Tex reaches none of the gateway's
5
+ * modules for them (`docs/decisions/texting-assistant/tex-service.md`).
6
+ *
7
+ * Moved verbatim; the gateway's modules re-export these, so every caller and
8
+ * test there is unchanged.
9
+ */
10
+ "use strict";
11
+
12
+ /**
13
+ * The same id key kept in Tex's Durable Object instead of the bucket
14
+ * (`texStore/keys.js`): `tex/<owner>/notes/<noteId>.md`, the owner
15
+ * `person:<workspaceId>` or `chat:<chatId>`. A row whose key has this form
16
+ * keeps its note's text there (decided by the owner, 2026-10-31).
17
+ */
18
+ const TEX_KEY = /^tex\/(?:person|chat):[A-Za-z0-9_-]{1,64}\/(?:notes|files)\/[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}(?:\.[^/]*)?$/;
19
+
20
+ function isTexKey(key) {
21
+ return typeof key === "string" && TEX_KEY.test(key);
22
+ }
23
+
24
+ /**
25
+ * A group chat's own state in its Durable Object, not a note:
26
+ * tex/chat:<chatKey>/state/<64 hex>.json (its memory record, a rebuildable
27
+ * cache of the visible memory note; `agent/chatMemoryRecord.js`). Only a chat
28
+ * owns one, never a person; no row ever names it, so it is plumbing, and never
29
+ * an id key.
30
+ */
31
+ const TEX_STATE_KEY = /^tex\/chat:[A-Za-z0-9_-]{1,64}\/state\/[0-9a-f]{64}\.json$/;
32
+
33
+ function isTexStateKey(key) {
34
+ return typeof key === "string" && TEX_STATE_KEY.test(key);
35
+ }
36
+
37
+ /**
38
+ * Whether `error` is the gateway's refusal of a Tex key it cannot serve (`TexStoreUnavailable` in
39
+ * `apps/mcp/src/store/texRouting.js`: another workspace's owner, or no way to reach the object), by its name.
40
+ */
41
+ function isTexStoreUnavailable(error) {
42
+ return error instanceof Error && error.name === "TexStoreUnavailable";
43
+ }
44
+
45
+ /** The `.context/agent/` folders a person's Tex bookkeeping lives under, in their object. */
46
+ const AGENT_HOME_FOLDERS = ["history", "turns", "running", "cancel", "steer", "go"];
47
+ const AGENT_HOME = /^\.context\/agent\/(history|turns|running|cancel|steer|go)\/((?:[A-Za-z0-9_-][A-Za-z0-9_.-]{0,127}\/){0,2}[A-Za-z0-9_-][A-Za-z0-9_.-]{0,127})$/;
48
+ const AGENT_HOME_PREFIX = /^\.context\/agent\/(history|turns|running|cancel|steer|go)\/((?:[A-Za-z0-9_-][A-Za-z0-9_.-]{0,127}\/){0,2})$/;
49
+
50
+ /** Whether `key` is a person's Tex bookkeeping, kept in their object (`state/agent/...`). No `..`, no empty segment. */
51
+ function isAgentHomeKey(key) {
52
+ return typeof key === "string" && AGENT_HOME.test(key) && !key.includes("..");
53
+ }
54
+
55
+ /** `{owner, key}` for a Tex key or a chat's state key: whose object, and the key inside it. */
56
+ function splitTexKey(key) {
57
+ if (!isTexKey(key) && !isTexStateKey(key)) return null;
58
+ const cut = key.indexOf("/", "tex/".length);
59
+ return { owner: key.slice("tex/".length, cut), key: key.slice(cut + 1) };
60
+ }
61
+
62
+ /**
63
+ * Whether a call goes to a Tex Durable Object rather than the bucket, by the
64
+ * same rules as `withTexRouting`: a person's bookkeeping key, a Tex or chat
65
+ * state key, or (for a listing, `prefix: true`) a prefix under either. For
66
+ * timing only (`agent/texTiming.js`); the routing itself decides access.
67
+ */
68
+ function goesToObject(key, { prefix = false } = {}) {
69
+ if (typeof key !== "string" || key.includes("..")) return false;
70
+ if (prefix) return AGENT_HOME_PREFIX.test(key) || /^tex\/(?:person|chat):[A-Za-z0-9_-]{1,64}\//.test(key);
71
+ return isAgentHomeKey(key) || splitTexKey(key) !== null;
72
+ }
73
+
74
+ /** The Tex key for an id key kept in `owner`'s object. */
75
+ function texKeyFor(owner, idKey) {
76
+ const key = `tex/${owner}/${idKey}`;
77
+ if (!isTexKey(key)) throw new TypeError("not an id key, or not an owner");
78
+ return key;
79
+ }
80
+
81
+ /** A group chat's state key: `name` is 64 hex (a SHA-256), kept in that chat's object alone. */
82
+ function texStateKeyFor(chat, name) {
83
+ const key = ["tex", `chat:${chat}`, "state", `${name}.json`].join("/");
84
+ if (!isTexStateKey(key)) throw new TypeError("not a chat, or not a state name");
85
+ return key;
86
+ }
87
+
88
+ module.exports = {
89
+ TEX_KEY,
90
+ isTexKey,
91
+ isTexStateKey,
92
+ isTexStoreUnavailable,
93
+ AGENT_HOME_FOLDERS,
94
+ AGENT_HOME_PREFIX,
95
+ isAgentHomeKey,
96
+ splitTexKey,
97
+ goesToObject,
98
+ texKeyFor,
99
+ texStateKeyFor,
100
+ };
@@ -0,0 +1,13 @@
1
+ /** Types for `texKeys.cjs`; see that file. */
2
+
3
+ export declare const TEX_KEY: RegExp;
4
+ export declare function isTexKey(key: unknown): boolean;
5
+ export declare function isTexStateKey(key: unknown): boolean;
6
+ export declare function isTexStoreUnavailable(error: unknown): boolean;
7
+ export declare const AGENT_HOME_FOLDERS: string[];
8
+ export declare const AGENT_HOME_PREFIX: RegExp;
9
+ export declare function isAgentHomeKey(key: unknown): boolean;
10
+ export declare function splitTexKey(key: unknown): { owner: string; key: string } | null;
11
+ export declare function goesToObject(key: unknown, options?: { prefix?: boolean }): boolean;
12
+ export declare function texKeyFor(owner: string, idKey: string): string;
13
+ export declare function texStateKeyFor(chat: string, name: string): string;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Tex's number: the one line people are told to text. It is configuration, not code: each deployment reads it from its
3
+ * own `TEX_NUMBER` setting (an E.164 number), so this public repository carries no real line and moving Tex to a new
4
+ * line changes no source. Tex's own copy is `packages/tex/src/texNumber.cjs` in Supa-Media/tex.
5
+ */
6
+ "use strict";
7
+
8
+ /** The configured number when it is one E.164 number, else null (unset, or anything that isn't a number). */
9
+ function readTexNumber(value) {
10
+ const number = typeof value === "string" ? value.trim() : "";
11
+ return /^\+[1-9]\d{6,14}$/.test(number) ? number : null;
12
+ }
13
+
14
+ /** "+1 (415) 555-0100" for a US number; any other number as given. */
15
+ function formatNumber(number) {
16
+ const us = /^\+1(\d{3})(\d{3})(\d{4})$/.exec(String(number));
17
+ return us ? `+1 (${us[1]}) ${us[2]}-${us[3]}` : String(number);
18
+ }
19
+
20
+ module.exports = { readTexNumber, formatNumber };
@@ -0,0 +1,3 @@
1
+ /** Types for `texNumber.cjs`; see that file. */
2
+ export declare function readTexNumber(value: unknown): string | null;
3
+ export declare function formatNumber(number: string): string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The `source`s of a text Tex sends on its own (`sentOnItsOwn.js`): each has a gateway note beside it, so readers
3
+ * show the note and drop the linked text event. The gateway's conversations page reads the same set.
4
+ */
5
+
6
+ /** The `source` of a text Tex sent on its own, outside a reply to a text: these have a gateway note beside them. */
7
+ const OWN_SOURCES = new Set(["checkin", "routine", "ping", "update", "job", "new_line", "notice"]);
8
+
9
+ module.exports = { OWN_SOURCES };
@@ -0,0 +1,3 @@
1
+ /** Types for `texOwnSources.cjs`; see that file. */
2
+
3
+ export declare const OWN_SOURCES: Set<string>;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Every setting that changes what Tex does, once (Dev2, 2026-11-12; `docs/decisions/texting-assistant/settings-by-text.md`),
3
+ * as data: where it applies, whether Tex changes it from a text and with which `send` action, or where in the app it
4
+ * changes. The app's settings page has a switch for each `setting` row. The rows are `texSettings.generated.json`,
5
+ * written by `scripts/tex-contract/snapshot.mjs`; Tex's own copy, with each row's title and line, is
6
+ * `packages/tex/src/texSettings.cjs` in Supa-Media/tex.
7
+ */
8
+ "use strict";
9
+
10
+ const SNAPSHOT = require("./texSettings.generated.json");
11
+
12
+ /** Where a setting applies: a person's own chat with Tex, and a group chat. */
13
+ const WHERE = Object.freeze([...SNAPSHOT.where]);
14
+
15
+ const TEX_SETTINGS = Object.freeze(SNAPSHOT.settings.map((row) => Object.freeze({ ...row, where: Object.freeze([...row.where]) })));
16
+
17
+ /** The row for a key, or null. */
18
+ function texSetting(key) {
19
+ return TEX_SETTINGS.find((row) => row.key === key) ?? null;
20
+ }
21
+
22
+ module.exports = { TEX_SETTINGS, WHERE, texSetting };
@@ -0,0 +1,20 @@
1
+ /** Types for `texSettings.cjs`; see that file. Data only: the titles and lines are Tex's. */
2
+
3
+ export type TexSettingWhere = "1:1" | "group";
4
+
5
+ export interface TexSetting {
6
+ key: string;
7
+ /** The settings page section it sits in. */
8
+ section: string;
9
+ where: readonly TexSettingWhere[];
10
+ /** Whether Tex changes it from a text. */
11
+ byText: boolean;
12
+ /** The `send` action that changes it, when `byText`. */
13
+ via?: string;
14
+ /** Where in the app it changes, when it doesn't by text. */
15
+ appPath?: string;
16
+ }
17
+
18
+ export declare const TEX_SETTINGS: readonly TexSetting[];
19
+ export declare const WHERE: readonly TexSettingWhere[];
20
+ export declare function texSetting(key: string): TexSetting | null;
@@ -0,0 +1,25 @@
1
+ {
2
+ "where": [
3
+ "1:1",
4
+ "group"
5
+ ],
6
+ "settings": [
7
+ {"key":"talk","section":"Tex","where":["1:1","group"],"byText":true,"via":"tex_instructions"},
8
+ {"key":"checkins","section":"Tex","where":["1:1"],"byText":true,"via":"setting"},
9
+ {"key":"quiet_hours","section":"Tex","where":["1:1"],"byText":true,"via":"setting"},
10
+ {"key":"pings","section":"Tex","where":["1:1"],"byText":true,"via":"setting"},
11
+ {"key":"overnight","section":"Tex","where":["1:1"],"byText":true,"via":"setting"},
12
+ {"key":"tidy","section":"Tex","where":["1:1"],"byText":true,"via":"setting"},
13
+ {"key":"name","section":"Profile","where":["1:1"],"byText":true,"via":"account_name"},
14
+ {"key":"review_sharing","section":"Tex","where":["1:1"],"byText":true,"via":"review_sharing"},
15
+ {"key":"vault","section":"Vault","where":["1:1","group"],"byText":true,"via":"vault_access"},
16
+ {"key":"vault_delete","section":"Vault","where":["1:1","group"],"byText":false,"appPath":"Context app → Vault, on the right rail (on a phone, in your account menu)"},
17
+ {"key":"computers","section":"Tex","where":["1:1","group"],"byText":true,"via":"computers"},
18
+ {"key":"mute","section":"Group chats","where":["group"],"byText":true,"via":"chat_mute"},
19
+ {"key":"chat_mail","section":"Group chats","where":["group"],"byText":true,"via":"chat_share_mail"},
20
+ {"key":"chat_calendar","section":"Group chats","where":["group"],"byText":true,"via":"chat_share_calendar"},
21
+ {"key":"workspaces","section":"Group chats","where":["1:1","group"],"byText":true,"via":"chat_add_everyone"},
22
+ {"key":"apps","section":"Tex","where":["1:1"],"byText":false,"appPath":"Context app → Settings → Apps Tex uses → Disconnect"},
23
+ {"key":"features","section":"Tex","where":["1:1"],"byText":false,"appPath":"Not changeable: the Context team turns these on"}
24
+ ]
25
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Tex's state files in a person's workspace, and the action that writes each (rule 3 of Tex's tool rules). The control
3
+ * plane keeps only these names on a turn's record (`apps/convex/functions/agentTurns.ts`). Data only: Tex's own copy,
4
+ * with what each holds, is `packages/tex/src/toolRules.cjs` in Supa-Media/tex.
5
+ */
6
+ "use strict";
7
+
8
+ const TEX_STATE_FILES = Object.freeze([
9
+ { file: "tex/heartbeat.md", action: "setting" },
10
+ { file: "tex/attention.md", action: "setting" },
11
+ { file: "tex/voice.md", action: "write" },
12
+ { file: "tex/routines/", action: "write" },
13
+ { file: "tex/about.md", action: "remember" },
14
+ ].map(Object.freeze));
15
+
16
+ /** The state file a note path is, or null: `tex/routines/daily/x.md` is `tex/routines/`. */
17
+ function stateFileOf(path) {
18
+ const clean = String(path ?? "").replace(/^\/+/, "");
19
+ return TEX_STATE_FILES.find((entry) => (entry.file.endsWith("/") ? clean.startsWith(entry.file) : clean === entry.file)) ?? null;
20
+ }
21
+
22
+ module.exports = { TEX_STATE_FILES, stateFileOf };
@@ -0,0 +1,9 @@
1
+ /** Types for `texStateFiles.cjs`; see that file. */
2
+ export interface TexStateFile {
3
+ /** A note path, or a folder ending in `/`. */
4
+ file: string;
5
+ /** The action that writes it. */
6
+ action: string;
7
+ }
8
+ export declare const TEX_STATE_FILES: readonly TexStateFile[];
9
+ export declare function stateFileOf(path: string): TexStateFile | null;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Tex's model steps, as the contract carries them (`texSteps.generated.json`, written by
3
+ * `scripts/tex-contract/snapshot.mjs` from Tex's config). The staff console's AI costs page groups spend by these ids.
4
+ * Same shape as Tex's own `texSteps.cjs`, which reads its config live.
5
+ */
6
+ "use strict";
7
+
8
+ const SNAPSHOT = require("./texSteps.generated.json");
9
+
10
+ const TEX_STEPS = Object.freeze(SNAPSHOT.steps.map((step) => Object.freeze({ ...step })));
11
+ /** Each step that is on and the model key it falls back to. */
12
+ const FALLBACKS = Object.freeze(SNAPSHOT.fallbacks.map((pair) => Object.freeze([...pair])));
13
+
14
+ /**
15
+ * The first step that is on and runs this model key, or else falls back to it, or else any step (off included) that
16
+ * runs it, so spend from before a step was turned off still lands on Tex; null when none does.
17
+ */
18
+ function texStepForModel(model) {
19
+ const step = TEX_STEPS.find((s) => s.on && s.model === model);
20
+ if (step) return step.id;
21
+ const falls = FALLBACKS.find(([, key]) => key === model);
22
+ if (falls) return falls[0];
23
+ const off = TEX_STEPS.find((s) => s.model === model);
24
+ return off ? off.id : null;
25
+ }
26
+
27
+ module.exports = { TEX_STEPS, FALLBACKS, texStepForModel };
@@ -0,0 +1,14 @@
1
+ /** Types for `texSteps.cjs`; see that file. */
2
+
3
+ export interface TexStepDef {
4
+ /** The Tex config node id. */
5
+ id: string;
6
+ label: string;
7
+ /** The Tex config model key. */
8
+ model: string;
9
+ on: boolean;
10
+ }
11
+
12
+ export declare const TEX_STEPS: readonly TexStepDef[];
13
+ export declare const FALLBACKS: readonly (readonly [step: string, model: string])[];
14
+ export declare function texStepForModel(model: string): string | null;
@@ -0,0 +1,41 @@
1
+ {
2
+ "steps": [
3
+ {"id":"decide","label":"Decide","model":"clef","on":true},
4
+ {"id":"decideWhy","label":"Decide's reason","model":"clef","on":true},
5
+ {"id":"fd","label":"Front door","model":"haiku-5-5","on":true},
6
+ {"id":"advisor","label":"Advisor","model":"sonnet-5-5","on":true},
7
+ {"id":"mail","label":"Mail checker","model":"haiku-5-5","on":true},
8
+ {"id":"card","label":"Card check","model":"haiku-5-5","on":true},
9
+ {"id":"job","label":"Background job","model":"haiku-5-5","on":true},
10
+ {"id":"handback","label":"Hand-back judge","model":"haiku-5-5","on":true},
11
+ {"id":"egress","label":"Egress judge","model":"haiku-5-5","on":true},
12
+ {"id":"picture","label":"Picture maker","model":"gemini","on":true},
13
+ {"id":"shapeGate","label":"Shape gate","model":"clef","on":false},
14
+ {"id":"jobadv","label":"Job advisor","model":"sonnet-5-5","on":true},
15
+ {"id":"learn","label":"Learn","model":"haiku-5-5","on":true},
16
+ {"id":"afterReply","label":"After the reply","model":"haiku-5-5","on":true},
17
+ {"id":"answerCheck","label":"Answer check","model":"haiku-5-5","on":true},
18
+ {"id":"reviewer","label":"Reply reviewer","model":"haiku-5-5","on":true},
19
+ {"id":"recheck","label":"Still answers them?","model":"clef","on":true},
20
+ {"id":"chatDays","label":"Chat day summaries","model":"haiku-5-5","on":true},
21
+ {"id":"moveJudge","label":"Move judge","model":"haiku-5-5","on":true},
22
+ {"id":"stickerLook","label":"Sticker look","model":"haiku-5-5","on":true},
23
+ {"id":"askGate","label":"Before asking","model":"clef-flash","on":true},
24
+ {"id":"connect","label":"Connect notes","model":"haiku-5-5","on":false},
25
+ {"id":"noteRun","label":"Tex in a note","model":"haiku-5-5","on":true},
26
+ {"id":"mailRun","label":"Tex in mail","model":"haiku-5-5","on":true},
27
+ {"id":"nudgeOffer","label":"Nudge","model":"haiku-5-5","on":false},
28
+ {"id":"quietCheck","label":"Quiet check","model":"haiku-5-5","on":true},
29
+ {"id":"checkinResearch","label":"Research","model":"haiku-5-5","on":true},
30
+ {"id":"groupCard","label":"Group card","model":"haiku-5-5","on":true},
31
+ {"id":"friendCheck","label":"Friend check","model":"haiku-5-5","on":true},
32
+ {"id":"guestNames","label":"Guest names","model":"haiku-5-5","on":true},
33
+ {"id":"dream","label":"Dream","model":"haiku-5-5","on":true},
34
+ {"id":"daysum","label":"Day summaries","model":"haiku-5-5","on":true},
35
+ {"id":"housekeep","label":"Housekeeping","model":"haiku-5-5","on":true},
36
+ {"id":"aboutCheck","label":"Recheck About me","model":"sonnet-5-5","on":true}
37
+ ],
38
+ "fallbacks": [
39
+
40
+ ]
41
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Names both sides of the Tex store read: what a person's texted turn's desk reads from their chat's ledger
3
+ * (`apps/mcp/src/texStore/desk.js`) and the history and conversations files a chat's Tex object answers as views of
4
+ * its ledger (`apps/mcp/src/texStore/historyView.js`). Both of those re-export them; Tex's code reads them here.
5
+ */
6
+
7
+ /** A person's one-to-one chat with Tex is one ledger, whichever line they text on, as their history record is. */
8
+ const ONE_TO_ONE_CHAT = "texts";
9
+ /** The reads whose arguments a slim read keeps: where a page, search or note came from, for the reads index (`agent/readsIndex.js` `INDEXED_READS`). */
10
+ const READ_ARGS_KEPT = Object.freeze(["open_page", "search_web", "browse", "read_note", "read_notes"]);
11
+ /**
12
+ * The newest page of the person's one-to-one chat's ledger, slim, that the
13
+ * desk answers beside the record (`agent/ledgerHistory.js`): the whole chat a
14
+ * texted turn is shown, in the same call.
15
+ */
16
+ const DESK_LEDGER = Object.freeze({ chat: ONE_TO_ONE_CHAT, options: Object.freeze({ before: Number.MAX_SAFE_INTEGER, kinds: Object.freeze(["text", "note", "tool", "reply", "day"]), limit: 2_000, slim: true, keepArgs: READ_ARGS_KEPT }) });
17
+
18
+ /** What the object keeps under the history file's key: this, and nothing of the chat. */
19
+ const HISTORY_VIEW_MARKER = '{"tex-history-view":1}';
20
+ /** The file's name, in a person's `tex/` and in each group chat's home. */
21
+ const HISTORY_FILE = "history.ledger.json";
22
+ /** The chat's conversations, as a second view beside it (`historyView.js`). */
23
+ const CONVERSATIONS_FILE = "conversations.ledger.json";
24
+ const CONVERSATIONS_VIEW_MARKER = '{"tex-conversations-view":1}';
25
+
26
+ module.exports = { ONE_TO_ONE_CHAT, READ_ARGS_KEPT, DESK_LEDGER, HISTORY_VIEW_MARKER, HISTORY_FILE, CONVERSATIONS_FILE, CONVERSATIONS_VIEW_MARKER };
@@ -0,0 +1,12 @@
1
+ /** Types for `texStoreNames.cjs`; see that file. */
2
+
3
+ export declare const ONE_TO_ONE_CHAT: string;
4
+ export declare const READ_ARGS_KEPT: readonly string[];
5
+ export declare const DESK_LEDGER: {
6
+ readonly chat: string;
7
+ readonly options: { readonly before: number; readonly kinds: readonly string[]; readonly limit: number; readonly slim: boolean; readonly keepArgs: readonly string[] };
8
+ };
9
+ export declare const HISTORY_VIEW_MARKER: string;
10
+ export declare const HISTORY_FILE: string;
11
+ export declare const CONVERSATIONS_FILE: string;
12
+ export declare const CONVERSATIONS_VIEW_MARKER: string;