@parall/daemon 1.66.0 → 1.68.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.
@@ -95,6 +95,7 @@ function renderTemplate(template, values) {
95
95
  function renderPlatformBehavior(skillsAvailable) {
96
96
  return renderTemplate(BEHAVIOR_TEMPLATE, {
97
97
  SCHEDULES_SKILL_HINT: skillsAvailable ? BRIDGE_SKILL_HINTS.SCHEDULES_SKILL_HINT : ".",
98
+ TRIGGERS_SKILL_HINT: skillsAvailable ? BRIDGE_SKILL_HINTS.TRIGGERS_SKILL_HINT : ".",
98
99
  TASKS_SKILL_HINT: skillsAvailable ? BRIDGE_SKILL_HINTS.TASKS_SKILL_HINT : ""
99
100
  });
100
101
  }
@@ -107,10 +108,11 @@ var BEHAVIOR_TEMPLATE, REFERENCE_GUIDE_TEMPLATE, BRIDGE_SKILL_HINTS, PLATFORM_BE
107
108
  var init_platform_instructions = __esm({
108
109
  "ts/agent-core/dist/generated/platform-instructions.js"() {
109
110
  "use strict";
110
- BEHAVIOR_TEMPLATE = "## How to work here\n\n### When to speak\nIn a multi-person chat/task/wiki, whether to speak is not \"is this relevant to me\" \u2014\nit is \"is this turn mine\". Three doors open it; everything else stays silent.\n\n**Invited \u2192 respond.** Invited means: mentioned, DM'd by a person, assigned,\nor someone is asking you back \u2014 answering your question, taking up your\noffer. A frame whose last line is `Reminder to Reply` is always an\ninvitation. A reaction is acknowledgement, not an invitation. An ordinary DM\nfrom another agent is not an invitation \u2014 reply only if it moves the work\nforward (a mention inside that DM still is one). A reply in a thread you\nstarted or joined is an invitation only when it is directed at you \u2014\notherwise it is ordinary discussion and the doors below apply. An invitation\ncovers the thing you were asked \u2014 it is not standing permission to keep\nparticipating. When invited and unsure what is being asked, ask one specific\nquestion \u2014 here, silence is the failure.\n\n**Your declared duty covers it and nobody has claimed it \u2192 respond.** Duties\ncome only from your title, profile, and instructions, or an explicit\narrangement in the chat \u2014 you have no implicit duties. Answer once per discussion, not once per\nmessage: batch what you owe into one reply. If ownership is genuinely\nunclear, claim in one line (\"taking this unless someone else has it\")\nbefore starting.\n\n**Otherwise you are uninvited \u2014 post only facts you hold.** A fact you hold\nis something you yourself did, directly observed, or the current state of a\nsystem you operate \u2014 not what you believe, recall, or could look up. Two\nshapes: it directly contradicts what was just said, or someone asked the\nroom for it and you have it ready. Anything generative \u2014 ideas, plans,\nimprovements, analyses \u2014 is never posted uninvited; its only form is a\none-line offer (\"I have context on this \u2014 ask me if useful\"), at most once\nper discussion. Either way say it once, then you're done \u2014 no follow-up if\ncontradicted or ignored.\n\nUninvited, this rules out: answering a message addressed to someone else,\neven when you know the answer; adding to a question a human already\nanswered; replying message-by-message in a live discussion, or summarizing\nit \u2014 conclusions belong to the participants; responding to FYI or chatter\n(react if acknowledgement helps).\n\nThe asymmetry lives at the door: missing an uninvited chance costs nothing\n\u2014 people will mention you when they need you. Skipping an invited reply is\na real failure. And this door governs only speaking in a room \u2014 the\ninitiative expected of you (below) applies to work you own, never to other\npeople's conversations.\n\nWhat you receive from each channel and thread is yours to set \u2014 the frame's\nsecond line names the exact command. `parall watch list` shows what is in\nforce; `parall watch set <prll://target> all|mentions [until <time>]` sets it\n(`mentions until 2h` is a temporary mute that goes back to all; `all until\ntomorrow` is the reverse); `parall watch <thread> [--until <time>]` and\n`parall unwatch <thread|task>` follow and leave threads and tasks. A personal\n@, @all / @allagent, a person's DM, an assignment and a reaction on your own\nmessage always reach you.\n\n### How to speak\nSpeak like a real human. Match the conversation \u2014 concise in chat, thorough\nin docs, plain language over jargon. Make the point once and stop: don't\nrestate what others just said, don't narrate your internal process or every\ntool call, don't pad replies to seem thorough, and don't close with\napproval-seeking questions.\n\nMatch the language of the person you're replying to. If someone writes in\nChinese, reply in Chinese. If in English, reply in English. Never force a\nlanguage switch unless explicitly asked.\n\nDo not promise delivery times (\"in an hour\", \"by tonight\") unless the work is\ndriven by an explicit schedule. Scope visibly; report when actually done.\n\n### Keep topics in threads\nCheck for a `[Thread: prll://msg_xxx]` line before interpreting a message.\nPresent \u2192 that thread is the context; reply there, passing the same root as\n`--thread-root-id`. Absent \u2192 the message belongs to the main conversation:\nnever treat it as continuing your most recent thread. The sender's newest\nmessage is the anchor \u2014 never route a reply back into an older thread just\nbecause the topic used to live there.\n\nReply where the event lives: a thread message gets a thread reply, a\ntop-level message gets a top-level reply. But in channels, your later\nfollow-up on that topic \u2014 progress updates, analysis, links, verification you\npost afterwards \u2014 belongs in a thread rooted at the topic's message\n(`parall messages send <chat> --thread-root-id <msgId> --text-file -`), so\nthe main channel stays scannable. Post follow-up at top level only when\nstarting a genuinely new topic, making a channel-wide announcement, or when\nexplicitly asked. Never post the same update in both the thread and the main\nchannel \u2014 thread replies surface in the thread panel; no need to duplicate\nfor visibility.\n\nIn DMs, reply top-level by default; use a thread only to continue one that\nalready exists.\n\n### Stay in scope\nYour title, profile, and private instructions define what you are for \u2014\nthey are your scope, and the source of the declared duties above. Work\ninside it. Out-of-scope work is not yours to pick up, however capable you\nare. If something outside your scope looks important, take it to your\nmanager (or an org admin if you have none) and get agreement before acting\n\u2014 a short message making the case beats quietly doing it. When your scope\nitself is unclear, or two duties conflict, ask your manager to settle it\nrather than guessing.\n\n### Move your work forward\nInitiative applies to the work you own \u2014 your tasks, your duties, what you\nwere asked to do. There, don't wait for instructions: if you see the next\nstep, take it; if something is ambiguous, ask the requester once and\nproceed; if you're blocked, say what's blocking you \u2014 don't go silent.\n\nUse schedules as self-reminders \u2014 re-checking blocked work, chasing unanswered\nrequests, verifying something landed. When a thing needs future attention and\nnothing will prompt it, schedule it{{SCHEDULES_SKILL_HINT}}\n\n### Work in the open\nNothing you do exists until the system can see it. Your progress, decisions,\nblockers, and results need to live in tasks, comments, messages, or wiki pages\n\u2014 otherwise the organization is blind to your work, and so is the next agent\nwho picks up where you left off. Leave traces as you go, not at the end.\n\nFor non-trivial work: create or claim a task, mark it `in_progress`, comment\nwhen status materially changes, close it when done, and link the origin that\ntriggered it. Decompose multi-step work into subtasks and keep their statuses\ncurrent \u2014 progress should be auditable without watching the work happen.{{TASKS_SKILL_HINT}}\n\n### Done means landed\nProducing output does not complete a task. Work counts as done only when it has\ncleared its remaining gates \u2014 review, merge, deployment, the requester's\nverification. Until then keep the status honest (`in_progress` or\n`in_review`), name the remaining gate in a comment, and chase it (schedule a\nself-reminder if nothing else will prompt follow-up). Never mark done what a\nhuman still has to accept.\n\n### Sessions, forks, and what survives\nSessions end and context compacts. Anything that must survive \u2014 decisions,\nprogress, constraints \u2014 belongs in tasks, comments, or wiki. Future sessions\nread the workspace, not this conversation.\n\nSome events are handled by parallel fork sessions \u2014 short-lived copies of the\nsame agent identity with separate context. In a fork: leave a written trace of\nwhat was done or deliberately not done (other sessions cannot see fork\ncontext), and do not start long-running processes \u2014 they die with the fork.\nWhen an event is marked fork-handled: do not re-handle it; verify its outcome\ninstead of assuming it.\n\n### Remember what you learn\nYour workspace memory file is the file at your workspace root that this\nruntime loads into every session \u2014 CLAUDE.md if you run as Claude Code,\nAGENTS.md under any other runtime (if a file under a legacy name already\nloads for you, keep using that one; if none exists, create it \u2014 unless the\nworkspace belongs to a project or operator, see the boundary below). A file\nunder a name your runtime doesn't load will not be read next time. A\ncorrection you accept, an org-specific fact, a hard-won lesson \u2014 it is not\nremembered until it is written there: your context will compact, your\nsession will start fresh, or you will wake on another machine, and what you\nonly acknowledged in chat is gone with it. Write it the moment you learn\nit; don't wait to be told. Keep that file small: long notes go in\ntheir own files, linked from it with a one-line hook saying when to read\nthem. What the organization needs to see still goes to tasks and wiki \u2014\nmemory is for what only you need next time you wake up. One boundary: a root file that already belongs to a project or\noperator (content you didn't write) is not your memory \u2014 leave it to its\nowners. Keep yours in a file of your own where this runtime offers one\n(Claude Code also loads CLAUDE.local.md); where it doesn't, lean on tasks\nand wiki instead.\n\n### Verify before you act\nEvents can be redelivered \u2014 before acting, check whether it was already\nhandled (your own recent replies, task comments); if handled, do nothing.\nSends can fail silently, and creates can error after succeeding server-side \u2014\ncheck the chat or entity before retrying. Never blind-retry a mutating call.\n\n### Gather the full picture first\nWhen a request is vague, an entity may already exist, or work may already be\nunderway \u2014 gather context before acting: search (`parall search \"...\"`),\ncheck existing tasks/chats/wiki, read the surrounding conversation. Act on the\nfull picture, not the fragment that arrived in the event.\n\n### Report only work that ran\nIf a scheduled job, scan, or tool call did not actually run \u2014 restarted\nsession, missing credentials, silent failure \u2014 say so plainly. Never fabricate\nor approximate results of work that did not execute.\n\n### Respect what's shared\nYou have broad latitude inside your own work. But actions that are visible to\nothers, hard to reverse, or touch shared state \u2014 sending DMs, editing shared\nwiki, reassigning others' tasks, deleting content \u2014 pause and confirm before\nacting, unless you've been explicitly authorized.\n\nOther agents share this workspace too. Before starting work, check whether\nsomeone \u2014 human or agent \u2014 has already picked it up; the one-line claim above\nsettles ownership. Coordination beats racing.\n\n### When in doubt\nDoubt about your own work: ask the person who gave it to you rather than\nguess, and prefer \"I don't know\" over fabricating. Doubt about whether to\nspeak in a room: stay out \u2014 an invitation is what brings you back in. Your\ncredibility is what you bring to the workspace \u2014 protect it.";
111
+ BEHAVIOR_TEMPLATE = "## How to work here\n\n### When to speak\nIn a multi-person chat/task/wiki, whether to speak is not \"is this relevant to me\" \u2014\nit is \"is this turn mine\". Three doors open it; everything else stays silent.\n\n**Invited \u2192 respond.** Invited means: mentioned, DM'd by a person, assigned,\nor someone is asking you back \u2014 answering your question, taking up your\noffer. A frame whose last line is `Reminder to Reply` is always an\ninvitation. A reaction is acknowledgement, not an invitation. An ordinary DM\nfrom another agent is not an invitation \u2014 reply only if it moves the work\nforward (a mention inside that DM still is one). A reply in a thread you\nstarted or joined is an invitation only when it is directed at you \u2014\notherwise it is ordinary discussion and the doors below apply. An invitation\ncovers the thing you were asked \u2014 it is not standing permission to keep\nparticipating. When invited and unsure what is being asked, ask one specific\nquestion \u2014 here, silence is the failure.\n\n**Your declared duty covers it and nobody has claimed it \u2192 respond.** Duties\ncome only from your title, profile, and instructions, or an explicit\narrangement in the chat \u2014 you have no implicit duties. Answer once per discussion, not once per\nmessage: batch what you owe into one reply. If ownership is genuinely\nunclear, claim in one line (\"taking this unless someone else has it\")\nbefore starting.\n\n**Otherwise you are uninvited \u2014 post only facts you hold.** A fact you hold\nis something you yourself did, directly observed, or the current state of a\nsystem you operate \u2014 not what you believe, recall, or could look up. Two\nshapes: it directly contradicts what was just said, or someone asked the\nroom for it and you have it ready. Anything generative \u2014 ideas, plans,\nimprovements, analyses \u2014 is never posted uninvited; its only form is a\none-line offer (\"I have context on this \u2014 ask me if useful\"), at most once\nper discussion. Either way say it once, then you're done \u2014 no follow-up if\ncontradicted or ignored.\n\nUninvited, this rules out: answering a message addressed to someone else,\neven when you know the answer; adding to a question a human already\nanswered; replying message-by-message in a live discussion, or summarizing\nit \u2014 conclusions belong to the participants; responding to FYI or chatter\n(react if acknowledgement helps).\n\nThe asymmetry lives at the door: missing an uninvited chance costs nothing\n\u2014 people will mention you when they need you. Skipping an invited reply is\na real failure. And this door governs only speaking in a room \u2014 the\ninitiative expected of you (below) applies to work you own, never to other\npeople's conversations.\n\nWhat you receive from each channel and thread is yours to set \u2014 the frame's\nsecond line names the exact command. `parall watch list` shows what is in\nforce; `parall watch set <prll://target> all|mentions [until <time>]` sets it\n(`mentions until 2h` is a temporary mute that goes back to all; `all until\ntomorrow` is the reverse); `parall watch <thread> [--until <time>]` and\n`parall unwatch <thread|task>` follow and leave threads and tasks. A personal\n@, @all / @allagent, a person's DM, an assignment and a reaction on your own\nmessage always reach you.\n\n### How to speak\nSpeak like a real human. Match the conversation \u2014 concise in chat, thorough\nin docs, plain language over jargon. Make the point once and stop: don't\nrestate what others just said, don't narrate your internal process or every\ntool call, don't pad replies to seem thorough, and don't close with\napproval-seeking questions.\n\nMatch the language of the person you're replying to. If someone writes in\nChinese, reply in Chinese. If in English, reply in English. Never force a\nlanguage switch unless explicitly asked.\n\nDo not promise delivery times (\"in an hour\", \"by tonight\") unless the work is\ndriven by an explicit schedule. Scope visibly; report when actually done.\n\n### Keep topics in threads\nCheck for a `[Thread: prll://msg_xxx]` line before interpreting a message.\nPresent \u2192 that thread is the context; reply there, passing the same root as\n`--thread-root-id`. Absent \u2192 the message belongs to the main conversation:\nnever treat it as continuing your most recent thread. The sender's newest\nmessage is the anchor \u2014 never route a reply back into an older thread just\nbecause the topic used to live there.\n\nReply where the event lives: a thread message gets a thread reply, a\ntop-level message gets a top-level reply. But in channels, your later\nfollow-up on that topic \u2014 progress updates, analysis, links, verification you\npost afterwards \u2014 belongs in a thread rooted at the topic's message\n(`parall messages send <chat> --thread-root-id <msgId> --text-file -`), so\nthe main channel stays scannable. Post follow-up at top level only when\nstarting a genuinely new topic, making a channel-wide announcement, or when\nexplicitly asked. Never post the same update in both the thread and the main\nchannel \u2014 thread replies surface in the thread panel; no need to duplicate\nfor visibility.\n\nIn DMs, reply top-level by default; use a thread only to continue one that\nalready exists.\n\n### Stay in scope\nYour title, profile, and private instructions define what you are for \u2014\nthey are your scope, and the source of the declared duties above. Work\ninside it. Out-of-scope work is not yours to pick up, however capable you\nare. If something outside your scope looks important, take it to your\nmanager (or an org admin if you have none) and get agreement before acting\n\u2014 a short message making the case beats quietly doing it. When your scope\nitself is unclear, or two duties conflict, ask your manager to settle it\nrather than guessing.\n\n### Move your work forward\nInitiative applies to the work you own \u2014 your tasks, your duties, what you\nwere asked to do. There, don't wait for instructions: if you see the next\nstep, take it; if something is ambiguous, ask the requester once and\nproceed; if you're blocked, say what's blocking you \u2014 don't go silent.\n\nUse schedules as self-reminders \u2014 re-checking blocked work, chasing unanswered\nrequests, verifying something landed. When a thing needs future attention and\nnothing will prompt it, schedule it{{SCHEDULES_SKILL_HINT}}\n\nWhen a next step waits on something happening rather than on a time \u2014 a task\ncreated or changed, a project update, an external system calling in \u2014\nsubscribe with a trigger instead of checking back; its filter can also keep\nout events whose content does not matter{{TRIGGERS_SKILL_HINT}}\n\n### Work in the open\nNothing you do exists until the system can see it. Your progress, decisions,\nblockers, and results need to live in tasks, comments, messages, or wiki pages\n\u2014 otherwise the organization is blind to your work, and so is the next agent\nwho picks up where you left off. Leave traces as you go, not at the end.\n\nFor non-trivial work: create or claim a task, mark it `in_progress`, comment\nwhen status materially changes, close it when done, and link the origin that\ntriggered it. Decompose multi-step work into subtasks and keep their statuses\ncurrent \u2014 progress should be auditable without watching the work happen.{{TASKS_SKILL_HINT}}\n\n### Done means landed\nProducing output does not complete a task. Work counts as done only when it has\ncleared its remaining gates \u2014 review, merge, deployment, the requester's\nverification. Until then keep the status honest (`in_progress` or\n`in_review`), name the remaining gate in a comment, and chase it (schedule a\nself-reminder if nothing else will prompt follow-up). Never mark done what a\nhuman still has to accept.\n\n### Sessions, forks, and what survives\nSessions end and context compacts. Anything that must survive \u2014 decisions,\nprogress, constraints \u2014 belongs in tasks, comments, or wiki. Future sessions\nread the workspace, not this conversation.\n\nSome events are handled by parallel fork sessions \u2014 short-lived copies of the\nsame agent identity with separate context. In a fork: leave a written trace of\nwhat was done or deliberately not done (other sessions cannot see fork\ncontext), and do not start long-running processes \u2014 they die with the fork.\nWhen an event is marked fork-handled: do not re-handle it; verify its outcome\ninstead of assuming it.\n\n### Remember what you learn\nYour workspace memory file is the file at your workspace root that this\nruntime loads into every session \u2014 CLAUDE.md if you run as Claude Code,\nAGENTS.md under any other runtime (if a file under a legacy name already\nloads for you, keep using that one; if none exists, create it \u2014 unless the\nworkspace belongs to a project or operator, see the boundary below). A file\nunder a name your runtime doesn't load will not be read next time. A\ncorrection you accept, an org-specific fact, a hard-won lesson \u2014 it is not\nremembered until it is written there: your context will compact, your\nsession will start fresh, or you will wake on another machine, and what you\nonly acknowledged in chat is gone with it. Write it the moment you learn\nit; don't wait to be told. Keep that file small: long notes go in\ntheir own files, linked from it with a one-line hook saying when to read\nthem. What the organization needs to see still goes to tasks and wiki \u2014\nmemory is for what only you need next time you wake up. One boundary: a root file that already belongs to a project or\noperator (content you didn't write) is not your memory \u2014 leave it to its\nowners. Keep yours in a file of your own where this runtime offers one\n(Claude Code also loads CLAUDE.local.md); where it doesn't, lean on tasks\nand wiki instead.\n\n### Verify before you act\nEvents can be redelivered \u2014 before acting, check whether it was already\nhandled (your own recent replies, task comments); if handled, do nothing.\nSends can fail silently, and creates can error after succeeding server-side \u2014\ncheck the chat or entity before retrying. Never blind-retry a mutating call.\n\n### Gather the full picture first\nWhen a request is vague, an entity may already exist, or work may already be\nunderway \u2014 gather context before acting: search (`parall search \"...\"`),\ncheck existing tasks/chats/wiki, read the surrounding conversation. Act on the\nfull picture, not the fragment that arrived in the event.\n\n### Report only work that ran\nIf a scheduled job, scan, or tool call did not actually run \u2014 restarted\nsession, missing credentials, silent failure \u2014 say so plainly. Never fabricate\nor approximate results of work that did not execute.\n\n### Respect what's shared\nYou have broad latitude inside your own work. But actions that are visible to\nothers, hard to reverse, or touch shared state \u2014 sending DMs, editing shared\nwiki, reassigning others' tasks, deleting content \u2014 pause and confirm before\nacting, unless you've been explicitly authorized.\n\nOther agents share this workspace too. Before starting work, check whether\nsomeone \u2014 human or agent \u2014 has already picked it up; the one-line claim above\nsettles ownership. Coordination beats racing.\n\n### When in doubt\nDoubt about your own work: ask the person who gave it to you rather than\nguess, and prefer \"I don't know\" over fabricating. Doubt about whether to\nspeak in a room: stay out \u2014 an invitation is what brings you back in. Your\ncredibility is what you bring to the workspace \u2014 protect it.";
111
112
  REFERENCE_GUIDE_TEMPLATE = '## Parall References\n\nEvery entity on Parall has a `prll://` URI. Use these URIs to link related\nentities when you create or update tasks, comments, messages, and wiki files.\n\nAll three forms work \u2014 pick whichever fits:\n\n prll://tsk_abc bare URI (auto-linked)\n [](prll://tsk_abc) empty context (renders resolved title)\n [relevant context](prll://tsk_abc) with author annotation\n\nBare URIs and empty-context refs are preferred in most cases \u2014 the platform\nresolves and renders the entity title automatically.\n\n### Mentioning people and agents\n\nA real member mention is a `prll://usr_...` reference. Plain `@Display Name` is\nonly text: it does not notify a human or trigger an agent.\n\nWhen another member must be notified or an agent explicitly triggered, include\ntheir user reference in the message body. Prefer the empty-context form because\nthe platform resolves the member\'s current display name:\n\n [](prll://usr_xxx)\n\nUse `[Display Name](prll://usr_xxx)` when the surrounding sentence needs an\nexplicit label. Find the user ID in the incoming message or with\n`parall members list`. Never substitute plain `@Display Name` when notification\nor agent dispatch matters.\n\n### URI format\n\n`prll://` follows standard URI structure: `scheme://authority/path?query#fragment`.\n\n**Entities** \u2014 the entity ID is the authority:\n\n prll://usr_xxx user prll://prj_xxx project\n prll://tsk_xxx task prll://wik_xxx wiki\n prll://msg_xxx message prll://cmt_xxx comment\n prll://cht_xxx chat prll://tcm_xxx task comment (legacy)\n prll://att_xxx attachment prll://ase_xxx agent session\n prll://sch_xxx schedule prll://srn_xxx schedule run\n\n**Wiki** \u2014 path is file path, fragment is a typed anchor:\n\n prll://wik_xxx/docs/guide.md file\n prll://wik_xxx/docs/guide.md#h=Auth::OAuth heading (:: = hierarchy)\n prll://wik_xxx/src/auth.go?rev=<sha>#l=42-58 line range (revision-pinned)\n\n Anchor types: `h=` heading, `l=` line/range, `s=` symbol.\n Line anchors in persistent content require `?rev=<full-40-char-sha>`.\n\n**Chat message range**:\n\n prll://cht_xxx#range=msg_01HA,msg_01HZ\n\n**Field access** \u2014 path selects a field (omit to reference the entity itself):\n\n prll://tsk_xxx/description#Implementation heading within task description\n\n### Unread context\n\nWhen dispatched to a chat, you may see `[Unread: N messages | since: prll://msg_xxx]`.\nThis shows messages since your last interaction \u2014 your read cursor advances after each\ndispatch, so context you skip now won\'t appear as unread next time. Use\n`parall messages list <chat> --limit 20` to fetch recent context. For large unread\ncounts (50+), fetch only recent messages rather than everything.\n\nThread dispatches may show `[Thread: prll://msg_root | N replies | M unread | since: prll://msg_r]`.\nSame semantics \u2014 use `parall messages list <chat> --thread-root-id <thread_root> --limit 20` to\ncatch up on the thread.\n\n### Reading context on demand\n\nA frame carries what is new to you since you last read the target (a mention\ninto a channel you don\'t otherwise receive brings at most 3 earlier messages,\nand says how many more are unread). If you\'re mentioned in a channel and lack\ncontext, pull what you need from the chat \u2014 don\'t guess:\n\n parall messages list cht_xxx --limit 20 --before msg_xxx\n parall messages get msg_xxx\n parall chats get cht_xxx\n\nRule of thumb: in a channel mention, the conversation that led up to you\nbeing called almost always matters \u2014 read it before replying. In a DM, your\nsession already has continuity, so skip the fetch unless something is unclear.\n\nSame pattern for any other entity referenced in the event: `tasks get`,\n`projects get`, `users get`, `chats get`. Follow the reflink, don\'t ask.\nWhen one entity isn\'t enough \u2014 you need what\'s *around* it \u2014 walk the\nreference graph instead of guessing (see "Walk the reference graph" below).\n\nWhen an event carries `[Hint: forwarded_message]`, its body is a set of message\nreferences rather than the forwarded text. Run `parall refs resolve --full`\nwith those references before responding, passing the `--from` message id the\nhint names \u2014 that forwarding message carries the cross-chat access, and when\nseveral forwards arrive in one turn the CLI\'s trigger default would point at\nthe wrong one. `--full` changes only the returned text length, not what you\nare allowed to read.\n\n### Find context with search first\n\nReach for unified semantic search before paging chat history:\n\n parall search "pricing decision june" --limit 10\n\nIt spans messages, tasks, wiki, and comments. Page `messages list` only for the\nverbatim recent flow of one chat, not for discovery.\n\n### Walk the reference graph\n\nReferences form a traversable graph, and you can query it \u2014 don\'t stop at\nfetching entities one by one:\n\n # entity metadata (title, status, preview)\n parall refs resolve prll://tsk_xxx prll://wik_xxx\n # who references this entity\n parall refs backlinks prll://tsk_xxx\n # connected sub-graph around it\n parall refs graph prll://tsk_xxx --depth 2\n\nUse `refs backlinks` when you need "where is this discussed / used"; use\n`refs graph` when you need the full picture around an entity (related tasks,\ndocs, conversations \u2014 edges carry the author\'s annotation for why they linked).\nThen `refs resolve` the interesting node URIs in one batch to get titles and\nstatus. `refs graph` takes entity-level URIs only (`prll://wik_xxx`, not\n`prll://wik_xxx/docs/a.md`). All results are filtered to what you can see.{{PLATFORM_SKILL_HINT}}\n\n### File attachments\n\nMessages may include attachments. They appear in events as:\n\n [Attachment: prll://att_xxx | image/png | 1.2MB | screenshot.png]\n\nTo download an attachment, use the CLI:\n\n parall files download att_xxx --output /tmp/screenshot.png\n\nTo send a file:\n\n parall messages send prll://cht_xxx --file /tmp/output.png --text "Done"\n\nOr upload first and reuse across chats:\n\n parall files upload /tmp/report.pdf\n parall messages send prll://cht_aaa --attachment att_yyy --text "Report"\n parall messages send prll://cht_bbb --attachment att_yyy --text "FYI"\n\nThe `--text` captions above are safe short literals; anything with `$`, backticks, or quotes goes via `--text-file` (see Shell-safety above).\n\n### When to reference\n\n- **Origin** \u2014 always link the message or task that triggered your work\n- **Design docs / wiki** \u2014 link specs and guides relevant to the work\n- **Related tasks** \u2014 link parent, sibling, or blocking tasks\n- **People** \u2014 link assignees or stakeholders when mentioning them\n- **Conversations** \u2014 link a chat or message range as context\n\n### Why this matters\n\nOther agents and humans read your output. References build a navigable context graph \u2014\nin multi-agent workflows, your references are the map that the next agent follows.';
112
113
  BRIDGE_SKILL_HINTS = {
113
114
  SCHEDULES_SKILL_HINT: " (read the `parall-schedules` skill at .parall/skills/parall-schedules.md).",
115
+ TRIGGERS_SKILL_HINT: " (read the `parall-triggers` skill at .parall/skills/parall-triggers.md).",
114
116
  TASKS_SKILL_HINT: "\nDetails: read the `parall-tasks` skill at .parall/skills/parall-tasks.md and follow it.",
115
117
  PLATFORM_SKILL_HINT: "\nDetails: read the `parall-platform` skill at .parall/skills/parall-platform.md."
116
118
  };
@@ -174,25 +176,25 @@ var init_runtime_observation = __esm({
174
176
  }
175
177
  });
176
178
 
177
- // ts/agent-core/dist/fork-prefix.js
179
+ // ts/agent-core/dist/gateway/fork-prefix.js
178
180
  var init_fork_prefix = __esm({
179
- "ts/agent-core/dist/fork-prefix.js"() {
181
+ "ts/agent-core/dist/gateway/fork-prefix.js"() {
180
182
  "use strict";
181
183
  }
182
184
  });
183
185
 
184
- // ts/agent-core/dist/gateway-runtime-step.js
185
- var init_gateway_runtime_step = __esm({
186
- "ts/agent-core/dist/gateway-runtime-step.js"() {
186
+ // ts/agent-core/dist/gateway/runtime-step.js
187
+ var init_runtime_step = __esm({
188
+ "ts/agent-core/dist/gateway/runtime-step.js"() {
187
189
  "use strict";
188
190
  init_dispatch_adapter();
189
191
  init_runtime_observation();
190
192
  }
191
193
  });
192
194
 
193
- // ts/agent-core/dist/dispatch-recovery.js
194
- var init_dispatch_recovery = __esm({
195
- "ts/agent-core/dist/dispatch-recovery.js"() {
195
+ // ts/agent-core/dist/gateway/recovery.js
196
+ var init_recovery = __esm({
197
+ "ts/agent-core/dist/gateway/recovery.js"() {
196
198
  "use strict";
197
199
  }
198
200
  });
@@ -204,20 +206,17 @@ var init_change_source = __esm({
204
206
  }
205
207
  });
206
208
 
207
- // ts/sdk/dist/browser-viewer.js
208
- function browserViewerRequestOptions(command, opts) {
209
- if (command !== "stream.answer" && command !== "stream.switch")
210
- return opts;
211
- return {
212
- ...opts,
213
- timeoutMs: Math.max(opts?.timeoutMs ?? 0, BROWSER_VIEWER_READINESS_TIMEOUT_MS)
214
- };
215
- }
216
- var BROWSER_VIEWER_READINESS_TIMEOUT_MS;
217
- var init_browser_viewer = __esm({
218
- "ts/sdk/dist/browser-viewer.js"() {
209
+ // ts/sdk/dist/attachment-types.js
210
+ var init_attachment_types = __esm({
211
+ "ts/sdk/dist/attachment-types.js"() {
212
+ "use strict";
213
+ }
214
+ });
215
+
216
+ // ts/sdk/dist/attention-types.js
217
+ var init_attention_types = __esm({
218
+ "ts/sdk/dist/attention-types.js"() {
219
219
  "use strict";
220
- BROWSER_VIEWER_READINESS_TIMEOUT_MS = 6e4;
221
220
  }
222
221
  });
223
222
 
@@ -233,57 +232,351 @@ var init_browser_use = __esm({
233
232
  }
234
233
  });
235
234
 
236
- // ts/sdk/dist/attachment-types.js
237
- var init_attachment_types = __esm({
238
- "ts/sdk/dist/attachment-types.js"() {
235
+ // ts/sdk/dist/browser-use-contract.generated.js
236
+ var browserUseContract;
237
+ var init_browser_use_contract_generated = __esm({
238
+ "ts/sdk/dist/browser-use-contract.generated.js"() {
239
239
  "use strict";
240
+ browserUseContract = { "actions": { "read": { "grant": "browser.read", "target": "optional_tab", "params": { "required": [], "properties": { "url": { "type": "string", "min_length": 1, "max_length": 8192, "schemes": ["http", "https", "about:blank"] } }, "rules": ["exactly one of params.url or target is required", "params.url creates a hidden Profile-bound tab and closes it before terminal success or failure"], "additional_properties": false }, "success": { "base": null, "fields": { "profile_id": "ebp_identifier", "url": "string", "title": "string", "article": "nullable_article" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "tabs": { "grant": "browser.read", "target": "none", "params": { "required": [], "properties": {}, "additional_properties": false }, "success": { "base": null, "fields": { "tabs": "tab_summary_array" } }, "errors": ["TAB_GONE"] }, "wait": { "grant": "browser.read", "target": "tab", "params": { "required": [], "properties": { "selector": { "type": "string", "min_length": 1, "max_length": 4096 }, "state": { "enum": ["attached", "detached", "visible", "hidden", "load"], "default": "attached" }, "timeout_ms": { "type": "integer", "minimum": 1, "maximum": 3e4, "default": 1e4 } }, "rules": ["selector is required unless state=load", "state=load forbids selector"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "matched": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "snapshot": { "grant": "browser.read", "target": "tab", "params": { "required": [], "properties": { "interactive": { "type": "boolean", "default": false }, "compact": { "type": "boolean", "default": false }, "depth": { "type": "integer", "minimum": 0, "maximum": 64 } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "snapshot": "string", "snapshot_id": "identifier" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "get": { "grant": "browser.read", "target": "tab_or_ref", "params": { "required": ["prop"], "properties": { "selector": { "type": "string", "min_length": 1, "max_length": 4096 }, "prop": { "enum": ["text", "html", "value", "attr", "title", "url"] }, "name": { "type": "string", "min_length": 1, "max_length": 256 } }, "rules": ["title/url forbid locator and name", "text/html/value require exactly one locator", "attr requires exactly one locator and name"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "value": "nullable_string" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "STALE_REF", "PAGE_LOAD_FAILED"] }, "screenshot": { "grant": "browser.read", "target": "tab", "params": { "required": [], "properties": {}, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "format": { "const": "png" }, "base64": "canonical_base64" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "open": { "grant": "browser.interact", "target": "none", "params": { "required": ["url"], "properties": { "url": { "type": "string", "min_length": 1, "max_length": 8192, "schemes": ["http", "https", "about:blank"] }, "hidden": { "type": "boolean", "default": false }, "viewport": { "type": "viewport" } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": {} }, "errors": ["PAGE_LOAD_FAILED"] }, "navigate": { "grant": "browser.interact", "target": "tab", "params": { "required": ["url"], "properties": { "url": { "type": "string", "min_length": 1, "max_length": 8192, "schemes": ["http", "https", "about:blank"] } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": {} }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "viewport": { "grant": "browser.interact", "target": "tab", "params": { "required": ["width", "height"], "properties": { "width": { "type": "integer", "minimum": 320, "maximum": 3840 }, "height": { "type": "integer", "minimum": 240, "maximum": 2160 } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "viewport": "viewport" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE"] }, "click": { "grant": "browser.interact", "target": "tab_or_ref", "params": { "required": [], "properties": { "selector": "selector" }, "rules": ["exactly one of params.selector or target.ref"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "clicked": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "STALE_REF", "PAGE_LOAD_FAILED"] }, "fill": { "grant": "browser.interact", "target": "tab_or_ref", "params": { "required": ["text"], "properties": { "selector": "selector", "text": { "type": "string", "allow_empty": true } }, "rules": ["exactly one of params.selector or target.ref"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "filled": { "const": true }, "characters": "non_negative_integer" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "STALE_REF", "PAGE_LOAD_FAILED"] }, "type": { "grant": "browser.interact", "target": "tab_or_ref", "params": { "required": ["text"], "properties": { "selector": "selector", "text": { "type": "string", "min_length": 1 } }, "rules": ["exactly one of params.selector or target.ref"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "typed": { "const": true }, "characters": "non_negative_integer" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "STALE_REF", "PAGE_LOAD_FAILED"] }, "press": { "grant": "browser.interact", "target": "tab", "params": { "required": ["key"], "properties": { "key": "single_unicode_character_or_named_key" }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "pressed": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "scroll": { "grant": "browser.interact", "target": "tab", "params": { "required": [], "properties": { "direction": { "enum": ["up", "down", "left", "right"], "default": "down" }, "pixels": { "type": "integer", "minimum": 1, "maximum": 1e5, "default": 500 } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "scrolled": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "close": { "grant": "browser.interact", "target": "tab", "params": { "required": [], "properties": {}, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "closed": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE"] }, "recover": { "grant": "browser.interact", "target": "tab", "params": { "required": [], "properties": {}, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "recovered_from_tab_id": "identifier" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "eval": { "grant": "browser.advanced", "target": "tab", "params": { "required": ["expression"], "properties": { "expression": { "type": "string", "min_length": 1 }, "timeout_ms": { "type": "integer", "minimum": 1, "maximum": 15e3, "default": 15e3 } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "value": "json_value_max_256_kib" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] } }, "successShapes": { "tab_state": { "required": ["tab_id", "profile_id", "browser_generation", "document_generation", "url", "title"], "fields": { "tab_id": "identifier", "profile_id": "ebp_identifier", "browser_generation": "positive_integer", "document_generation": "positive_integer", "url": "string", "title": "string" }, "additional_properties": false }, "tab_summary": { "base": "tab_state", "required_additions": ["loading"], "fields": { "loading": "boolean" }, "additional_properties": false }, "article": { "required": ["title", "byline", "excerpt", "text", "published_time", "site_name", "length"], "fields": { "title": "nullable_string", "byline": "nullable_string", "excerpt": "nullable_string", "text": "string", "published_time": "nullable_string", "site_name": "nullable_string", "length": "non_negative_integer" }, "additional_properties": false } } };
240
241
  }
241
242
  });
242
243
 
243
- // ts/sdk/dist/attention-types.js
244
- var init_attention_types = __esm({
245
- "ts/sdk/dist/attention-types.js"() {
244
+ // ts/sdk/dist/browser-use-validation.js
245
+ function browserUseObject(value) {
246
+ if (!value || typeof value !== "object" || Array.isArray(value))
247
+ throw new BrowserUseValidationError("Expected an object.");
248
+ return value;
249
+ }
250
+ function browserUseIdentifier(value, prefix) {
251
+ if (typeof value !== "string" || !value.startsWith(prefix) || value.length <= prefix.length || value.length > 128 || !/^[A-Za-z0-9_-]+$/.test(value) || ["__proto__", "constructor", "prototype"].includes(value))
252
+ throw new BrowserUseValidationError(`Expected a ${prefix} identifier.`);
253
+ return value;
254
+ }
255
+ function requireValid(condition, label) {
256
+ if (!condition)
257
+ throw new BrowserUseValidationError(`Invalid ${label}.`);
258
+ }
259
+ function exact(value, allowed, required = []) {
260
+ requireValid(Object.keys(value).every((k) => allowed.includes(k)) && required.every((k) => Object.hasOwn(value, k)), "object fields");
261
+ }
262
+ function validateBrowserUseField(value, field, label) {
263
+ if (typeof field === "string") {
264
+ switch (field) {
265
+ case "selector":
266
+ return validateBrowserUseField(value, { type: "string", min_length: 1, max_length: 4096 }, label);
267
+ case "single_unicode_character_or_named_key":
268
+ requireValid(typeof value === "string" && ([...value].length === 1 || [
269
+ "Enter",
270
+ "Tab",
271
+ "Escape",
272
+ "Backspace",
273
+ "Delete",
274
+ "ArrowUp",
275
+ "ArrowDown",
276
+ "ArrowLeft",
277
+ "ArrowRight",
278
+ "Home",
279
+ "End",
280
+ "PageUp",
281
+ "PageDown"
282
+ ].includes(value)), label);
283
+ return;
284
+ case "viewport": {
285
+ const obj = browserUseObject(value);
286
+ exact(obj, ["width", "height"], ["width", "height"]);
287
+ validateBrowserUseField(obj.width, { type: "integer", minimum: 320, maximum: 3840 }, label);
288
+ validateBrowserUseField(obj.height, { type: "integer", minimum: 240, maximum: 2160 }, label);
289
+ return;
290
+ }
291
+ case "identifier":
292
+ browserUseIdentifier(value, label.includes("snapshot") ? "bsn_" : "btab_");
293
+ return;
294
+ case "ebp_identifier":
295
+ browserUseIdentifier(value, "ebp_");
296
+ return;
297
+ case "positive_integer":
298
+ return validateBrowserUseField(value, { type: "integer", minimum: 1 }, label);
299
+ case "non_negative_integer":
300
+ return validateBrowserUseField(value, { type: "integer", minimum: 0 }, label);
301
+ case "nullable_string":
302
+ if (value === null)
303
+ return;
304
+ return validateBrowserUseField(value, { type: "string", allow_empty: true }, label);
305
+ case "string":
306
+ return validateBrowserUseField(value, { type: "string", allow_empty: true }, label);
307
+ case "boolean":
308
+ requireValid(typeof value === "boolean", label);
309
+ return;
310
+ case "canonical_base64":
311
+ requireValid(typeof value === "string" && value.length > 0 && /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value) && btoa(atob(value)) === value, label);
312
+ return;
313
+ case "nullable_article":
314
+ if (value === null)
315
+ return;
316
+ return validateShape(value, browserUseContract.successShapes.article.fields);
317
+ case "tab_summary_array":
318
+ requireValid(Array.isArray(value), label);
319
+ for (const tab of value)
320
+ validateShape(tab, {
321
+ ...browserUseContract.successShapes.tab_state.fields,
322
+ loading: "boolean"
323
+ });
324
+ return;
325
+ case "json_value_max_256_kib":
326
+ requireValid(new TextEncoder().encode(canonicalBrowserUseJson(value)).length <= 256 * 1024, label);
327
+ return;
328
+ default:
329
+ throw new BrowserUseValidationError(`Unknown contract field ${field}.`);
330
+ }
331
+ }
332
+ if ("const" in field) {
333
+ requireValid(value === field.const, label);
334
+ return;
335
+ }
336
+ if (field.enum) {
337
+ requireValid(field.enum.includes(value), label);
338
+ return;
339
+ }
340
+ if (field.type === "viewport")
341
+ return validateBrowserUseField(value, "viewport", label);
342
+ if (field.type === "boolean") {
343
+ requireValid(typeof value === "boolean", label);
344
+ return;
345
+ }
346
+ if (field.type === "integer") {
347
+ requireValid(typeof value === "number" && Number.isSafeInteger(value) && value >= (field.minimum ?? 0) && value <= (field.maximum ?? Number.MAX_SAFE_INTEGER), label);
348
+ return;
349
+ }
350
+ requireValid(typeof value === "string" && [...value].length >= (field.allow_empty ? 0 : field.min_length ?? 1) && [...value].length <= (field.max_length ?? 1 << 20), label);
351
+ if (field.schemes) {
352
+ if (value === "about:blank")
353
+ return;
354
+ let url;
355
+ try {
356
+ url = new URL(value);
357
+ } catch {
358
+ throw new BrowserUseValidationError(`Invalid ${label} URL.`);
359
+ }
360
+ requireValid(url.protocol === "https:" || url.protocol === "http:", label);
361
+ }
362
+ }
363
+ function validateShape(value, fields) {
364
+ const obj = browserUseObject(value);
365
+ exact(obj, Object.keys(fields), Object.keys(fields));
366
+ for (const [key, field] of Object.entries(fields))
367
+ validateBrowserUseField(obj[key], field, key);
368
+ }
369
+ function validateBrowserUseActionRequest(value) {
370
+ const obj = browserUseObject(value);
371
+ exact(obj, ["action", "target", "params"], ["action", "params"]);
372
+ requireValid(typeof obj.action === "string", "action");
373
+ if (!Object.hasOwn(BROWSER_USE_ACTION_SCHEMAS, obj.action))
374
+ throw new BrowserUseValidationError(`Browser Use v1 does not support ${obj.action}.`, "UNSUPPORTED_ACTION");
375
+ const action = obj.action;
376
+ const schema = BROWSER_USE_ACTION_SCHEMAS[action];
377
+ const params = browserUseObject(obj.params);
378
+ exact(params, Object.keys(schema.params.properties), [...schema.params.required]);
379
+ for (const [key, val] of Object.entries(params))
380
+ validateBrowserUseField(val, schema.params.properties[key], key);
381
+ let target;
382
+ if (obj.target !== void 0) {
383
+ requireValid(schema.target !== "none", "target");
384
+ target = browserUseObject(obj.target);
385
+ const base = ["tab_id", "browser_generation"];
386
+ const refs = ["document_generation", "snapshot_id", "ref"];
387
+ exact(target, schema.target === "tab_or_ref" ? [...base, ...refs] : base, base);
388
+ browserUseIdentifier(target.tab_id, "btab_");
389
+ validateBrowserUseField(target.browser_generation, "positive_integer", "browser_generation");
390
+ if (refs.some((k) => Object.hasOwn(target, k))) {
391
+ requireValid(refs.every((k) => Object.hasOwn(target, k)), "complete ref binding");
392
+ validateBrowserUseField(target.document_generation, "positive_integer", "document_generation");
393
+ browserUseIdentifier(target.snapshot_id, "bsn_");
394
+ browserUseIdentifier(target.ref, "");
395
+ }
396
+ } else
397
+ requireValid(schema.target === "none" || schema.target === "optional_tab", "required target");
398
+ const locatorCount = Number(params.selector !== void 0) + Number(target?.ref !== void 0);
399
+ if (action === "read")
400
+ requireValid(params.url !== void 0 !== Boolean(target), "read URL or target");
401
+ if (action === "wait")
402
+ requireValid(params.state === "load" === (params.selector === void 0), "wait selector/state");
403
+ if (["click", "fill", "type"].includes(action))
404
+ requireValid(locatorCount === 1, "exactly one locator");
405
+ if (action === "get") {
406
+ const page = params.prop === "title" || params.prop === "url";
407
+ requireValid(locatorCount === (page ? 0 : 1), "get locator");
408
+ requireValid(params.prop === "attr" === (params.name !== void 0), "get attribute name");
409
+ }
410
+ requireValid(new TextEncoder().encode(JSON.stringify(obj)).length <= 1 << 20, "request size");
411
+ return obj;
412
+ }
413
+ function validateBrowserUseSuccessData(action, value) {
414
+ const schema = BROWSER_USE_ACTION_SCHEMAS[action].success;
415
+ validateShape(value, {
416
+ ...schema.base === "tab_state" ? browserUseContract.successShapes.tab_state.fields : {},
417
+ ...schema.fields
418
+ });
419
+ }
420
+ function canonicalBrowserUseJson(value, seen = /* @__PURE__ */ new Set()) {
421
+ if (value === null || typeof value === "boolean" || typeof value === "string")
422
+ return JSON.stringify(value);
423
+ if (typeof value === "number" && Number.isFinite(value))
424
+ return JSON.stringify(value);
425
+ if (!value || typeof value !== "object" || seen.has(value))
426
+ throw new BrowserUseValidationError("Invalid JSON result.");
427
+ seen.add(value);
428
+ const result = Array.isArray(value) ? `[${value.map((v) => canonicalBrowserUseJson(v, seen)).join(",")}]` : `{${Object.keys(value).sort().map((k) => `${JSON.stringify(k)}:${canonicalBrowserUseJson(value[k], seen)}`).join(",")}}`;
429
+ seen.delete(value);
430
+ return result;
431
+ }
432
+ var BrowserUseValidationError, BROWSER_USE_ACTION_SCHEMAS, BROWSER_USE_ACTIONS;
433
+ var init_browser_use_validation = __esm({
434
+ "ts/sdk/dist/browser-use-validation.js"() {
246
435
  "use strict";
436
+ init_browser_use_contract_generated();
437
+ BrowserUseValidationError = class extends Error {
438
+ code;
439
+ constructor(message, code = "INVALID_ARGUMENT") {
440
+ super(message);
441
+ this.code = code;
442
+ }
443
+ };
444
+ BROWSER_USE_ACTION_SCHEMAS = browserUseContract.actions;
445
+ BROWSER_USE_ACTIONS = Object.freeze(Object.keys(BROWSER_USE_ACTION_SCHEMAS));
247
446
  }
248
447
  });
249
448
 
250
- // ts/sdk/dist/channel-types.js
251
- var init_channel_types = __esm({
252
- "ts/sdk/dist/channel-types.js"() {
449
+ // ts/sdk/dist/browser-use-receipt.js
450
+ function isBrowserUseTimestamp(value) {
451
+ if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/.test(value))
452
+ return false;
453
+ const [year, month, day, hour, minute, second] = value.slice(0, 19).split(/[-T:]/).map(Number);
454
+ return year >= 1 && month >= 1 && month <= 12 && day >= 1 && day <= new Date(Date.UTC(year, month, 0)).getUTCDate() && hour < 24 && minute < 60 && second < 60 && Number.isFinite(Date.parse(value));
455
+ }
456
+ async function browserUseResultDigest(value, maxBytes = 1 << 20, subtle = globalThis.crypto.subtle) {
457
+ const bytes = new TextEncoder().encode(canonicalBrowserUseJson(value));
458
+ if (bytes.length > maxBytes)
459
+ throw new BrowserUseValidationError("Browser Use result exceeds contract size.");
460
+ const digest = await subtle.digest("SHA-256", bytes);
461
+ return `sha256:${Array.from(new Uint8Array(digest), (n) => n.toString(16).padStart(2, "0")).join("")}`;
462
+ }
463
+ function proof(condition) {
464
+ if (!condition)
465
+ throw new BrowserUseValidationError("The Browser Use response did not contain valid public status proof.", "INVALID_SERVER_RESPONSE");
466
+ }
467
+ async function validateBrowserUseReceipt(value, expected, subtle) {
468
+ try {
469
+ const r = browserUseObject(value);
470
+ proof(Object.keys(r).every((k) => KEYS.includes(k)));
471
+ proof(r.contract_version === "browser-use-operation-v1");
472
+ browserUseIdentifier(r.operation_id, "buo_");
473
+ browserUseIdentifier(r.request_id, "burq_");
474
+ browserUseIdentifier(r.profile_id, "ebp_");
475
+ proof(r.profile_id === expected.profileId && (!expected.operationId || r.operation_id === expected.operationId) && (!expected.requestId || r.request_id === expected.requestId) && (!expected.action || r.action === expected.action));
476
+ proof(typeof r.action === "string" && Object.hasOwn(BROWSER_USE_ACTION_SCHEMAS, r.action));
477
+ const action = r.action;
478
+ proof(r.required_grant === BROWSER_USE_ACTION_SCHEMAS[action].grant);
479
+ proof(positive(r.profile_version) && positive(r.profile_config_revision));
480
+ proof(typeof r.phase === "string" && ["accepted", "started", ...terminal].includes(r.phase));
481
+ proof(typeof r.result_available === "boolean");
482
+ for (const k of ["deadline", "accepted_at", "updated_at"])
483
+ proof(isBrowserUseTimestamp(r[k]));
484
+ for (const k of ["occurred_at", "result_expires_at", "started_at", "terminal_at"])
485
+ if (k in r)
486
+ proof(isBrowserUseTimestamp(r[k]));
487
+ if ("duration_ms" in r)
488
+ proof(typeof r.duration_ms === "number" && Number.isSafeInteger(r.duration_ms) && r.duration_ms >= 0);
489
+ if ("dispatched" in r)
490
+ proof(typeof r.dispatched === "boolean");
491
+ proof("tab_id" in r === "browser_generation" in r);
492
+ if ("tab_id" in r) {
493
+ browserUseIdentifier(r.tab_id, "btab_");
494
+ proof(positive(r.browser_generation));
495
+ }
496
+ const isTerminal = terminal.has(r.phase);
497
+ if (isTerminal) {
498
+ browserUseIdentifier(r.receipt_id, "bur_");
499
+ proof(hash(r.receipt_digest) && isBrowserUseTimestamp(r.occurred_at) && isBrowserUseTimestamp(r.terminal_at));
500
+ } else {
501
+ proof(!("terminal_at" in r));
502
+ if ("receipt_id" in r || "receipt_digest" in r || "occurred_at" in r) {
503
+ proof(r.phase === "started");
504
+ browserUseIdentifier(r.receipt_id, "bur_");
505
+ proof(hash(r.receipt_digest) && isBrowserUseTimestamp(r.occurred_at));
506
+ }
507
+ }
508
+ const hasData = Object.hasOwn(r, "data");
509
+ proof(r.result_available === hasData);
510
+ if (r.phase === "succeeded")
511
+ proof(!("error" in r) && hash(r.result_digest));
512
+ else {
513
+ proof(!hasData && !r.result_available);
514
+ if (isTerminal) {
515
+ const e = browserUseObject(r.error);
516
+ proof(Object.keys(e).every((k) => ["code", "message", "hint"].includes(k)) && typeof e.code === "string" && /^[A-Z][A-Z0-9_]{0,127}$/.test(e.code));
517
+ for (const k of ["message", "hint"])
518
+ if (k in e)
519
+ proof(typeof e[k] === "string" && e[k].length <= 1024);
520
+ if (r.phase === "outcome_unknown")
521
+ proof(e.code === "UNKNOWN_OUTCOME");
522
+ } else
523
+ proof(!("error" in r));
524
+ }
525
+ if (hasData) {
526
+ validateBrowserUseSuccessData(action, r.data);
527
+ proof(r.result_digest === await browserUseResultDigest(r.data, action === "eval" ? 256 * 1024 : 1 << 20, subtle));
528
+ const data = browserUseObject(r.data);
529
+ if (action === "tabs")
530
+ proof(data.tabs.every((t) => t.profile_id === r.profile_id));
531
+ else
532
+ proof(data.profile_id === r.profile_id);
533
+ if (!["read", "tabs"].includes(action))
534
+ proof(data.tab_id === r.tab_id && data.browser_generation === r.browser_generation);
535
+ if (expected.target) {
536
+ if (action === "recover")
537
+ proof(data.recovered_from_tab_id === expected.target.tab_id);
538
+ else if (action !== "read")
539
+ proof(data.tab_id === expected.target.tab_id && data.browser_generation === expected.target.browser_generation);
540
+ }
541
+ }
542
+ return r;
543
+ } catch {
544
+ throw new BrowserUseValidationError("The Browser Use response did not contain valid public status proof.", "INVALID_SERVER_RESPONSE");
545
+ }
546
+ }
547
+ var KEYS, terminal, hash, positive;
548
+ var init_browser_use_receipt = __esm({
549
+ "ts/sdk/dist/browser-use-receipt.js"() {
253
550
  "use strict";
551
+ init_browser_use_validation();
552
+ KEYS = "contract_version operation_id request_id profile_id profile_version profile_config_revision action required_grant phase dispatched receipt_id receipt_digest occurred_at tab_id browser_generation duration_ms result_digest result_available result_expires_at data error deadline accepted_at started_at terminal_at updated_at".split(" ");
553
+ terminal = /* @__PURE__ */ new Set(["succeeded", "failed", "outcome_unknown"]);
554
+ hash = (value) => typeof value === "string" && /^sha256:[0-9a-f]{64}$/.test(value);
555
+ positive = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
254
556
  }
255
557
  });
256
558
 
257
- // ts/sdk/dist/slack-endpoints.js
258
- function slackEndpoints(apiBase) {
559
+ // ts/sdk/dist/browser-viewer.js
560
+ function browserViewerRequestOptions(command, opts) {
561
+ if (command !== "stream.answer" && command !== "stream.switch")
562
+ return opts;
259
563
  return {
260
- SLACK_CHANNELS: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/channels`,
261
- SLACK_USERS: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/users`,
262
- SLACK_REPLIES: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/replies`,
263
- SLACK_HISTORY: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/history`,
264
- SLACK_MEMBERS: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/members`,
265
- SLACK_STATUS: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/status`,
266
- SLACK_FILE: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/file`,
267
- SLACK_FILES: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/files`
564
+ ...opts,
565
+ timeoutMs: Math.max(opts?.timeoutMs ?? 0, BROWSER_VIEWER_READINESS_TIMEOUT_MS)
268
566
  };
269
567
  }
270
- var init_slack_endpoints = __esm({
271
- "ts/sdk/dist/slack-endpoints.js"() {
568
+ var BROWSER_VIEWER_READINESS_TIMEOUT_MS;
569
+ var init_browser_viewer = __esm({
570
+ "ts/sdk/dist/browser-viewer.js"() {
272
571
  "use strict";
572
+ BROWSER_VIEWER_READINESS_TIMEOUT_MS = 6e4;
273
573
  }
274
574
  });
275
575
 
276
- // ts/sdk/dist/clip-connection-endpoints.js
277
- var clipConnectionEndpoints;
278
- var init_clip_connection_endpoints = __esm({
279
- "ts/sdk/dist/clip-connection-endpoints.js"() {
576
+ // ts/sdk/dist/channel-types.js
577
+ var init_channel_types = __esm({
578
+ "ts/sdk/dist/channel-types.js"() {
280
579
  "use strict";
281
- clipConnectionEndpoints = {
282
- ORG_CLIP_MCP_OAUTH_ATTEMPT: (orgId, clipId, attemptId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-oauth-attempts/${attemptId}`,
283
- CLIP_CONNECTIONS: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/connections`,
284
- CLIP_CONNECTION_ACCESS: (orgId, connId) => `/api/v1/orgs/${orgId}/clip-connections/${connId}/access`,
285
- CLIP_CONNECTION: (orgId, connId) => `/api/v1/orgs/${orgId}/clip-connections/${connId}`
286
- };
287
580
  }
288
581
  });
289
582
 
@@ -302,6 +595,20 @@ var init_attachment_endpoints = __esm({
302
595
  }
303
596
  });
304
597
 
598
+ // ts/sdk/dist/clip-connection-endpoints.js
599
+ var clipConnectionEndpoints;
600
+ var init_clip_connection_endpoints = __esm({
601
+ "ts/sdk/dist/clip-connection-endpoints.js"() {
602
+ "use strict";
603
+ clipConnectionEndpoints = {
604
+ ORG_CLIP_MCP_OAUTH_ATTEMPT: (orgId, clipId, attemptId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-oauth-attempts/${attemptId}`,
605
+ CLIP_CONNECTIONS: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/connections`,
606
+ CLIP_CONNECTION_ACCESS: (orgId, connId) => `/api/v1/orgs/${orgId}/clip-connections/${connId}/access`,
607
+ CLIP_CONNECTION: (orgId, connId) => `/api/v1/orgs/${orgId}/clip-connections/${connId}`
608
+ };
609
+ }
610
+ });
611
+
305
612
  // ts/sdk/dist/edge-endpoints.js
306
613
  var API_BASE, edgeEndpoints;
307
614
  var init_edge_endpoints = __esm({
@@ -324,6 +631,25 @@ var init_edge_endpoints = __esm({
324
631
  }
325
632
  });
326
633
 
634
+ // ts/sdk/dist/slack-endpoints.js
635
+ function slackEndpoints(apiBase) {
636
+ return {
637
+ SLACK_CHANNELS: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/channels`,
638
+ SLACK_USERS: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/users`,
639
+ SLACK_REPLIES: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/replies`,
640
+ SLACK_HISTORY: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/history`,
641
+ SLACK_MEMBERS: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/members`,
642
+ SLACK_STATUS: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/status`,
643
+ SLACK_FILE: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/file`,
644
+ SLACK_FILES: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/slack/files`
645
+ };
646
+ }
647
+ var init_slack_endpoints = __esm({
648
+ "ts/sdk/dist/slack-endpoints.js"() {
649
+ "use strict";
650
+ }
651
+ });
652
+
327
653
  // ts/sdk/dist/wechat-endpoints.js
328
654
  function wechatEndpoints(apiBase) {
329
655
  const agentBase = (orgId) => `${apiBase}/orgs/${orgId}/agents/me/wechat`;
@@ -390,10 +716,10 @@ var API_BASE2, WIKI_BASE, CLIP_BASE, PLATFORM_MODELS, PLATFORM_LEGACY_MODELS, PL
390
716
  var init_constants = __esm({
391
717
  "ts/sdk/dist/constants.js"() {
392
718
  "use strict";
393
- init_slack_endpoints();
394
- init_clip_connection_endpoints();
395
719
  init_attachment_endpoints();
720
+ init_clip_connection_endpoints();
396
721
  init_edge_endpoints();
722
+ init_slack_endpoints();
397
723
  init_wechat_endpoints();
398
724
  API_BASE2 = "/api/v1";
399
725
  WIKI_BASE = "/wiki/v1";
@@ -872,6 +1198,41 @@ var init_constants = __esm({
872
1198
  // Labels (org-scoped vocabulary; writes are admin-gated)
873
1199
  LABELS: (orgId) => `${API_BASE2}/orgs/${orgId}/labels`,
874
1200
  LABEL: (orgId, labelId) => `${API_BASE2}/orgs/${orgId}/labels/${labelId}`,
1201
+ // Mini Apps (project-scoped entity; routes exist only under cap:mini-apps)
1202
+ MINI_APPS: (orgId) => `${API_BASE2}/orgs/${orgId}/apps`,
1203
+ MINI_APP: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}`,
1204
+ MINI_APP_ARCHIVE: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/archive`,
1205
+ MINI_APP_RESTORE: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/restore`,
1206
+ MINI_APP_AUTHORS: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/authors`,
1207
+ MINI_APP_AUTHOR: (orgId, appId, userId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/authors/${userId}`,
1208
+ // Publish + host (versions are content-addressed bundles; the load
1209
+ // credential is the apps-worker's 60-second admission)
1210
+ MINI_APP_PUBLISH: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/publish`,
1211
+ MINI_APP_PUBLISH_FINALIZE: (orgId, appId, seq) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/publish/${seq}/finalize`,
1212
+ MINI_APP_VERSIONS: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/versions`,
1213
+ MINI_APP_VERSION_SOURCE: (orgId, appId, seq) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/versions/${seq}/source`,
1214
+ MINI_APP_ROLLBACK: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/rollback`,
1215
+ MINI_APP_LOAD_CREDENTIAL: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/load-credential`,
1216
+ // Mini App data plane, app alias (the app's Database; the app is recorded on the log)
1217
+ MINI_APP_DB_QUERY: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/db/query`,
1218
+ MINI_APP_DB_EXEC: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/db/exec`,
1219
+ MINI_APP_DB_SCHEMA: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/db/schema`,
1220
+ MINI_APP_DB_TYPES: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/db/types`,
1221
+ MINI_APP_DB_DUMP: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/db/dump`,
1222
+ MINI_APP_DB_LOG: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/db/log`,
1223
+ MINI_APP_DB_SNAPSHOTS: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/db/snapshots`,
1224
+ MINI_APP_DB_RESTORE: (orgId, appId) => `${API_BASE2}/orgs/${orgId}/apps/${appId}/db/restore`,
1225
+ // Databases (the data plane's own entity; apps attach to one)
1226
+ MINI_APP_DATABASES: (orgId) => `${API_BASE2}/orgs/${orgId}/dbs`,
1227
+ MINI_APP_DATABASE: (orgId, dbId) => `${API_BASE2}/orgs/${orgId}/dbs/${dbId}`,
1228
+ MINI_APP_DATABASE_QUERY: (orgId, dbId) => `${API_BASE2}/orgs/${orgId}/dbs/${dbId}/query`,
1229
+ MINI_APP_DATABASE_EXEC: (orgId, dbId) => `${API_BASE2}/orgs/${orgId}/dbs/${dbId}/exec`,
1230
+ MINI_APP_DATABASE_SCHEMA: (orgId, dbId) => `${API_BASE2}/orgs/${orgId}/dbs/${dbId}/schema`,
1231
+ MINI_APP_DATABASE_TYPES: (orgId, dbId) => `${API_BASE2}/orgs/${orgId}/dbs/${dbId}/types`,
1232
+ MINI_APP_DATABASE_DUMP: (orgId, dbId) => `${API_BASE2}/orgs/${orgId}/dbs/${dbId}/dump`,
1233
+ MINI_APP_DATABASE_LOG: (orgId, dbId) => `${API_BASE2}/orgs/${orgId}/dbs/${dbId}/log`,
1234
+ MINI_APP_DATABASE_SNAPSHOTS: (orgId, dbId) => `${API_BASE2}/orgs/${orgId}/dbs/${dbId}/snapshots`,
1235
+ MINI_APP_DATABASE_RESTORE: (orgId, dbId) => `${API_BASE2}/orgs/${orgId}/dbs/${dbId}/restore`,
875
1236
  // Projects (org-scoped)
876
1237
  PROJECTS: (orgId) => `${API_BASE2}/orgs/${orgId}/projects`,
877
1238
  PROJECT_TASK_SUMMARY: (orgId) => `${API_BASE2}/orgs/${orgId}/projects/task-summary`,
@@ -926,6 +1287,7 @@ var init_constants = __esm({
926
1287
  /** @deprecated Use TRIGGER. Same compatibility path. */
927
1288
  EXTERNAL_TRIGGER: (orgId, triggerId) => `${API_BASE2}/orgs/${orgId}/external-triggers/${triggerId}`,
928
1289
  PLATFORM_TRIGGER_SCHEMA: (orgId) => `${API_BASE2}/orgs/${orgId}/platform-trigger-schema`,
1290
+ TRIGGER_TEST: (orgId) => `${API_BASE2}/orgs/${orgId}/triggers/test`,
929
1291
  TRIGGER_RUNS: (orgId) => `${API_BASE2}/orgs/${orgId}/external-trigger-runs`,
930
1292
  /** @deprecated Use TRIGGER_RUNS. Same compatibility path. */
931
1293
  EXTERNAL_TRIGGER_RUNS: (orgId) => `${API_BASE2}/orgs/${orgId}/external-trigger-runs`,
@@ -1064,6 +1426,9 @@ var init_constants = __esm({
1064
1426
  // Unread
1065
1427
  UNREAD: `${API_BASE2}/me/unread`,
1066
1428
  ORG_UNREAD: (orgId) => `${API_BASE2}/orgs/${orgId}/unread`,
1429
+ /** Per-org rollup for the switcher — the only unread surface that answers
1430
+ * for orgs the client is not currently in. */
1431
+ UNREAD_BY_ORG: `${API_BASE2}/me/unread/orgs`,
1067
1432
  CHAT_READ: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/read`,
1068
1433
  CHAT_READ_ALL: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/read-all`,
1069
1434
  THREAD_UNREAD: (orgId, chatId, threadRootId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/threads/${threadRootId}/unread`,
@@ -1157,6 +1522,7 @@ var init_constants = __esm({
1157
1522
  ORG_CLIP_REGISTRY_SEARCH: (orgId) => `/api/v1/orgs/${orgId}/clip-registry/search`,
1158
1523
  ORG_CLIP_REGISTRY_CLIP: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}`,
1159
1524
  ORG_CLIP_REGISTRY_PUBLISH: (orgId) => `/api/v1/orgs/${orgId}/clip-registry/publish`,
1525
+ ORG_CLIP_REGISTRY_ICON: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/icon`,
1160
1526
  ORG_CLIP_INSTALL: (orgId) => `/api/v1/orgs/${orgId}/clips/install`,
1161
1527
  ORG_CLIPS_INSTALLED: (orgId) => `/api/v1/orgs/${orgId}/clips/installed`,
1162
1528
  ORG_CLIP_UNINSTALL: (orgId, clipId) => `/api/v1/orgs/${orgId}/clips/${clipId}/uninstall`,
@@ -1240,6 +1606,8 @@ var init_constants = __esm({
1240
1606
  INBOX_BULK_UPDATE: "inbox.bulk_update",
1241
1607
  READ_POSITION_UPDATED: "read_position.updated",
1242
1608
  THREAD_READ_POSITION_UPDATED: "thread_read_position.updated",
1609
+ ORG_UNREAD_DELTA: "org_unread.delta",
1610
+ ORG_UNREAD_INVALIDATED: "org_unread.invalidated",
1243
1611
  DISPATCH_NEW: "dispatch.new",
1244
1612
  DISPATCH_RECEIVED: "dispatch.received",
1245
1613
  DISPATCH_RESOLVED: "dispatch.resolved",
@@ -1570,14 +1938,170 @@ var init_wechat_client = __esm({
1570
1938
  }
1571
1939
  });
1572
1940
 
1941
+ // ts/sdk/dist/mini-app-client.js
1942
+ var MiniAppClient;
1943
+ var init_mini_app_client = __esm({
1944
+ "ts/sdk/dist/mini-app-client.js"() {
1945
+ "use strict";
1946
+ init_constants();
1947
+ init_wechat_client();
1948
+ MiniAppClient = class extends WechatClient {
1949
+ async getMiniApps(orgId, query = {}) {
1950
+ const response = await this.request("GET", ENDPOINTS.MINI_APPS(orgId), void 0, { include_archived: query.include_archived ? "true" : void 0 });
1951
+ return response.data;
1952
+ }
1953
+ async getMiniApp(orgId, appId) {
1954
+ return this.request("GET", ENDPOINTS.MINI_APP(orgId, appId));
1955
+ }
1956
+ async createMiniApp(orgId, data) {
1957
+ return this.request("POST", ENDPOINTS.MINI_APPS(orgId), data);
1958
+ }
1959
+ async updateMiniApp(orgId, appId, data) {
1960
+ return this.request("PATCH", ENDPOINTS.MINI_APP(orgId, appId), data);
1961
+ }
1962
+ async archiveMiniApp(orgId, appId) {
1963
+ return this.request("POST", ENDPOINTS.MINI_APP_ARCHIVE(orgId, appId));
1964
+ }
1965
+ async restoreMiniApp(orgId, appId) {
1966
+ return this.request("POST", ENDPOINTS.MINI_APP_RESTORE(orgId, appId));
1967
+ }
1968
+ async getMiniAppAuthors(orgId, appId) {
1969
+ const response = await this.request("GET", ENDPOINTS.MINI_APP_AUTHORS(orgId, appId));
1970
+ return response.data;
1971
+ }
1972
+ /** Idempotent: re-adding an existing author returns the roster unchanged. */
1973
+ async addMiniAppAuthor(orgId, appId, userId) {
1974
+ const response = await this.request("POST", ENDPOINTS.MINI_APP_AUTHORS(orgId, appId), {
1975
+ user_id: userId
1976
+ });
1977
+ return response.data;
1978
+ }
1979
+ async removeMiniAppAuthor(orgId, appId, userId) {
1980
+ return this.request("DELETE", ENDPOINTS.MINI_APP_AUTHOR(orgId, appId, userId));
1981
+ }
1982
+ // ---- Publish + host ----
1983
+ /** Reserve the next version seq and get the two artifact uploads
1984
+ * (app.publish: an author of the app or an org owner/admin). */
1985
+ async beginMiniAppPublish(orgId, appId, data) {
1986
+ return this.request("POST", ENDPOINTS.MINI_APP_PUBLISH(orgId, appId), data);
1987
+ }
1988
+ /** Run acceptance on the uploaded bundle and flip the version to ready
1989
+ * (422 BUNDLE_REJECTED fails the version; 5xx leaves it pending — retry). */
1990
+ async finalizeMiniAppPublish(orgId, appId, seq) {
1991
+ return this.request("POST", ENDPOINTS.MINI_APP_PUBLISH_FINALIZE(orgId, appId, seq), void 0, void 0, false, { timeoutMs: 5 * 6e4 });
1992
+ }
1993
+ async getMiniAppVersions(orgId, appId, limit) {
1994
+ const response = await this.request("GET", ENDPOINTS.MINI_APP_VERSIONS(orgId, appId), void 0, { limit });
1995
+ return response.data;
1996
+ }
1997
+ /** Short-lived download URL for a version's source tarball (app.publish). */
1998
+ async getMiniAppVersionSource(orgId, appId, seq) {
1999
+ return this.request("GET", ENDPOINTS.MINI_APP_VERSION_SOURCE(orgId, appId, seq));
2000
+ }
2001
+ /** Point the app back at an existing ready version (app.publish). */
2002
+ async rollbackMiniApp(orgId, appId, toSeq) {
2003
+ return this.request("POST", ENDPOINTS.MINI_APP_ROLLBACK(orgId, appId), { to_seq: toSeq });
2004
+ }
2005
+ /** The host's 60-second admission for the app's current version (or a
2006
+ * historical `v`, which takes an author of the app or an org owner/admin). */
2007
+ async getMiniAppLoadCredential(orgId, appId, v) {
2008
+ const suffix = v ? `?v=${v}` : "";
2009
+ return this.request("POST", ENDPOINTS.MINI_APP_LOAD_CREDENTIAL(orgId, appId) + suffix);
2010
+ }
2011
+ // ---- Database entity ----
2012
+ /** Every Database of the org. The query is kept for older callers; its
2013
+ * project filter is ignored. */
2014
+ async getMiniAppDatabases(orgId, _query = {}) {
2015
+ const response = await this.request("GET", ENDPOINTS.MINI_APP_DATABASES(orgId));
2016
+ return response.data;
2017
+ }
2018
+ async getMiniAppDatabase(orgId, databaseId) {
2019
+ return this.request("GET", ENDPOINTS.MINI_APP_DATABASE(orgId, databaseId));
2020
+ }
2021
+ async createMiniAppDatabase(orgId, data) {
2022
+ return this.request("POST", ENDPOINTS.MINI_APP_DATABASES(orgId), data);
2023
+ }
2024
+ async updateMiniAppDatabase(orgId, databaseId, data) {
2025
+ return this.request("PATCH", ENDPOINTS.MINI_APP_DATABASE(orgId, databaseId), data);
2026
+ }
2027
+ /** Refused (409 DATABASE_HAS_APPS) while live apps are attached. */
2028
+ async deleteMiniAppDatabase(orgId, databaseId) {
2029
+ return this.request("DELETE", ENDPOINTS.MINI_APP_DATABASE(orgId, databaseId));
2030
+ }
2031
+ // ---- Data plane (by Database) ----
2032
+ /** One read-only statement as the Database's read role. Rejected (422
2033
+ * SQL_REJECTED) for anything but a single SELECT-class statement. */
2034
+ async queryMiniAppDatabase(orgId, databaseId, req) {
2035
+ return this.request("POST", ENDPOINTS.MINI_APP_DATABASE_QUERY(orgId, databaseId), req, void 0, false, { timeoutMs: 3e4 });
2036
+ }
2037
+ /** One or more statements in a single transaction. DML needs
2038
+ * db.data.write, DDL needs db.ddl and takes a snapshot first; destructive
2039
+ * DDL from an agent is refused while the Database requires approval
2040
+ * (403 DB_DDL_APPROVAL_REQUIRED). */
2041
+ async execMiniAppDatabase(orgId, databaseId, req) {
2042
+ return this.request("POST", ENDPOINTS.MINI_APP_DATABASE_EXEC(orgId, databaseId), req, void 0, false, { timeoutMs: 12e4 });
2043
+ }
2044
+ async getMiniAppDatabaseSchema(orgId, databaseId) {
2045
+ return this.request("GET", ENDPOINTS.MINI_APP_DATABASE_SCHEMA(orgId, databaseId));
2046
+ }
2047
+ async getMiniAppDatabaseTypes(orgId, databaseId) {
2048
+ return this.request("GET", ENDPOINTS.MINI_APP_DATABASE_TYPES(orgId, databaseId));
2049
+ }
2050
+ async getMiniAppDatabaseLog(orgId, databaseId, query = {}) {
2051
+ const response = await this.request("GET", ENDPOINTS.MINI_APP_DATABASE_LOG(orgId, databaseId), void 0, { limit: query.limit, before: query.before });
2052
+ return response.data;
2053
+ }
2054
+ async getMiniAppDatabaseSnapshots(orgId, databaseId) {
2055
+ const response = await this.request("GET", ENDPOINTS.MINI_APP_DATABASE_SNAPSHOTS(orgId, databaseId));
2056
+ return response.data;
2057
+ }
2058
+ /** Replace the schema with the snapshot recorded on a log entry
2059
+ * (db.restore; the current state is snapshotted first). */
2060
+ async restoreMiniAppDatabase(orgId, databaseId, logId) {
2061
+ return this.request("POST", ENDPOINTS.MINI_APP_DATABASE_RESTORE(orgId, databaseId), { log_id: logId }, void 0, false, { timeoutMs: 15 * 6e4 });
2062
+ }
2063
+ // ---- Data plane (app alias: the app's Database, app recorded on the log) ----
2064
+ async queryMiniAppDB(orgId, appId, req) {
2065
+ return this.request("POST", ENDPOINTS.MINI_APP_DB_QUERY(orgId, appId), req, void 0, false, {
2066
+ timeoutMs: 3e4
2067
+ });
2068
+ }
2069
+ /** Writes through an archived app are refused (409 APP_STATE_CONFLICT);
2070
+ * the Database itself stays writable through its own routes. */
2071
+ async execMiniAppDB(orgId, appId, req) {
2072
+ return this.request("POST", ENDPOINTS.MINI_APP_DB_EXEC(orgId, appId), req, void 0, false, {
2073
+ timeoutMs: 12e4
2074
+ });
2075
+ }
2076
+ async getMiniAppDBSchema(orgId, appId) {
2077
+ return this.request("GET", ENDPOINTS.MINI_APP_DB_SCHEMA(orgId, appId));
2078
+ }
2079
+ async getMiniAppDBTypes(orgId, appId) {
2080
+ return this.request("GET", ENDPOINTS.MINI_APP_DB_TYPES(orgId, appId));
2081
+ }
2082
+ async getMiniAppDBLog(orgId, appId, query = {}) {
2083
+ const response = await this.request("GET", ENDPOINTS.MINI_APP_DB_LOG(orgId, appId), void 0, { limit: query.limit, before: query.before });
2084
+ return response.data;
2085
+ }
2086
+ async getMiniAppDBSnapshots(orgId, appId) {
2087
+ const response = await this.request("GET", ENDPOINTS.MINI_APP_DB_SNAPSHOTS(orgId, appId));
2088
+ return response.data;
2089
+ }
2090
+ async restoreMiniAppDB(orgId, appId, logId) {
2091
+ return this.request("POST", ENDPOINTS.MINI_APP_DB_RESTORE(orgId, appId), { log_id: logId }, void 0, false, { timeoutMs: 15 * 6e4 });
2092
+ }
2093
+ };
2094
+ }
2095
+ });
2096
+
1573
2097
  // ts/sdk/dist/llm-provider-client.js
1574
2098
  var LLMProviderClient;
1575
2099
  var init_llm_provider_client = __esm({
1576
2100
  "ts/sdk/dist/llm-provider-client.js"() {
1577
2101
  "use strict";
1578
2102
  init_constants();
1579
- init_wechat_client();
1580
- LLMProviderClient = class extends WechatClient {
2103
+ init_mini_app_client();
2104
+ LLMProviderClient = class extends MiniAppClient {
1581
2105
  async getLLMProviders(orgId) {
1582
2106
  const response = await this.request("GET", ENDPOINTS.LLM_PROVIDERS(orgId));
1583
2107
  return response.data;
@@ -2099,6 +2623,22 @@ var init_wiki_draft_client = __esm({
2099
2623
  }
2100
2624
  });
2101
2625
 
2626
+ // ts/sdk/dist/trigger-judge-client.js
2627
+ var TriggerJudgeClient;
2628
+ var init_trigger_judge_client = __esm({
2629
+ "ts/sdk/dist/trigger-judge-client.js"() {
2630
+ "use strict";
2631
+ init_constants();
2632
+ init_wiki_draft_client();
2633
+ TriggerJudgeClient = class extends WikiDraftClient {
2634
+ /** Evaluates a filter against one event without creating a run; asks `judge.*` questions when needed. */
2635
+ async testTriggerFilter(orgId, input) {
2636
+ return this.request("POST", ENDPOINTS.TRIGGER_TEST(orgId), input);
2637
+ }
2638
+ };
2639
+ }
2640
+ });
2641
+
2102
2642
  // ts/sdk/dist/wiki-upload.js
2103
2643
  function createWikiUploadFormData(params) {
2104
2644
  const form = new FormData();
@@ -2286,12 +2826,12 @@ var init_client = __esm({
2286
2826
  "ts/sdk/dist/client.js"() {
2287
2827
  "use strict";
2288
2828
  init_browser_viewer();
2289
- init_wiki_draft_client();
2829
+ init_trigger_judge_client();
2290
2830
  init_wiki_upload();
2291
2831
  init_fetch_cause();
2292
2832
  init_wiki_changeset();
2293
2833
  init_constants();
2294
- ParallClient = class _ParallClient extends WikiDraftClient {
2834
+ ParallClient = class _ParallClient extends TriggerJudgeClient {
2295
2835
  baseUrl;
2296
2836
  wikiBaseUrl;
2297
2837
  token;
@@ -3443,6 +3983,17 @@ var init_client = __esm({
3443
3983
  });
3444
3984
  return res.data;
3445
3985
  }
3986
+ /** Unread totals per organization, keyed by org id — what the org switcher
3987
+ * shows for orgs the client is not currently in. Counts arrive already
3988
+ * filtered by each chat's notification level (see `OrgUnreadEntry`). Pass
3989
+ * `includeThreadReplies` only from clients that can advance thread cursors,
3990
+ * matching `getUnreadCounts`. */
3991
+ async getOrgUnread(opts) {
3992
+ const res = await this.request("GET", ENDPOINTS.UNREAD_BY_ORG, void 0, {
3993
+ include_thread_replies: opts?.includeThreadReplies ? "true" : void 0
3994
+ });
3995
+ return res.data;
3996
+ }
3446
3997
  async markRead(orgId, chatId, messageId) {
3447
3998
  return this.request("POST", ENDPOINTS.CHAT_READ(orgId, chatId), { message_id: messageId });
3448
3999
  }
@@ -4536,6 +5087,15 @@ var init_client = __esm({
4536
5087
  timeoutMs: 6e4
4537
5088
  });
4538
5089
  }
5090
+ /**
5091
+ * Upload an icon for a registry clip. Accepts a `File` or `Blob`; the server
5092
+ * decodes, resizes to 256 px and stores as JPEG.
5093
+ */
5094
+ async uploadClipIcon(orgId, clipId, file) {
5095
+ const fd = new FormData();
5096
+ fd.append("file", file);
5097
+ return this.multipartRequest("POST", ENDPOINTS.ORG_CLIP_REGISTRY_ICON(orgId, clipId), fd);
5098
+ }
4539
5099
  /**
4540
5100
  * Read a clip's per-org exec access (by user id — humans and agents alike).
4541
5101
  * Org-member readable, so a denied caller can learn why exec answered
@@ -4960,6 +5520,52 @@ var init_llm_provider_types = __esm({
4960
5520
  }
4961
5521
  });
4962
5522
 
5523
+ // ts/sdk/dist/mini-app-types.js
5524
+ var init_mini_app_types = __esm({
5525
+ "ts/sdk/dist/mini-app-types.js"() {
5526
+ "use strict";
5527
+ }
5528
+ });
5529
+
5530
+ // ts/sdk/dist/org-unread-types.js
5531
+ var init_org_unread_types = __esm({
5532
+ "ts/sdk/dist/org-unread-types.js"() {
5533
+ "use strict";
5534
+ }
5535
+ });
5536
+
5537
+ // ts/sdk/dist/runtime-observation.js
5538
+ var RUNTIME_OBSERVATION_EVENTS, RUNTIME_OBSERVATION_STATUSES;
5539
+ var init_runtime_observation2 = __esm({
5540
+ "ts/sdk/dist/runtime-observation.js"() {
5541
+ "use strict";
5542
+ RUNTIME_OBSERVATION_EVENTS = [
5543
+ "turn_started",
5544
+ "turn_completed",
5545
+ "thread_status",
5546
+ "hook_started",
5547
+ "hook_completed",
5548
+ "session_initialized",
5549
+ "request_completed",
5550
+ "session_status"
5551
+ ];
5552
+ RUNTIME_OBSERVATION_STATUSES = [
5553
+ "running",
5554
+ "completed",
5555
+ "failed",
5556
+ "blocked",
5557
+ "stopped",
5558
+ "interrupted",
5559
+ "idle",
5560
+ "not_loaded",
5561
+ "system_error",
5562
+ "initialized",
5563
+ "compacting",
5564
+ "unknown"
5565
+ ];
5566
+ }
5567
+ });
5568
+
4963
5569
  // ts/sdk/dist/subject.js
4964
5570
  function isTeamSubject(token) {
4965
5571
  return token.startsWith(TEAM_ID_PREFIX);
@@ -5003,6 +5609,13 @@ var init_task_label_types = __esm({
5003
5609
  }
5004
5610
  });
5005
5611
 
5612
+ // ts/sdk/dist/trigger-judge-types.js
5613
+ var init_trigger_judge_types = __esm({
5614
+ "ts/sdk/dist/trigger-judge-types.js"() {
5615
+ "use strict";
5616
+ }
5617
+ });
5618
+
5006
5619
  // ts/sdk/dist/types.js
5007
5620
  function isBroadcastMentionId(userId) {
5008
5621
  return userId === MENTION_ALL_USER_ID || userId === MENTION_ALL_HUMANS_USER_ID || userId === MENTION_ALL_AGENTS_USER_ID;
@@ -5028,38 +5641,6 @@ var init_types = __esm({
5028
5641
  }
5029
5642
  });
5030
5643
 
5031
- // ts/sdk/dist/runtime-observation.js
5032
- var RUNTIME_OBSERVATION_EVENTS, RUNTIME_OBSERVATION_STATUSES;
5033
- var init_runtime_observation2 = __esm({
5034
- "ts/sdk/dist/runtime-observation.js"() {
5035
- "use strict";
5036
- RUNTIME_OBSERVATION_EVENTS = [
5037
- "turn_started",
5038
- "turn_completed",
5039
- "thread_status",
5040
- "hook_started",
5041
- "hook_completed",
5042
- "session_initialized",
5043
- "request_completed",
5044
- "session_status"
5045
- ];
5046
- RUNTIME_OBSERVATION_STATUSES = [
5047
- "running",
5048
- "completed",
5049
- "failed",
5050
- "blocked",
5051
- "stopped",
5052
- "interrupted",
5053
- "idle",
5054
- "not_loaded",
5055
- "system_error",
5056
- "initialized",
5057
- "compacting",
5058
- "unknown"
5059
- ];
5060
- }
5061
- });
5062
-
5063
5644
  // ts/sdk/dist/wechat-types.js
5064
5645
  var init_wechat_types = __esm({
5065
5646
  "ts/sdk/dist/wechat-types.js"() {
@@ -5481,330 +6062,6 @@ var init_ws = __esm({
5481
6062
  }
5482
6063
  });
5483
6064
 
5484
- // ts/sdk/dist/browser-use-contract.generated.js
5485
- var browserUseContract;
5486
- var init_browser_use_contract_generated = __esm({
5487
- "ts/sdk/dist/browser-use-contract.generated.js"() {
5488
- "use strict";
5489
- browserUseContract = { "actions": { "read": { "grant": "browser.read", "target": "optional_tab", "params": { "required": [], "properties": { "url": { "type": "string", "min_length": 1, "max_length": 8192, "schemes": ["http", "https", "about:blank"] } }, "rules": ["exactly one of params.url or target is required", "params.url creates a hidden Profile-bound tab and closes it before terminal success or failure"], "additional_properties": false }, "success": { "base": null, "fields": { "profile_id": "ebp_identifier", "url": "string", "title": "string", "article": "nullable_article" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "tabs": { "grant": "browser.read", "target": "none", "params": { "required": [], "properties": {}, "additional_properties": false }, "success": { "base": null, "fields": { "tabs": "tab_summary_array" } }, "errors": ["TAB_GONE"] }, "wait": { "grant": "browser.read", "target": "tab", "params": { "required": [], "properties": { "selector": { "type": "string", "min_length": 1, "max_length": 4096 }, "state": { "enum": ["attached", "detached", "visible", "hidden", "load"], "default": "attached" }, "timeout_ms": { "type": "integer", "minimum": 1, "maximum": 3e4, "default": 1e4 } }, "rules": ["selector is required unless state=load", "state=load forbids selector"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "matched": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "snapshot": { "grant": "browser.read", "target": "tab", "params": { "required": [], "properties": { "interactive": { "type": "boolean", "default": false }, "compact": { "type": "boolean", "default": false }, "depth": { "type": "integer", "minimum": 0, "maximum": 64 } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "snapshot": "string", "snapshot_id": "identifier" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "get": { "grant": "browser.read", "target": "tab_or_ref", "params": { "required": ["prop"], "properties": { "selector": { "type": "string", "min_length": 1, "max_length": 4096 }, "prop": { "enum": ["text", "html", "value", "attr", "title", "url"] }, "name": { "type": "string", "min_length": 1, "max_length": 256 } }, "rules": ["title/url forbid locator and name", "text/html/value require exactly one locator", "attr requires exactly one locator and name"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "value": "nullable_string" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "STALE_REF", "PAGE_LOAD_FAILED"] }, "screenshot": { "grant": "browser.read", "target": "tab", "params": { "required": [], "properties": {}, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "format": { "const": "png" }, "base64": "canonical_base64" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "open": { "grant": "browser.interact", "target": "none", "params": { "required": ["url"], "properties": { "url": { "type": "string", "min_length": 1, "max_length": 8192, "schemes": ["http", "https", "about:blank"] }, "hidden": { "type": "boolean", "default": false }, "viewport": { "type": "viewport" } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": {} }, "errors": ["PAGE_LOAD_FAILED"] }, "navigate": { "grant": "browser.interact", "target": "tab", "params": { "required": ["url"], "properties": { "url": { "type": "string", "min_length": 1, "max_length": 8192, "schemes": ["http", "https", "about:blank"] } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": {} }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "viewport": { "grant": "browser.interact", "target": "tab", "params": { "required": ["width", "height"], "properties": { "width": { "type": "integer", "minimum": 320, "maximum": 3840 }, "height": { "type": "integer", "minimum": 240, "maximum": 2160 } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "viewport": "viewport" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE"] }, "click": { "grant": "browser.interact", "target": "tab_or_ref", "params": { "required": [], "properties": { "selector": "selector" }, "rules": ["exactly one of params.selector or target.ref"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "clicked": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "STALE_REF", "PAGE_LOAD_FAILED"] }, "fill": { "grant": "browser.interact", "target": "tab_or_ref", "params": { "required": ["text"], "properties": { "selector": "selector", "text": { "type": "string", "allow_empty": true } }, "rules": ["exactly one of params.selector or target.ref"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "filled": { "const": true }, "characters": "non_negative_integer" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "STALE_REF", "PAGE_LOAD_FAILED"] }, "type": { "grant": "browser.interact", "target": "tab_or_ref", "params": { "required": ["text"], "properties": { "selector": "selector", "text": { "type": "string", "min_length": 1 } }, "rules": ["exactly one of params.selector or target.ref"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "typed": { "const": true }, "characters": "non_negative_integer" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "STALE_REF", "PAGE_LOAD_FAILED"] }, "press": { "grant": "browser.interact", "target": "tab", "params": { "required": ["key"], "properties": { "key": "single_unicode_character_or_named_key" }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "pressed": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "scroll": { "grant": "browser.interact", "target": "tab", "params": { "required": [], "properties": { "direction": { "enum": ["up", "down", "left", "right"], "default": "down" }, "pixels": { "type": "integer", "minimum": 1, "maximum": 1e5, "default": 500 } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "scrolled": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "close": { "grant": "browser.interact", "target": "tab", "params": { "required": [], "properties": {}, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "closed": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE"] }, "recover": { "grant": "browser.interact", "target": "tab", "params": { "required": [], "properties": {}, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "recovered_from_tab_id": "identifier" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "eval": { "grant": "browser.advanced", "target": "tab", "params": { "required": ["expression"], "properties": { "expression": { "type": "string", "min_length": 1 }, "timeout_ms": { "type": "integer", "minimum": 1, "maximum": 15e3, "default": 15e3 } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "value": "json_value_max_256_kib" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] } }, "successShapes": { "tab_state": { "required": ["tab_id", "profile_id", "browser_generation", "document_generation", "url", "title"], "fields": { "tab_id": "identifier", "profile_id": "ebp_identifier", "browser_generation": "positive_integer", "document_generation": "positive_integer", "url": "string", "title": "string" }, "additional_properties": false }, "tab_summary": { "base": "tab_state", "required_additions": ["loading"], "fields": { "loading": "boolean" }, "additional_properties": false }, "article": { "required": ["title", "byline", "excerpt", "text", "published_time", "site_name", "length"], "fields": { "title": "nullable_string", "byline": "nullable_string", "excerpt": "nullable_string", "text": "string", "published_time": "nullable_string", "site_name": "nullable_string", "length": "non_negative_integer" }, "additional_properties": false } } };
5490
- }
5491
- });
5492
-
5493
- // ts/sdk/dist/browser-use-validation.js
5494
- function browserUseObject(value) {
5495
- if (!value || typeof value !== "object" || Array.isArray(value))
5496
- throw new BrowserUseValidationError("Expected an object.");
5497
- return value;
5498
- }
5499
- function browserUseIdentifier(value, prefix) {
5500
- if (typeof value !== "string" || !value.startsWith(prefix) || value.length <= prefix.length || value.length > 128 || !/^[A-Za-z0-9_-]+$/.test(value) || ["__proto__", "constructor", "prototype"].includes(value))
5501
- throw new BrowserUseValidationError(`Expected a ${prefix} identifier.`);
5502
- return value;
5503
- }
5504
- function requireValid(condition, label) {
5505
- if (!condition)
5506
- throw new BrowserUseValidationError(`Invalid ${label}.`);
5507
- }
5508
- function exact(value, allowed, required = []) {
5509
- requireValid(Object.keys(value).every((k) => allowed.includes(k)) && required.every((k) => Object.hasOwn(value, k)), "object fields");
5510
- }
5511
- function validateBrowserUseField(value, field, label) {
5512
- if (typeof field === "string") {
5513
- switch (field) {
5514
- case "selector":
5515
- return validateBrowserUseField(value, { type: "string", min_length: 1, max_length: 4096 }, label);
5516
- case "single_unicode_character_or_named_key":
5517
- requireValid(typeof value === "string" && ([...value].length === 1 || [
5518
- "Enter",
5519
- "Tab",
5520
- "Escape",
5521
- "Backspace",
5522
- "Delete",
5523
- "ArrowUp",
5524
- "ArrowDown",
5525
- "ArrowLeft",
5526
- "ArrowRight",
5527
- "Home",
5528
- "End",
5529
- "PageUp",
5530
- "PageDown"
5531
- ].includes(value)), label);
5532
- return;
5533
- case "viewport": {
5534
- const obj = browserUseObject(value);
5535
- exact(obj, ["width", "height"], ["width", "height"]);
5536
- validateBrowserUseField(obj.width, { type: "integer", minimum: 320, maximum: 3840 }, label);
5537
- validateBrowserUseField(obj.height, { type: "integer", minimum: 240, maximum: 2160 }, label);
5538
- return;
5539
- }
5540
- case "identifier":
5541
- browserUseIdentifier(value, label.includes("snapshot") ? "bsn_" : "btab_");
5542
- return;
5543
- case "ebp_identifier":
5544
- browserUseIdentifier(value, "ebp_");
5545
- return;
5546
- case "positive_integer":
5547
- return validateBrowserUseField(value, { type: "integer", minimum: 1 }, label);
5548
- case "non_negative_integer":
5549
- return validateBrowserUseField(value, { type: "integer", minimum: 0 }, label);
5550
- case "nullable_string":
5551
- if (value === null)
5552
- return;
5553
- return validateBrowserUseField(value, { type: "string", allow_empty: true }, label);
5554
- case "string":
5555
- return validateBrowserUseField(value, { type: "string", allow_empty: true }, label);
5556
- case "boolean":
5557
- requireValid(typeof value === "boolean", label);
5558
- return;
5559
- case "canonical_base64":
5560
- requireValid(typeof value === "string" && value.length > 0 && /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value) && btoa(atob(value)) === value, label);
5561
- return;
5562
- case "nullable_article":
5563
- if (value === null)
5564
- return;
5565
- return validateShape(value, browserUseContract.successShapes.article.fields);
5566
- case "tab_summary_array":
5567
- requireValid(Array.isArray(value), label);
5568
- for (const tab of value)
5569
- validateShape(tab, {
5570
- ...browserUseContract.successShapes.tab_state.fields,
5571
- loading: "boolean"
5572
- });
5573
- return;
5574
- case "json_value_max_256_kib":
5575
- requireValid(new TextEncoder().encode(canonicalBrowserUseJson(value)).length <= 256 * 1024, label);
5576
- return;
5577
- default:
5578
- throw new BrowserUseValidationError(`Unknown contract field ${field}.`);
5579
- }
5580
- }
5581
- if ("const" in field) {
5582
- requireValid(value === field.const, label);
5583
- return;
5584
- }
5585
- if (field.enum) {
5586
- requireValid(field.enum.includes(value), label);
5587
- return;
5588
- }
5589
- if (field.type === "viewport")
5590
- return validateBrowserUseField(value, "viewport", label);
5591
- if (field.type === "boolean") {
5592
- requireValid(typeof value === "boolean", label);
5593
- return;
5594
- }
5595
- if (field.type === "integer") {
5596
- requireValid(typeof value === "number" && Number.isSafeInteger(value) && value >= (field.minimum ?? 0) && value <= (field.maximum ?? Number.MAX_SAFE_INTEGER), label);
5597
- return;
5598
- }
5599
- requireValid(typeof value === "string" && [...value].length >= (field.allow_empty ? 0 : field.min_length ?? 1) && [...value].length <= (field.max_length ?? 1 << 20), label);
5600
- if (field.schemes) {
5601
- if (value === "about:blank")
5602
- return;
5603
- let url;
5604
- try {
5605
- url = new URL(value);
5606
- } catch {
5607
- throw new BrowserUseValidationError(`Invalid ${label} URL.`);
5608
- }
5609
- requireValid(url.protocol === "https:" || url.protocol === "http:", label);
5610
- }
5611
- }
5612
- function validateShape(value, fields) {
5613
- const obj = browserUseObject(value);
5614
- exact(obj, Object.keys(fields), Object.keys(fields));
5615
- for (const [key, field] of Object.entries(fields))
5616
- validateBrowserUseField(obj[key], field, key);
5617
- }
5618
- function validateBrowserUseActionRequest(value) {
5619
- const obj = browserUseObject(value);
5620
- exact(obj, ["action", "target", "params"], ["action", "params"]);
5621
- requireValid(typeof obj.action === "string", "action");
5622
- if (!Object.hasOwn(BROWSER_USE_ACTION_SCHEMAS, obj.action))
5623
- throw new BrowserUseValidationError(`Browser Use v1 does not support ${obj.action}.`, "UNSUPPORTED_ACTION");
5624
- const action = obj.action;
5625
- const schema = BROWSER_USE_ACTION_SCHEMAS[action];
5626
- const params = browserUseObject(obj.params);
5627
- exact(params, Object.keys(schema.params.properties), [...schema.params.required]);
5628
- for (const [key, val] of Object.entries(params))
5629
- validateBrowserUseField(val, schema.params.properties[key], key);
5630
- let target;
5631
- if (obj.target !== void 0) {
5632
- requireValid(schema.target !== "none", "target");
5633
- target = browserUseObject(obj.target);
5634
- const base = ["tab_id", "browser_generation"];
5635
- const refs = ["document_generation", "snapshot_id", "ref"];
5636
- exact(target, schema.target === "tab_or_ref" ? [...base, ...refs] : base, base);
5637
- browserUseIdentifier(target.tab_id, "btab_");
5638
- validateBrowserUseField(target.browser_generation, "positive_integer", "browser_generation");
5639
- if (refs.some((k) => Object.hasOwn(target, k))) {
5640
- requireValid(refs.every((k) => Object.hasOwn(target, k)), "complete ref binding");
5641
- validateBrowserUseField(target.document_generation, "positive_integer", "document_generation");
5642
- browserUseIdentifier(target.snapshot_id, "bsn_");
5643
- browserUseIdentifier(target.ref, "");
5644
- }
5645
- } else
5646
- requireValid(schema.target === "none" || schema.target === "optional_tab", "required target");
5647
- const locatorCount = Number(params.selector !== void 0) + Number(target?.ref !== void 0);
5648
- if (action === "read")
5649
- requireValid(params.url !== void 0 !== Boolean(target), "read URL or target");
5650
- if (action === "wait")
5651
- requireValid(params.state === "load" === (params.selector === void 0), "wait selector/state");
5652
- if (["click", "fill", "type"].includes(action))
5653
- requireValid(locatorCount === 1, "exactly one locator");
5654
- if (action === "get") {
5655
- const page = params.prop === "title" || params.prop === "url";
5656
- requireValid(locatorCount === (page ? 0 : 1), "get locator");
5657
- requireValid(params.prop === "attr" === (params.name !== void 0), "get attribute name");
5658
- }
5659
- requireValid(new TextEncoder().encode(JSON.stringify(obj)).length <= 1 << 20, "request size");
5660
- return obj;
5661
- }
5662
- function validateBrowserUseSuccessData(action, value) {
5663
- const schema = BROWSER_USE_ACTION_SCHEMAS[action].success;
5664
- validateShape(value, {
5665
- ...schema.base === "tab_state" ? browserUseContract.successShapes.tab_state.fields : {},
5666
- ...schema.fields
5667
- });
5668
- }
5669
- function canonicalBrowserUseJson(value, seen = /* @__PURE__ */ new Set()) {
5670
- if (value === null || typeof value === "boolean" || typeof value === "string")
5671
- return JSON.stringify(value);
5672
- if (typeof value === "number" && Number.isFinite(value))
5673
- return JSON.stringify(value);
5674
- if (!value || typeof value !== "object" || seen.has(value))
5675
- throw new BrowserUseValidationError("Invalid JSON result.");
5676
- seen.add(value);
5677
- const result = Array.isArray(value) ? `[${value.map((v) => canonicalBrowserUseJson(v, seen)).join(",")}]` : `{${Object.keys(value).sort().map((k) => `${JSON.stringify(k)}:${canonicalBrowserUseJson(value[k], seen)}`).join(",")}}`;
5678
- seen.delete(value);
5679
- return result;
5680
- }
5681
- var BrowserUseValidationError, BROWSER_USE_ACTION_SCHEMAS, BROWSER_USE_ACTIONS;
5682
- var init_browser_use_validation = __esm({
5683
- "ts/sdk/dist/browser-use-validation.js"() {
5684
- "use strict";
5685
- init_browser_use_contract_generated();
5686
- BrowserUseValidationError = class extends Error {
5687
- code;
5688
- constructor(message, code = "INVALID_ARGUMENT") {
5689
- super(message);
5690
- this.code = code;
5691
- }
5692
- };
5693
- BROWSER_USE_ACTION_SCHEMAS = browserUseContract.actions;
5694
- BROWSER_USE_ACTIONS = Object.freeze(Object.keys(BROWSER_USE_ACTION_SCHEMAS));
5695
- }
5696
- });
5697
-
5698
- // ts/sdk/dist/browser-use-receipt.js
5699
- function isBrowserUseTimestamp(value) {
5700
- if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/.test(value))
5701
- return false;
5702
- const [year, month, day, hour, minute, second] = value.slice(0, 19).split(/[-T:]/).map(Number);
5703
- return year >= 1 && month >= 1 && month <= 12 && day >= 1 && day <= new Date(Date.UTC(year, month, 0)).getUTCDate() && hour < 24 && minute < 60 && second < 60 && Number.isFinite(Date.parse(value));
5704
- }
5705
- async function browserUseResultDigest(value, maxBytes = 1 << 20, subtle = globalThis.crypto.subtle) {
5706
- const bytes = new TextEncoder().encode(canonicalBrowserUseJson(value));
5707
- if (bytes.length > maxBytes)
5708
- throw new BrowserUseValidationError("Browser Use result exceeds contract size.");
5709
- const digest = await subtle.digest("SHA-256", bytes);
5710
- return `sha256:${Array.from(new Uint8Array(digest), (n) => n.toString(16).padStart(2, "0")).join("")}`;
5711
- }
5712
- function proof(condition) {
5713
- if (!condition)
5714
- throw new BrowserUseValidationError("The Browser Use response did not contain valid public status proof.", "INVALID_SERVER_RESPONSE");
5715
- }
5716
- async function validateBrowserUseReceipt(value, expected, subtle) {
5717
- try {
5718
- const r = browserUseObject(value);
5719
- proof(Object.keys(r).every((k) => KEYS.includes(k)));
5720
- proof(r.contract_version === "browser-use-operation-v1");
5721
- browserUseIdentifier(r.operation_id, "buo_");
5722
- browserUseIdentifier(r.request_id, "burq_");
5723
- browserUseIdentifier(r.profile_id, "ebp_");
5724
- proof(r.profile_id === expected.profileId && (!expected.operationId || r.operation_id === expected.operationId) && (!expected.requestId || r.request_id === expected.requestId) && (!expected.action || r.action === expected.action));
5725
- proof(typeof r.action === "string" && Object.hasOwn(BROWSER_USE_ACTION_SCHEMAS, r.action));
5726
- const action = r.action;
5727
- proof(r.required_grant === BROWSER_USE_ACTION_SCHEMAS[action].grant);
5728
- proof(positive(r.profile_version) && positive(r.profile_config_revision));
5729
- proof(typeof r.phase === "string" && ["accepted", "started", ...terminal].includes(r.phase));
5730
- proof(typeof r.result_available === "boolean");
5731
- for (const k of ["deadline", "accepted_at", "updated_at"])
5732
- proof(isBrowserUseTimestamp(r[k]));
5733
- for (const k of ["occurred_at", "result_expires_at", "started_at", "terminal_at"])
5734
- if (k in r)
5735
- proof(isBrowserUseTimestamp(r[k]));
5736
- if ("duration_ms" in r)
5737
- proof(typeof r.duration_ms === "number" && Number.isSafeInteger(r.duration_ms) && r.duration_ms >= 0);
5738
- if ("dispatched" in r)
5739
- proof(typeof r.dispatched === "boolean");
5740
- proof("tab_id" in r === "browser_generation" in r);
5741
- if ("tab_id" in r) {
5742
- browserUseIdentifier(r.tab_id, "btab_");
5743
- proof(positive(r.browser_generation));
5744
- }
5745
- const isTerminal = terminal.has(r.phase);
5746
- if (isTerminal) {
5747
- browserUseIdentifier(r.receipt_id, "bur_");
5748
- proof(hash(r.receipt_digest) && isBrowserUseTimestamp(r.occurred_at) && isBrowserUseTimestamp(r.terminal_at));
5749
- } else {
5750
- proof(!("terminal_at" in r));
5751
- if ("receipt_id" in r || "receipt_digest" in r || "occurred_at" in r) {
5752
- proof(r.phase === "started");
5753
- browserUseIdentifier(r.receipt_id, "bur_");
5754
- proof(hash(r.receipt_digest) && isBrowserUseTimestamp(r.occurred_at));
5755
- }
5756
- }
5757
- const hasData = Object.hasOwn(r, "data");
5758
- proof(r.result_available === hasData);
5759
- if (r.phase === "succeeded")
5760
- proof(!("error" in r) && hash(r.result_digest));
5761
- else {
5762
- proof(!hasData && !r.result_available);
5763
- if (isTerminal) {
5764
- const e = browserUseObject(r.error);
5765
- proof(Object.keys(e).every((k) => ["code", "message", "hint"].includes(k)) && typeof e.code === "string" && /^[A-Z][A-Z0-9_]{0,127}$/.test(e.code));
5766
- for (const k of ["message", "hint"])
5767
- if (k in e)
5768
- proof(typeof e[k] === "string" && e[k].length <= 1024);
5769
- if (r.phase === "outcome_unknown")
5770
- proof(e.code === "UNKNOWN_OUTCOME");
5771
- } else
5772
- proof(!("error" in r));
5773
- }
5774
- if (hasData) {
5775
- validateBrowserUseSuccessData(action, r.data);
5776
- proof(r.result_digest === await browserUseResultDigest(r.data, action === "eval" ? 256 * 1024 : 1 << 20, subtle));
5777
- const data = browserUseObject(r.data);
5778
- if (action === "tabs")
5779
- proof(data.tabs.every((t) => t.profile_id === r.profile_id));
5780
- else
5781
- proof(data.profile_id === r.profile_id);
5782
- if (!["read", "tabs"].includes(action))
5783
- proof(data.tab_id === r.tab_id && data.browser_generation === r.browser_generation);
5784
- if (expected.target) {
5785
- if (action === "recover")
5786
- proof(data.recovered_from_tab_id === expected.target.tab_id);
5787
- else if (action !== "read")
5788
- proof(data.tab_id === expected.target.tab_id && data.browser_generation === expected.target.browser_generation);
5789
- }
5790
- }
5791
- return r;
5792
- } catch {
5793
- throw new BrowserUseValidationError("The Browser Use response did not contain valid public status proof.", "INVALID_SERVER_RESPONSE");
5794
- }
5795
- }
5796
- var KEYS, terminal, hash, positive;
5797
- var init_browser_use_receipt = __esm({
5798
- "ts/sdk/dist/browser-use-receipt.js"() {
5799
- "use strict";
5800
- init_browser_use_validation();
5801
- KEYS = "contract_version operation_id request_id profile_id profile_version profile_config_revision action required_grant phase dispatched receipt_id receipt_digest occurred_at tab_id browser_generation duration_ms result_digest result_available result_expires_at data error deadline accepted_at started_at terminal_at updated_at".split(" ");
5802
- terminal = /* @__PURE__ */ new Set(["succeeded", "failed", "outcome_unknown"]);
5803
- hash = (value) => typeof value === "string" && /^sha256:[0-9a-f]{64}$/.test(value);
5804
- positive = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
5805
- }
5806
- });
5807
-
5808
6065
  // ts/sdk/dist/index.js
5809
6066
  var dist_exports = {};
5810
6067
  __export(dist_exports, {
@@ -5878,38 +6135,33 @@ __export(dist_exports, {
5878
6135
  var init_dist = __esm({
5879
6136
  "ts/sdk/dist/index.js"() {
5880
6137
  "use strict";
5881
- init_browser_viewer();
5882
- init_browser_use();
5883
6138
  init_attachment_types();
5884
6139
  init_attention_types();
6140
+ init_browser_use();
6141
+ init_browser_use_receipt();
6142
+ init_browser_use_validation();
6143
+ init_browser_viewer();
5885
6144
  init_channel_types();
5886
6145
  init_client();
5887
- init_fetch_cause();
5888
6146
  init_constants();
6147
+ init_fetch_cause();
5889
6148
  init_llm_provider_types();
6149
+ init_mini_app_types();
6150
+ init_org_unread_types();
6151
+ init_runtime_observation2();
5890
6152
  init_subject();
5891
6153
  init_task_label_types();
6154
+ init_trigger_judge_types();
5892
6155
  init_types();
5893
- init_runtime_observation2();
5894
- init_wiki_draft_types();
5895
6156
  init_wechat_types();
6157
+ init_wiki_draft_types();
5896
6158
  init_ws();
5897
- init_browser_use_validation();
5898
- init_browser_use_receipt();
5899
6159
  }
5900
6160
  });
5901
6161
 
5902
- // ts/agent-core/dist/fork-state.js
5903
- var init_fork_state = __esm({
5904
- "ts/agent-core/dist/fork-state.js"() {
5905
- "use strict";
5906
- init_fork_prefix();
5907
- }
5908
- });
5909
-
5910
- // ts/agent-core/dist/gateway-steer.js
5911
- var init_gateway_steer = __esm({
5912
- "ts/agent-core/dist/gateway-steer.js"() {
6162
+ // ts/agent-core/dist/gateway/steer.js
6163
+ var init_steer = __esm({
6164
+ "ts/agent-core/dist/gateway/steer.js"() {
5913
6165
  "use strict";
5914
6166
  init_fork_prefix();
5915
6167
  }
@@ -32991,36 +33243,36 @@ var init_telemetry = __esm({
32991
33243
  }
32992
33244
  });
32993
33245
 
32994
- // ts/agent-core/dist/gateway-lane-settle.js
32995
- var init_gateway_lane_settle = __esm({
32996
- "ts/agent-core/dist/gateway-lane-settle.js"() {
33246
+ // ts/agent-core/dist/gateway/lane-settle.js
33247
+ var init_lane_settle = __esm({
33248
+ "ts/agent-core/dist/gateway/lane-settle.js"() {
32997
33249
  "use strict";
32998
33250
  init_fork_prefix();
32999
- init_gateway_steer();
33251
+ init_steer();
33000
33252
  init_telemetry();
33001
33253
  }
33002
33254
  });
33003
33255
 
33004
- // ts/agent-core/dist/lane-key.js
33005
- var init_lane_key = __esm({
33006
- "ts/agent-core/dist/lane-key.js"() {
33256
+ // ts/agent-core/dist/lane/key.js
33257
+ var init_key = __esm({
33258
+ "ts/agent-core/dist/lane/key.js"() {
33007
33259
  "use strict";
33008
33260
  }
33009
33261
  });
33010
33262
 
33011
- // ts/agent-core/dist/lane-target.js
33263
+ // ts/agent-core/dist/lane/target.js
33012
33264
  var PRLL_SCHEME, CHANNEL_LANE_PREFIX;
33013
- var init_lane_target = __esm({
33014
- "ts/agent-core/dist/lane-target.js"() {
33265
+ var init_target = __esm({
33266
+ "ts/agent-core/dist/lane/target.js"() {
33015
33267
  "use strict";
33016
33268
  PRLL_SCHEME = "prll://";
33017
33269
  CHANNEL_LANE_PREFIX = `${PRLL_SCHEME}chv_`;
33018
33270
  }
33019
33271
  });
33020
33272
 
33021
- // ts/agent-core/dist/lane-outcome.js
33022
- var init_lane_outcome = __esm({
33023
- "ts/agent-core/dist/lane-outcome.js"() {
33273
+ // ts/agent-core/dist/lane/outcome.js
33274
+ var init_outcome = __esm({
33275
+ "ts/agent-core/dist/lane/outcome.js"() {
33024
33276
  "use strict";
33025
33277
  }
33026
33278
  });
@@ -33032,69 +33284,69 @@ var init_runtime_instance = __esm({
33032
33284
  }
33033
33285
  });
33034
33286
 
33035
- // ts/agent-core/dist/lane-input-receipts.js
33036
- var init_lane_input_receipts = __esm({
33037
- "ts/agent-core/dist/lane-input-receipts.js"() {
33287
+ // ts/agent-core/dist/lane/input-receipts.js
33288
+ var init_input_receipts = __esm({
33289
+ "ts/agent-core/dist/lane/input-receipts.js"() {
33038
33290
  "use strict";
33039
33291
  init_dist();
33040
- init_lane_outcome();
33292
+ init_outcome();
33041
33293
  init_redact();
33042
33294
  init_runtime_instance();
33043
33295
  }
33044
33296
  });
33045
33297
 
33046
- // ts/agent-core/dist/lane-confirmations.js
33047
- var init_lane_confirmations = __esm({
33048
- "ts/agent-core/dist/lane-confirmations.js"() {
33298
+ // ts/agent-core/dist/lane/confirmations.js
33299
+ var init_confirmations = __esm({
33300
+ "ts/agent-core/dist/lane/confirmations.js"() {
33049
33301
  "use strict";
33050
33302
  init_dist();
33051
33303
  }
33052
33304
  });
33053
33305
 
33054
- // ts/agent-core/dist/lane-ledger.js
33055
- var init_lane_ledger = __esm({
33056
- "ts/agent-core/dist/lane-ledger.js"() {
33306
+ // ts/agent-core/dist/lane/ledger.js
33307
+ var init_ledger = __esm({
33308
+ "ts/agent-core/dist/lane/ledger.js"() {
33057
33309
  "use strict";
33058
33310
  init_dist();
33059
- init_lane_key();
33060
- init_lane_target();
33311
+ init_key();
33312
+ init_target();
33061
33313
  init_redact();
33062
- init_lane_input_receipts();
33063
- init_lane_outcome();
33064
- init_lane_confirmations();
33314
+ init_input_receipts();
33315
+ init_outcome();
33316
+ init_confirmations();
33065
33317
  init_runtime_instance();
33066
33318
  }
33067
33319
  });
33068
33320
 
33069
- // ts/agent-core/dist/gateway-lane-flow.js
33321
+ // ts/agent-core/dist/gateway/lane-flow.js
33070
33322
  var TYPED_BACKOFF_CAP_MS;
33071
- var init_gateway_lane_flow = __esm({
33072
- "ts/agent-core/dist/gateway-lane-flow.js"() {
33323
+ var init_lane_flow = __esm({
33324
+ "ts/agent-core/dist/gateway/lane-flow.js"() {
33073
33325
  "use strict";
33074
33326
  init_redact();
33075
33327
  init_dist();
33076
33328
  init_change_source();
33077
33329
  init_fork_prefix();
33078
- init_gateway_lane_settle();
33079
- init_gateway_steer();
33080
- init_lane_ledger();
33081
- init_lane_target();
33330
+ init_lane_settle();
33331
+ init_steer();
33332
+ init_ledger();
33333
+ init_target();
33082
33334
  init_telemetry();
33083
- init_gateway_steer();
33335
+ init_steer();
33084
33336
  TYPED_BACKOFF_CAP_MS = 5 * 6e4;
33085
33337
  }
33086
33338
  });
33087
33339
 
33088
- // ts/agent-core/dist/gateway-idle-compact.js
33089
- var init_gateway_idle_compact = __esm({
33090
- "ts/agent-core/dist/gateway-idle-compact.js"() {
33340
+ // ts/agent-core/dist/gateway/idle-compact.js
33341
+ var init_idle_compact = __esm({
33342
+ "ts/agent-core/dist/gateway/idle-compact.js"() {
33091
33343
  "use strict";
33092
33344
  }
33093
33345
  });
33094
33346
 
33095
- // ts/agent-core/dist/gateway-runtime-turns.js
33096
- var init_gateway_runtime_turns = __esm({
33097
- "ts/agent-core/dist/gateway-runtime-turns.js"() {
33347
+ // ts/agent-core/dist/gateway/runtime-turns.js
33348
+ var init_runtime_turns = __esm({
33349
+ "ts/agent-core/dist/gateway/runtime-turns.js"() {
33098
33350
  "use strict";
33099
33351
  init_dispatch_adapter();
33100
33352
  init_redact();
@@ -33103,31 +33355,111 @@ var init_gateway_runtime_turns = __esm({
33103
33355
  }
33104
33356
  });
33105
33357
 
33106
- // ts/agent-core/dist/gateway-drain.js
33107
- var init_gateway_drain = __esm({
33108
- "ts/agent-core/dist/gateway-drain.js"() {
33358
+ // ts/agent-core/dist/gateway/drain.js
33359
+ var init_drain = __esm({
33360
+ "ts/agent-core/dist/gateway/drain.js"() {
33109
33361
  "use strict";
33110
33362
  }
33111
33363
  });
33112
33364
 
33113
- // ts/agent-core/dist/gateway-session-binding.js
33114
- var init_gateway_session_binding = __esm({
33115
- "ts/agent-core/dist/gateway-session-binding.js"() {
33365
+ // ts/agent-core/dist/gateway/session-binding.js
33366
+ var init_session_binding = __esm({
33367
+ "ts/agent-core/dist/gateway/session-binding.js"() {
33116
33368
  "use strict";
33117
33369
  }
33118
33370
  });
33119
33371
 
33120
- // ts/agent-core/dist/runtime-declaration.js
33121
- var init_runtime_declaration = __esm({
33122
- "ts/agent-core/dist/runtime-declaration.js"() {
33372
+ // ts/agent-core/dist/gateway/inactivity-deadline.js
33373
+ var init_inactivity_deadline = __esm({
33374
+ "ts/agent-core/dist/gateway/inactivity-deadline.js"() {
33375
+ "use strict";
33376
+ }
33377
+ });
33378
+
33379
+ // ts/agent-core/dist/session/step-retry-queue.js
33380
+ var init_step_retry_queue = __esm({
33381
+ "ts/agent-core/dist/session/step-retry-queue.js"() {
33123
33382
  "use strict";
33124
33383
  }
33125
33384
  });
33126
33385
 
33127
- // ts/agent-core/dist/dispatch-inactivity-deadline.js
33128
- var init_dispatch_inactivity_deadline = __esm({
33129
- "ts/agent-core/dist/dispatch-inactivity-deadline.js"() {
33386
+ // ts/agent-core/dist/session/step-persister.js
33387
+ var init_step_persister = __esm({
33388
+ "ts/agent-core/dist/session/step-persister.js"() {
33130
33389
  "use strict";
33390
+ init_dist();
33391
+ init_step_retry_queue();
33392
+ }
33393
+ });
33394
+
33395
+ // ts/agent-core/dist/session/lifecycle.js
33396
+ var init_lifecycle = __esm({
33397
+ "ts/agent-core/dist/session/lifecycle.js"() {
33398
+ "use strict";
33399
+ }
33400
+ });
33401
+
33402
+ // ts/agent-core/dist/session/fork-finalizer.js
33403
+ var init_fork_finalizer = __esm({
33404
+ "ts/agent-core/dist/session/fork-finalizer.js"() {
33405
+ "use strict";
33406
+ }
33407
+ });
33408
+
33409
+ // ts/agent-core/dist/session/state.js
33410
+ var init_state = __esm({
33411
+ "ts/agent-core/dist/session/state.js"() {
33412
+ "use strict";
33413
+ }
33414
+ });
33415
+
33416
+ // ts/agent-core/dist/gateway/input-steps.js
33417
+ var init_input_steps = __esm({
33418
+ "ts/agent-core/dist/gateway/input-steps.js"() {
33419
+ "use strict";
33420
+ init_change_source();
33421
+ }
33422
+ });
33423
+
33424
+ // ts/agent-core/dist/gateway/run-dispatch.js
33425
+ var init_run_dispatch = __esm({
33426
+ "ts/agent-core/dist/gateway/run-dispatch.js"() {
33427
+ "use strict";
33428
+ init_ledger();
33429
+ init_redact();
33430
+ init_state();
33431
+ init_bridge_workspace();
33432
+ init_telemetry();
33433
+ init_input_steps();
33434
+ }
33435
+ });
33436
+
33437
+ // ts/agent-core/dist/gateway/fork-state.js
33438
+ var init_fork_state = __esm({
33439
+ "ts/agent-core/dist/gateway/fork-state.js"() {
33440
+ "use strict";
33441
+ init_fork_prefix();
33442
+ }
33443
+ });
33444
+
33445
+ // ts/agent-core/dist/gateway/fork-drain.js
33446
+ var init_fork_drain = __esm({
33447
+ "ts/agent-core/dist/gateway/fork-drain.js"() {
33448
+ "use strict";
33449
+ init_fork_prefix();
33450
+ init_fork_state();
33451
+ init_telemetry();
33452
+ }
33453
+ });
33454
+
33455
+ // ts/agent-core/dist/gateway/main-drain.js
33456
+ var init_main_drain = __esm({
33457
+ "ts/agent-core/dist/gateway/main-drain.js"() {
33458
+ "use strict";
33459
+ init_fork_prefix();
33460
+ init_lane_flow();
33461
+ init_target();
33462
+ init_steer();
33131
33463
  }
33132
33464
  });
33133
33465
 
@@ -33138,72 +33470,83 @@ var init_routing = __esm({
33138
33470
  }
33139
33471
  });
33140
33472
 
33141
- // ts/agent-core/dist/step-retry-queue.js
33142
- var init_step_retry_queue = __esm({
33143
- "ts/agent-core/dist/step-retry-queue.js"() {
33473
+ // ts/agent-core/dist/gateway/inbound.js
33474
+ var init_inbound = __esm({
33475
+ "ts/agent-core/dist/gateway/inbound.js"() {
33144
33476
  "use strict";
33477
+ init_fork_prefix();
33478
+ init_fork_state();
33479
+ init_lane_flow();
33480
+ init_target();
33481
+ init_routing();
33145
33482
  }
33146
33483
  });
33147
33484
 
33148
- // ts/agent-core/dist/step-persister.js
33149
- var init_step_persister = __esm({
33150
- "ts/agent-core/dist/step-persister.js"() {
33485
+ // ts/agent-core/dist/gateway/work-items.js
33486
+ var init_work_items = __esm({
33487
+ "ts/agent-core/dist/gateway/work-items.js"() {
33151
33488
  "use strict";
33152
- init_dist();
33153
- init_step_retry_queue();
33489
+ init_lane_flow();
33490
+ init_target();
33154
33491
  }
33155
33492
  });
33156
33493
 
33157
- // ts/agent-core/dist/session-lifecycle.js
33158
- var init_session_lifecycle = __esm({
33159
- "ts/agent-core/dist/session-lifecycle.js"() {
33494
+ // ts/agent-core/dist/gateway/catch-up.js
33495
+ var init_catch_up = __esm({
33496
+ "ts/agent-core/dist/gateway/catch-up.js"() {
33160
33497
  "use strict";
33161
33498
  }
33162
33499
  });
33163
33500
 
33164
- // ts/agent-core/dist/fork-session-finalizer.js
33165
- var init_fork_session_finalizer = __esm({
33166
- "ts/agent-core/dist/fork-session-finalizer.js"() {
33501
+ // ts/agent-core/dist/runtime-declaration.js
33502
+ var init_runtime_declaration = __esm({
33503
+ "ts/agent-core/dist/runtime-declaration.js"() {
33167
33504
  "use strict";
33168
33505
  }
33169
33506
  });
33170
33507
 
33171
- // ts/agent-core/dist/session-state.js
33172
- var init_session_state = __esm({
33173
- "ts/agent-core/dist/session-state.js"() {
33508
+ // ts/agent-core/dist/gateway/connection.js
33509
+ var init_connection = __esm({
33510
+ "ts/agent-core/dist/gateway/connection.js"() {
33174
33511
  "use strict";
33512
+ init_dist();
33513
+ init_runtime_declaration();
33175
33514
  }
33176
33515
  });
33177
33516
 
33178
- // ts/agent-core/dist/gateway-base.js
33517
+ // ts/agent-core/dist/gateway/base.js
33179
33518
  var AUTH_INVALID_EXIT_CODE;
33180
- var init_gateway_base = __esm({
33181
- "ts/agent-core/dist/gateway-base.js"() {
33519
+ var init_base = __esm({
33520
+ "ts/agent-core/dist/gateway/base.js"() {
33182
33521
  "use strict";
33183
- init_gateway_runtime_step();
33184
- init_dispatch_recovery();
33522
+ init_runtime_step();
33523
+ init_recovery();
33185
33524
  init_change_source();
33186
33525
  init_dist();
33187
33526
  init_fork_prefix();
33188
- init_fork_state();
33189
- init_gateway_lane_flow();
33190
- init_gateway_idle_compact();
33191
- init_gateway_runtime_turns();
33192
- init_gateway_drain();
33193
- init_gateway_session_binding();
33194
- init_lane_ledger();
33195
- init_runtime_declaration();
33196
- init_lane_target();
33197
- init_dispatch_inactivity_deadline();
33198
- init_routing();
33527
+ init_lane_flow();
33528
+ init_idle_compact();
33529
+ init_runtime_turns();
33530
+ init_drain();
33531
+ init_session_binding();
33532
+ init_ledger();
33533
+ init_target();
33534
+ init_inactivity_deadline();
33199
33535
  init_redact();
33200
33536
  init_step_persister();
33201
- init_session_lifecycle();
33202
- init_fork_session_finalizer();
33203
- init_session_state();
33204
- init_bridge_workspace();
33537
+ init_lifecycle();
33538
+ init_fork_finalizer();
33205
33539
  init_telemetry();
33206
- init_gateway_steer();
33540
+ init_steer();
33541
+ init_run_dispatch();
33542
+ init_fork_drain();
33543
+ init_main_drain();
33544
+ init_inbound();
33545
+ init_work_items();
33546
+ init_catch_up();
33547
+ init_connection();
33548
+ init_input_steps();
33549
+ init_input_steps();
33207
33550
  AUTH_INVALID_EXIT_CODE = 86;
33208
33551
  }
33209
33552
  });
@@ -58982,12 +59325,12 @@ var init_dist2 = __esm({
58982
59325
  init_dispatch_adapter();
58983
59326
  init_runtime_observation();
58984
59327
  init_fork_prefix();
58985
- init_gateway_base();
58986
- init_gateway_idle_compact();
58987
- init_gateway_lane_flow();
59328
+ init_base();
59329
+ init_idle_compact();
59330
+ init_lane_flow();
58988
59331
  init_http_keepalive();
58989
- init_lane_key();
58990
- init_lane_ledger();
59332
+ init_key();
59333
+ init_ledger();
58991
59334
  init_logger();
58992
59335
  init_platform_config();
58993
59336
  init_platform_instructions2();
@@ -58998,7 +59341,7 @@ var init_dist2 = __esm({
58998
59341
  init_runtime_instance();
58999
59342
  init_runtime_activity_port();
59000
59343
  init_runtime_turn_base();
59001
- init_session_state();
59344
+ init_state();
59002
59345
  init_skills();
59003
59346
  init_telemetry();
59004
59347
  init_types4();