@cotal-ai/pi 0.133.3 → 0.133.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs-bundle.bin +0 -0
- package/dist/docs-index.bin +0 -0
- package/dist/index.js +1 -1
- package/dist/standalone.js +2 -2
- package/package.json +3 -3
package/dist/docs-bundle.bin
CHANGED
|
Binary file
|
package/dist/docs-index.bin
CHANGED
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -84,7 +84,7 @@ ${tail}`)}if(history.length){blocks.push(`\u{1F4DA} Cotal \u2014 ${history.lengt
|
|
|
84
84
|
${history.map(format).join("\n")}
|
|
85
85
|
(This is replayed history, not new work. Do not act on or reply to these old requests unless the person explicitly asks.)`)}return blocks.join("\n\n")}function writeReply(sock,reply,awaitHandoff){return new Promise(resolve=>{let settled=false;const done=ok3=>{if(settled)return;settled=true;resolve(ok3)};sock.once("error",()=>done(false));sock.once("close",()=>done(false));if(!awaitHandoff){const stall=setTimeout(()=>done(false),LEGACY_WRITE_DEADLINE_MS);stall.unref?.();try{sock.end(JSON.stringify(reply)+"\n",(err3=>{clearTimeout(stall);done(!err3)}))}catch{clearTimeout(stall);done(false)}return}const deadline=setTimeout(()=>{sock.destroy();done(false)},HANDOFF_DEADLINE_MS);deadline.unref?.();let receipt="";sock.on("data",d2=>{receipt+=d2;if(!receipt.includes("\n"))return;clearTimeout(deadline);try{sock.end()}catch{}done(true)});try{sock.write(JSON.stringify(reply)+"\n",err3=>{if(!err3)return;clearTimeout(deadline);done(false)})}catch{clearTimeout(deadline);done(false)}})}function startControlServer(agent,endpoint,handle,opts={}){const{path}=endpoint;const digest=createHash6("sha256").update(endpoint.token).digest();const server=createServer(sock=>{let buf="";let handled=false;sock.setEncoding("utf8");const deadline=setTimeout(()=>sock.destroy(),AUTH_DEADLINE_MS);deadline.unref?.();sock.on("close",()=>clearTimeout(deadline));sock.on("data",async d2=>{if(handled)return;buf+=d2;if(buf.length>MAX_FRAME_BYTES){sock.destroy();return}const nl=buf.indexOf("\n");if(nl<0)return;handled=true;clearTimeout(deadline);let frame={};try{frame=JSON.parse(buf.slice(0,nl)||"{}")}catch{}if(!tokenMatches(frame.token,digest)){sock.destroy();return}const op=frame.op;if(op==="shutdown"){try{sock.end(JSON.stringify({ok:true})+"\n")}catch{}opts.onShutdown?.();return}if(op==="session"){const sessionId=opts.onSession?.();try{sock.end(JSON.stringify(sessionId?{ok:true,sessionId}:{ok:false,error:"session not ready"})+"\n")}catch{}return}const ev=frame.event??{};const awaitHandoff=frame.handoff===true;const reply=await handle(agent,ev);const delivered=await writeReply(sock,reply,awaitHandoff);opts.onReply?.(ev,delivered)});sock.on("error",()=>{})});let bound=false;let retried=false;const emit=server.emit.bind(server);server.emit=(event,...args)=>{const error51=args[0];if(event!=="error"||bound||retried||process.platform==="win32"||path.startsWith("\0")||error51?.code!=="EADDRINUSE")return emit(event,...args);retried=true;let original;try{original=lstatSync(path);if(!original.isSocket())return emit(event,...args)}catch(e){if(e.code!=="ENOENT")return emit(event,...args)}const probe=connect(path);let settled=false;const finish=stale=>{if(settled)return;settled=true;clearTimeout(deadline);probe.destroy();server.off("close",cancel);if(!stale){emit(event,...args);return}try{const current=lstatSync(path);if(!original||!current.isSocket()||current.dev!==original.dev||current.ino!==original.ino){emit(event,...args);return}unlinkSync(path)}catch(e){if(e.code!=="ENOENT"){emit("error",e);return}}server.listen(path)};const cancel=()=>{settled=true;clearTimeout(deadline);probe.destroy()};const deadline=setTimeout(()=>finish(false),250);server.once("close",cancel);probe.once("connect",()=>finish(false));probe.once("error",e=>finish(e.code==="ECONNREFUSED"||e.code==="ENOENT"));return true};server.on("error",e=>{process.stderr.write(`[cotal-connector] control server error: ${e.message}
|
|
86
86
|
`);if(opts.fatalBind&&!bound)process.exit(1)});server.listen(path,()=>{bound=true;process.stderr.write(`[cotal-connector] control socket: ${path}
|
|
87
|
-
`)});return server}var ok=text=>({text});var err=text=>({text,isError:true});async function submitFeedback(input,options={}){const url2=options.url??(options.key?FEEDBACK_URL:PUBLIC_FEEDBACK_URL);const headers={"content-type":"application/json"};const body={...input};if(options.key){headers.authorization=`Bearer ${options.key}`}else{if(!options.email)return err("Keyless feedback goes to the public cotal.ai intake, which requires a traceable contact email \u2014 ask the user for one and retry with the email argument (or set COTAL_FEEDBACK_EMAIL).");body.email=options.email}try{const res=await fetch(url2,{method:"POST",headers,body:JSON.stringify(body)});const raw=await res.text();let reply={};if(raw)try{reply=JSON.parse(raw)}catch{reply={error:raw}}if(!res.ok)return err(`Feedback rejected (${res.status}${reply.error?`: ${reply.error}`:""}).`);const note=reply.published===false?" (stored, but the internal feedback channel publish failed)":"";return ok(`Feedback sent${reply.id?` (id ${reply.id})`:""}${note}. Thanks!`)}catch(e){return err(`Couldn't reach the feedback intake at ${url2}: ${e.message}`)}}import{execFileSync}from"node:child_process";init_external();init_external();import{isConcreteChannel as isConcreteChannel3,channelInAllow as channelInAllow3,AmbiguousPeerError,peerLabel as peerLabel4,assertLifecycleToken as assertLifecycleToken3,isPermissionDenied as isPermissionDenied2,renderLifecycleBlocked,EpEnvelopeError as EpEnvelopeError3,LANG_PROBLEM_DETAIL_KIND,formatAge,presenceAges,presenceText}from"@cotal-ai/core";import{parsePrincipalKey as parsePrincipalKey2,peerLabel as peerLabel3}from"@cotal-ai/core";import{createHash as createHash7}from"node:crypto";import{readFileSync as readFileSync2}from"node:fs";import{join as join5}from"node:path";import{gunzipSync}from"node:zlib";var DOCS_VERSION="0.133.3";function loadDocsMetadata(){return{"version":"0.133.3","pages":[{"slug":"what-is-cotal","title":"What is Cotal","kind":"Start here (informative)","category":"Start here","summary":"Cotal is an open pub/sub standard for AI agents and software services to work together."},{"slug":"getting-started","title":"Quickstart","kind":"Start here (informative)","category":"Start here","summary":"Paste this into any coding agent (Claude Code, OpenCode, Cursor, Codex) and it will do the whole page for you:"},{"slug":"architecture","title":"Architecture","kind":"Concept (informative)","category":"Concept","summary":"Cotal is built as a thin waist: the normative wire contract (subjects, message schemas, presence/discovery, delivery semantics, the auth grammar) is the standard (SPEC), and everything else is a pl\u2026"},{"slug":"mcp-tools","title":"MCP tool catalog","kind":"Reference: the `cotal_*` tool surface every connected agent gets.","category":"Reference","summary":"The tools are defined once, platform-neutrally, in @cotal-ai/connector-core and rendered onto each host's native tool API (an MCP server for Claude Code, Codex and Jcode, native plugin tools for Op\u2026"},{"slug":"channels-and-permissions","title":"Channel permissions","kind":"Reference (informative task card)","category":"Reference","summary":"Channel permissions decide who can read, who can post, and what each agent tunes into at boot."},{"slug":"identity-and-auth","title":"Identity","kind":"Concept (informative)","category":"Concept","summary":"Who can do what on a mesh, and how it is enforced."},{"slug":"agent-files","title":"Agent files","kind":"Reference (the persisted form of an agent's identity + persona, read by every launcher)","category":"Reference","summary":"An agent's identity and persona live in one Markdown file instead of being passed flag-by-flag, the same shape Claude Code uses for subagents:"},{"slug":"api-reference","title":"API reference","kind":"Reference (informative)","category":"Reference","summary":"Cotal exposes a wire protocol, TypeScript libraries, CLI commands and agent tools."},{"slug":"auth-api","title":"Auth HTTP API","kind":"Reference (informative)","category":"Reference","summary":"HTTP interface of the stock auth public listener: 11 paths and 12 operations."},{"slug":"authoring-a-connector","title":"Authoring a connector","kind":"Reference: describes the TypeScript reference implementation, not the wire contract.","category":"Reference","summary":"A connector teaches Cotal how to launch one agent harness (Claude Code, OpenCode, your own) as a mesh node."},{"slug":"build-a-client","title":"Build a Cotal client","kind":"Guide (informative)","category":"Guide","summary":"This page is the reading order for implementing a Cotal client in another language (Go, Python, Rust, or anything with a NATS client library) against the spec, without reimplementing the protocol."},{"slug":"cli","title":"`cotal` CLI reference","kind":"Reference: describes the TypeScript reference implementation (the `cotal` CLI), not the wire contract.","category":"Reference","summary":"cotal is the operator command line for the reference implementation: bring a mesh up, mint identities, launch agents, watch what they do, and tear it all down."},{"slug":"config","title":"Configuration","kind":"Reference: describes the TypeScript reference implementation (the `cotal` CLI and connectors), not the wire contract.","category":"Reference","summary":"Four things configure a Cotal workstation: the config file (per-connector settings, notably which of your MCP servers get shared with spawned agents), your preferences (the defaults your own comman\u2026"},{"slug":"connect-claude","title":"Connect Claude","kind":"Guide (informative)","category":"Guide","summary":"The Claude Code connector turns a real claude session into a Cotal mesh peer."},{"slug":"connect-codex","title":"Connect Codex (beta)","kind":"Guide (informative)","category":"Guide","summary":"OpenAI Codex joins a Cotal mesh as a lateral peer: the same cotal tool surface, the same message delivery and attention model as the other connectors, plus mid-turn steering: a directed peer messag\u2026"},{"slug":"connect-hermes","title":"Connect Hermes (alpha)","kind":"Guide (informative)","category":"Guide","summary":"Hermes (Nous Research) joins a Cotal mesh as a lateral peer, with the same shared cotal tool surface and delivery model as the other connectors."},{"slug":"connect-jcode","title":"Connect Jcode (beta)","kind":"Guide (informative)","category":"Guide","summary":"Jcode joins a Cotal mesh as a lateral peer."},{"slug":"connect-opencode","title":"Connect OpenCode (beta)","kind":"Guide (informative)","category":"Guide","summary":"OpenCode joins a Cotal mesh as a lateral peer, at parity with Claude Code: the same cotal tool surface, the same message delivery and attention model."},{"slug":"connect-pi","title":"Connect pi (alpha)","kind":"Guide (informative)","category":"Guide","summary":"@cotal-ai/pi is Cotal's first host-native framework adapter."},{"slug":"connectors","title":"Connectors","kind":"Guide (informative)","category":"Guide","summary":"Every connector puts a real agent session on the mesh with the same cotal tools, presence, and delivery model (MCP tools)."},{"slug":"control-surface","title":"The control surface","kind":"Concept (informative)","category":"Concept","summary":"Cotal once had a privileged control rail: a fixed set of named service tiers (self / manager / admin / delivery) on their own ctl."},{"slug":"dashboard-api","title":"Dashboard HTTP API","kind":"Reference (informative)","category":"Reference","summary":"HTTP interface of the @cotal-ai/web reference implementation."},{"slug":"define-a-team","title":"Define a team","kind":"Guide (informative)","category":"Guide","summary":"The Quickstart gives you one agent. To run a specific team (your own channels, your own agents, and the channel access for each agent), describe it once in a cotal.yaml and launch it with a single\u2026"},{"slug":"delivery-daemon","title":"The delivery daemon (Plane-3)","kind":"Concept (informative)","category":"Concept","summary":"Live channel delivery is at-most-once: a message reaches only the peers subscribed at the moment it is published (SPEC \xA74)."},{"slug":"deploy","title":"Deploying agent teams","kind":"Guide (informative)","category":"Guide","summary":"The deploy/ tree runs a team of agents in an isolated container that dials out to an existing Cotal broker."},{"slug":"embedding","title":"Embedding Cotal","kind":"Guide (informative)","category":"Guide","summary":"The cotal binary in this repo is one composition root: an operator CLI."},{"slug":"examples","title":"Examples","kind":"Guide (informative)","category":"Guide","summary":"Examples live in examples/, one self-contained folder each."},{"slug":"glossary","title":"Glossary","kind":"Reference (informative)","category":"Reference","summary":"One-line definitions of the terms used across these docs and the spec."},{"slug":"lang-card","title":"The cotal-lang card","kind":"Reference (informative)","category":"Reference","summary":"One page to write a correct workflow program."},{"slug":"manifest","title":"Mesh manifest (`cotal.yaml`)","kind":"Reference: every field of the mesh manifest.","category":"Reference","summary":"A manifest (cotal.yaml, kind: Mesh) describes a whole team (its channels, its agents, and who may read and post where) in one file."},{"slug":"mesh-view","title":"MeshView","kind":"Reference: TypeScript observer surfaces (`MeshView`)","category":"Reference","summary":"MeshView is the CLI's shared model for the terminal console and its plain stream."},{"slug":"presence-and-delivery","title":"Message flow","kind":"Concept (informative)","category":"Concept","summary":"How peers see each other and how messages reach them: the presence directory, the three delivery modes, and the two delivery guarantees."},{"slug":"release","title":"Publishing a release","kind":"Project (non-normative maintainer notes)","category":"Project","summary":"Cotal uses pnpm, Changesets and one GitHub Actions workflow."},{"slug":"roadmap","title":"Roadmap","kind":"Project (non-normative)","category":"Project","summary":"Cotal is pre-1.0. The wire contract (v0.x) may still change under the change process. This page tracks what is deliberately not built yet, and the direction each area is headed."},{"slug":"run-a-mesh","title":"Run a mesh","kind":"Guide (informative)","category":"Guide","summary":"Day-to-day operation of a local mesh: what cotal up actually runs, how spawning resolves personas, harnesses, and models, how to reach a mesh from any directory, and the operator-only maintenance v\u2026"},{"slug":"security","title":"Security model","kind":"Concept (informative threat model)","category":"Concept","summary":"Cotal v0 provides containment and sender authenticity for peers sharing one trusted NATS broker."},{"slug":"setup-internals","title":"Setup internals (maintainer notes)","kind":"Project (non-normative maintainer notes)","category":"Project","summary":"cotal setup (implementations/cli/src/commands/setup.ts) saves configuration by default: it checks prerequisites, sets up the chosen application and runtimes, and seeds persona files."},{"slug":"spaces","title":"Spaces","kind":"Concept (informative)","category":"Concept","summary":"The space concept, and why it is distinct from a channel."},{"slug":"stability","title":"Substrate stability","kind":"Project (informative)","category":"Project","summary":"Cotal's packages are pre-1.0 and publish in lockstep."},{"slug":"telemetry","title":"Telemetry","kind":"Reference","category":"Reference","summary":"The cotal CLI sends usage data about commands, failures and platforms."},{"slug":"transport","title":"Transport vs protocol","kind":"Concept (informative)","category":"Concept","summary":"What in Cotal is the protocol, what is the transport, and what a transport binding must provide."},{"slug":"upgrading","title":"Upgrading a running deployment","kind":"Guide (informative)","category":"Guide","summary":"Substrate stability tells you what the version numbers promise."},{"slug":"using-cotal","title":"Choose a workflow","kind":"Guide (informative)","category":"Guide","summary":"Cotal can run a local team, connect a session to a shared space, or expose a service to agents."},{"slug":"watch-a-mesh","title":"Watch a mesh","kind":"Guide (informative)","category":"Guide","summary":"Cotal's watch surfaces show who is present, their reported activity and the messages your credential permits you to read."},{"slug":"workflows","title":"Workflow runs","kind":"Concept (informative)","category":"Concept","summary":"A workflow run is a program that coordinates agents over hours or days and survives the process that started it."}],"spec":{"title":"Cotal Wire Specification"},"lang":{"title":"Cotal Lang: the workflow language"},"schema":{"title":"Cotal message schema (JSON Schema)"}}}function loadDocsBundle(){const packed=readFileSync2(join5(import.meta.dirname,"docs-bundle.bin"));if(packed.length!==979447||createHash7("sha256").update(packed).digest("hex")!=="11b6e2816284e544746e48544b7e0e5e9448c2b5a4f9f217a10eea5e83df1a33")throw new Error("docs data file docs-bundle.bin beside this module is not the one built with it");return JSON.parse(gunzipSync(packed).toString("utf8"))}function loadDocsIndex(){const packed=readFileSync2(join5(import.meta.dirname,"docs-index.bin"));if(packed.length!==437020||createHash7("sha256").update(packed).digest("hex")!=="b3053267b8b24fd23ca8a552e25d45bfa14d11c4e33b8aba29acc7af58eb5e5e")throw new Error("docs data file docs-index.bin beside this module is not the one built with it");return gunzipSync(packed)}var TOKEN=/[a-z0-9_$.#>*-]+/gi;var EDGE=/^[.>*#-]+|[.>*#-]+$/g;function tokenize(s){const raw=s.toLowerCase().match(TOKEN);if(!raw)return[];const out=[];for(const r of raw){if(r.length>=2)out.push(r);const t=r.replace(EDGE,"");if(t.length>=2&&t!==r)out.push(t);if(t.includes(".")){for(const seg of t.split("."))if(seg.length>=2)out.push(seg)}}return out}var STOP=new Set("a an and are as at be by do for from has how in is it of on or that the this to use using was what when where which who with you your".split(" "));function decodeIndex(bytes,bodyLengths,version2){if(bytes.length<4)throw new Error("docs index is truncated or malformed");const headerLength=bytes.readUInt32LE(0);if(4+headerLength>bytes.length)throw new Error("docs index is truncated or malformed");const header=JSON.parse(bytes.toString("utf8",4,4+headerLength));if(header.version!==version2||header.bodyLengths.length!==bodyLengths.length||header.bodyLengths.some((length2,i)=>length2!==bodyLengths[i]))throw new Error("docs index does not match the docs bundle it is searching");const n=header.sections;const length=4*n+header.terms.length+1+2*header.postings;if(bytes.length-4-headerLength!==4*length)throw new Error("docs index is truncated or malformed");const columns=new Uint32Array(length);for(let i=0;i<length;i++)columns[i]=bytes.readUInt32LE(4+headerLength+4*i);const offsets=4*n;const sectionColumn=offsets+header.terms.length+1;let total=0;for(let i=0;i<n;i++)total+=columns[3*n+i];return{sections:n,terms:header.terms,headings:header.headings,source:columns.subarray(0,n),start:columns.subarray(n,2*n),end:columns.subarray(2*n,3*n),length:columns.subarray(3*n,4*n),offsets:columns.subarray(offsets,sectionColumn),postSection:columns.subarray(sectionColumn,sectionColumn+header.postings),postWeight:columns.subarray(sectionColumn+header.postings),avgdl:total/Math.max(1,n)}}var indexed;function metadata(){return indexed??=loadDocsMetadata()}var bundled;function bundle(){return bundled??=loadDocsBundle()}var REMOTE_BASE="https://docs.cotal.ai";function resolvePage(page){const key=page.trim().toLowerCase().replace(/\.md$/,"");if(key==="spec")return{slug:"spec",title:bundle().spec.title,kind:"normative",category:"normative",summary:"",body:bundle().spec.body};if(key==="lang"||key==="cotal-lang")return{slug:"lang",title:bundle().lang.title,kind:"normative",category:"normative",summary:"",body:bundle().lang.body};if(key==="schema")return{slug:"schema",title:bundle().schema.title,kind:"reference",category:"reference",summary:"",body:bundle().schema.body};return bundle().pages.find(p=>p.slug===key)}function remoteUrl(slug){const base=`${REMOTE_BASE}/v/${bundle().version}`;if(slug==="schema")return`${base}/cotal.schema.json`;if(slug==="lang")return`${base}/cotal-lang.md`;return`${base}/${slug}.md`}function renderDocsIndex(){const b2=metadata();const rows=b2.pages.map(p=>{const kind=p.kind?`: ${p.kind}`:"";return`- \`${p.slug}\`${kind}
|
|
87
|
+
`)});return server}var ok=text=>({text});var err=text=>({text,isError:true});async function submitFeedback(input,options={}){const url2=options.url??(options.key?FEEDBACK_URL:PUBLIC_FEEDBACK_URL);const headers={"content-type":"application/json"};const body={...input};if(options.key){headers.authorization=`Bearer ${options.key}`}else{if(!options.email)return err("Keyless feedback goes to the public cotal.ai intake, which requires a traceable contact email \u2014 ask the user for one and retry with the email argument (or set COTAL_FEEDBACK_EMAIL).");body.email=options.email}try{const res=await fetch(url2,{method:"POST",headers,body:JSON.stringify(body)});const raw=await res.text();let reply={};if(raw)try{reply=JSON.parse(raw)}catch{reply={error:raw}}if(!res.ok)return err(`Feedback rejected (${res.status}${reply.error?`: ${reply.error}`:""}).`);const note=reply.published===false?" (stored, but the internal feedback channel publish failed)":"";return ok(`Feedback sent${reply.id?` (id ${reply.id})`:""}${note}. Thanks!`)}catch(e){return err(`Couldn't reach the feedback intake at ${url2}: ${e.message}`)}}import{execFileSync}from"node:child_process";init_external();init_external();import{isConcreteChannel as isConcreteChannel3,channelInAllow as channelInAllow3,AmbiguousPeerError,peerLabel as peerLabel4,assertLifecycleToken as assertLifecycleToken3,isPermissionDenied as isPermissionDenied2,renderLifecycleBlocked,EpEnvelopeError as EpEnvelopeError3,LANG_PROBLEM_DETAIL_KIND,formatAge,presenceAges,presenceText}from"@cotal-ai/core";import{parsePrincipalKey as parsePrincipalKey2,peerLabel as peerLabel3}from"@cotal-ai/core";import{createHash as createHash7}from"node:crypto";import{readFileSync as readFileSync2}from"node:fs";import{join as join5}from"node:path";import{gunzipSync}from"node:zlib";var DOCS_VERSION="0.133.5";function loadDocsMetadata(){return{"version":"0.133.5","pages":[{"slug":"what-is-cotal","title":"What is Cotal","kind":"Start here (informative)","category":"Start here","summary":"Cotal is an open pub/sub standard for AI agents and software services to work together."},{"slug":"getting-started","title":"Quickstart","kind":"Start here (informative)","category":"Start here","summary":"Paste this into any coding agent (Claude Code, OpenCode, Cursor, Codex) and it will do the whole page for you:"},{"slug":"architecture","title":"Architecture","kind":"Concept (informative)","category":"Concept","summary":"Cotal is built as a thin waist: the normative wire contract (subjects, message schemas, presence/discovery, delivery semantics, the auth grammar) is the standard (SPEC), and everything else is a pl\u2026"},{"slug":"mcp-tools","title":"MCP tool catalog","kind":"Reference: the `cotal_*` tool surface every connected agent gets.","category":"Reference","summary":"The tools are defined once, platform-neutrally, in @cotal-ai/connector-core and rendered onto each host's native tool API (an MCP server for Claude Code, Codex and Jcode, native plugin tools for Op\u2026"},{"slug":"channels-and-permissions","title":"Channel permissions","kind":"Reference (informative task card)","category":"Reference","summary":"Channel permissions decide who can read, who can post, and what each agent tunes into at boot."},{"slug":"identity-and-auth","title":"Identity","kind":"Concept (informative)","category":"Concept","summary":"Who can do what on a mesh, and how it is enforced."},{"slug":"agent-files","title":"Agent files","kind":"Reference (the persisted form of an agent's identity + persona, read by every launcher)","category":"Reference","summary":"An agent's identity and persona live in one Markdown file instead of being passed flag-by-flag, the same shape Claude Code uses for subagents:"},{"slug":"api-reference","title":"API reference","kind":"Reference (informative)","category":"Reference","summary":"Cotal exposes a wire protocol, TypeScript libraries, CLI commands and agent tools."},{"slug":"auth-api","title":"Auth HTTP API","kind":"Reference (informative)","category":"Reference","summary":"HTTP interface of the stock auth public listener: 11 paths and 12 operations."},{"slug":"authoring-a-connector","title":"Authoring a connector","kind":"Reference: describes the TypeScript reference implementation, not the wire contract.","category":"Reference","summary":"A connector teaches Cotal how to launch one agent harness (Claude Code, OpenCode, your own) as a mesh node."},{"slug":"build-a-client","title":"Build a Cotal client","kind":"Guide (informative)","category":"Guide","summary":"This page is the reading order for implementing a Cotal client in another language (Go, Python, Rust, or anything with a NATS client library) against the spec, without reimplementing the protocol."},{"slug":"cli","title":"`cotal` CLI reference","kind":"Reference: describes the TypeScript reference implementation (the `cotal` CLI), not the wire contract.","category":"Reference","summary":"cotal is the operator command line for the reference implementation: bring a mesh up, mint identities, launch agents, watch what they do, and tear it all down."},{"slug":"config","title":"Configuration","kind":"Reference: describes the TypeScript reference implementation (the `cotal` CLI and connectors), not the wire contract.","category":"Reference","summary":"Four things configure a Cotal workstation: the config file (per-connector settings, notably which of your MCP servers get shared with spawned agents), your preferences (the defaults your own comman\u2026"},{"slug":"connect-claude","title":"Connect Claude","kind":"Guide (informative)","category":"Guide","summary":"The Claude Code connector turns a real claude session into a Cotal mesh peer."},{"slug":"connect-codex","title":"Connect Codex (beta)","kind":"Guide (informative)","category":"Guide","summary":"OpenAI Codex joins a Cotal mesh as a lateral peer: the same cotal tool surface, the same message delivery and attention model as the other connectors, plus mid-turn steering: a directed peer messag\u2026"},{"slug":"connect-hermes","title":"Connect Hermes (alpha)","kind":"Guide (informative)","category":"Guide","summary":"Hermes (Nous Research) joins a Cotal mesh as a lateral peer, with the same shared cotal tool surface and delivery model as the other connectors."},{"slug":"connect-jcode","title":"Connect Jcode (beta)","kind":"Guide (informative)","category":"Guide","summary":"Jcode joins a Cotal mesh as a lateral peer."},{"slug":"connect-opencode","title":"Connect OpenCode (beta)","kind":"Guide (informative)","category":"Guide","summary":"OpenCode joins a Cotal mesh as a lateral peer, at parity with Claude Code: the same cotal tool surface, the same message delivery and attention model."},{"slug":"connect-pi","title":"Connect pi (alpha)","kind":"Guide (informative)","category":"Guide","summary":"@cotal-ai/pi is Cotal's first host-native framework adapter."},{"slug":"connectors","title":"Connectors","kind":"Guide (informative)","category":"Guide","summary":"Every connector puts a real agent session on the mesh with the same cotal tools, presence, and delivery model (MCP tools)."},{"slug":"control-surface","title":"The control surface","kind":"Concept (informative)","category":"Concept","summary":"Cotal once had a privileged control rail: a fixed set of named service tiers (self / manager / admin / delivery) on their own ctl."},{"slug":"dashboard-api","title":"Dashboard HTTP API","kind":"Reference (informative)","category":"Reference","summary":"HTTP interface of the @cotal-ai/web reference implementation."},{"slug":"define-a-team","title":"Define a team","kind":"Guide (informative)","category":"Guide","summary":"The Quickstart gives you one agent. To run a specific team (your own channels, your own agents, and the channel access for each agent), describe it once in a cotal.yaml and launch it with a single\u2026"},{"slug":"delivery-daemon","title":"The delivery daemon (Plane-3)","kind":"Concept (informative)","category":"Concept","summary":"Live channel delivery is at-most-once: a message reaches only the peers subscribed at the moment it is published (SPEC \xA74)."},{"slug":"deploy","title":"Deploying agent teams","kind":"Guide (informative)","category":"Guide","summary":"The deploy/ tree runs a team of agents in an isolated container that dials out to an existing Cotal broker."},{"slug":"embedding","title":"Embedding Cotal","kind":"Guide (informative)","category":"Guide","summary":"The cotal binary in this repo is one composition root: an operator CLI."},{"slug":"examples","title":"Examples","kind":"Guide (informative)","category":"Guide","summary":"Examples live in examples/, one self-contained folder each."},{"slug":"glossary","title":"Glossary","kind":"Reference (informative)","category":"Reference","summary":"One-line definitions of the terms used across these docs and the spec."},{"slug":"lang-card","title":"The cotal-lang card","kind":"Reference (informative)","category":"Reference","summary":"One page to write a correct workflow program."},{"slug":"manifest","title":"Mesh manifest (`cotal.yaml`)","kind":"Reference: every field of the mesh manifest.","category":"Reference","summary":"A manifest (cotal.yaml, kind: Mesh) describes a whole team (its channels, its agents, and who may read and post where) in one file."},{"slug":"mesh-view","title":"MeshView","kind":"Reference: TypeScript observer surfaces (`MeshView`)","category":"Reference","summary":"MeshView is the CLI's shared model for the terminal console and its plain stream."},{"slug":"presence-and-delivery","title":"Message flow","kind":"Concept (informative)","category":"Concept","summary":"How peers see each other and how messages reach them: the presence directory, the three delivery modes, and the two delivery guarantees."},{"slug":"release","title":"Publishing a release","kind":"Project (non-normative maintainer notes)","category":"Project","summary":"Cotal uses pnpm, Changesets and one GitHub Actions workflow."},{"slug":"roadmap","title":"Roadmap","kind":"Project (non-normative)","category":"Project","summary":"Cotal is pre-1.0. The wire contract (v0.x) may still change under the change process. This page tracks what is deliberately not built yet, and the direction each area is headed."},{"slug":"run-a-mesh","title":"Run a mesh","kind":"Guide (informative)","category":"Guide","summary":"Day-to-day operation of a local mesh: what cotal up actually runs, how spawning resolves personas, harnesses, and models, how to reach a mesh from any directory, and the operator-only maintenance v\u2026"},{"slug":"security","title":"Security model","kind":"Concept (informative threat model)","category":"Concept","summary":"Cotal v0 provides containment and sender authenticity for peers sharing one trusted NATS broker."},{"slug":"setup-internals","title":"Setup internals (maintainer notes)","kind":"Project (non-normative maintainer notes)","category":"Project","summary":"cotal setup (implementations/cli/src/commands/setup.ts) saves configuration by default: it checks prerequisites, sets up the chosen application and runtimes, and seeds persona files."},{"slug":"spaces","title":"Spaces","kind":"Concept (informative)","category":"Concept","summary":"The space concept, and why it is distinct from a channel."},{"slug":"stability","title":"Substrate stability","kind":"Project (informative)","category":"Project","summary":"Cotal's packages are pre-1.0 and publish in lockstep."},{"slug":"telemetry","title":"Telemetry","kind":"Reference","category":"Reference","summary":"The cotal CLI sends usage data about commands, failures and platforms."},{"slug":"transport","title":"Transport vs protocol","kind":"Concept (informative)","category":"Concept","summary":"What in Cotal is the protocol, what is the transport, and what a transport binding must provide."},{"slug":"upgrading","title":"Upgrading a running deployment","kind":"Guide (informative)","category":"Guide","summary":"Substrate stability tells you what the version numbers promise."},{"slug":"using-cotal","title":"Choose a workflow","kind":"Guide (informative)","category":"Guide","summary":"Cotal can run a local team, connect a session to a shared space, or expose a service to agents."},{"slug":"watch-a-mesh","title":"Watch a mesh","kind":"Guide (informative)","category":"Guide","summary":"Cotal's watch surfaces show who is present, their reported activity and the messages your credential permits you to read."},{"slug":"workflows","title":"Workflow runs","kind":"Concept (informative)","category":"Concept","summary":"A workflow run is a program that coordinates agents over hours or days and survives the process that started it."}],"spec":{"title":"Cotal Wire Specification"},"lang":{"title":"Cotal Lang: the workflow language"},"schema":{"title":"Cotal message schema (JSON Schema)"}}}function loadDocsBundle(){const packed=readFileSync2(join5(import.meta.dirname,"docs-bundle.bin"));if(packed.length!==979447||createHash7("sha256").update(packed).digest("hex")!=="b742b1751f319892081418ffcb408df4253452953992ebe98f7bebed9796288f")throw new Error("docs data file docs-bundle.bin beside this module is not the one built with it");return JSON.parse(gunzipSync(packed).toString("utf8"))}function loadDocsIndex(){const packed=readFileSync2(join5(import.meta.dirname,"docs-index.bin"));if(packed.length!==437017||createHash7("sha256").update(packed).digest("hex")!=="9e814f93b292f5af1c4fee1ce09abbbebb6e80f19dc912987020f20e8129dfe3")throw new Error("docs data file docs-index.bin beside this module is not the one built with it");return gunzipSync(packed)}var TOKEN=/[a-z0-9_$.#>*-]+/gi;var EDGE=/^[.>*#-]+|[.>*#-]+$/g;function tokenize(s){const raw=s.toLowerCase().match(TOKEN);if(!raw)return[];const out=[];for(const r of raw){if(r.length>=2)out.push(r);const t=r.replace(EDGE,"");if(t.length>=2&&t!==r)out.push(t);if(t.includes(".")){for(const seg of t.split("."))if(seg.length>=2)out.push(seg)}}return out}var STOP=new Set("a an and are as at be by do for from has how in is it of on or that the this to use using was what when where which who with you your".split(" "));function decodeIndex(bytes,bodyLengths,version2){if(bytes.length<4)throw new Error("docs index is truncated or malformed");const headerLength=bytes.readUInt32LE(0);if(4+headerLength>bytes.length)throw new Error("docs index is truncated or malformed");const header=JSON.parse(bytes.toString("utf8",4,4+headerLength));if(header.version!==version2||header.bodyLengths.length!==bodyLengths.length||header.bodyLengths.some((length2,i)=>length2!==bodyLengths[i]))throw new Error("docs index does not match the docs bundle it is searching");const n=header.sections;const length=4*n+header.terms.length+1+2*header.postings;if(bytes.length-4-headerLength!==4*length)throw new Error("docs index is truncated or malformed");const columns=new Uint32Array(length);for(let i=0;i<length;i++)columns[i]=bytes.readUInt32LE(4+headerLength+4*i);const offsets=4*n;const sectionColumn=offsets+header.terms.length+1;let total=0;for(let i=0;i<n;i++)total+=columns[3*n+i];return{sections:n,terms:header.terms,headings:header.headings,source:columns.subarray(0,n),start:columns.subarray(n,2*n),end:columns.subarray(2*n,3*n),length:columns.subarray(3*n,4*n),offsets:columns.subarray(offsets,sectionColumn),postSection:columns.subarray(sectionColumn,sectionColumn+header.postings),postWeight:columns.subarray(sectionColumn+header.postings),avgdl:total/Math.max(1,n)}}var indexed;function metadata(){return indexed??=loadDocsMetadata()}var bundled;function bundle(){return bundled??=loadDocsBundle()}var REMOTE_BASE="https://docs.cotal.ai";function resolvePage(page){const key=page.trim().toLowerCase().replace(/\.md$/,"");if(key==="spec")return{slug:"spec",title:bundle().spec.title,kind:"normative",category:"normative",summary:"",body:bundle().spec.body};if(key==="lang"||key==="cotal-lang")return{slug:"lang",title:bundle().lang.title,kind:"normative",category:"normative",summary:"",body:bundle().lang.body};if(key==="schema")return{slug:"schema",title:bundle().schema.title,kind:"reference",category:"reference",summary:"",body:bundle().schema.body};return bundle().pages.find(p=>p.slug===key)}function remoteUrl(slug){const base=`${REMOTE_BASE}/v/${bundle().version}`;if(slug==="schema")return`${base}/cotal.schema.json`;if(slug==="lang")return`${base}/cotal-lang.md`;return`${base}/${slug}.md`}function renderDocsIndex(){const b2=metadata();const rows=b2.pages.map(p=>{const kind=p.kind?`: ${p.kind}`:"";return`- \`${p.slug}\`${kind}
|
|
88
88
|
${p.summary}`});return[`# Cotal v${b2.version} documentation`,"","The authoritative docs bundled with this installed version. This index lists what","exists; it holds no answers itself. Your next call:",'- Know the page? Read it in full: `cotal_docs(page: "<slug>")` (e.g. "spec", "architecture").','- Not sure which page? Search: `cotal_docs(query: "\u2026")` returns the most relevant sections.',"Prefer these docs over training memory, and read the full page before writing code or wire","frames. Docs are bundled and version-exact; add `refresh: true` to also pull any patches","published to docs.cotal.ai for this same version.","","## The normative sources",`- \`spec\`: ${b2.spec.title} (the wire contract; where a page disagrees, the spec wins)`,`- \`lang\`: ${b2.lang.title} (the workflow language a durable run executes; spec \xA714)`,`- \`schema\`: ${b2.schema.title} (authoritative for message shapes)`,"","## Pages",...rows].join("\n")}function renderPage(p,note){return`${note}
|
|
89
89
|
|
|
90
90
|
${p.body}`.trimStart()}var K1=1.2;var B=.75;function sources(){const b2=bundle();return[...b2.pages,{slug:"spec",...b2.spec},{slug:"lang",...b2.lang},{slug:"schema",...b2.schema}]}var index;function searchIndex(){return index??=decodeIndex(loadDocsIndex(),sources().map(source=>source.body.length),DOCS_VERSION)}function termId(terms,term){let low=0;let high=terms.length-1;while(low<=high){const mid=low+high>>>1;const candidate=terms[mid];if(candidate===term)return mid;if(candidate<term)low=mid+1;else high=mid-1}return-1}function searchDocs(query,limit=5){if(limit<=0)return[];let terms=tokenize(query).filter(t=>!STOP.has(t));if(!terms.length)terms=tokenize(query);const termSet=new Set(terms);if(!termSet.size)return[];const idx=searchIndex();const N2=idx.sections;const scores=new Float64Array(N2);for(const t of termSet){const id=termId(idx.terms,t);if(id<0)continue;const from=idx.offsets[id];const to=idx.offsets[id+1];const n=to-from;const idf=Math.log(1+(N2-n+.5)/(n+.5));for(let p=from;p<to;p++){const s=idx.postSection[p];const f=idx.postWeight[p];scores[s]+=idf*(f*(K1+1)/(f+K1*(1-B+B*idx.length[s]/idx.avgdl)))}}const scored=[];for(let s=0;s<N2;s++)if(scores[s]>0)scored.push({s,score:scores[s]});scored.sort((a,b2)=>b2.score-a.score);const all=sources();const perPage=new Map;const hits=[];for(const{s,score}of scored){const source=all[idx.source[s]];const seen=perPage.get(source.slug)??0;if(seen>=2)continue;perPage.set(source.slug,seen+1);hits.push({slug:source.slug,pageTitle:source.title,heading:idx.headings[s],text:source.body.slice(idx.start[s],idx.end[s]),score});if(hits.length>=limit)break}return hits}function capSection(text,maxLines=48){const lines=text.split("\n");if(lines.length<=maxLines)return text.trim();return lines.slice(0,maxLines).join("\n").trimEnd()+"\n\n\u2026 (section continues; read the full page)"}function renderSearch(query,hits){if(!hits.length){return`No matches for "${query}" in the Cotal v${bundle().version} docs. Call cotal_docs() for the page index, or search an exact identifier (a subject, a cotal_* tool, a field name).`}const blocks=hits.map(h2=>`## ${h2.heading}
|