@witbitz/sdk 0.0.0-stage → 4.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.
- package/LICENSE +21 -0
- package/README.md +20 -2
- package/a2aCore.js +200 -0
- package/a2aShared.js +27 -0
- package/accountErase.js +223 -0
- package/accountIndexDoc.js +122 -0
- package/accountOwner.js +59 -0
- package/accountRecord.js +90 -0
- package/accountScope.js +114 -0
- package/accountSeal.js +42 -0
- package/accountStores.js +173 -0
- package/acctV2App.js +619 -0
- package/acctV2Check.js +29 -0
- package/acctV2Client.js +382 -0
- package/acctV2Keys.js +43 -0
- package/acctV2Legacy.js +14 -0
- package/acctV2Switch.js +80 -0
- package/acctV2UiCore.js +857 -0
- package/acctV2WebAuthn.js +61 -0
- package/acctV2Wire.js +59 -0
- package/address.js +42 -0
- package/attestedBox.js +30 -0
- package/attestedRooms.js +78 -0
- package/awsKey.js +98 -0
- package/backupRecord.js +106 -0
- package/backupVault.js +97 -0
- package/blocks.js +115 -0
- package/blocksPush.js +64 -0
- package/browseSeal.js +103 -0
- package/cbor.js +225 -0
- package/changePush.js +75 -0
- package/chatLock.js +149 -0
- package/chatLockSw.js +13 -0
- package/cloudDeviceBuilds.js +11 -0
- package/cloudDevicePins.js +33 -0
- package/cloudDeviceSeal.js +53 -0
- package/codeBrowse.js +224 -0
- package/codeCloud.js +652 -0
- package/codeCloudKeys.js +112 -0
- package/codeCommands.js +167 -0
- package/codeComputers.js +388 -0
- package/codeEgress.js +123 -0
- package/codeFilesRoutes.js +17 -0
- package/codeMkdir.js +8 -0
- package/codeModes.js +57 -0
- package/codeOrphanKeys.js +42 -0
- package/codeOutputs.js +141 -0
- package/codeRelay.js +505 -0
- package/codeSentinel.js +86 -0
- package/codeTransport.js +295 -0
- package/codeUndo.js +48 -0
- package/compress.js +24 -0
- package/config.js +11 -0
- package/connCatalog.js +164 -0
- package/connDisp.js +76 -0
- package/connOtherWays.js +74 -0
- package/connPending.js +16 -0
- package/connWrap.js +53 -0
- package/connectionEntry.js +89 -0
- package/connections.js +562 -0
- package/credits.js +30 -0
- package/csAttest.js +112 -0
- package/decrypt.html +384 -0
- package/deviceAttest.js +521 -0
- package/deviceCall.js +54 -0
- package/deviceKeyCore.js +41 -0
- package/deviceSeal.js +59 -0
- package/e2ee.js +323 -0
- package/eat.js +103 -0
- package/emailFork.js +275 -0
- package/emailSignIn.js +81 -0
- package/emptySpaces.js +111 -0
- package/encSource.js +55 -0
- package/enclaveAccept.js +214 -0
- package/enclaveClaim.js +241 -0
- package/enclaveRoute.js +102 -0
- package/enclaveSnapshotMerge.js +44 -0
- package/entrySig.js +165 -0
- package/env.js +73 -0
- package/eraseFile.js +58 -0
- package/followImage.js +86 -0
- package/healNames.js +45 -0
- package/idb.js +97 -0
- package/idbSeal.js +119 -0
- package/indexGone.js +12 -0
- package/invite.js +51 -0
- package/inviteEnroll.js +67 -0
- package/inviteSend.js +68 -0
- package/jobAgents.js +87 -0
- package/keptMerge.js +84 -0
- package/l1-worker-src.js +2 -0
- package/l1-worker.js +831 -0
- package/laneConfig.js +57 -0
- package/laneLinkCore.js +177 -0
- package/ledgerView.js +64 -0
- package/manifest.json +220 -0
- package/mcpRecommended.js +25 -0
- package/memberChange.js +123 -0
- package/mkseal.js +101 -0
- package/nativePush.js +153 -0
- package/nitroVerify.js +220 -0
- package/noble-p256.js +27 -0
- package/notice.js +116 -0
- package/notifKey.js +58 -0
- package/offlineBundle.js +62 -0
- package/ohttp.js +177 -0
- package/opencodeWire.js +282 -0
- package/oprf.js +70 -0
- package/ownAgentLink.js +96 -0
- package/ownerPolicy.js +117 -0
- package/package.json +254 -4
- package/pollVerdict.js +33 -0
- package/prefetchPoll.js +60 -0
- package/protectedLocal.js +410 -0
- package/pushCore.js +42 -0
- package/recovery.js +107 -0
- package/regions.js +42 -0
- package/removedMessage.js +11 -0
- package/renameRefusal.js +9 -0
- package/replyQuote.js +34 -0
- package/reqEnvelope.js +126 -0
- package/roomDefaultPrefs.js +76 -0
- package/roomDelete.js +109 -0
- package/roomName.js +177 -0
- package/roomPass.js +256 -0
- package/roomRoster.js +289 -0
- package/roomSettings.js +61 -0
- package/roomState.js +58 -0
- package/roomStreamClient.js +115 -0
- package/rosterCount.js +49 -0
- package/rosterHash.js +13 -0
- package/rowSchema.js +113 -0
- package/safeMedia.js +116 -0
- package/safeMediaPins.js +17 -0
- package/schedulesDoc.js +78 -0
- package/sdkA2A.js +404 -0
- package/sdkAccount.js +470 -0
- package/sdkAccountDoc.js +81 -0
- package/sdkAccountSections.js +223 -0
- package/sdkAgui.js +141 -0
- package/sdkAttest.js +34 -0
- package/sdkBackup.js +480 -0
- package/sdkBackupV2.js +630 -0
- package/sdkBrowserPrivate.js +28 -0
- package/sdkBuilds.js +208 -0
- package/sdkCloudDevice.js +215 -0
- package/sdkComputers.js +480 -0
- package/sdkDictation.js +142 -0
- package/sdkErase.js +283 -0
- package/sdkExports.js +69 -0
- package/sdkInvitations.js +34 -0
- package/sdkKeptAgent.js +188 -0
- package/sdkLaneLink.js +205 -0
- package/sdkPlan.js +94 -0
- package/sdkProtect.js +228 -0
- package/sdkRedact.js +36 -0
- package/sdkRekey.js +307 -0
- package/sdkReport.js +68 -0
- package/sdkSafeMedia.js +255 -0
- package/sdkSchedules.js +39 -0
- package/sdkSpeech.js +54 -0
- package/sdkTurn.js +117 -0
- package/sdkVault.js +124 -0
- package/sealShare.js +18 -0
- package/sealedNames.js +64 -0
- package/sealedReceipt.js +17 -0
- package/sentinelRelease.js +154 -0
- package/shamir.js +85 -0
- package/sharedViews.js +38 -0
- package/sheetChrome.js +450 -0
- package/siri.js +171 -0
- package/spaceClient.js +1418 -0
- package/spaceConfig.js +81 -0
- package/spaceEmailGate.js +813 -0
- package/spaceExport.js +125 -0
- package/spaceFork.js +216 -0
- package/spaceLock.js +358 -0
- package/spacePasskey.js +180 -0
- package/speechOut.js +100 -0
- package/splitKeyClient.js +90 -0
- package/store.js +587 -0
- package/streamHint.js +36 -0
- package/sttCloud.js +220 -0
- package/sttWorklet.js +38 -0
- package/sw-notif-core.js +538 -0
- package/tempList.js +48 -0
- package/tinfoilVerifier.js +78 -0
- package/toolBooks.js +31 -0
- package/toolRules.js +52 -0
- package/turnCerts.js +254 -0
- package/turnFeed.js +58 -0
- package/turnVerdict.js +36 -0
- package/usageReceipts.js +176 -0
- package/usageSummary.js +90 -0
- package/util.js +181 -0
- package/vault-core.js +1958 -0
- package/vault-kit.mjs +354 -0
- package/vault-screens.js +263 -0
- package/vaultAtRest.js +177 -0
- package/vaultCoreLock.js +111 -0
- package/vaultCorePush.js +140 -0
- package/vaultDeviceKey.js +95 -0
- package/vaultEnclaveHandoff.js +114 -0
- package/vaultKeep.js +281 -0
- package/vaultSealedStore.js +77 -0
- package/vaultWorkerHost.js +98 -0
- package/vcWorker.js +34 -0
- package/voiceAttest.js +50 -0
- package/voiceCert.js +51 -0
- package/witbitz-admin.d.ts +135 -0
- package/witbitz-admin.js +529 -0
- package/witbitz-admin.mjs +1459 -0
- package/witbitz-sdk.d.ts +1106 -0
- package/witbitz-sdk.js +3835 -0
- package/workerClient.js +16 -0
- package/workerLiveness.js +21 -0
- package/x509.js +218 -0
package/codeTransport.js
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
// codeTransport.js — how the Code section reaches OpenCode. Two interchangeable transports behind one shape, so the rest
|
|
2
|
+
// of opencodeApp.js never knows which it is using (docs/opencode-relay.md §5):
|
|
3
|
+
//
|
|
4
|
+
// relay — the normal path: a sealed WebSocket to the connector on a paired computer (codeRelay.js). No server address,
|
|
5
|
+
// no password in the page, no third-party origin in the CSP.
|
|
6
|
+
// direct — development only: fetch + SSE straight to an OpenCode server the page can reach (http://127.0.0.1:4096).
|
|
7
|
+
//
|
|
8
|
+
// t.request(method, pathWithQuery, bodyObject?) → { ok, status, json, text }
|
|
9
|
+
// t.subscribe(pathWithQuery, onEvent) → stop() (onEvent gets each parsed OpenCode event)
|
|
10
|
+
// t.status() → 'online' | 'connecting' | 'offline'
|
|
11
|
+
// t.onChange(fn) t.kick() t.close()
|
|
12
|
+
import { RelayPeer } from './codeRelay.js'
|
|
13
|
+
import { makeSseParser } from './opencodeWire.js'
|
|
14
|
+
|
|
15
|
+
const parse = (text) => { try { return text ? JSON.parse(text) : null } catch { return null } }
|
|
16
|
+
const rid = () => Array.from(crypto.getRandomValues(new Uint8Array(9)), (b) => b.toString(36).padStart(2, '0')).join('')
|
|
17
|
+
|
|
18
|
+
// ── direct ───────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
19
|
+
export function directTransport({ base, pass, fetchImpl = (...a) => fetch(...a) }) {
|
|
20
|
+
const root = String(base || '').replace(/\/+$/, '')
|
|
21
|
+
const auth = () => (pass ? { authorization: 'Basic ' + btoa('opencode:' + pass) } : {})
|
|
22
|
+
return {
|
|
23
|
+
kind: 'direct',
|
|
24
|
+
label: root,
|
|
25
|
+
status: () => 'online',
|
|
26
|
+
onChange: () => () => {},
|
|
27
|
+
can: () => false, // Auto mode lives in the connector — a direct server has none
|
|
28
|
+
autoSessions: () => [],
|
|
29
|
+
onAuto: () => () => {},
|
|
30
|
+
onProgress: () => () => {}, // the confidential-model proxy lives in the connector too
|
|
31
|
+
setAuto: () => false,
|
|
32
|
+
setBrowsePrivate: () => false,
|
|
33
|
+
askTools: async () => null, // a direct server has no connector to look
|
|
34
|
+
kick: () => {},
|
|
35
|
+
close: () => {},
|
|
36
|
+
async request(method, p, body) {
|
|
37
|
+
const init = { method, headers: { ...auth(), ...(body !== undefined ? { 'content-type': 'application/json' } : {}) } }
|
|
38
|
+
if (body !== undefined) init.body = JSON.stringify(body)
|
|
39
|
+
const r = await fetchImpl(root + p, init) // a network failure throws — the caller explains it
|
|
40
|
+
const text = await r.text().catch(() => '')
|
|
41
|
+
return { ok: r.ok, status: r.status, json: parse(text), text }
|
|
42
|
+
},
|
|
43
|
+
subscribe(p, onEvent, onError = () => {}) {
|
|
44
|
+
const ctrl = new AbortController()
|
|
45
|
+
;(async () => {
|
|
46
|
+
let r
|
|
47
|
+
try { r = await fetchImpl(root + p, { headers: { ...auth(), accept: 'text/event-stream' }, signal: ctrl.signal }) }
|
|
48
|
+
catch (err) { if (!ctrl.signal.aborted) onError(err); return }
|
|
49
|
+
if (!r.ok || !r.body) { onError(new Error(`event stream ${r.status}`)); return }
|
|
50
|
+
const feed = makeSseParser(onEvent)
|
|
51
|
+
const reader = r.body.getReader()
|
|
52
|
+
const dec = new TextDecoder()
|
|
53
|
+
try { for (;;) { const { done, value } = await reader.read(); if (done) break; feed(dec.decode(value, { stream: true })) } }
|
|
54
|
+
catch { /* aborted, or the server went away */ }
|
|
55
|
+
})()
|
|
56
|
+
return () => ctrl.abort()
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ── relay ────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
62
|
+
const PEERS_WAIT_MS = 3_000 // a relay that never says who is on the channel: offline after this, not "connecting" for good
|
|
63
|
+
const HELLO_FRESH_MS = 30_000 // the connector says hello every 20 s while someone is here
|
|
64
|
+
const WAIT_ONLINE_MS = 8_000 // a request made while connecting waits this long for the computer
|
|
65
|
+
const REQUEST_TIMEOUT_MS = 35_000 // the connector's own timeout is 30 s
|
|
66
|
+
const RESUB_MS = 30_000 // the connector drops a subscription nobody renewed for 75 s
|
|
67
|
+
const GIVE_UP_MS = 60_000
|
|
68
|
+
const SILENT_MS = 50_000 // an "open" socket with a computer on it but no hello for this long is a dead path: redial
|
|
69
|
+
const WAKE_GAP_MS = 15_000 // the 5-second tick went this long without running: the page was frozen in the background
|
|
70
|
+
const WAKE_WAIT_MS = 4_000 // back from the background: how long the computer has to answer before "offline" may show
|
|
71
|
+
|
|
72
|
+
export function relayTransport({ computer, WebSocketImpl, now = () => Date.now() }) {
|
|
73
|
+
const listeners = new Set()
|
|
74
|
+
const pending = new Map() // id → { resolve, timer, resend: (() => void) | null }
|
|
75
|
+
const subs = new Map() // path → Set(onEvent)
|
|
76
|
+
let lastHello = 0
|
|
77
|
+
// The connector's nonce for its CURRENT socket (sealed in its hello). Every request carries it; a request recorded before
|
|
78
|
+
// the connector restarted carries a stale one and is refused there (replay protection across restarts).
|
|
79
|
+
let nonce = ''
|
|
80
|
+
let lastHelloTs = 0 // a replayed OLD hello (earlier ts) must not move this page back onto a dead nonce
|
|
81
|
+
// This device's id for its event-stream interest, so one device leaving never closes a stream another is reading.
|
|
82
|
+
const cid = rid()
|
|
83
|
+
let last = 'connecting'
|
|
84
|
+
// Auto mode (docs/code-auto-mode.md §5): what the connector says it can do, which sessions it decides for, and its verdicts.
|
|
85
|
+
let caps = []
|
|
86
|
+
let omitted = [] // what the connector leaves out on purpose (its hello's `omits`): no update adds it (state machines pass 9, C#8)
|
|
87
|
+
let autoList = []
|
|
88
|
+
const autoListeners = new Set()
|
|
89
|
+
const toolWaiters = [] // askTools() calls waiting for the computer's {t:'tools'} answer
|
|
90
|
+
const tellAuto = (e) => { for (const fn of autoListeners) { try { fn(e) } catch { /* */ } } }
|
|
91
|
+
const progressListeners = new Set() // what a confidential model is doing (codeProgress.js)
|
|
92
|
+
// The enclave's own report of the agent's browser, which rides its hello beside `egress` and `agent`
|
|
93
|
+
// (vm/main.go, docs/cloud-computer.md § 12). A local computer never sends one, and then this stays null.
|
|
94
|
+
const browseListeners = new Set()
|
|
95
|
+
let browseState = null
|
|
96
|
+
// The egress story rides the same hello, and the browser's row needs it: free browsing is reported there, by the
|
|
97
|
+
// same state the enclave's own decision reads (vm/policy.go freeReport). Kept beside `browse` and announced with
|
|
98
|
+
// it, so the row cannot show one of the two as stale.
|
|
99
|
+
let egressState = null
|
|
100
|
+
let resubTimer = 0
|
|
101
|
+
let freshTimer = 0
|
|
102
|
+
|
|
103
|
+
let openedAt = 0
|
|
104
|
+
// The relay says who is on the channel only just AFTER the socket opens. Counting the page alone before then said
|
|
105
|
+
// "offline" for a moment on every open (the owner: "I get this brief red warning. It is transient and shouldnt show up").
|
|
106
|
+
let peersKnown = false
|
|
107
|
+
// ★ BACK FROM THE BACKGROUND. iOS freezes the page with its socket still "open"; on return the computer's last hello is
|
|
108
|
+
// old because nothing ran, not because the computer left — and the first tick said offline before anyone had asked it
|
|
109
|
+
// again (the owner: "When I switch apps and return to spaces I get this transient red notice"). A frozen tick, or the
|
|
110
|
+
// page saying it is visible again (kick), asks the computer and holds "offline" back until it has had time to answer.
|
|
111
|
+
let lastTick = now()
|
|
112
|
+
let wokeAt = -Infinity
|
|
113
|
+
const status = () => {
|
|
114
|
+
if (!peer.isOpen) return 'connecting' // still dialling the relay (or retrying)
|
|
115
|
+
if (peer.peers >= 2 && now() - lastHello < HELLO_FRESH_MS) return 'online'
|
|
116
|
+
if (now() - lastTick > WAKE_GAP_MS || now() - wokeAt < WAKE_WAIT_MS) return 'connecting' // just back: asking again
|
|
117
|
+
if (peer.peers < 2) return !peersKnown && now() - openedAt < PEERS_WAIT_MS ? 'connecting' : 'offline' // alone on the channel: the computer is not running
|
|
118
|
+
// Someone else is here but has not said hello — maybe the computer is just answering, maybe it is only another of
|
|
119
|
+
// your devices. Give it a moment, then call it offline.
|
|
120
|
+
return now() - openedAt < 5_000 ? 'connecting' : 'offline'
|
|
121
|
+
}
|
|
122
|
+
let giveUpTimer = 0
|
|
123
|
+
const changed = () => {
|
|
124
|
+
const s = status()
|
|
125
|
+
if (s === last) return
|
|
126
|
+
last = s
|
|
127
|
+
clearTimeout(giveUpTimer)
|
|
128
|
+
if (s === 'online') { resubscribe(); for (const e of pending.values()) if (e.resend) e.resend() }
|
|
129
|
+
// A turn waiting on a computer that went away would leave the page "busy" forever. After a minute offline, every
|
|
130
|
+
// request that cannot be safely re-asked resolves as failed; reads stay pending and re-ask when it returns.
|
|
131
|
+
if (s === 'offline') giveUpTimer = setTimeout(() => {
|
|
132
|
+
for (const [id, e] of pending) if (!e.resend) { pending.delete(id); clearTimeout(e.timer); e.resolve({ ok: false, status: 0, json: null, text: 'offline' }) }
|
|
133
|
+
}, GIVE_UP_MS)
|
|
134
|
+
for (const fn of listeners) { try { fn(s) } catch { /* */ } }
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function onHello(m) {
|
|
138
|
+
// A hello OLDER than the last one is a replay (the relay can record and resend frames): ignore it, or the page would
|
|
139
|
+
// move back onto a nonce the connector no longer accepts.
|
|
140
|
+
if (typeof m.ts === 'number' && m.ts <= lastHelloTs) return
|
|
141
|
+
if (typeof m.ts === 'number') lastHelloTs = m.ts
|
|
142
|
+
const renewed = typeof m.k === 'string' && m.k && m.k !== nonce
|
|
143
|
+
if (typeof m.k === 'string' && m.k) nonce = m.k
|
|
144
|
+
lastHello = now()
|
|
145
|
+
const nextCaps = Array.isArray(m.caps) ? m.caps.filter((c) => typeof c === 'string').slice(0, 16) : []
|
|
146
|
+
omitted = Array.isArray(m.omits) ? m.omits.filter((c) => typeof c === 'string').slice(0, 16) : []
|
|
147
|
+
const nextAuto = nextCaps.includes('auto') && Array.isArray(m.auto) ? m.auto.filter((s) => typeof s === 'string' && /^ses[A-Za-z0-9_-]{1,80}$/.test(s)) : []
|
|
148
|
+
if (nextCaps.join() !== caps.join() || nextAuto.join() !== autoList.join()) { caps = nextCaps; autoList = nextAuto; tellAuto({ kind: 'sessions', sessions: [...autoList] }) }
|
|
149
|
+
// A NEW nonce = the connector restarted, redialled or rotated: anything it has not answered was refused or lost —
|
|
150
|
+
// re-ask the reads with the new nonce and renew the streams. (Mutations are never re-sent.)
|
|
151
|
+
if (renewed && last === 'online') { resubscribe(); for (const e of pending.values()) if (e.resend) e.resend() }
|
|
152
|
+
// ★ Only a CHANGE is announced. A hello arrives every 20 s and the browser's row must not be rebuilt under the
|
|
153
|
+
// owner's finger — `changed()` below has the same discipline for the status string.
|
|
154
|
+
const nextBrowse = (m.browse && typeof m.browse === 'object') ? m.browse : null
|
|
155
|
+
const nextEgress = (m.egress && typeof m.egress === 'object') ? m.egress : null
|
|
156
|
+
if (JSON.stringify(nextBrowse) !== JSON.stringify(browseState) || JSON.stringify(nextEgress) !== JSON.stringify(egressState)) {
|
|
157
|
+
browseState = nextBrowse
|
|
158
|
+
egressState = nextEgress
|
|
159
|
+
for (const fn of browseListeners) { try { fn(browseState) } catch { /* a listener's fault is not the socket's */ } }
|
|
160
|
+
}
|
|
161
|
+
changed()
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const peer = new RelayPeer({
|
|
165
|
+
secret: computer.secret,
|
|
166
|
+
role: 'client',
|
|
167
|
+
relay: computer.relay,
|
|
168
|
+
WebSocketImpl,
|
|
169
|
+
onState: (s) => { peersKnown = false; if (s === 'open') { openedAt = now(); peer.send({ t: 'ping' }); setTimeout(changed, PEERS_WAIT_MS + 50) } else { lastHello = 0; nonce = '' } changed() },
|
|
170
|
+
onPeers: (n) => { peersKnown = peer.isOpen; if (n < 2) lastHello = 0; else peer.send({ t: 'ping' }); changed() },
|
|
171
|
+
onMessage: (m) => {
|
|
172
|
+
if (m.t === 'hello') { onHello(m); return }
|
|
173
|
+
if (m.t === 'progress') { for (const fn of progressListeners) { try { fn(m) } catch { /* */ } } return }
|
|
174
|
+
if (m.t === 'tools') { const waiting = toolWaiters.splice(0); for (const w of waiting) w(m); return }
|
|
175
|
+
if (m.t === 'autoverdict') { if (typeof m.sessionID === 'string' && typeof m.action === 'string') tellAuto({ kind: 'verdict', verdict: m }); return }
|
|
176
|
+
if (m.t === 'res') {
|
|
177
|
+
const e = pending.get(m.id)
|
|
178
|
+
if (!e) return // another device's request, or one we gave up on
|
|
179
|
+
if (m.st === 409 && e.resend) return // stale nonce on a read: the connector's new hello re-sends it
|
|
180
|
+
pending.delete(m.id)
|
|
181
|
+
clearTimeout(e.timer)
|
|
182
|
+
e.resolve({ ok: m.st >= 200 && m.st < 300, status: m.st, json: parse(m.b), text: m.b || '' })
|
|
183
|
+
return
|
|
184
|
+
}
|
|
185
|
+
if (m.t === 'evts') {
|
|
186
|
+
const handlers = subs.get(m.p)
|
|
187
|
+
if (!handlers) return
|
|
188
|
+
const batch = parse(m.b)
|
|
189
|
+
if (!Array.isArray(batch)) return
|
|
190
|
+
for (const d of batch) { const ev = parse(d); if (ev) for (const h of handlers) { try { h(ev) } catch { /* */ } } }
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
})
|
|
194
|
+
const resubscribe = () => { if (nonce) for (const p of subs.keys()) peer.send({ t: 'sub', c: cid, k: nonce, p }) }
|
|
195
|
+
const wake = () => {
|
|
196
|
+
lastTick = now()
|
|
197
|
+
wokeAt = now()
|
|
198
|
+
if (peer.isOpen) peer.send({ t: 'ping' }) // the connector answers a ping with its hello
|
|
199
|
+
setTimeout(changed, WAKE_WAIT_MS + 50)
|
|
200
|
+
changed()
|
|
201
|
+
}
|
|
202
|
+
peer.start()
|
|
203
|
+
freshTimer = setInterval(() => {
|
|
204
|
+
if (now() - lastTick > WAKE_GAP_MS) wake() // the page was frozen: this tick is the first thing to run
|
|
205
|
+
lastTick = now()
|
|
206
|
+
// ★ A dead network path can leave a socket "open" forever (send() never fails). The connector says hello every 20 s
|
|
207
|
+
// while anyone is here, so silence for 50 s with a peer present means the path is gone: redial.
|
|
208
|
+
if (peer.isOpen && peer.peers >= 2 && lastHello && now() - lastHello > SILENT_MS) peer.reconnect()
|
|
209
|
+
changed() // a hello that stops arriving must turn into "offline"
|
|
210
|
+
}, 5_000)
|
|
211
|
+
resubTimer = setInterval(() => { if (status() === 'online') resubscribe() }, RESUB_MS)
|
|
212
|
+
|
|
213
|
+
const waitOnline = () => new Promise((resolve) => {
|
|
214
|
+
if (status() === 'online') return resolve(true)
|
|
215
|
+
const off = () => { listeners.delete(fn); clearTimeout(timer) }
|
|
216
|
+
const fn = (s) => { if (s === 'online') { off(); resolve(true) } }
|
|
217
|
+
const timer = setTimeout(() => { off(); resolve(false) }, WAIT_ONLINE_MS)
|
|
218
|
+
listeners.add(fn)
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
kind: 'relay',
|
|
223
|
+
label: computer.name || 'your computer',
|
|
224
|
+
_nonce: () => nonce, // test hooks
|
|
225
|
+
_hello: (m) => onHello(m),
|
|
226
|
+
computer,
|
|
227
|
+
status,
|
|
228
|
+
onChange(fn) { listeners.add(fn); return () => listeners.delete(fn) },
|
|
229
|
+
can: (cap) => caps.includes(cap),
|
|
230
|
+
omits: (cap) => omitted.includes(cap),
|
|
231
|
+
autoSessions: () => [...autoList],
|
|
232
|
+
onAuto(fn) { autoListeners.add(fn); return () => autoListeners.delete(fn) },
|
|
233
|
+
onProgress(fn) { progressListeners.add(fn); return () => progressListeners.delete(fn) },
|
|
234
|
+
/** The enclave's `browse` report from its last hello, or null (a local computer, or one from before § 12). */
|
|
235
|
+
browse: () => browseState,
|
|
236
|
+
egress: () => egressState,
|
|
237
|
+
onBrowse(fn) { browseListeners.add(fn); return () => browseListeners.delete(fn) },
|
|
238
|
+
/** Switch Auto for one session on the computer (nonce-checked there). The next hello confirms it. */
|
|
239
|
+
setAuto(sid, dir, on) { if (!nonce || !caps.includes('auto')) return false; peer.send({ t: 'auto', k: nonce, sid, dir, on: !!on }); return true },
|
|
240
|
+
/** Private browsing for the agent's browser on this computer — only where its browse report says `canPrivate` (an older
|
|
241
|
+
* witbitz-code never does). Nonce-checked there; the next hello carries the new state. */
|
|
242
|
+
setBrowsePrivate(on) { if (!nonce || !(browseState && browseState.canPrivate)) return false; peer.send({ t: 'browse', k: nonce, private: !!on }); return true },
|
|
243
|
+
/** Which suggested tools the computer has ("Set up this computer"): its `{t:'tools'}` answer, or null when it does not
|
|
244
|
+
* answer in `ms` — a connector from before this never does. */
|
|
245
|
+
askTools(ms = 6000) {
|
|
246
|
+
if (!nonce) return Promise.resolve(null)
|
|
247
|
+
return new Promise((resolve) => {
|
|
248
|
+
const done = (m) => { clearTimeout(timer); const i = toolWaiters.indexOf(done); if (i >= 0) toolWaiters.splice(i, 1); resolve(m) }
|
|
249
|
+
const timer = setTimeout(() => done(null), ms)
|
|
250
|
+
toolWaiters.push(done)
|
|
251
|
+
peer.send({ t: 'tools', k: nonce })
|
|
252
|
+
})
|
|
253
|
+
},
|
|
254
|
+
/** Tell the computer which models this account is offered as CONFIDENTIAL today. The connector ADDS them to what it
|
|
255
|
+
* was built with and never removes any, so this can only widen what is enforced, never narrow it. */
|
|
256
|
+
/** "Waiting for your approval" (codeRemind.js): with a prompt, who to tickle when an approval in this session waits — this
|
|
257
|
+
* device's signed push grant and its own key. Only to a computer that says it can (`remind`). */
|
|
258
|
+
sendRemind(sid, dir, r) { if (!nonce || !caps.includes('remind') || !r || !sid) return false; peer.send({ t: 'remind', k: nonce, sid, dir, grant: r.grant, key: r.key, url: r.url }); return true },
|
|
259
|
+
sendModels(list) { if (!nonce || !Array.isArray(list) || !list.length) return false; peer.send({ t: 'models', k: nonce, confidential: list.slice(0, 100) }); return true },
|
|
260
|
+
kick: () => { wake(); peer.kick() }, // the page is visible again: ask the computer, and redial a dead socket
|
|
261
|
+
close() {
|
|
262
|
+
clearInterval(resubTimer); clearInterval(freshTimer); clearTimeout(giveUpTimer)
|
|
263
|
+
for (const e of pending.values()) { clearTimeout(e.timer); e.resolve({ ok: false, status: 0, json: null, text: 'closed' }) }
|
|
264
|
+
pending.clear(); subs.clear(); listeners.clear(); autoListeners.clear(); progressListeners.clear(); browseListeners.clear()
|
|
265
|
+
peer.stop()
|
|
266
|
+
},
|
|
267
|
+
async request(method, p, body) {
|
|
268
|
+
if (!(await waitOnline())) return { ok: false, status: 0, json: null, text: 'offline' }
|
|
269
|
+
return new Promise((resolve) => {
|
|
270
|
+
const id = rid()
|
|
271
|
+
const b = body !== undefined ? { b: JSON.stringify(body) } : {}
|
|
272
|
+
const msg = () => ({ t: 'req', id, k: nonce, m: method, p, ...b }) // built at send time: always the CURRENT nonce
|
|
273
|
+
// A turn POST returns only when the model has finished; its progress rides the event stream, so no timeout.
|
|
274
|
+
const turn = method === 'POST' && /\/message$/.test(p.split('?')[0])
|
|
275
|
+
const entry = { resolve, timer: 0, resend: null }
|
|
276
|
+
// Reads are safe to re-ask after a reconnect; anything that changes state is never sent twice.
|
|
277
|
+
if (method === 'GET') entry.resend = () => peer.send(msg())
|
|
278
|
+
if (!turn) entry.timer = setTimeout(() => { pending.delete(id); resolve({ ok: false, status: 0, json: null, text: 'timeout' }) }, globalThis.__codeRequestMs || REQUEST_TIMEOUT_MS) // __codeRequestMs: tests only (as __codeListMs)
|
|
279
|
+
pending.set(id, entry)
|
|
280
|
+
peer.send(msg()).then((sent) => { if (!sent && method !== 'GET') { pending.delete(id); clearTimeout(entry.timer); resolve({ ok: false, status: 0, json: null, text: 'offline' }) } })
|
|
281
|
+
})
|
|
282
|
+
},
|
|
283
|
+
subscribe(p, onEvent) {
|
|
284
|
+
if (!subs.has(p)) subs.set(p, new Set())
|
|
285
|
+
subs.get(p).add(onEvent)
|
|
286
|
+
if (status() === 'online' && nonce) peer.send({ t: 'sub', c: cid, k: nonce, p })
|
|
287
|
+
return () => {
|
|
288
|
+
const set = subs.get(p)
|
|
289
|
+
if (!set) return
|
|
290
|
+
set.delete(onEvent)
|
|
291
|
+
if (!set.size) { subs.delete(p); if (nonce) peer.send({ t: 'unsub', c: cid, k: nonce, p }) }
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
}
|
|
295
|
+
}
|
package/codeUndo.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// spaces/public/codeUndo.js — /undo, /redo and /compact in the Code section.
|
|
2
|
+
//
|
|
3
|
+
// Measured on opencode 1.18.30 (2026-09-13), a real agent writing a file in a scratch git repo:
|
|
4
|
+
// undo POST /session/:id/revert {messageID} → the Session, revert {messageID, snapshot, diff}; the files are back as
|
|
5
|
+
// they were before that turn ("two" → "one"). GET …/message still lists EVERY message — hiding is the page's.
|
|
6
|
+
// redo POST /session/:id/unrevert → files forward again, revert cleared.
|
|
7
|
+
// final a new message while undone drops the undone turns for good (and clears revert).
|
|
8
|
+
// compact POST /session/:id/summarize {providerID, modelID} → true; a user `compaction` part + an assistant summary.
|
|
9
|
+
// events session.updated carries the revert point, so an undo made elsewhere reaches this page.
|
|
10
|
+
// The pure rules are tested in spaces/test/codeUndo.test.mjs.
|
|
11
|
+
|
|
12
|
+
import { normRevert } from './opencodeWire.js' // the pure wire shape lives with the rest of the wire
|
|
13
|
+
export { normRevert }
|
|
14
|
+
|
|
15
|
+
const indexOf = (messages, revert) => (revert ? messages.findIndex((m) => m && m.info && m.info.id === revert.messageID) : -1)
|
|
16
|
+
const isUser = (m) => m && m.info && m.info.role === 'user'
|
|
17
|
+
|
|
18
|
+
/** The transcript as it stands: everything before the undone turn. A revert point not in the list hides nothing. */
|
|
19
|
+
export function visibleMessages(messages, revert) {
|
|
20
|
+
const at = indexOf(messages, revert)
|
|
21
|
+
return at < 0 ? messages : messages.slice(0, at)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** What /undo takes back: the last of your turns still showing (its message id), or null when there is none. */
|
|
25
|
+
export function undoTarget(messages, revert) {
|
|
26
|
+
const shown = visibleMessages(messages, revert)
|
|
27
|
+
for (let i = shown.length - 1; i >= 0; i--) if (isUser(shown[i])) return shown[i].info.id
|
|
28
|
+
return null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// The page's own commands, listed after the computer's in the "/" menu (menu-shaped like normCommands' entries). They
|
|
32
|
+
// win over a computer command of the same name, as OpenCode's TUI's do.
|
|
33
|
+
export const UNDO_COMMANDS = [
|
|
34
|
+
{ name: 'undo', description: 'Take back your last turn, and the changes it made to files', source: 'built-in', template: '', agent: '', model: '', needsComputer: false },
|
|
35
|
+
{ name: 'redo', description: 'Bring back what undo took away', source: 'built-in', template: '', agent: '', model: '', needsComputer: false },
|
|
36
|
+
{ name: 'compact', description: 'Summarize the conversation so far, to free the model\'s context', source: 'built-in', template: '', agent: '', model: '', needsComputer: false },
|
|
37
|
+
]
|
|
38
|
+
/** "/undo", "/redo", "/compact" (anything after the name is ignored) → its name; anything else → null. */
|
|
39
|
+
export function undoCommand(text) {
|
|
40
|
+
const m = /^\/(\S+)(?:\s[\s\S]*)?$/.exec(String(text || '').trim())
|
|
41
|
+
return m && UNDO_COMMANDS.some((c) => c.name === m[1]) ? m[1] : null
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** How many of your turns the undo took away (what the note says). */
|
|
45
|
+
export function undoneTurns(messages, revert) {
|
|
46
|
+
const at = indexOf(messages, revert)
|
|
47
|
+
return at < 0 ? 0 : messages.slice(at).filter(isUser).length
|
|
48
|
+
}
|
package/compress.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// spaces/public/compress.js — gzip codec for synced docs (native CompressionStream, no dep).
|
|
2
|
+
// Large index/pipes docs are wrapped { z: <gzip-b64> } to dodge the 413 ceiling; small docs stay
|
|
3
|
+
// PLAIN so any reader unwraps transparently. LEAF: pure functions, zero back-deps. $( -clean.
|
|
4
|
+
|
|
5
|
+
// the SMALL compressed bytes, and any reader unwraps it. Small docs stay PLAIN (readable without the codec). If the
|
|
6
|
+
// browser lacks CompressionStream we push plain — a truly huge doc can still 413, i.e. no worse than before.
|
|
7
|
+
export const _hasGzip = typeof CompressionStream !== 'undefined' && typeof DecompressionStream !== 'undefined'
|
|
8
|
+
export const _jsonBytes = (v) => { try { return new TextEncoder().encode(JSON.stringify(v ?? null)).length } catch { return Infinity } }
|
|
9
|
+
async function _streamToU8(stream) {
|
|
10
|
+
const reader = stream.getReader(); const chunks = []; let n = 0
|
|
11
|
+
for (;;) { const { value, done } = await reader.read(); if (done) break; chunks.push(value); n += value.length }
|
|
12
|
+
const out = new Uint8Array(n); let o = 0; for (const c of chunks) { out.set(c, o); o += c.length }; return out
|
|
13
|
+
}
|
|
14
|
+
function _u8ToB64(u8) { let s = ''; for (let i = 0; i < u8.length; i++) s += String.fromCharCode(u8[i]); return btoa(s) }
|
|
15
|
+
function _b64ToU8(b64) { const s = atob(b64); const u8 = new Uint8Array(s.length); for (let i = 0; i < s.length; i++) u8[i] = s.charCodeAt(i); return u8 }
|
|
16
|
+
export async function gzipB64(obj) {
|
|
17
|
+
const bytes = new TextEncoder().encode(JSON.stringify(obj ?? null))
|
|
18
|
+
const stream = new Response(bytes).body.pipeThrough(new CompressionStream('gzip'))
|
|
19
|
+
return _u8ToB64(await _streamToU8(stream))
|
|
20
|
+
}
|
|
21
|
+
export async function gunzipB64(b64) {
|
|
22
|
+
const stream = new Response(_b64ToU8(b64)).body.pipeThrough(new DecompressionStream('gzip'))
|
|
23
|
+
return JSON.parse(new TextDecoder().decode(await _streamToU8(stream)))
|
|
24
|
+
}
|
package/config.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// config.js — baked, dep-free configuration constants (Verified-Client Phase 1). App tag, the solo key
|
|
2
|
+
// model, and the PUBLIC Google OAuth client id + VAPID key. Imported wherever needed so no module owns them.
|
|
3
|
+
|
|
4
|
+
export const APP_TAG = 'spaces'
|
|
5
|
+
export const SOLO = { keyModel: '1-of-1' }
|
|
6
|
+
export const GOOGLE_CLIENT_ID = '138139257987-2s658reba6jjsc6rmuahputsts3qvjlk.apps.googleusercontent.com'
|
|
7
|
+
export const VAPID_PUBLIC_KEY = 'BADZvvI-iJ1LUpormHIdAvhtNiiArDSf30QRJ6kFh2grgAob6oP_X1GKQdDOXlogfUvgtDt3a74rIVfsw0tMvms' // public by design; unset ⇒ the notify row stays hidden
|
|
8
|
+
// Raw-bytes cap for a document attachment (PDF/Word/Excel) — kept under the server's 5MB base64 cap; the agent reads
|
|
9
|
+
// them via read_file (text extraction), and the turn POSTs straight to API Gateway (10MB limit). Shared by the composer's
|
|
10
|
+
// attachments and the WhatsApp import (both stage documents through the same reader).
|
|
11
|
+
export const MAX_FILE_BYTES = 3_500_000
|
package/connCatalog.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// connCatalog.js — the services Connections offers (the owner, 2026-10-14: Grok Bot's connector catalog; "We should just take it?").
|
|
2
|
+
// Every address passed the Sentinel's own MCP sign-in steps (infra/cloud-computer/sentinel/mcpAuth.mjs: discover → self-register
|
|
3
|
+
// → consent page; tools/conn-catalog/probe.mjs) or answers without a sign-in. Entries marked `src: 'cursor'` take their address,
|
|
4
|
+
// description and logo from github.com/cursor/plugins third_party/* (MIT, © 2026 Cursor — see icons/services/NOTICE).
|
|
5
|
+
// Five long descriptions are shortened to one line (Trello, Plaud, beehiiv, PostHog, TinyFish). The rest are ours; their marks are in serviceIcons.js (Simple Icons, CC0) or a letter tile.
|
|
6
|
+
// Witbitz's Google Calendar app as filed with the Sentinel (tools/file-oauth-provider.mjs) — '' until filed (the row stays hidden)
|
|
7
|
+
export const GCAL_PROVIDER = 'prov_XE5FdiPdAx881HKs'
|
|
8
|
+
export const CATALOG = [
|
|
9
|
+
// AN AGENT YOU SEND JOBS TO, not a service you sign in to (the owner, 2026-10-15: "Doesn't grokbot have a connector like
|
|
10
|
+
// other connectors?" → "Yes"). Grok Bot takes MCP servers but offers none; what starts a run from outside is a routine's
|
|
11
|
+
// trigger "When this webhook receives a request": an Endpoint https://grok.com/webhook/automation/<id> and a Signing
|
|
12
|
+
// secret whsec_… — a SIGNED webhook (docs/signed-webhooks.md). Attached through grokRoutine.js; each call is approved.
|
|
13
|
+
{ name: "Grok Bot", kind: "webhook", host: "grok.com", desc: "Send a job to one of your Grok Bot routines — you approve each one.", cat: "Agents", png: "/icons/services/grok-bot.png" },
|
|
14
|
+
// CLAUDE CODE (the owner, 2026-10-21: "Let's do Claude code"): the same kind as Grok Bot — a scheduled task's API trigger
|
|
15
|
+
// (a bearer webhook on api.anthropic.com) takes the job, the run reports back through this Space's MCP address. The card and
|
|
16
|
+
// what the room keeps come from jobAgents.js (docs/job-agents.md).
|
|
17
|
+
{ name: "Claude Code", kind: "webhook", host: "api.anthropic.com", desc: "Send a job to a Claude Code task in Anthropic's cloud — you approve each one.", cat: "Agents", png: "/icons/services/claude-code.png" },
|
|
18
|
+
// AN AGENT THAT COMES TO YOU (the owner, 2026-10-15: "add a muse ai connector like we did for grokbot"). Meta's Muse takes
|
|
19
|
+
// custom MCP connectors (streamable HTTP, a bearer key) but nothing can start a Muse task from outside — no webhook, no
|
|
20
|
+
// public API (docs/outside-agents.md). So it is ONE way: Muse reaches a Space's private assistant through the Sentinel's
|
|
21
|
+
// MCP door (message_member / get_reply), and a recurring Muse task asks that assistant for work. Set up by connectionsSheet.js openMuse.
|
|
22
|
+
{ name: "Muse", kind: "agent", host: "meta.ai", desc: "Let Meta's Muse work with this Space's assistant — it asks for jobs and sends back the results.", cat: "Agents", png: "/icons/services/muse.png" },
|
|
23
|
+
// OpenAI's Dots (the owner, 2026-10-15: "OpenAI new dots bot" → "Do a"): a ChatGPT custom MCP server (name + URL, the key in
|
|
24
|
+
// it). One way for now, as Muse; ChatGPT's MCP Events could push it jobs later (a Sentinel cycle).
|
|
25
|
+
{ name: "Dots", kind: "agent", host: "chatgpt.com", desc: "Let your OpenAI dot work with this Space's assistant — it asks for jobs and sends back the results.", cat: "Agents", png: "/icons/services/dots.png" },
|
|
26
|
+
{ name: "Context7", url: "https://mcp.context7.com/mcp", desc: "Up-to-date docs for code libraries.", cat: "Engineering", png: "/icons/services/context7.png" },
|
|
27
|
+
{ name: "GitHub", url: "https://api.githubcopilot.com/mcp/", desc: "Repositories, issues and pull requests.", cat: "Engineering", registered: true },
|
|
28
|
+
{ name: "Hugging Face", url: "https://huggingface.co/mcp", desc: "Models, datasets and Spaces.", cat: "Engineering" },
|
|
29
|
+
{ name: "Jam", url: "https://mcp.jam.dev/mcp", desc: "Bug reports with console and network logs.", cat: "Engineering", png: "/icons/services/jam.png" },
|
|
30
|
+
{ name: "Linear", url: "https://mcp.linear.app/mcp", desc: "Issues, projects and cycles.", cat: "Engineering" },
|
|
31
|
+
{ name: "Neon", url: "https://mcp.neon.tech/mcp", desc: "Postgres databases and branches.", cat: "Engineering", png: "/icons/services/neon.png" },
|
|
32
|
+
{ name: "Sentry", url: "https://mcp.sentry.dev/mcp", desc: "Errors, issues and releases.", cat: "Engineering" },
|
|
33
|
+
{ name: "Statsig", url: "https://api.statsig.com/v3/mcp", desc: "Inspect and manage feature gates, experiments, dynamic configs, and metrics.", cat: "Engineering", png: "/icons/services/statsig.png", src: "cursor" },
|
|
34
|
+
{ name: "Supabase", url: "https://mcp.supabase.com/mcp", desc: "Databases, tables and edge functions.", cat: "Engineering" },
|
|
35
|
+
{ name: "Airtable", url: "https://mcp.airtable.com/mcp", desc: "Bases, tables and records.", cat: "Productivity" },
|
|
36
|
+
{ name: "Atlassian", url: "https://mcp.atlassian.com/v1/mcp", desc: "Jira issues and Confluence pages.", cat: "Productivity" },
|
|
37
|
+
{ name: "Basecamp", url: "https://mcp.basecamp.com/mcp", desc: "Projects, to-dos and messages.", cat: "Productivity" },
|
|
38
|
+
{ name: "ClickUp", url: "https://mcp.clickup.com/mcp", desc: "Tasks, docs and spaces.", cat: "Productivity" },
|
|
39
|
+
{ name: "Jotform", url: "https://mcp.jotform.com", desc: "Create and edit forms, then read submissions.", cat: "Productivity", png: "/icons/services/jotform.png", src: "cursor" },
|
|
40
|
+
{ name: "monday.com", url: "https://mcp.monday.com/mcp", desc: "Boards, items and updates.", cat: "Productivity", png: "/icons/services/monday.png" },
|
|
41
|
+
{ name: "Todoist", url: "https://ai.todoist.net/mcp", desc: "Create, find, and complete tasks and projects.", cat: "Productivity", png: "/icons/services/todoist.png", src: "cursor" },
|
|
42
|
+
{ name: "Trello", url: "https://mcp.trello.com/v1", desc: "Boards, lists and cards: create, move and complete, with checklists and due dates.", cat: "Productivity", png: "/icons/services/trello.png", src: "cursor" },
|
|
43
|
+
{ name: "Zapier", url: "https://mcp.zapier.com/api/mcp/mcp", desc: "Actions across thousands of apps.", cat: "Productivity" },
|
|
44
|
+
{ name: "Coda", url: "https://docs.superhuman.com/apis/mcp", desc: "Search docs, read pages, and update tables.", cat: "Documents", png: "/icons/services/coda.png", src: "cursor" },
|
|
45
|
+
{ name: "Craft", url: "https://mcp.craft.do/my/mcp", desc: "Search, create, and update documents and daily notes.", cat: "Documents", png: "/icons/services/craft.png", src: "cursor" },
|
|
46
|
+
{ name: "Guru", url: "https://mcp.api.getguru.com/mcp", desc: "Search company knowledge and draft verified answers.", cat: "Documents", png: "/icons/services/guru.png", src: "cursor" },
|
|
47
|
+
{ name: "Mem", url: "https://mcp.mem.ai/mcp", desc: "Capture, search, and organize notes and collections.", cat: "Documents", png: "/icons/services/mem.png", src: "cursor" },
|
|
48
|
+
{ name: "Notion", url: "https://mcp.notion.com/mcp", desc: "Search, read and write pages.", cat: "Documents" },
|
|
49
|
+
{ name: "Readwise", url: "https://mcp2.readwise.io/mcp", desc: "Search highlights and Reader documents, save articles.", cat: "Documents", png: "/icons/services/readwise.png", src: "cursor" },
|
|
50
|
+
{ name: "Canva", url: "https://mcp.canva.com/mcp", desc: "Designs, templates and exports.", cat: "Design" },
|
|
51
|
+
{ name: "Excalidraw", url: "https://mcp.excalidraw.com/mcp", desc: "Hand-drawn diagrams and sketches.", cat: "Design" },
|
|
52
|
+
{ name: "Miro", url: "https://mcp.miro.com/", desc: "Boards, diagrams and sticky notes.", cat: "Design" },
|
|
53
|
+
{ name: "Webflow", url: "https://mcp.webflow.com/sse", desc: "Sites, pages and CMS items.", cat: "Design" },
|
|
54
|
+
{ name: "Wix", url: "https://mcp.wix.com/mcp", desc: "Sites, stores and bookings.", cat: "Design" },
|
|
55
|
+
{ name: "Circleback", url: "https://circleback.ai/api/mcp", desc: "Search meetings, transcripts, action items, and emails.", cat: "Meetings", png: "/icons/services/circleback.png", src: "cursor" },
|
|
56
|
+
{ name: "Fathom", url: "https://api.fathom.ai/mcp", desc: "Search meetings and pull transcripts and summaries.", cat: "Meetings", png: "/icons/services/fathom.png", src: "cursor" },
|
|
57
|
+
{ name: "Fireflies", url: "https://api.fireflies.ai/mcp", desc: "Search meeting transcripts, summaries, and action items.", cat: "Meetings", png: "/icons/services/fireflies.png", src: "cursor" },
|
|
58
|
+
{ name: "Granola", url: "https://mcp.granola.ai/mcp", desc: "Your meeting notes and transcripts.", cat: "Meetings", png: "/icons/services/granola.png" },
|
|
59
|
+
{ name: "Otter.ai", url: "https://mcp.otter.ai/mcp", desc: "Search meeting history and pull full transcripts.", cat: "Meetings", png: "/icons/services/otter.png", src: "cursor" },
|
|
60
|
+
{ name: "Plaud", url: "https://mcp.plaud.ai/mcp", desc: "Your Plaud recordings: transcripts with speakers, summaries and action items.", cat: "Meetings", png: "/icons/services/plaud.png", src: "cursor" },
|
|
61
|
+
{ name: "Read AI", url: "https://api.read.ai/mcp", desc: "Meeting summaries and transcripts.", cat: "Meetings", png: "/icons/services/readai.png" },
|
|
62
|
+
{ name: "Calendly", url: "https://mcp.calendly.com/", desc: "Check availability and book, cancel, or reschedule.", cat: "Scheduling", png: "/icons/services/calendly.png", src: "cursor" },
|
|
63
|
+
{ name: "Amplemarket", url: "https://mcp.amplemarket.com/mcp", desc: "Search people and companies, enrich leads, run sequences.", cat: "Sales", png: "/icons/services/amplemarket.png", src: "cursor" },
|
|
64
|
+
{ name: "Attio", url: "https://mcp.attio.com/mcp", desc: "Search and update CRM records, lists, notes, and tasks.", cat: "Sales", png: "/icons/services/attio.png", src: "cursor" },
|
|
65
|
+
{ name: "Clay", url: "https://api.clay.com/v3/mcp", desc: "Enrich people and companies, run AI research agents.", cat: "Sales", png: "/icons/services/clay.png", src: "cursor" },
|
|
66
|
+
{ name: "Gong", url: "https://mcp.gong.io/mcp", desc: "Pull account summaries, deal insights, and call briefs.", cat: "Sales", png: "/icons/services/gong.png", src: "cursor" },
|
|
67
|
+
{ name: "HubSpot", url: "https://mcp.hubspot.com/", desc: "Contacts, companies, deals and tickets in your CRM.", cat: "Sales", registered: true },
|
|
68
|
+
{ name: "Hunter", url: "https://mcp.hunter.io/mcp", desc: "Find and verify emails, discover companies, and save leads.", cat: "Sales", png: "/icons/services/hunter.png", src: "cursor" },
|
|
69
|
+
{ name: "Juicebox", url: "https://mcp.juicebox.ai/v1", desc: "Query recruiting analytics, shortlists, and sourcing agents.", cat: "Sales", png: "/icons/services/juicebox.png", src: "cursor" },
|
|
70
|
+
{ name: "Outreach", url: "https://api.outreach.io/mcp", desc: "Search sequences, prospects, and Kaia meetings.", cat: "Sales", png: "/icons/services/outreach.png", src: "cursor" },
|
|
71
|
+
{ name: "beehiiv", url: "https://mcp.beehiiv.com/mcp", desc: "Your newsletter: posts, subscribers, segments and performance.", cat: "Marketing", png: "/icons/services/beehiiv.png", src: "cursor" },
|
|
72
|
+
{ name: "Customer.io", url: "https://mcp.customer.io/mcp", desc: "Build campaigns, manage segments, and query people.", cat: "Marketing", png: "/icons/services/customer-io.png", src: "cursor" },
|
|
73
|
+
{ name: "Klaviyo", url: "https://mcp.klaviyo.com/mcp", desc: "Manage profiles, segments, campaigns, and flows.", cat: "Marketing", png: "/icons/services/klaviyo.png", src: "cursor" },
|
|
74
|
+
{ name: "MailerLite", url: "https://mcp.mailerlite.com/mcp", desc: "Manage subscribers, groups, campaigns, and automations.", cat: "Marketing", png: "/icons/services/mailerlite.png", src: "cursor" },
|
|
75
|
+
{ name: "Meltwater", url: "https://api.meltwater.com/v2/mcp", desc: "Search media and social mentions and pull analytics.", cat: "Marketing", png: "/icons/services/meltwater.png", src: "cursor" },
|
|
76
|
+
{ name: "Profound", url: "https://mcp.tryprofound.com/mcp", desc: "Track AI visibility, sentiment, and citations.", cat: "Marketing", png: "/icons/services/profound.png", src: "cursor" },
|
|
77
|
+
{ name: "Plain", url: "https://mcp.plain.com/mcp", desc: "Support threads, customers and help articles.", cat: "Customer support", png: "/icons/services/plain.png" },
|
|
78
|
+
{ name: "Amplitude", url: "https://mcp.amplitude.com/mcp", desc: "Product analytics and charts.", cat: "Data analytics", png: "/icons/services/amplitude.png" },
|
|
79
|
+
{ name: "PostHog", url: "https://mcp.posthog.com/mcp", desc: "Product analytics and SQL, feature flags, experiments, errors and replays.", cat: "Data analytics", png: "/icons/services/posthog-mcp.png", src: "cursor" },
|
|
80
|
+
{ name: "Similarweb", url: "https://mcp.similarweb.com", desc: "Analyze website traffic, audiences, and competitors.", cat: "Data analytics", png: "/icons/services/similarweb.png", src: "cursor" },
|
|
81
|
+
{ name: "Ashby", url: "https://mcp.ashbyhq.com/mcp/v1", desc: "Search candidates, prep interviews, and manage pipeline tasks.", cat: "Hiring", png: "/icons/services/ashby.png", src: "cursor" },
|
|
82
|
+
{ name: "Greenhouse", url: "https://mcp.us.greenhouse.io/mcp", desc: "Search candidates, jobs, and applications, and review scorecards in Greenhouse Recruiting.", cat: "Hiring", png: "/icons/services/greenhouse.png", src: "cursor" },
|
|
83
|
+
{ name: "Workable", url: "https://mcp.workable.com/mcp", desc: "Search candidates, move pipelines, and manage HR records.", cat: "Hiring", png: "/icons/services/workable.png", src: "cursor" },
|
|
84
|
+
{ name: "Brex", url: "https://api.brex.com/mcp", desc: "Query expenses, receipts, bills, cards, and travel.", cat: "Finance", png: "/icons/services/brex.png", src: "cursor" },
|
|
85
|
+
{ name: "Daloopa", url: "https://mcp.daloopa.com/server/mcp", desc: "Pull source-linked fundamentals, KPIs, filings, and prices.", cat: "Finance", png: "/icons/services/daloopa.png", src: "cursor" },
|
|
86
|
+
{ name: "Interactive Brokers", url: "https://api.ibkr.com/v1/api/mcp-public", desc: "Review positions, balances, P&L, and draft trade instructions.", cat: "Finance", png: "/icons/services/interactive-brokers.png", src: "cursor" },
|
|
87
|
+
{ name: "PayPal", url: "https://mcp.paypal.com/mcp", desc: "Orders, invoices and payments.", cat: "Finance" },
|
|
88
|
+
{ name: "Robinhood", url: "https://agent.robinhood.com/mcp/trading", desc: "View portfolios, positions, orders, watchlists, and market data, and trade in a Robinhood Agentic account.", cat: "Finance", png: "/icons/services/robinhood.png", src: "cursor" },
|
|
89
|
+
{ name: "S&P Global", url: "https://kfinance.kensho.com/integrations/mcp", desc: "Query S&P Capital IQ financials, prices, and transcripts.", cat: "Finance", png: "/icons/services/sp-global.png", src: "cursor" },
|
|
90
|
+
{ name: "Stripe", url: "https://mcp.stripe.com/", desc: "Payments, customers and invoices.", cat: "Finance" },
|
|
91
|
+
{ name: "Webull", url: "https://api.webull.com/mcp", desc: "View accounts, positions, orders, watchlists, and market data.", cat: "Finance", png: "/icons/services/webull.png", src: "cursor" },
|
|
92
|
+
{ name: "Ahrefs", url: "https://api.ahrefs.com/mcp/mcp", desc: "Research keywords, backlinks, rankings, and site health.", cat: "Research", png: "/icons/services/ahrefs.png", src: "cursor" },
|
|
93
|
+
{ name: "Cloudflare Docs", url: "https://docs.mcp.cloudflare.com/mcp", desc: "Cloudflare’s developer documentation.", cat: "Research" },
|
|
94
|
+
{ name: "Exa", url: "https://mcp.exa.ai/mcp", desc: "Web search and page contents.", cat: "Research", png: "/icons/services/exa.png" },
|
|
95
|
+
{ name: "TinyFish", url: "https://agent.tinyfish.ai/mcp", desc: "Web automations, search and clean page content in remote browsers.", cat: "Research", png: "/icons/services/tinyfish.png", src: "cursor" },
|
|
96
|
+
// FROM GROK BOT'S PLUGIN MARKETPLACE (github.com/xai-org/plugin-marketplace, read 2026-11-16; the owner: "look at grokbot opensource
|
|
97
|
+
// connections - update our connections and add missing ones"): each address passed tools/conn-catalog/probe.mjs's sign-in steps
|
|
98
|
+
// that day (GoDaddy answers without one — domain suggestions and availability only). Descriptions are ours; no logos copied.
|
|
99
|
+
// Left out: the 13 that register no outside app (HubSpot, Zoom, Google's, X, DocuSign, Shopify…), the 22 that refuse Witbitz's
|
|
100
|
+
// registration (Figma, Vercel, Netlify, Railway, Intercom, Square…), Stable (its tools need the person's own API key), TikTok Ads
|
|
101
|
+
// (no sign-in method), and every address behind Cursor's or Grok's own gateway. Navan was removed: it now refuses registration.
|
|
102
|
+
{ name: "Axiom", url: "https://mcp.axiom.co/mcp", desc: "Logs and metrics: queries, dashboards and monitors.", cat: "Engineering", png: "/icons/services/axiom.png" },
|
|
103
|
+
{ name: "Clerk", url: "https://mcp.clerk.com/mcp", desc: "Your app's users, organizations and sign-in.", cat: "Engineering" },
|
|
104
|
+
{ name: "Cloudflare", url: "https://mcp.cloudflare.com/mcp", desc: "Workers, DNS and your Cloudflare account.", cat: "Engineering" },
|
|
105
|
+
{ name: "Expo", url: "https://mcp.expo.dev/mcp", desc: "Build, test and ship iOS and Android apps.", cat: "Engineering" },
|
|
106
|
+
{ name: "GoDaddy", url: "https://api.godaddy.com/v1/domains/mcp", desc: "Domain name ideas and whether a name is free.", cat: "Engineering" },
|
|
107
|
+
{ name: "Pi Security", url: "https://mcp.pi.security/mcp", desc: "Security findings, posture and how to fix them.", cat: "Engineering", png: "/icons/services/pi-security.png" },
|
|
108
|
+
{ name: "RingCentral Team Messaging", url: "https://mcp.labs.ringcentral.com/ringex/v1.1.0/team-chat", desc: "Team chats and messages in RingCentral.", cat: "Productivity", png: "/icons/services/ringcentral-team-messaging.png" },
|
|
109
|
+
{ name: "Framer", url: "https://mcp.framer.com/mcp", desc: "Pages and content of a Framer website.", cat: "Design" },
|
|
110
|
+
{ name: "HTML/CSS to Image", url: "https://mcp.hcti.io", desc: "Turn HTML or a web page into an image or a PDF.", cat: "Design", png: "/icons/services/html-css-to-image.png" },
|
|
111
|
+
{ name: "VideoGen", url: "https://mcp.videogen.io/mcp", desc: "Make a video from text, images or a script.", cat: "Design", png: "/icons/services/videogen.png" },
|
|
112
|
+
{ name: "Cal.com", url: "https://mcp.cal.com/mcp", desc: "Availability, bookings and event types.", cat: "Scheduling" },
|
|
113
|
+
// GOOGLE CALENDAR (2026-11-23, docs/google-calendar-verification.md): Google's own Calendar MCP server takes no self-registered
|
|
114
|
+
// app — Witbitz files its own client (project witbitz-spaces-calendar, scope calendar.events alone) with the Sentinel, and the
|
|
115
|
+
// sign-in comes back through the broker's callback (connections.js mcpRedirectFor). Until Google verifies the client, only its
|
|
116
|
+
// test users can sign in.
|
|
117
|
+
// ⛔ OUT OF THE CATALOG until Google makes the Calendar MCP server generally available (2026-11-23): it answers only projects in
|
|
118
|
+
// the Workspace Developer Preview Program, which takes only Workspace-domain accounts, and its terms keep preview features out of
|
|
119
|
+
// public apps. Everything else is in place (the filed client, st51, the broker's callback) — put this line back then:
|
|
120
|
+
// { name: "Google Calendar", url: "https://calendarmcp.googleapis.com/mcp/v1", desc: "Read your events and, when you approve, add or change them.", cat: "Scheduling", registered: true },
|
|
121
|
+
// GOOGLE CALENDAR ON GOOGLE'S REGULAR CALENDAR API (2026-11-23; owner: "it did not sync automatically" → this): kind 'oauth' = the
|
|
122
|
+
// Sentinel's own Google sign-in (custody.mjs oauthStart: offline access, a refresh token it renews itself) with Witbitz's app filed
|
|
123
|
+
// under `tenant` as `provider`; the connection reaches `host`. Reads run without asking, a change is a card (connSpaces readsAutoFor).
|
|
124
|
+
{ name: "Google Calendar", kind: "oauth", tenant: "t_815e94f68944437592310c0b80861cd9", provider: GCAL_PROVIDER, host: "www.googleapis.com", reads: "auto", desc: "Read your events and, when you approve, add or change them.", cat: "Scheduling" },
|
|
125
|
+
{ name: "Helena", url: "https://agent.enrichlabs.ai/api/mcp", desc: "An AI marketer for SEO, ads, social and email campaigns.", cat: "Marketing", png: "/icons/services/helena.png" },
|
|
126
|
+
{ name: "Omneky", url: "https://mcp.omneky.com/mcp", desc: "Ad campaigns, their results and new creatives.", cat: "Marketing", png: "/icons/services/omneky.png" },
|
|
127
|
+
{ name: "Quo", url: "https://mcp.quo.com/mcp", desc: "Business texts, calls and contacts.", cat: "Customer support", png: "/icons/services/quo.png" },
|
|
128
|
+
{ name: "RingCentral Phone", url: "https://mcp.labs.ringcentral.com/ringex/phone", desc: "Calls, voicemail and texts in RingCentral.", cat: "Customer support", png: "/icons/services/ringcentral-phone.png" },
|
|
129
|
+
{ name: "Finary", url: "https://public-api.finary.com/mcp", desc: "Your investments, accounts and net worth.", cat: "Finance", png: "/icons/services/finary.png" },
|
|
130
|
+
{ name: "Gusto", url: "https://mcp.api.gusto.com/", desc: "Payroll, employees and benefits.", cat: "Finance" },
|
|
131
|
+
{ name: "Firecrawl", url: "https://mcp.firecrawl.dev/v2/mcp-oauth", desc: "Scrape, crawl and search websites as clean text.", cat: "Research", png: "/icons/services/firecrawl.png" },
|
|
132
|
+
{ name: "Octen", url: "https://mcp.octen.ai/mcp", desc: "Web and news search, and page extraction.", cat: "Research", png: "/icons/services/octen.png" },
|
|
133
|
+
{ name: "Tavily", url: "https://mcp.tavily.com/mcp", desc: "Web search, page extraction and research.", cat: "Research", png: "/icons/services/tavily.png" },
|
|
134
|
+
// SINCE STANDING SENTINEL st33 (2026-11-16): Netlify (its client id is a 447-character token — the Sentinel took 400 at most) and
|
|
135
|
+
// the services that refuse a web app's self-registration but take the app as its OWN client (client ID metadata documents —
|
|
136
|
+
// /mcp-client.json). Vercel signed in end to end on the owner's phone; Railway, Typeform and Upwork showed their consent page.
|
|
137
|
+
{ name: "Netlify", url: "https://mcp.netlify.com/mcp", desc: "Sites, deploys and build logs.", cat: "Engineering" },
|
|
138
|
+
{ name: "Railway", url: "https://mcp.railway.com", desc: "Services, deployments and logs.", cat: "Engineering" },
|
|
139
|
+
{ name: "Vercel", url: "https://mcp.vercel.com", desc: "Deployments, build logs and domains.", cat: "Engineering" },
|
|
140
|
+
{ name: "Typeform", url: "https://api.typeform.com/mcp", desc: "Forms and their responses.", cat: "Productivity" },
|
|
141
|
+
{ name: "Upwork", url: "https://mcp.upwork.com/mcp", desc: "Jobs, proposals and contracts.", cat: "Hiring" },
|
|
142
|
+
// FROM THE MONTHLY CHECK (2026-11-16, owner: "yes"): eight that newly pass the sign-in steps, from Cursor's plugins and Grok Bot's
|
|
143
|
+
// marketplace; their marks found by the same check (tools/conn-catalog/icons.mjs). Descriptions are ours.
|
|
144
|
+
{ name: "Mixpanel", url: "https://mcp.mixpanel.com/mcp", desc: "Events, funnels, retention and dashboards.", cat: "Data analytics" },
|
|
145
|
+
{ name: "Metricool", url: "https://ai.metricool.com/mcp", desc: "Plan and publish social posts, and their results.", cat: "Marketing", png: "/icons/services/metricool.png" },
|
|
146
|
+
{ name: "Squarespace", url: "https://mcp.squarespace.com/mcp", desc: "Business name ideas and domains: availability and price.", cat: "Design" },
|
|
147
|
+
{ name: "Runta", url: "https://mcp.runta.com/mcp", desc: "Run lasting agent runtimes: ports, checkpoints and images.", cat: "Engineering", png: "/icons/services/runta.png" },
|
|
148
|
+
{ name: "OnePay", url: "https://mcp.onepay.com", desc: "Balances and spending across your OnePay accounts.", cat: "Finance", png: "/icons/services/onepay.png" },
|
|
149
|
+
{ name: "Questrade", url: "https://mcp.questrade.com/v1/brokerage/mcp", desc: "Your portfolio and live market data.", cat: "Finance", png: "/icons/services/questrade.png" },
|
|
150
|
+
{ name: "Engine", url: "https://mcp.engine.com/mcp", desc: "Find and book hotels, change or cancel stays.", cat: "Travel", png: "/icons/services/engine.png" },
|
|
151
|
+
{ name: "Eight Sleep", url: "https://public-api.8slp.net/mcp", desc: "Your sleep scores and your Pod's temperature.", cat: "Health" },
|
|
152
|
+
{ name: "AgentMail", url: "https://mcp.agentmail.to/mcp", desc: "Email inboxes for your assistant.", cat: "Email", png: "/icons/services/agentmail.png" },
|
|
153
|
+
// GMAIL BY FORWARDING (the owner, 2026-11-21: Nylas's verified Google app — the only way to read Gmail without Google's yearly
|
|
154
|
+
// assessment — was "too expensive" → "lets do this forward connector to gmail"). Not a sign-in: Gmail forwards what the person
|
|
155
|
+
// chooses to the Space's own address (Witbitz Mail, mailShare.js — received and sealed in the Sentinel). kind 'mail': no MCP address;
|
|
156
|
+
// connectionsSheet.js opens the Space's Mail card with Gmail's steps. (Reading through Nylas is built and kept: nylas.mjs.)
|
|
157
|
+
{ name: "Gmail", kind: "mail", host: "mail.google.com", desc: "Forward the mail you choose into a Space of your own — the assistant reads it when you ask.", cat: "Email" },
|
|
158
|
+
]
|
|
159
|
+
export const CATEGORY_ORDER = ["Agents", "Engineering", "Productivity", "Documents", "Design", "Meetings", "Scheduling", "Sales", "Marketing", "Customer support", "Data analytics", "Hiring", "Finance", "Travel", "Health", "Research", "Email"]
|
|
160
|
+
|
|
161
|
+
// A connection made through Witbitz's own sign-in to a service's API (kind 'oauth', the Sentinel's provider) whose entry says its reads
|
|
162
|
+
// run without asking (Google Calendar): a room keeps `reads: 'auto'` on it (connSpaces entryFor; agent/connectionTools.mjs readsRunAlone).
|
|
163
|
+
export const readsAutoFor = (c) => !!c && c.provider === 'oauth2' && CATALOG.some((x) => x.kind === 'oauth' && x.host === c.host && x.reads === 'auto')
|
|
164
|
+
|