@supa-media/tex-contract 0.0.0-stage → 0.2.7
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/LICENSE +21 -0
- package/README.md +11 -2
- package/package.json +16 -4
- package/texContract/aboutLines.cjs +117 -0
- package/texContract/aboutLines.d.cts +14 -0
- package/texContract/aboutNoteLimits.cjs +41 -0
- package/texContract/aboutNoteLimits.d.cts +5 -0
- package/texContract/actionManual.cjs +104 -0
- package/texContract/activityHint.cjs +40 -0
- package/texContract/activityHint.d.cts +4 -0
- package/texContract/asks.cjs +16 -0
- package/texContract/asks.d.cts +6 -0
- package/texContract/asksToFile.cjs +20 -0
- package/texContract/asksToFile.d.cts +2 -0
- package/texContract/attention.cjs +138 -0
- package/texContract/attention.d.cts +20 -0
- package/texContract/browserHandback.cjs +13 -0
- package/texContract/browserHandback.d.cts +3 -0
- package/texContract/browserOwner.cjs +31 -0
- package/texContract/browserOwner.d.cts +2 -0
- package/texContract/bytes.cjs +12 -0
- package/texContract/chatHistoryPath.cjs +38 -0
- package/texContract/chatHistoryPath.d.cts +5 -0
- package/texContract/chatLedger.cjs +91 -0
- package/texContract/chatLedger.d.cts +21 -0
- package/texContract/computerTool.cjs +102 -0
- package/texContract/computerTool.d.cts +16 -0
- package/texContract/consentYes.cjs +22 -0
- package/texContract/consentYes.d.cts +5 -0
- package/texContract/contextGateway.cjs +52 -0
- package/texContract/contextGateway.d.cts +19 -0
- package/texContract/deskEligible.cjs +20 -0
- package/texContract/deskEligible.d.cts +3 -0
- package/texContract/downloads.cjs +129 -0
- package/texContract/downloads.d.cts +15 -0
- package/texContract/egressLedger.cjs +114 -0
- package/texContract/egressLedger.d.cts +14 -0
- package/texContract/emailRead.cjs +38 -0
- package/texContract/emailRead.d.cts +5 -0
- package/texContract/eventWords.cjs +35 -0
- package/texContract/eventWords.d.cts +4 -0
- package/texContract/fileParts.cjs +43 -0
- package/texContract/fileParts.d.cts +6 -0
- package/texContract/fileTables.cjs +243 -0
- package/texContract/fileWords.cjs +169 -0
- package/texContract/folded.cjs +16 -0
- package/texContract/folded.d.cts +3 -0
- package/texContract/googleAiAccess.cjs +12 -0
- package/texContract/googleAiAccess.d.cts +2 -0
- package/texContract/graphWires.cjs +18 -0
- package/texContract/graphWires.d.cts +5 -0
- package/texContract/groupSession.cjs +28 -0
- package/texContract/groupSession.d.cts +7 -0
- package/texContract/guestNames.cjs +136 -0
- package/texContract/guestNames.d.cts +35 -0
- package/texContract/heard.cjs +19 -0
- package/texContract/heard.d.cts +4 -0
- package/texContract/heldOffer.cjs +57 -0
- package/texContract/heldOffer.d.cts +8 -0
- package/texContract/helperCallers.cjs +29 -0
- package/texContract/helperCallers.d.cts +4 -0
- package/texContract/identity.cjs +179 -0
- package/texContract/identity.d.cts +8 -0
- package/texContract/jobLogEntries.cjs +93 -0
- package/texContract/jobLogEntries.d.cts +12 -0
- package/texContract/judgedActions.cjs +20 -0
- package/texContract/judgedActions.d.cts +4 -0
- package/texContract/labSandboxGate.cjs +63 -0
- package/texContract/labSandboxGate.d.cts +9 -0
- package/texContract/ledgerReadChars.cjs +4 -0
- package/texContract/ledgerReadChars.d.cts +3 -0
- package/texContract/mailCheck.cjs +90 -0
- package/texContract/mailCheck.d.cts +12 -0
- package/texContract/mailEntries.cjs +64 -0
- package/texContract/mailEntries.d.cts +13 -0
- package/texContract/mailHealth.cjs +60 -0
- package/texContract/mailHealth.d.cts +10 -0
- package/texContract/notePath.cjs +99 -0
- package/texContract/notePath.d.cts +4 -0
- package/texContract/noteRunFacts.cjs +136 -0
- package/texContract/noteRunFacts.d.cts +32 -0
- package/texContract/objectEtag.cjs +84 -0
- package/texContract/objectEtag.d.cts +4 -0
- package/texContract/objectPlace.cjs +32 -0
- package/texContract/objectPlace.d.cts +5 -0
- package/texContract/pageJobs.cjs +226 -0
- package/texContract/pageJobs.d.cts +13 -0
- package/texContract/pdfLinks.cjs +135 -0
- package/texContract/pdfLinks.d.cts +4 -0
- package/texContract/personHub.cjs +38 -0
- package/texContract/personHub.d.cts +5 -0
- package/texContract/personNameText.cjs +18 -0
- package/texContract/personNameText.d.cts +3 -0
- package/texContract/pinnedContext.cjs +12 -0
- package/texContract/pinnedContext.d.cts +3 -0
- package/texContract/quietHoursWindow.cjs +36 -0
- package/texContract/quietHoursWindow.d.cts +3 -0
- package/texContract/scopeClamp.cjs +117 -0
- package/texContract/scopeClamp.d.cts +5 -0
- package/texContract/scopes.cjs +29 -0
- package/texContract/scopes.d.cts +7 -0
- package/texContract/searchSettings.cjs +54 -0
- package/texContract/searchSettings.d.cts +6 -0
- package/texContract/settingHabits.cjs +87 -0
- package/texContract/settingHabits.d.cts +20 -0
- package/texContract/settingsNotes.cjs +217 -0
- package/texContract/settingsNotes.d.cts +26 -0
- package/texContract/shownEmail.cjs +181 -0
- package/texContract/texClients.cjs +53 -0
- package/texContract/texClients.d.cts +12 -0
- package/texContract/texGraph.cjs +593 -0
- package/texContract/texGraph.d.cts +55 -0
- package/texContract/texKeys.cjs +100 -0
- package/texContract/texKeys.d.cts +13 -0
- package/texContract/texOwnSources.cjs +9 -0
- package/texContract/texOwnSources.d.cts +3 -0
- package/texContract/texStoreNames.cjs +26 -0
- package/texContract/texStoreNames.d.cts +12 -0
- package/texContract/texStoreWire.cjs +306 -0
- package/texContract/texStoreWire.d.cts +32 -0
- package/texContract/threadsFold.cjs +75 -0
- package/texContract/threadsFold.d.cts +22 -0
- package/texContract/toolActions.cjs +253 -0
- package/texContract/toolCatalog.cjs +49 -0
- package/texContract/toolCatalog.generated.json +90 -0
- package/texContract/toolContract.cjs +52 -0
- package/texContract/toolContract.d.cts +12 -0
- package/texContract/toolShapes.cjs +14 -0
- package/texContract/transcription.cjs +101 -0
- package/texContract/transcription.d.cts +3 -0
- package/texContract/treeJobs.cjs +31 -0
- package/texContract/treeJobs.d.cts +3 -0
- package/texContract/turnSession.cjs +90 -0
- package/texContract/turnSession.d.cts +19 -0
- package/texContract/turnWords.cjs +90 -0
- package/texContract/turnWords.d.cts +9 -0
- package/texContract/uploadImages.cjs +131 -0
- package/texContract/uploadImages.d.cts +13 -0
- package/texContract/v2Names.cjs +41 -0
- package/texContract/v2SearchFetch.cjs +316 -0
- package/texContract/v2Translate.cjs +123 -0
- package/texContract/vaultTools.cjs +112 -0
- package/texContract/vaultTools.d.cts +15 -0
- package/texContract/yesWords.cjs +91 -0
- package/texShared/argumentCoercion.cjs +93 -0
- package/texShared/cellComments.cjs +122 -0
- package/texShared/cellComments.d.cts +21 -0
- package/texShared/comments.cjs +586 -0
- package/texShared/comments.d.cts +115 -0
- package/texShared/contentTypes.cjs +85 -0
- package/texShared/fileKinds.cjs +123 -0
- package/texShared/flags.cjs +124 -0
- package/texShared/flags.d.cts +21 -0
- package/texShared/folderJobInfo.cjs +301 -0
- package/texShared/folderJobInfo.d.cts +40 -0
- package/texShared/folderRoles.cjs +512 -0
- package/texShared/folderRoles.d.cts +73 -0
- package/texShared/githubOidc.ts +98 -0
- package/texShared/groupRunQuestions.cjs +98 -0
- package/texShared/groupRunQuestions.d.cts +4 -0
- package/texShared/inboxFolders.cjs +49 -0
- package/texShared/inboxFolders.d.cts +5 -0
- package/texShared/ink/drawing.cjs +474 -0
- package/texShared/ink/texFigure.cjs +252 -0
- package/texShared/ink/texFigure.d.cts +36 -0
- package/texShared/ink/texPoses.cjs +180 -0
- package/texShared/ink/texPoses.d.cts +20 -0
- package/texShared/jobPartEnd.cjs +133 -0
- package/texShared/jobPartEnd.d.cts +13 -0
- package/texShared/jobResume.cjs +31 -0
- package/texShared/jobResume.d.cts +5 -0
- package/texShared/jobSplit.cjs +90 -0
- package/texShared/jobSplit.d.cts +6 -0
- package/texShared/jobStart.cjs +56 -0
- package/texShared/jobStart.d.cts +9 -0
- package/texShared/mail.cjs +400 -0
- package/texShared/mail.d.cts +56 -0
- package/texShared/messageAnchors.cjs +38 -0
- package/texShared/models/aiKeys.cjs +137 -0
- package/texShared/models/aiKeys.d.cts +42 -0
- package/texShared/models/aiKeys.json +56 -0
- package/texShared/models/creditRest.cjs +269 -0
- package/texShared/models/promptBudget.cjs +295 -0
- package/texShared/models/promptSections.cjs +29 -0
- package/texShared/noteAppLink.cjs +23 -0
- package/texShared/notePreview.cjs +219 -0
- package/texShared/notePreview.d.cts +21 -0
- package/texShared/pages/blocks.cjs +215 -0
- package/texShared/pages/cover.cjs +164 -0
- package/texShared/pages/css.cjs +181 -0
- package/texShared/pages/cssBlocks.cjs +264 -0
- package/texShared/pages/draw.cjs +212 -0
- package/texShared/pages/drawRich.cjs +232 -0
- package/texShared/pages/html.cjs +168 -0
- package/texShared/pages/inline.cjs +251 -0
- package/texShared/pages/layout.cjs +76 -0
- package/texShared/pages/parse.cjs +418 -0
- package/texShared/pages/render.cjs +200 -0
- package/texShared/pages/skill.cjs +147 -0
- package/texShared/pages/skill.d.cts +5 -0
- package/texShared/pages/templates.cjs +336 -0
- package/texShared/r2Store.cjs +163 -0
- package/texShared/remoteImage.cjs +177 -0
- package/texShared/routines.cjs +656 -0
- package/texShared/routines.d.cts +86 -0
- package/texShared/servedListing.cjs +250 -0
- package/texShared/servedListing.d.cts +17 -0
- package/texShared/sheetCsv.cjs +566 -0
- package/texShared/sheetCsv.d.cts +91 -0
- package/texShared/storageLayout.cjs +88 -0
- package/texShared/storeKeys.cjs +144 -0
- package/texShared/toolArguments.cjs +323 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Every v2 action, and the existing tool that carries it out.
|
|
4
|
+
*
|
|
5
|
+
* A v2 call (`write`, `manage`, `send`, `search`, `fetch`) is translated into
|
|
6
|
+
* one call of an existing tool before anything else happens (`translate.js`),
|
|
7
|
+
* so routing, the write gate, the egress gate, argument validation and audit
|
|
8
|
+
* all see exactly the call they saw before v2 and decide it the same way.
|
|
9
|
+
* Nothing here decides authority: a table entry only says which tool an
|
|
10
|
+
* action is, and how its arguments are spelled there.
|
|
11
|
+
*
|
|
12
|
+
* Adding a capability is adding a row. `orient` renders this table as the
|
|
13
|
+
* live manual, and the tool's own description and schema (what the row's
|
|
14
|
+
* `tool` advertises) are the reference for its arguments.
|
|
15
|
+
*
|
|
16
|
+
* Tools whose existence is masked from most callers (`EXISTENCE_MASKED_TOOLS`)
|
|
17
|
+
* are deliberately absent: an action name is listed to everybody, so mapping
|
|
18
|
+
* one would publish what the mask hides.
|
|
19
|
+
*/
|
|
20
|
+
const { actionOf } = require("./toolContract.cjs");
|
|
21
|
+
|
|
22
|
+
/** Top-level `write` fields, merged under the action's own `args`. */
|
|
23
|
+
function withNote(call, extra = {}) {
|
|
24
|
+
const inner = call.args || {};
|
|
25
|
+
const out = { ...inner, ...extra };
|
|
26
|
+
// A field left blank beside args is not given: a client that fills every field it is shown sends `content: ""` next to
|
|
27
|
+
// the args that carry the real content (Grok, 2026-11-25), and that blank took its place. A blank path or etag names
|
|
28
|
+
// nothing; a blank content alone is still a note emptied on purpose.
|
|
29
|
+
const blank = (value) => typeof value === "string" && value.trim() === "";
|
|
30
|
+
for (const key of ["path", "content", "expected_etag"]) {
|
|
31
|
+
const value = call[key];
|
|
32
|
+
if (value === undefined) continue;
|
|
33
|
+
if (blank(value) && (key !== "content" || inner.content !== undefined)) continue;
|
|
34
|
+
out[key] = value;
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** `rows`: path and etag may ride beside the call or inside args; the rest is the change. */
|
|
40
|
+
function sheetRows(call) {
|
|
41
|
+
const { path, expected_etag: etag, ...rows } = call.args || {};
|
|
42
|
+
const out = { rows };
|
|
43
|
+
const filled = (value) => (typeof value === "string" && value.trim() === "" ? undefined : value);
|
|
44
|
+
const where = filled(call.path) ?? path;
|
|
45
|
+
if (where !== undefined) out.path = where;
|
|
46
|
+
const expected = filled(call.expected_etag) ?? etag;
|
|
47
|
+
if (expected !== undefined) out.expected_etag = expected;
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* `mail`'s args without the fields left blank: every one of them (join, text, to, kind, device) means nothing as
|
|
53
|
+
* `""`, and a client that fills every field it is shown sends `text: ""` beside `join` (Grok, 2026-11-25), which
|
|
54
|
+
* read as a join and a send at once.
|
|
55
|
+
*/
|
|
56
|
+
function filledMail(args) {
|
|
57
|
+
if (!args || typeof args !== "object" || Array.isArray(args)) return args;
|
|
58
|
+
return Object.fromEntries(Object.entries(args).filter(([, value]) => value !== null && !(typeof value === "string" && value.trim() === "")));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** `{ path, <key>: args }`: the write_note sub-objects (comment, mail, site, upload). */
|
|
62
|
+
function nested(key) {
|
|
63
|
+
return (call) => {
|
|
64
|
+
const out = { [key]: (key === "mail" ? filledMail(call.args) : call.args) || {} };
|
|
65
|
+
if (call.path !== undefined) out.path = call.path;
|
|
66
|
+
return out;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* `manage website`: write_note's `site`, whose path is required but names no
|
|
72
|
+
* page (every site action is about the whole website). manage takes no path
|
|
73
|
+
* of its own, so one given in `args` moves beside `site`, and none means the
|
|
74
|
+
* website's home page.
|
|
75
|
+
*/
|
|
76
|
+
function website(call) {
|
|
77
|
+
const { path, ...site } = call.args || {};
|
|
78
|
+
return { path: path ?? "website/index.md", site };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The action's `args`, as the tool's own arguments. */
|
|
82
|
+
const plain = (call) => ({ ...(call.args || {}) });
|
|
83
|
+
|
|
84
|
+
const ACTIONS = {
|
|
85
|
+
write: {
|
|
86
|
+
save: { tool: "write_note", summary: "Create or replace a note (the default).", take: (call) => withNote(call) },
|
|
87
|
+
save_many: {
|
|
88
|
+
tool: "write_notes",
|
|
89
|
+
summary: "Create or replace up to 100 notes in one call, each saved exactly as save saves it.",
|
|
90
|
+
take: plain,
|
|
91
|
+
// Never a listed tool: `callToolForSession` turns the call into one `write` per note (`saveMany.js`).
|
|
92
|
+
// This is only the shape `orient` describes its arguments from.
|
|
93
|
+
carrier: {
|
|
94
|
+
name: "write_notes",
|
|
95
|
+
description:
|
|
96
|
+
"Save up to 100 notes in one call: args { notes: [{ path, content, expected_etag? }] }. Each note is saved exactly as " +
|
|
97
|
+
"write saves one (new or replaced, with expected_etag catching a concurrent edit), and the answer has one outcome line " +
|
|
98
|
+
"per note, in order. A note that is refused is reported beside the ones that saved; nothing is rolled back. " +
|
|
99
|
+
"A call that runs long stops starting saves and marks the rest NOT_STARTED: send just those again. " +
|
|
100
|
+
"Name each path once; to change visibility or add images, use save on that note.",
|
|
101
|
+
inputSchema: {
|
|
102
|
+
type: "object",
|
|
103
|
+
properties: {
|
|
104
|
+
notes: {
|
|
105
|
+
type: "array",
|
|
106
|
+
minItems: 1,
|
|
107
|
+
maxItems: 100,
|
|
108
|
+
items: {
|
|
109
|
+
type: "object",
|
|
110
|
+
properties: { path: { type: "string" }, content: { type: "string" }, expected_etag: { type: "string" } },
|
|
111
|
+
required: ["path", "content"],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
required: ["notes"],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
comment: { tool: "write_note", summary: "Comment on words in a note, reply, resolve or delete.", take: nested("comment") },
|
|
120
|
+
rows: { tool: "write_note", summary: "Add, change or delete rows of a sheet (.csv): args { append } or { update: { match, set } } or { delete: { match } }.", take: sheetRows },
|
|
121
|
+
mail: { tool: "write_note", summary: "Join a note's mail or send mail to agents working on it.", take: nested("mail") },
|
|
122
|
+
upload: {
|
|
123
|
+
tool: "write_note",
|
|
124
|
+
summary: "Get upload commands for image files too big to send inline.",
|
|
125
|
+
// write_note's `upload` is a list, so it travels as `args.files`.
|
|
126
|
+
take: (call) => ({ ...(call.path !== undefined ? { path: call.path } : {}), upload: call.args?.files }),
|
|
127
|
+
},
|
|
128
|
+
remember: { tool: "remember", summary: "Save one durable fact about the person.", take: plain },
|
|
129
|
+
answer: { tool: "submit_form", summary: "Answer a Markdown form.", take: (call) => withNote(call) },
|
|
130
|
+
update_answer: { tool: "update_submission", summary: "Replace your answer to a form.", take: (call) => withNote(call) },
|
|
131
|
+
retract_answer: { tool: "retract_submission", summary: "Delete your answer to a form.", take: (call) => withNote(call) },
|
|
132
|
+
vote: { tool: "vote_form", summary: "Upvote, or take back a vote on, a form answer.", take: (call) => withNote(call) },
|
|
133
|
+
save_session: { tool: "save_context", summary: "Save what mattered from this session before it ends.", take: (call) => withNote(call) },
|
|
134
|
+
report_problem: { tool: "report_problem", summary: "Tell Context's builders something in Context is broken.", take: plain },
|
|
135
|
+
},
|
|
136
|
+
manage: {
|
|
137
|
+
move: { tool: "move_note", summary: "Move or rename one note, also into another workspace.", take: plain },
|
|
138
|
+
move_many: { tool: "move_notes", summary: "Move up to 100 notes at once, all or none.", take: plain },
|
|
139
|
+
move_folder: { tool: "move_folder", summary: "Move or rename a folder and everything in it.", take: plain },
|
|
140
|
+
archive: { tool: "archive_note", summary: "Move a note into the archive (there is no delete).", take: plain },
|
|
141
|
+
visibility: { tool: "set_visibility", summary: "Make one note private or team, or name people who may open it.", take: plain },
|
|
142
|
+
folder_visibility: { tool: "set_folder_visibility", summary: "Make a folder private, team or inherited.", take: plain },
|
|
143
|
+
encrypt: { tool: "set_encryption", summary: "Encrypt or decrypt one note.", take: plain },
|
|
144
|
+
suggest_destination: { tool: "suggest_destination", summary: "Rank which workspace a note belongs in.", take: plain },
|
|
145
|
+
website: { tool: "write_note", summary: "Check, publish, screenshot or roll back the website, or set its domain.", take: website },
|
|
146
|
+
share_link: { tool: "create_link", summary: "Make a link to a note or folder (owners only).", take: plain },
|
|
147
|
+
revoke_link: { tool: "revoke_link", summary: "Turn a link off.", take: plain },
|
|
148
|
+
vault_add: { tool: "vault_add_link", summary: "Get a link where the person saves a login, secret or card. A login fills only on its site, so never guess the site from the name: unless they gave the address, search_web the company and what it's for first (theCut the barber app is thecut.co, not thecut.com) and name the domain of the result that is that company. When they ask you to save a login, send the link at once: never ask first which email they sign in with, since they fill that in on the link.", take: plain },
|
|
149
|
+
vault_share: { tool: "vault_share_link", summary: "Get a link to give a saved login to another member.", take: plain },
|
|
150
|
+
vault_view: { tool: "vault_view_link", summary: "Get a link where the person sees a saved entry.", take: plain },
|
|
151
|
+
create_workspace: {
|
|
152
|
+
tool: "create_workspace",
|
|
153
|
+
summary: "Create a shared workspace the person owns; dry_run checks the @handle is free.",
|
|
154
|
+
take: plain,
|
|
155
|
+
},
|
|
156
|
+
invite: {
|
|
157
|
+
tool: "invite_member",
|
|
158
|
+
summary: "Invite people into a shared workspace the person owns; they are emailed once the person says yes.",
|
|
159
|
+
take: plain,
|
|
160
|
+
},
|
|
161
|
+
layout: { tool: "apply_layout", summary: "Lay down a workspace's starting folders, or add one built-in folder.", take: plain },
|
|
162
|
+
folder_job: {
|
|
163
|
+
tool: "apply_layout",
|
|
164
|
+
summary: "Choose which folder does a built-in job (path), make its folder, or take an optional job away (remove).",
|
|
165
|
+
take: (call) => Object.fromEntries(["job", "path", "remove"].filter((key) => call.args?.[key] !== undefined).map((key) => [key, call.args[key]])),
|
|
166
|
+
},
|
|
167
|
+
connect_google: { tool: "connect_google", summary: "Get the link where the person connects Gmail or Calendar.", take: plain },
|
|
168
|
+
connect: { tool: "connect_app", summary: "Get the link where the person connects an app fetch apps: lists, through its own approval screen.", take: plain },
|
|
169
|
+
dream_now: { tool: "dream_now", summary: "Start Tex's dream now: it rewrites tex/about.md (owner only).", take: plain },
|
|
170
|
+
run_model: {
|
|
171
|
+
tool: "run_model",
|
|
172
|
+
summary: "Run one Workers AI model for the Architecture Lab (clef or glm-4.7-flash) on a JSON input; staff only, not for Tex.",
|
|
173
|
+
take: plain,
|
|
174
|
+
},
|
|
175
|
+
area: {
|
|
176
|
+
tool: "set_area",
|
|
177
|
+
summary: "Set an area's owner, its delegate (the one bot or Tex acting for a person owner there), modes, approval rules or metric, or a bot's card or webhook; or, from a bot's own main chat, setup_bot: \"<its name>\" for its whole setup in one call (bind_bot only binds); or, from a bot, start_helper: { task } before it starts Claude Code or another agent for deep work, and end_helper to end one.",
|
|
178
|
+
take: plain,
|
|
179
|
+
},
|
|
180
|
+
fill_dates: { tool: "fill_dates", summary: "Fill every empty date created / date modified from each note's history, once (owner only).", take: plain },
|
|
181
|
+
pair_device: {
|
|
182
|
+
tool: "pair_device",
|
|
183
|
+
summary: "Approve the code this session's own computer shows, so it gets note mail at once (mail only, never jobs).",
|
|
184
|
+
take: plain,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
send: {
|
|
188
|
+
api: {
|
|
189
|
+
tool: "vault_list",
|
|
190
|
+
summary: "Call an API with a key from the vault; the key is added for you and never shown.",
|
|
191
|
+
take: (call) => ({ fetch: call.args || {} }),
|
|
192
|
+
},
|
|
193
|
+
email: {
|
|
194
|
+
tool: "send_email",
|
|
195
|
+
summary: "Show one email for a yes: the call sends nothing, and only the yes of whoever it goes from sends that exact email.",
|
|
196
|
+
take: plain,
|
|
197
|
+
},
|
|
198
|
+
email_draft: {
|
|
199
|
+
tool: "save_email_draft",
|
|
200
|
+
summary: "Save one email as a draft in the person's Gmail, for them to send; nothing is sent.",
|
|
201
|
+
take: plain,
|
|
202
|
+
},
|
|
203
|
+
notify: {
|
|
204
|
+
tool: "notify_me",
|
|
205
|
+
summary: "Have Tex text the person now: they asked to be told, or it is an emergency. Their settings may hold it.",
|
|
206
|
+
take: plain,
|
|
207
|
+
},
|
|
208
|
+
slack: {
|
|
209
|
+
tool: "slack_api",
|
|
210
|
+
summary:
|
|
211
|
+
"Call one Slack Web API method through the connected Slack; a post waits for the person's yes to its words. " +
|
|
212
|
+
"Find someone: users.list {match: their name or email}, which reads every active person at once. " +
|
|
213
|
+
"DM someone: chat.postMessage {channel: their user id or the email they use in that Slack, text}. " +
|
|
214
|
+
"Post in a channel: chat.postMessage {channel: \"#name\", text}; reply in a thread: add thread_ts (the message's ts). " +
|
|
215
|
+
"Read a channel: conversations.history {channel: \"#name\"}, newest first, with names; a thread: conversations.replies {channel, ts}. " +
|
|
216
|
+
"Find channels: conversations.list {match}; search: search.messages {query}; react: reactions.add {channel, timestamp, name}. " +
|
|
217
|
+
"Mention someone in text as <@their user id>. If Slack says a permission is missing, ask them to reconnect Slack in Settings.",
|
|
218
|
+
take: plain,
|
|
219
|
+
},
|
|
220
|
+
app: {
|
|
221
|
+
tool: "app_change",
|
|
222
|
+
summary: "Make one change through an app the person connected (app, tool, arguments), once they say yes to it.",
|
|
223
|
+
take: plain,
|
|
224
|
+
},
|
|
225
|
+
google_chat: {
|
|
226
|
+
tool: "google_chat",
|
|
227
|
+
summary:
|
|
228
|
+
"Send one Google Chat message as the person: to (a person's work email) for a direct message, or space (its name in Chat) " +
|
|
229
|
+
"for a space, with text. They are asked for a 👍 to the exact message, so just call it. action spaces lists their spaces. " +
|
|
230
|
+
"Use this, never the browser, for Google Chat; if it says to reconnect, give them the link from manage connect_google (kind gmail).",
|
|
231
|
+
take: plain,
|
|
232
|
+
},
|
|
233
|
+
calendar: {
|
|
234
|
+
tool: "calendar_event",
|
|
235
|
+
summary:
|
|
236
|
+
"Add, edit, move, cancel or RSVP to one event on the person's Google Calendar. Their own events change at once; one with guests " +
|
|
237
|
+
"(or an RSVP) is shown to them for one 👍, so just call it. edit finds the event by its exact title and start (fetch calendar: shows both) " +
|
|
238
|
+
"and changes any of new_title, new_start + new_end, location, notes, add_guests, remove_guests, meet, reminders, recurrence; " +
|
|
239
|
+
"all_events: true for every time a repeating one happens. Never tell them to change an event themselves.",
|
|
240
|
+
take: plain,
|
|
241
|
+
},
|
|
242
|
+
forward_rule: {
|
|
243
|
+
tool: "forward_rule",
|
|
244
|
+
summary: "Let a routine keep forwarding one kind of the person's mail to one address without asking, once they 👍 the rule; or stop it.",
|
|
245
|
+
take: plain,
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/** The v2 tools whose calls carry an `action`. */
|
|
251
|
+
const ACTION_TOOLS = new Set(Object.keys(ACTIONS));
|
|
252
|
+
|
|
253
|
+
module.exports = { ACTIONS, ACTION_TOOLS, actionOf };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Context's tool catalog as Tex reads it: the snapshot `scripts/tex-tool-catalog.mjs` writes from the gateway's
|
|
4
|
+
* registry (`toolCatalog.generated.json`), and the pure readings over it Tex's turn takes (which tools write, the
|
|
5
|
+
* scope sets, an alias's canonical name, one shape of a listed set).
|
|
6
|
+
*
|
|
7
|
+
* Nothing here decides authority. The gateway's dispatcher validates, canonicalises and refuses every call Tex makes,
|
|
8
|
+
* as it does for any MCP client, and what a person is offered is their own `tools/list`. A tool the snapshot names
|
|
9
|
+
* that the gateway has since removed is refused at the door; one the gateway added that the snapshot lacks is only
|
|
10
|
+
* not known here by name.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const SNAPSHOT = require("./toolCatalog.generated.json");
|
|
14
|
+
|
|
15
|
+
const { toolsOfShapeBy } = require("./toolShapes.cjs");
|
|
16
|
+
|
|
17
|
+
/** The readings over one catalog (`definitions`, the scope sets as arrays, `aliases` as an object). */
|
|
18
|
+
function catalogOf(data) {
|
|
19
|
+
const definitions = Object.freeze(data.definitions.map((tool) => Object.freeze(tool)));
|
|
20
|
+
const byName = new Map(definitions.map((tool) => [tool.name, tool]));
|
|
21
|
+
const aliases = new Map(Object.entries(data.aliases ?? {}));
|
|
22
|
+
const PRIVATE_TIER_ONLY_TOOLS = new Set(data.privateTierOnly);
|
|
23
|
+
const STAFF_ONLY_TOOLS = new Set(data.staffOnly);
|
|
24
|
+
const UNLISTED_TOOLS = new Set(data.unlisted);
|
|
25
|
+
const V2_TOOLS = new Set(data.v2);
|
|
26
|
+
const V2_ONLY_TOOLS = new Set(data.v2Only);
|
|
27
|
+
return {
|
|
28
|
+
PRIVATE_TIER_ONLY_TOOLS,
|
|
29
|
+
STAFF_ONLY_TOOLS,
|
|
30
|
+
UNLISTED_TOOLS,
|
|
31
|
+
V2_TOOLS,
|
|
32
|
+
V2_ONLY_TOOLS,
|
|
33
|
+
/** Every definition, each a fresh copy as the registry's own `toolDefinitions()` hands them out. */
|
|
34
|
+
toolDefinitions: () => structuredClone(definitions),
|
|
35
|
+
/** The definition a name (alias resolved) has, or null. Not a copy: read it, never change it. */
|
|
36
|
+
definitionOf: (name) => byName.get(aliases.get(name) ?? name) ?? null,
|
|
37
|
+
/** The name a tool is known by: an alias resolved, any other name unchanged. */
|
|
38
|
+
canonicalToolName: (name) => aliases.get(name) ?? name,
|
|
39
|
+
/** An unknown tool counts as writing, as the registry's own check does: a gate never fails open on a name. */
|
|
40
|
+
toolIsWriting: (name) => byName.get(name)?.annotations?.readOnlyHint !== true,
|
|
41
|
+
/** One shape of a listed set, as the gateway reads it (`tools/advertised.js` `toolsOfShape`). */
|
|
42
|
+
toolsOfShape: (all, shape) => toolsOfShapeBy({ unlisted: UNLISTED_TOOLS, v2: V2_TOOLS, v2Only: V2_ONLY_TOOLS }, all, shape),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The catalog Tex carries. */
|
|
47
|
+
const toolCatalog = catalogOf(SNAPSHOT);
|
|
48
|
+
|
|
49
|
+
module.exports = { catalogOf, toolCatalog, toolsOfShapeBy };
|