@runlith/tagma 0.0.0-stage → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapter/claudeHooks.d.ts +10 -0
- package/adapter/claudeHooks.js +4 -0
- package/adapter/declaration.d.ts +14 -0
- package/adapter/declaration.js +2 -0
- package/adapter/harness.d.ts +454 -0
- package/adapter/harness.js +2 -0
- package/adapter/hook.d.ts +43 -0
- package/adapter/hook.js +2 -0
- package/adapter/hostModules.d.ts +19 -0
- package/adapter/hostModules.js +2 -0
- package/adapter/loader.d.ts +10 -0
- package/adapter/loader.js +2 -0
- package/adapter/metadata.d.ts +179 -0
- package/adapter/metadata.js +4 -0
- package/adapter/payload.d.ts +19 -0
- package/adapter/payload.js +3 -0
- package/adapter/provider.d.ts +209 -0
- package/adapter/provider.js +2 -0
- package/adapter/settings.d.ts +182 -0
- package/adapter/settings.js +2 -0
- package/adapter/speech.d.ts +4 -0
- package/adapter/speech.js +2 -0
- package/host.d.ts +61223 -0
- package/package.json +134 -3
- package/plugin/Held-cvetk2wg.js +6 -0
- package/plugin/accountKey-t44g9avw.js +2 -0
- package/plugin/adapter-qdnpxs6n.js +1 -0
- package/plugin/anthropic-a4pdzrv2.js +2 -0
- package/plugin/anthropic-messages-svq0svwe.js +2 -0
- package/plugin/anthropic-q1xa9n0j.js +2 -0
- package/plugin/auth-cp8wnd0z.js +2 -0
- package/plugin/authStatus-d6scztz5.js +2 -0
- package/plugin/bundling.d.ts +30 -0
- package/plugin/bundling.js +2 -0
- package/plugin/cacheLifetime-c5mpw676.js +2 -0
- package/plugin/callback-server-q2asby82.js +16 -0
- package/plugin/capabilities-jfhf61dt.js +2 -0
- package/plugin/claudeHooks-edpg1e46.js +3 -0
- package/plugin/cli.js +21 -0
- package/plugin/cliStore-5s0qerr7.js +2 -0
- package/plugin/clientSession-tmmxm39z.js +2 -0
- package/plugin/codec-aa8mxqyr.js +1 -0
- package/plugin/connect-d7ec6kfh.js +2 -0
- package/plugin/contract-qn0z7r9c.js +1 -0
- package/plugin/credential-garn07qc.js +2 -0
- package/plugin/deepseek-fvdrmjr9.js +2 -0
- package/plugin/deepseek-sp4vxjqy.js +2 -0
- package/plugin/definition-0h3gqd2z.js +2 -0
- package/plugin/description-8xhxryaq.js +2 -0
- package/plugin/deviceGrant-axpyc7xr.js +2 -0
- package/plugin/devin-hy98d305.js +2 -0
- package/plugin/duplex-yexjcpv2.js +2 -0
- package/plugin/endpoint-0b9bsb4q.js +2 -0
- package/plugin/errors-kck87dpv.js +2 -0
- package/plugin/events-81m69vqz.js +2 -0
- package/plugin/events-s95ybm4g.js +2 -0
- package/plugin/executor-avear8af.js +2 -0
- package/plugin/failure-ddv4456n.js +2 -0
- package/plugin/framing-jnd2zm0h.js +2 -0
- package/plugin/grant-85r3bbqn.js +2 -0
- package/plugin/harness-jm3fhnwg.js +2 -0
- package/plugin/headers-w6p5sp18.js +2 -0
- package/plugin/hook-hjrk83m8.js +2 -0
- package/plugin/icon-044pa3y8.js +6 -0
- package/plugin/icon-j22svmgp.js +4 -0
- package/plugin/icon-ny6qbjvc.js +4 -0
- package/plugin/icon-pz54e8n3.js +4 -0
- package/plugin/icon-qy92jx2b.js +4 -0
- package/plugin/ids-2dndaq8y.js +2 -0
- package/plugin/images-s2kqebfv.js +2 -0
- package/plugin/index-b3yp4szm.js +2 -0
- package/plugin/index-xs7nfsck.js +2 -0
- package/plugin/lifecycle-er51apxp.js +2 -0
- package/plugin/manual-2mdscj84.js +2 -0
- package/plugin/messages-gmwcg1pq.js +2 -0
- package/plugin/metadata-gpazs3f5.js +4 -0
- package/plugin/muse-g8bc58v8.js +2 -0
- package/plugin/muse-tfe6sph7.js +2 -0
- package/plugin/museToolSchema-tbe0f3wa.js +2 -0
- package/plugin/notes-5m0m3pdr.js +2 -0
- package/plugin/object-9pjtdam7.js +2 -0
- package/plugin/open-browser-vqb7ckt1.js +2 -0
- package/plugin/openai-6f50tf64.js +2 -0
- package/plugin/openai-compatible-chat-eez8hkge.js +2 -0
- package/plugin/openai-images-haszbnft.js +2 -0
- package/plugin/openai-mfqwg6pa.js +2 -0
- package/plugin/openai-responses-1gpyp640.js +2 -0
- package/plugin/opencodeGo-1wgdjtjz.js +3 -0
- package/plugin/opencodeGo-qgw3pfg6.js +2 -0
- package/plugin/options-476akxaj.js +2 -0
- package/plugin/payload-2gr4q9g8.js +2 -0
- package/plugin/pkce-y3sh5pk8.js +2 -0
- package/plugin/plugin-0e34qaar.js +3 -0
- package/plugin/plugin-1vpp5mqk.js +4 -0
- package/plugin/plugin-1zkx860n.js +3 -0
- package/plugin/plugin-217mw9ck.js +3 -0
- package/plugin/plugin-24j9hnc7.js +3 -0
- package/plugin/plugin-2s6bq45c.js +3 -0
- package/plugin/plugin-3969dy0b.js +3 -0
- package/plugin/plugin-3b8x73y6.js +3 -0
- package/plugin/plugin-3t0qp574.js +3 -0
- package/plugin/plugin-55fbx586.js +3 -0
- package/plugin/plugin-5zq084fb.js +3 -0
- package/plugin/plugin-6a56xsx3.js +3 -0
- package/plugin/plugin-6vzw5yyr.js +3 -0
- package/plugin/plugin-72xxqm1t.js +3 -0
- package/plugin/plugin-7swap1ad.js +3 -0
- package/plugin/plugin-7te9b50h.js +3 -0
- package/plugin/plugin-7xmwhj5h.js +3 -0
- package/plugin/plugin-80gqwmjy.js +3 -0
- package/plugin/plugin-8g8myq9g.js +3 -0
- package/plugin/plugin-8q44b578.js +3 -0
- package/plugin/plugin-8v4g0q0b.js +3 -0
- package/plugin/plugin-8x3c401q.js +9 -0
- package/plugin/plugin-92sxs4r1.js +3 -0
- package/plugin/plugin-9gha9fx3.js +3 -0
- package/plugin/plugin-9zbh7788.js +3 -0
- package/plugin/plugin-a3vzpk4e.js +3 -0
- package/plugin/plugin-ak62rhwz.js +3 -0
- package/plugin/plugin-azkzdkpk.js +3 -0
- package/plugin/plugin-cydz2zhy.js +3 -0
- package/plugin/plugin-d28d8jar.js +4 -0
- package/plugin/plugin-dd951075.js +3 -0
- package/plugin/plugin-dqxdznvd.js +3 -0
- package/plugin/plugin-dsjq4tye.js +3 -0
- package/plugin/plugin-e5ybk2a2.js +3 -0
- package/plugin/plugin-eksq91yp.js +5 -0
- package/plugin/plugin-er1kc6f6.js +5 -0
- package/plugin/plugin-fjsmz1vy.js +4 -0
- package/plugin/plugin-fre9hdcg.js +3 -0
- package/plugin/plugin-g0zv4vrz.js +3 -0
- package/plugin/plugin-g4hst0jz.js +3 -0
- package/plugin/plugin-g7hrtg2p.js +3 -0
- package/plugin/plugin-gh857xdd.js +3 -0
- package/plugin/plugin-hkjxkgty.js +3 -0
- package/plugin/plugin-jxvmq18y.js +3 -0
- package/plugin/plugin-kc4z9msd.js +3 -0
- package/plugin/plugin-krbbb4ts.js +3 -0
- package/plugin/plugin-me00x60n.js +3 -0
- package/plugin/plugin-mqr325kz.js +3 -0
- package/plugin/plugin-nzacjxf9.js +3 -0
- package/plugin/plugin-p59gy5xd.js +3 -0
- package/plugin/plugin-p6x7emar.js +3 -0
- package/plugin/plugin-pdww1ma8.js +3 -0
- package/plugin/plugin-psj9935q.js +3 -0
- package/plugin/plugin-q6pvb1xf.js +3 -0
- package/plugin/plugin-r342d8zf.js +3 -0
- package/plugin/plugin-r7g3vqrm.js +3 -0
- package/plugin/plugin-rrgyjesv.js +3 -0
- package/plugin/plugin-t4xrq5q2.js +3 -0
- package/plugin/plugin-tetj2cr3.js +3 -0
- package/plugin/plugin-v80m00bq.js +14 -0
- package/plugin/plugin-vfjhxng8.js +3 -0
- package/plugin/plugin-vqrd05eg.js +3 -0
- package/plugin/plugin-w3zbkmy6.js +3 -0
- package/plugin/plugin-w8f977my.js +3 -0
- package/plugin/plugin-xbnw80pk.js +3 -0
- package/plugin/plugin-xfcgt5ba.js +36 -0
- package/plugin/plugin-y9cdpmbv.js +6 -0
- package/plugin/plugin-yg0h5k5d.js +3 -0
- package/plugin/plugin-yp736z4n.js +3 -0
- package/plugin/plugin-zrb8bbr4.js +3 -0
- package/plugin/plugin-zsv7wawc.js +3 -0
- package/plugin/plugin.d.ts +175 -0
- package/plugin/plugin.js +2 -0
- package/plugin/points.generated.d.ts +341 -0
- package/plugin/points.generated.js +2 -0
- package/plugin/process.d.ts +4 -0
- package/plugin/process.js +85 -0
- package/plugin/protocol-8c26dk6v.js +2 -0
- package/plugin/protocol.d.ts +115 -0
- package/plugin/protocol.js +2 -0
- package/plugin/provider-0b7xxyhn.js +2 -0
- package/plugin/quota-v63yvp13.js +2 -0
- package/plugin/quotaRead-esmjycnd.js +2 -0
- package/plugin/reasoning-1saw6tds.js +2 -0
- package/plugin/record-1m3vvy60.js +2 -0
- package/plugin/requests-2zyr1g8e.js +1 -0
- package/plugin/responseFold-xxhqx4sa.js +2 -0
- package/plugin/settings-8xq8dvhp.js +2 -0
- package/plugin/shared-4jndfh28.js +2 -0
- package/plugin/speech-067caz1a.js +2 -0
- package/plugin/stepfun-3en5g41d.js +2 -0
- package/plugin/stepfun-xp1c5wpk.js +2 -0
- package/plugin/stream-8yrr289z.js +2 -0
- package/plugin/svelteProgram-73v9yajk.js +2 -0
- package/plugin/synthesisDuplex-ch9jhqzt.js +2 -0
- package/plugin/template.d.ts +14 -0
- package/plugin/template.js +2 -0
- package/plugin/testing.d.ts +85 -0
- package/plugin/testing.js +4 -0
- package/plugin/tool-content-vean6rqa.js +2 -0
- package/plugin/tool-stream-fb180jmt.js +2 -0
- package/plugin/transport-j784dsdr.js +2 -0
- package/plugin/ui.generated.d.ts +1041 -0
- package/plugin/value.d.ts +8 -0
- package/plugin/value.js +2 -0
- package/plugin/vendor-pn6b5a8f.js +2 -0
- package/plugin/vendorCall-6n5chrn0.js +2 -0
- package/plugin/vendorCall-82evk8b3.js +2 -0
- package/plugin/vendorPayload-458354fv.js +2 -0
- package/plugin/vendorWeb-cz5t01m7.js +2 -0
- package/plugin/verbatim-2f2d9n02.js +2 -0
- package/plugin/xai-2cqraa99.js +2 -0
- package/plugin/xai-e8sbtk6a.js +2 -0
- package/rules/effect.d.ts +55 -0
- package/rules/effect.js +11 -0
- package/rules/rules.d.ts +342 -0
- package/rules/rules.js +50 -0
- package/types/node/assert/strict.d.ts +12 -0
- package/types/node/assert.d.ts +76 -0
- package/types/node/async_hooks.d.ts +113 -0
- package/types/node/buffer.buffer.d.ts +29 -0
- package/types/node/buffer.d.ts +162 -0
- package/types/node/child_process.d.ts +337 -0
- package/types/node/cluster.d.ts +118 -0
- package/types/node/compatibility/iterators.d.ts +11 -0
- package/types/node/console.d.ts +48 -0
- package/types/node/constants.d.ts +8 -0
- package/types/node/crypto.d.ts +847 -0
- package/types/node/dgram.d.ts +88 -0
- package/types/node/diagnostics_channel.d.ts +61 -0
- package/types/node/dns/promises.d.ts +94 -0
- package/types/node/dns.d.ts +276 -0
- package/types/node/domain.d.ts +17 -0
- package/types/node/events.d.ts +138 -0
- package/types/node/fs/promises.d.ts +253 -0
- package/types/node/fs.d.ts +1038 -0
- package/types/node/globals.d.ts +73 -0
- package/types/node/globals.typedarray.d.ts +22 -0
- package/types/node/http.d.ts +530 -0
- package/types/node/http2.d.ts +794 -0
- package/types/node/https.d.ts +66 -0
- package/types/node/index.d.ts +84 -0
- package/types/node/inspector/promises.d.ts +13 -0
- package/types/node/inspector.d.ts +61 -0
- package/types/node/inspector.generated.d.ts +1624 -0
- package/types/node/module.d.ts +187 -0
- package/types/node/net.d.ts +266 -0
- package/types/node/os.d.ts +236 -0
- package/types/node/path/posix.d.ts +8 -0
- package/types/node/path/win32.d.ts +8 -0
- package/types/node/path.d.ts +40 -0
- package/types/node/perf_hooks.d.ts +236 -0
- package/types/node/process.d.ts +436 -0
- package/types/node/punycode.d.ts +15 -0
- package/types/node/querystring.d.ts +22 -0
- package/types/node/quic.d.ts +203 -0
- package/types/node/readline/promises.d.ts +28 -0
- package/types/node/readline.d.ts +94 -0
- package/types/node/repl.d.ts +104 -0
- package/types/node/sea.d.ts +11 -0
- package/types/node/sqlite.d.ts +183 -0
- package/types/node/stream/consumers.d.ts +13 -0
- package/types/node/stream/iter.d.ts +240 -0
- package/types/node/stream/promises.d.ts +37 -0
- package/types/node/stream/web.d.ts +297 -0
- package/types/node/stream.d.ts +378 -0
- package/types/node/string_decoder.d.ts +10 -0
- package/types/node/test/reporters.d.ts +66 -0
- package/types/node/test.d.ts +462 -0
- package/types/node/timers/promises.d.ts +16 -0
- package/types/node/timers.d.ts +43 -0
- package/types/node/tls.d.ts +279 -0
- package/types/node/trace_events.d.ts +16 -0
- package/types/node/ts5.6/buffer.buffer.d.ts +26 -0
- package/types/node/ts5.6/compatibility/float16array.d.ts +43 -0
- package/types/node/ts5.6/globals.typedarray.d.ts +22 -0
- package/types/node/ts5.6/index.d.ts +84 -0
- package/types/node/ts5.7/compatibility/float16array.d.ts +50 -0
- package/types/node/ts5.7/index.d.ts +84 -0
- package/types/node/tty.d.ts +61 -0
- package/types/node/url.d.ts +165 -0
- package/types/node/util/types.d.ts +49 -0
- package/types/node/util.d.ts +320 -0
- package/types/node/v8.d.ts +178 -0
- package/types/node/vm.d.ts +130 -0
- package/types/node/wasi.d.ts +26 -0
- package/types/node/web-globals/abortcontroller.d.ts +47 -0
- package/types/node/web-globals/blob.d.ts +34 -0
- package/types/node/web-globals/console.d.ts +7 -0
- package/types/node/web-globals/crypto.d.ts +46 -0
- package/types/node/web-globals/domexception.d.ts +74 -0
- package/types/node/web-globals/encoding.d.ts +16 -0
- package/types/node/web-globals/events.d.ts +111 -0
- package/types/node/web-globals/fetch.d.ts +121 -0
- package/types/node/web-globals/importmeta.d.ts +11 -0
- package/types/node/web-globals/messaging.d.ts +32 -0
- package/types/node/web-globals/navigator.d.ts +28 -0
- package/types/node/web-globals/performance.d.ts +71 -0
- package/types/node/web-globals/storage.d.ts +26 -0
- package/types/node/web-globals/streams.d.ts +162 -0
- package/types/node/web-globals/timers.d.ts +22 -0
- package/types/node/web-globals/url.d.ts +27 -0
- package/types/node/worker_threads.d.ts +199 -0
- package/types/node/zlib/iter.d.ts +49 -0
- package/types/node/zlib.d.ts +360 -0
- package/types/undici/agent.d.ts +24 -0
- package/types/undici/api.d.ts +19 -0
- package/types/undici/balanced-pool.d.ts +16 -0
- package/types/undici/cache-interceptor.d.ts +98 -0
- package/types/undici/cache.d.ts +30 -0
- package/types/undici/client-stats.d.ts +9 -0
- package/types/undici/client.d.ts +61 -0
- package/types/undici/connector.d.ts +37 -0
- package/types/undici/content-type.d.ts +9 -0
- package/types/undici/cookies.d.ts +22 -0
- package/types/undici/diagnostics-channel.d.ts +72 -0
- package/types/undici/dispatcher.d.ts +207 -0
- package/types/undici/env-http-proxy-agent.d.ts +15 -0
- package/types/undici/errors.d.ts +117 -0
- package/types/undici/eventsource.d.ts +39 -0
- package/types/undici/fetch.d.ts +122 -0
- package/types/undici/formdata.d.ts +24 -0
- package/types/undici/global-dispatcher.d.ts +4 -0
- package/types/undici/global-origin.d.ts +3 -0
- package/types/undici/h2c-client.d.ts +35 -0
- package/types/undici/handlers.d.ts +7 -0
- package/types/undici/header.d.ts +10 -0
- package/types/undici/index.d.ts +85 -0
- package/types/undici/interceptors.d.ts +70 -0
- package/types/undici/mock-agent.d.ts +43 -0
- package/types/undici/mock-call-history.d.ts +57 -0
- package/types/undici/mock-client.d.ts +17 -0
- package/types/undici/mock-errors.d.ts +9 -0
- package/types/undici/mock-interceptor.d.ts +60 -0
- package/types/undici/mock-pool.d.ts +17 -0
- package/types/undici/patch.d.ts +21 -0
- package/types/undici/pool-stats.d.ts +11 -0
- package/types/undici/pool.d.ts +25 -0
- package/types/undici/proxy-agent.d.ts +22 -0
- package/types/undici/readable.d.ts +24 -0
- package/types/undici/retry-agent.d.ts +6 -0
- package/types/undici/retry-handler.d.ts +41 -0
- package/types/undici/round-robin-pool.d.ts +25 -0
- package/types/undici/snapshot-agent.d.ts +98 -0
- package/types/undici/socks5-proxy-agent.d.ts +17 -0
- package/types/undici/util.d.ts +4 -0
- package/types/undici/utility.d.ts +2 -0
- package/types/undici/webidl.d.ts +121 -0
- package/types/undici/websocket.d.ts +130 -0
- package/README.md +0 -3
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Jl,zs,ku,Gm}from"./plugin-d28d8jar.js";import{Go}from"./plugin-72xxqm1t.js";import{Mf,Eu,rn,Bi,hc,Aa,vu,de}from"./plugin-3t0qp574.js";import{Ao,Pt}from"./plugin-6vzw5yyr.js";import{ue,Ze,at,v,ee,ml,$r,hl,ha,n,ce,t,ge,x,gt,Kn,ui}from"./plugin-xfcgt5ba.js";import{Buffer as y}from"buffer";var ql=Kn(ce),Zk=hl(ql),xr=ha(ql),h=ml(ui),Dr=ge(t,ce),jn=(e)=>n(x(e)),Ie=(e)=>n(gt(e)),ds=(e,r,o)=>{if(o!==void 0)return o;if(e===void 0&&r===void 0)return;return(e??0)+(r??0)},Ta=(e,r)=>{if(e===void 0)return;if(r===void 0)return e;return Math.max(0,e-r)},Hm=(...e)=>{if(e.every((r)=>r===void 0))return;return e.reduce((r,o)=>r+(o??0),0)},c=(e)=>e.length<=Eu?e:`${e.slice(0,Eu)}\u2026`,b=(e)=>{try{return JSON.stringify(e)??String(e)}catch{return String(e)}},R=(e)=>{let r="_tag"in e?e._tag:void 0;if(typeof r==="string"&&r.length>0)return r;return e.name.length>0?e.name:"unknown"},p=(e)=>{let r=e;for(let o=0;o<Mf;o+=1){let a="reason"in r?r.reason:void 0;if(!(a instanceof Error)||a.message!==r.message)return r;r=a}return r},Su=(e,r=[])=>{let o=[],a=e;for(let s=0;s<Mf;s+=1){if(a===void 0||a===null)break;if(!(a instanceof Error)){o.push({tag:"unknown",message:c(Go(b(a),r))});break}let d=p(a),i="code"in d&&typeof d.code==="string"&&d.code.length>0?d.code:void 0;o.push({tag:c(Go(R(d),r)),message:c(Go(d.message,r)),code:i===void 0?void 0:c(Go(i,r))}),a=d.cause}return o},sy=(e)=>{let r=e;for(let o=0;o<Mf;o+=1){if(!(r instanceof Error))return;let a=p(r),s="code"in a?a.code:void 0;if(typeof s==="string"&&s.length>0)return s;r=a.cause}return},S=(e)=>[e.status===void 0?void 0:`HTTP ${e.status}`,e.upstreamRequestId,e.bytesRead===void 0?void 0:`${e.bytesRead} bytes`,e.lastEvent===void 0?void 0:`${e.lastEvent.count} events${e.lastEvent.type===void 0?"":`, last ${e.lastEvent.type}`}`,e.elapsedMs===void 0?void 0:`${e.elapsedMs} ms`].filter((r)=>r!==void 0&&r!==""),g=(e)=>{let r=S(e);return r.length===0?e.message:`${e.message} (${[e.family,...r].join(" \xB7 ")})`},Et=(e,r)=>{let o=(s)=>Go(s,r.secrets??[]),a=Su(e,r.secrets??[]);return new de({module:r.module??"ProviderShared",method:r.method??"stream",reason:new Aa({message:g(r),family:r.family,route:r.route,excerpt:r.excerpt===void 0?void 0:c(o(r.excerpt)),status:r.status,upstreamRequestId:r.upstreamRequestId,attempt:r.attempt,bytesRead:r.bytesRead,elapsedMs:r.elapsedMs,lastEvent:r.lastEvent,cause:a.length===0?void 0:a})})},m=(e,r)=>({...e,status:e.status??r.status,upstreamRequestId:e.upstreamRequestId??r.upstreamRequestId,attempt:e.attempt??r.attempt,bytesRead:e.bytesRead??r.bytesRead,elapsedMs:e.elapsedMs??r.elapsedMs,lastEvent:e.lastEvent??r.lastEvent}),iy=(e,r,o=[])=>{let a=e.reason,s=(l)=>c(Go(l,o)),i=(()=>{switch(a._tag){case"InvalidProviderOutput":{let l={...m(a,r),message:s(a.message),excerpt:a.excerpt===void 0?void 0:s(a.excerpt),cause:a.cause?.map((u)=>({tag:s(u.tag),message:s(u.message),code:u.code===void 0?void 0:s(u.code)}))};return new Aa(a.attempt===void 0?{...l,message:g({...l,family:a.family})}:l)}case"ProviderInternal":return new Bi({...m(a,r),message:s(a.message)});case"UnknownProvider":return new vu({...m(a,r),message:s(a.message)});case"InvalidRequest":return new rn({...m(a,r),message:s(a.message)});case"StreamStalled":return new hc(m(a,r));default:return a}})();return i===a?e:new de({module:e.module,method:e.method,reason:i})},T=(e)=>{if(e.message&&e.code)return`${e.code}: ${e.message}`;return e.message||e.code||""},Ls=(e)=>{let r=Go(T(e.refusal).trim());if(r==="")return Et(void 0,{module:e.module,message:e.unrecognized?"The provider ended the stream with an unrecognized error payload; its cause could not be read":"The provider ended the stream with an error naming neither a code nor a message",family:e.unrecognized?"invalid-output":"blank-error",excerpt:xr({kind:e.unrecognized?"unrecognized-error":"blank-error",eventType:e.evidence.eventType??null,keys:[...e.evidence.keys].sort(),payloadKeys:e.evidence.payloadKeys?.length?[...e.evidence.payloadKeys].sort():void 0})});return new de({module:e.module,method:"stream",reason:e.contextOverflow?new rn({message:r,classification:"context-overflow"}):e.retryable?new Bi({message:r,modelStarted:e.modelStarted}):new vu({message:r,modelStarted:e.modelStarted})})},DT=(e,r,o)=>Ze({try:()=>Zk(r),catch:(a)=>Et(a,{route:e,message:o,family:"invalid-output",excerpt:r})}),mi=(e)=>e.map((r)=>r.text).join(`
|
|
3
|
+
`),E=(e)=>e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">"),Gk=(e)=>`<system-update>
|
|
4
|
+
${E(mi(e))}
|
|
5
|
+
</system-update>`,jm=ee("ProviderShared.systemUpdateText")(function*(e,r){let o=[];for(let a of r.content){if(!Xr(a,["text"]))return yield*lr(e,"system",["text"]);o.push(a)}return o}),Ds=ee("ProviderShared.wrappedSystemUpdate")(function*(e,r){let o=yield*jm(e,r);return{type:"text",text:Gk(o),cache:o.at(-1)?.cache}}),w=$r(ql),ay=(e)=>{let r=w(e||"{}");return ue(r)?{input:r.success}:{input:{},unparsed:e}},Fs=["image/png","image/jpeg","image/gif","image/webp"],Jk=["video/mp4","video/webm","video/quicktime"],Kk=["audio/wav","audio/mp3","audio/aiff","audio/aac","audio/ogg","audio/flac"],cy=[...Fs,...Jk,...Kk],wv=29360128,qm=20971520,fs=ee("ProviderShared.validateMedia")(function*(e,r,o){let a=r.mediaType.toLowerCase();if(!o.has(a))return yield*xt(`${e} does not support media type ${r.mediaType}`);let s;if(typeof r.data!=="string"){if(r.data.byteLength>qm)return yield*xt(`${e} media exceeds the ${qm} byte decoded limit`);s=y.from(r.data).toString("base64")}else if(r.data.startsWith("data:")){let i=r.data.indexOf(","),l=i<0?"":r.data.slice(5,i),u=l.indexOf(";");if(i<0||u<=0||l.slice(u)!==";base64")return yield*xt(`${e} media data URL must contain valid base64`);let f=l.slice(0,u);if(f.toLowerCase()!==a)return yield*xt(`${e} media type ${r.mediaType} does not match data URL type ${f}`);s=r.data.slice(i+1)}else s=r.data;if(y.byteLength(s,"utf8")>wv)return yield*xt(`${e} media exceeds the ${wv} byte encoded limit`);if(!s||s.length%4!==0)return yield*xt(`${e} media must contain valid base64`);let d=y.from(s,"base64");if(d.byteLength>qm)return yield*xt(`${e} media exceeds the ${qm} byte decoded limit`);if(d.toString("base64")!==s)return yield*xt(`${e} media must contain canonical base64`);return{mime:a,base64:s,dataUrl:`data:${a};base64,${s}`,bytes:d}}),Ra=(e,r,o)=>fs(e,{type:"media",mediaType:r.mime,data:r.uri,filename:r.name},o),uy=(e)=>e.replace(/\/+$/,""),ps=(e)=>{if(e.result.type==="text")return String(e.result.value);if(e.result.type==="error"){let r=e.result.value,o=typeof r==="object"&&r!==null&&!Array.isArray(r)&&Object.getPrototypeOf(r);return(Array.isArray(r)||o===Object.prototype||o===null)&&h(r)?xr(r):String(r)}return xr(e.result.value)},Bl=(e,r)=>{let o=e.replaceAll(r.outside,"_"),a=r.maxLength??Number.POSITIVE_INFINITY;if(o===e&&e.length>0&&e.length<=a)return e;let s=`_${A(e)}`;return o.slice(0,a-s.length)+s},A=(e)=>{let r=2166136261;for(let o=0;o<e.length;o++)r^=e.charCodeAt(o),r=Math.imul(r,16777619);return(r>>>0).toString(16).padStart(8,"0")},xt=(e)=>new de({module:"ProviderShared",method:"request",reason:new rn({message:e})}),Us=v(function*(e,r,o){if(r.type==="auto")return o.auto();if(r.type==="none")return o.none();if(r.type==="required")return o.required();if(!r.name)return yield*xt(`${e} tool choice requires a tool name`);return o.tool(r.name)}),I=(e)=>{if(e.length<=1)return e[0]??"";if(e.length===2)return`${e[0]} and ${e[1]}`;return`${e.slice(0,-1).join(", ")}, and ${e.at(-1)}`},Xr=(e,r)=>r.includes(e.type),lr=(e,r,o)=>xt(`${e} ${r} messages only support ${I(o)} content for now`),Wl=(e)=>(r)=>e(r).pipe(at((o)=>xt(o.message))),Ia=(e)=>{let r=Pt(e.headers??{});return Jl(e.url).pipe(zs(r),Gm(e.body,"application/json"),ku((o)=>Pt(o,Ao(r))))};
|
|
6
|
+
export{ql,Zk,xr,Dr,jn,Ie,ds,Ta,Hm,Su,sy,Et,iy,Ls,DT,mi,Gk,jm,Ds,ay,Fs,Jk,Kk,cy,wv,qm,fs,Ra,uy,ps,Bl,xt,Us,Xr,lr,Wl,Ia};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{n,w,t,o,O,W,gt,kt,Zt,_t}from"./plugin-xfcgt5ba.js";var Tm=200,fk=160,Qg=t.check(kt(/^[a-z][a-z0-9-]*$/u),_t(64)),Rm=["tagma","lode"],fT="tagma",pk=W(["configured","serving","last-recorded"]),pT=W(["hook","vendor-record","transcript","session-store","terminal","protocol"]),mT=O([o({read:w("value"),value:t.check(_t(Tm)),claim:pk}),o({read:w("absent")}),o({read:w("unsupported")}),o({read:w("unreadable"),reason:t.check(_t(fk))})]),hT=o({value:t,label:t,description:n(t)}),gT=W(["choice"]),yT=o({id:gt(t.check(Zt(1))),tool:t.check(Zt(1)),subject:t.check(Zt(1))}),xT=["catalog","proxy"],mk=1e4,ST={chars:mk,basis:"unmeasured"},ev="tagma";function bT(r){let e=r[ev];if(e===null)throw Error(`The harness cannot express permission stance ${ev}.`);return e}function ET(r,e){if(e===void 0)return[];let a=e.rung===null?e.model:`${e.model} at ${e.rung}`;if(r===null)throw Error(`The harness declares no model surface and cannot launch on ${a}.`);return r.argv(e)}var vT={_tag:"char",char:"\x03"},wT=()=>null,kT=()=>null,_T=(r)=>(e,a)=>a.length===1?r(e,a[0]):null,TT=(r,e)=>{if(r.selected===null)return null;let a=r.options.findIndex((l)=>l.value===r.selected),s=r.options.findIndex((l)=>l.value===e);if(a<0||s<0)return null;let d=s>a?"down":"up";return[...Array.from({length:Math.abs(s-a)}).fill(d),"enter"]},RT=(r,e)=>r.options.some((a)=>a.value===e)?[...e].map((a)=>({_tag:"char",char:a})):null,IT=(r,e,a=r.findLastIndex((s)=>e(s)!==null))=>{if(a<0)return null;let s=[],d=[],l=a;for(;l>=0;l-=1){let i=e(r[l]);if(i===null)break;if(s.push({value:i.value,label:i.label}),i.selected)d.push(i.value)}return s.reverse(),{options:s,selected:d.length===1?d[0]:null,marked:d.length,above:l}},Im={asksFrom:"never"},yu={asksFrom:"review",timeout:"none"},CT={names:"kind",byName:{bash:{kind:"execute",approval:yu},read:{kind:"read",approval:Im},ls:{kind:"read",approval:Im},glob:{kind:"read",approval:Im},grep:{kind:"read",approval:Im},write:{kind:"write",approval:yu},edit:{kind:"write",approval:yu},delete:{kind:"write",approval:yu},rename:{kind:"write",approval:yu},webfetch:{kind:"network",approval:yu},websearch:{kind:"network",approval:yu}}};
|
|
3
|
+
export{Tm,fk,Qg,Rm,fT,pk,pT,mT,hT,gT,yT,xT,mk,ST,ev,bT,ET,vT,wT,kT,_T,TT,RT,IT,Im,yu,CT};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{N}from"./plugin-me00x60n.js";import{nh,Cu,Sr,ut,Ay,Ou}from"./plugin-q6pvb1xf.js";import{Xm,Oo,Ur,eh,rd,Ut,gs,_y}from"./plugin-7te9b50h.js";import{Pm}from"./plugin-a3vzpk4e.js";import{n,w,ce,t,S,z,o,x,O,W,Kr,ct,uu,Ke,nw,So}from"./plugin-xfcgt5ba.js";var d=new WeakMap;function u(e){let i=d.get(e);if(i!==void 0)return i;let a=So(e);return d.set(e,a),a}var m=o({mode:W(["manual","automatic"]),transcriptLocation:t,keep:n(t)}),f=o({...m.fields,id:t,preservedCount:S,previousMessageId:n(t),previousRequestId:n(t),toolReferences:n(x(t))});var T=o({type:w("text"),text:t,cache:n(gs),metadata:n(Sr)}).annotate({identifier:"LLM.SystemPart"}),h=(e)=>({type:"text",text:e}),Ck=Object.assign(T,{from:h,content:(e)=>{if(e===void 0)return[];return typeof e==="string"?[h(e)]:Array.isArray(e)?[...e]:[e]}}),Ak=o({type:w("text"),text:t,deferredTools:n(x(t)),cache:n(gs),metadata:n(Sr),providerMetadata:n(ut)}).annotate({identifier:"LLM.Content.Text"}),Mk=o({type:w("media"),mediaType:t,data:O([t,uu]),filename:n(t),cache:n(gs),metadata:n(Sr)}).annotate({identifier:"LLM.Content.Media"}),R=O([o({type:w("json"),value:Cu}),o({type:w("text"),value:Cu}),o({type:w("error"),value:Cu}),o({type:w("content"),value:x(Pm)})]).annotate({identifier:"LLM.ToolResult"}).pipe(Kr("type")),Ok=o({outputId:t,format:W(["text","json"]),byteLength:S,lineCount:S,location:n(t),contentLocation:n(t)}).annotate({identifier:"LLM.ToolResultRetention"}),g=(e)=>N(e)&&(e.type==="json"||e.type==="text"||e.type==="error"||e.type==="content")&&("value"in e),Os=Object.assign(R,{from:(e,i="json")=>{let a=g(e)?e.type:i,r=g(e)?e.value:e;if(a==="content")return{type:a,value:Array.isArray(r)?r:[]};return{type:a,value:nh(r)}}}),Mm=Object.assign(o({structured:ce,content:x(Pm)}).annotate({identifier:"LLM.ToolOutput"}),{from:(e,i=[])=>({structured:e,content:i}),fromResultValue:(e)=>{switch(e.type){case"json":return{structured:e.value,content:[]};case"text":return{structured:{},content:[{type:"text",text:L(e.value)}]};case"content":return{structured:{},content:e.value};case"error":return}},toResultValue:(e)=>{if(e.content.length===0)return{type:"json",value:e.structured};if(e.content.length===1&&e.content[0]?.type==="text")return{type:"text",value:e.content[0].text};return{type:"content",value:e.content}}}),L=(e)=>{if(typeof e==="string")return e;try{return JSON.stringify(e)??String(e)}catch{return String(e)}},Om=Object.assign(o({type:w("tool-call"),id:t,name:t,input:ce,unparsed:n(t),providerExecuted:n(z),cache:n(gs),metadata:n(Sr),providerMetadata:n(ut)}).annotate({identifier:"LLM.Content.ToolCall"}),{from:(e)=>({type:"tool-call",...e})}),_f=Object.assign(o({type:w("tool-result"),id:t,name:t,result:Os,toolReferences:n(x(t)),providerExecuted:n(z),retained:n(Ok),durationMs:n(ct),cache:n(gs),metadata:n(Sr),providerMetadata:n(ut)}).annotate({identifier:"LLM.Content.ToolResult"}),{from:(e)=>({type:"tool-result",id:e.id,name:e.name,result:Os.from(e.result,e.resultType),toolReferences:e.toolReferences,providerExecuted:e.providerExecuted,retained:e.retained,durationMs:e.durationMs,cache:e.cache,metadata:e.metadata,providerMetadata:e.providerMetadata})}),Pk=o({type:w("reasoning"),text:t,encrypted:n(t),metadata:n(Sr),providerMetadata:n(ut)}).annotate({identifier:"LLM.Content.Reasoning"}),$k=o({type:w("model-fallback"),from:Ut,to:Ut,trigger:Sr,providerMetadata:n(ut)}).annotate({identifier:"LLM.Content.ModelFallback"}),Nk=O([Ak,Mk,Om,_f,Pk,$k]).pipe(Kr("type"));class dn extends Ke("LLM.Message")({id:n(t),requestId:n(t),role:Ay,content:x(Nk),origin:n(Ut),compaction:n(f),metadata:n(Sr),native:n(Sr)}){}((c)=>(c.text=(p)=>({type:"text",text:p}),c.content=(p)=>typeof p==="string"?[c.text(p)]:Array.isArray(p)?[...p]:[p],c.make=(p)=>{if(p instanceof dn)return p;return new dn({...p,content:c.content(p.content)})},c.user=(p)=>c.make({role:"user",content:p}),c.assistant=(p)=>c.make({role:"assistant",content:p}),c.system=(p)=>c.make({role:"system",content:p}),c.tool=(p)=>c.make({role:"tool",content:["type"in p?p:_f.from(p)]})))(dn||={});var Lk=o({name:t,namespace:n(o({name:t,description:t}))});class pi extends Ke("LLM.ToolDefinition")({name:t,description:t,inputSchema:Ou,cache:n(gs),metadata:n(Sr),native:n(Sr),vendorWire:n(Lk),deferred:n(w(!0))}){}((i)=>i.make=(a)=>a instanceof pi?a:new pi(a))(pi||={});var Dk=(e)=>{let i=nw(u(e),{onExcessProperty:"error"});if(Object.keys(i.definitions).length===0)return i.schema;return{...i.schema,$defs:i.definitions}},C=new WeakMap,$T=(e)=>{let i=C.get(e);if(i!==void 0)return i;let a=P(Dk(e));return C.set(e,a),a},P=(e)=>{if(e.type==="object")return e;let{not:i,...a}=e;if(b(i)&&a.anyOf===void 0)return{...a,type:"object"};let{anyOf:r,...s}=e,l=Array.isArray(r)?r.filter(M):[];if(l.length===1)return{...s,...l[0],type:"object"};if(Array.isArray(r)&&l.length>1&&l.length===r.length)return{...s,type:"object",anyOf:l};throw Error("A tool input schema is one object at the root; this codec produced "+(l.length>0?"a union containing non-object shapes":"no object shape")+". Declare the wire form on the tool as `inputSchema`, and keep the codec for decoding.")},M=(e)=>N(e)&&(e.type==="object"||("properties"in e)),b=(e)=>N(e)&&e.type==="null"&&Object.keys(e).length===1;class fc extends Ke("LLM.ToolChoice")({type:eh,name:n(t)}){}((r)=>{let e=(s)=>s==="auto"||s==="none"||s==="required";r.named=(s)=>new fc({type:"tool",name:s}),r.make=(s)=>{if(s instanceof fc)return s;if(s instanceof pi)return r.named(s.name);if(typeof s==="string")return e(s)?new fc({type:s}):r.named(s);return new fc(s)}})(fc||={});var Fk=O([o({type:w("text")}),o({type:w("json"),schema:Ou}),o({type:w("tool"),tool:pi})]).pipe(Kr("type"));class us extends Ke("LLM.Request")({id:n(t),model:rd,system:x(Ck),messages:x(dn),tools:x(pi),toolChoice:n(fc),generation:n(Ur),providerOptions:n(Xm),http:n(Oo),responseFormat:n(Fk),compaction:n(m),cache:n(_y),liveness:n(S),metadata:n(Sr)}){}((a)=>(a.input=(r)=>({id:r.id,model:r.model,system:r.system,messages:r.messages,tools:r.tools,toolChoice:r.toolChoice,generation:r.generation,providerOptions:r.providerOptions,http:r.http,responseFormat:r.responseFormat,compaction:r.compaction,cache:r.cache,liveness:r.liveness,metadata:r.metadata}),a.update=(r,s)=>{if(Object.keys(s).length===0)return r;return new us({...a.input(r),...s,model:s.model??r.model})}))(us||={});
|
|
3
|
+
export{Ck,Ak,Mk,Ok,Os,Mm,Om,_f,Pk,$k,Nk,dn,Lk,pi,Dk,$T,fc,Fk,us};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{N}from"./plugin-me00x60n.js";import{Fr}from"./plugin-g4hst0jz.js";import{xr,Dr,jn,Ie,ds,Ta,Ls,mi,Ds,Fs,fs,Ra,ps,xt,Us,Xr,lr,Wl}from"./plugin-y9cdpmbv.js";import{Os}from"./plugin-yp736z4n.js";import{ln,we}from"./plugin-24j9hnc7.js";import{Lr}from"./plugin-r7g3vqrm.js";import{Zo,Ns}from"./plugin-p6x7emar.js";import{qi}from"./plugin-e5ybk2a2.js";import{kf}from"./plugin-7xmwhj5h.js";import{To}from"./plugin-pdww1ma8.js";import{XE}from"./plugin-7swap1ad.js";import{lf,jE,qE,BE,df,cc,ff,WE,VE,pf,ZE,GE,pm,JE,mf}from"./plugin-psj9935q.js";import{Cs,nn,Vo,Ol,cs,yr,As}from"./plugin-zsv7wawc.js";import{Hi,wa,hu,$l,Nl,Wg}from"./plugin-2s6bq45c.js";import{Ro}from"./plugin-kc4z9msd.js";import{qt,r,c,v,ee,pt,ha,n,w,ce,t,S,z,o,ge,ss,x,O,W,P,Kn}from"./plugin-xfcgt5ba.js";var h=(e,s)=>`${s??""}\x00${e}`,E=(e)=>new Map(e.flatMap((s)=>s.vendorWire===void 0?[]:[[s.name,s.vendorWire]])),L=(e)=>new Map(e.flatMap((s)=>s.vendorWire===void 0?[]:[[h(s.vendorWire.name,s.vendorWire.namespace?.name),s.name]]));var ne=(e,s)=>({type:"function",name:e.vendorWire?.name??e.name,description:e.description,parameters:s,strict:!1}),te=(e)=>{let s=e.model.compatibility?.toolSchema,i=[],a=new Map;for(let l of e.tools){let p=ne(l,Ro.modelCompatibility(l.inputSchema,s)),d=l.vendorWire?.namespace;if(d===void 0){i.push(p);continue}let u=a.get(d.name);if(u!==void 0){u.push(p);continue}let g=[p];a.set(d.name,g),i.push({type:"namespace",name:d.name,description:d.description,tools:g})}return i},oe=v(function*(e,s){let i=yield*Us("OpenAI Responses",e,{auto:()=>"auto",none:()=>"none",required:()=>"required",tool:(l)=>({type:"function",name:l})});if(typeof i==="string")return i;let a=s.get(i.name);if(a===void 0)return i;if(a.namespace!==void 0)return yield*xt(`OpenAI Responses cannot require ${i.name} by name: it is declared as ${a.namespace.name}.${a.name}, and a named tool choice reaches no namespaced function.`);return{type:"function",name:a.name}}),se=(e,s)=>{let i=s.get(e.name);return{type:"function_call",call_id:e.id,name:i?.name??e.name,namespace:i?.namespace?.name,arguments:xr(e.input)}},re=(e)=>{let s=e.providerMetadata?.openai;if(!N(s)||typeof s.itemId!=="string"||s.itemId.length===0)return;let i=typeof s.reasoningEncryptedContent==="string"?s.reasoningEncryptedContent:s.reasoningEncryptedContent===null?null:void 0;return{type:"reasoning",id:s.itemId,summary:e.text.length>0?[{type:"summary_text",text:e.text}]:[],encrypted_content:i}},ie=(e)=>{let s=e.providerMetadata?.openai;return N(s)&&typeof s.itemId==="string"&&s.itemId.length>0?s.itemId:void 0},ae=ee("OpenAIResponses.lowerUserContent")(function*(e){if(e.type==="text")return{type:"input_text",text:e.text};if(e.type==="media")return{type:"input_image",image_url:(yield*fs("OpenAI Responses",e,new Set(Fs))).dataUrl};return yield*lr("OpenAI Responses","user",["text","media"])}),pe=ee("OpenAIResponses.lowerToolResultContentItem")(function*(e){if(e.type==="text")return{type:"input_text",text:e.text};return{type:"input_image",image_url:(yield*Ra("OpenAI Responses",e,new Set(Fs))).dataUrl}}),le=ee("OpenAIResponses.lowerToolResultOutput")(function*(e){if(e.result.type!=="content")return ps(e);let s=e.result.value;return yield*qt(s,pe)}),de=ee("OpenAIResponses.lowerMessages")(function*(e,s){let a=[...e.system.length===0?[]:[{role:"system",content:mi(e.system)}]],l=cc(e);for(let p of e.messages){if(p.role==="system"){let d=yield*Ds("OpenAI Responses",p),u=a.at(-1);if(u&&"role"in u&&u.role==="user")a[a.length-1]={role:"user",content:[...u.content,{type:"input_text",text:d.text}]};else a.push({role:"user",content:[{type:"input_text",text:d.text}]});continue}if(p.role==="user"){a.push({role:"user",content:yield*qt(p.content,ae)});continue}if(p.role==="assistant"){let d=[],u={},g=new Set,R=new Set,_=()=>{if(d.length===0)return;a.push({role:"assistant",content:d.map((f)=>({type:"output_text",text:f.text}))}),d.splice(0,d.length)};for(let f of p.content){if(f.type==="text"){d.push(f);continue}if(f.type==="reasoning"){_();let m=re(f);if(!m)continue;if(l!==!1){if(!g.has(m.id))a.push({type:"item_reference",id:m.id});g.add(m.id);continue}let A=u[m.id];if(A){if(A.summary.push(...m.summary),typeof m.encrypted_content==="string")A.encrypted_content=m.encrypted_content;continue}let T={type:m.type,summary:m.summary,encrypted_content:m.encrypted_content};u[m.id]=T,a.push(T);continue}if(f.type==="tool-call"){if(_(),f.providerExecuted===!0)continue;a.push(se(f,s));continue}if(f.type==="tool-result"&&f.providerExecuted===!0){_();let m=ie(f);if(l!==!1&&m&&!R.has(m))a.push({type:"item_reference",id:m});if(m)R.add(m);continue}return yield*lr("OpenAI Responses","assistant",["text","reasoning","tool-call","tool-result"])}_();continue}for(let d of p.content){if(!Xr(d,["tool-result"]))return yield*lr("OpenAI Responses","tool",["tool-result"]);a.push({type:"function_call_output",call_id:d.id,output:yield*le(d)})}}return l===!1?a.filter((p)=>!("type"in p)||p.type!=="reasoning"||typeof p.encrypted_content==="string"):a}),ue=ee("OpenAIResponses.lowerOptions")(function*(e){let s=cc(e),i=pf(e),a=ZE(e),l=ff(e),p=WE(e),d=VE(e),u=GE(e),g=JE(e),R=pm(e);return{instructions:g||void 0,store:s,parallel_tool_calls:i,prompt_cache_key:a||void 0,include:d,reasoning:l||p?{effort:l,summary:p}:void 0,text:u?{verbosity:u}:void 0,service_tier:R}}),C=ee("OpenAIResponses.fromRequest")(function*(e){let s=e.generation,i=yield*ue(e),a=E(e.tools);return{model:e.model.id,input:yield*de(e,a),tools:e.tools.length===0?void 0:te(e),tool_choice:e.toolChoice?yield*oe(e.toolChoice,a):void 0,stream:!0,max_output_tokens:s?.maxTokens,temperature:s?.temperature,top_p:s?.topP,...i}});var U=(e,s)=>{if(s.name===void 0)return"";let i=e.names.get(h(s.name,s.namespace));if(i!==void 0)return i;return s.namespace===void 0?s.name:`${s.namespace}.${s.name}`},me=(e)=>{if(!e)return;let s=e.input_tokens_details?.cached_tokens,i=e.output_tokens_details?.reasoning_tokens,a=Ta(e.input_tokens,s);return new ln({inputTokens:e.input_tokens,outputTokens:e.output_tokens,nonCachedInputTokens:a,cacheReadInputTokens:s,reasoningTokens:i,totalTokens:ds(e.input_tokens,e.output_tokens,e.total_tokens),providerMetadata:{openai:e}})},ye=(e,s)=>{let i=e.response?.incomplete_details?.reason;if(i===void 0||i===null)return s?"tool-calls":"stop";if(i==="max_output_tokens")return"length";if(i==="content_filter")return"content-filter";return s?"tool-calls":"unknown"},I=(e)=>({openai:e}),F={web_search_call:{name:"web_search",input:(e)=>e.action??{}},web_search_preview_call:{name:"web_search_preview",input:(e)=>e.action??{}},file_search_call:{name:"file_search",input:(e)=>({queries:e.queries??[]})},code_interpreter_call:{name:"code_interpreter",input:(e)=>({code:e.code,container_id:e.container_id})},computer_use_call:{name:"computer_use",input:(e)=>e.action??{}},image_generation_call:{name:"image_generation",input:()=>({})},mcp_call:{name:"mcp",input:(e)=>({server_label:e.server_label,name:e.name,arguments:e.arguments})},local_shell_call:{name:"local_shell",input:(e)=>e.action??{}}},fe=(e)=>(e.type in F)&&typeof e.id==="string"&&e.id.length>0,D=(e)=>e.type==="reasoning"&&typeof e.id==="string"&&e.id.length>0,Se=(e)=>typeof e.error<"u"&&e.error!==null?Os.from(e.error,"error"):Os.from(e),Re=(e)=>{let s=F[e.type],i=I({itemId:e.id});return[we.toolCall({id:e.id,name:s.name,input:s.input(e),providerExecuted:!0,providerMetadata:i}),we.toolResult({id:e.id,name:s.name,result:Se(e),providerExecuted:!0,providerMetadata:i})]},y=[],j=new Set(["response.done","response.completed","response.incomplete","response.failed"]),_e=(e,s)=>{if(!s.delta)return[e,y];let i=[];return[{...e,lifecycle:Vo(e.lifecycle,i,s.item_id??"text-0",s.delta)},i]},Oe=(e,s)=>{if(!s.delta)return[e,y];let i=[],a=s.item_id??"reasoning-0",l=s.summary_index!==void 0||e.reasoningItems[a]?`${a}:${s.summary_index??0}`:a;return[{...e,lifecycle:cs(e.lifecycle,i,l,s.delta)},i]},Ae=(e,s)=>[e,y],B=(e)=>I({itemId:e.id,reasoningEncryptedContent:e.encrypted_content??null}),he=(e,s)=>{let i=s.item;if(i&&D(i)){let u=[];return[{...e,lifecycle:Ol(e.lifecycle,u,`${i.id}:0`,B(i)),reasoningItems:{...e.reasoningItems,[i.id]:{encryptedContent:i.encrypted_content,summaryParts:{0:"active"}}}},u]}if(i?.type!=="function_call"||!i.id)return[e,y];let a=I({itemId:i.id}),l=[],p=nn(e.lifecycle,l),d=U(e,i);return[{...e,lifecycle:p,hasFunctionCall:e.hasFunctionCall,tools:hu(e.tools,i.id,{id:i.call_id??i.id,name:d,input:i.arguments??"",providerMetadata:a})},[...l,we.toolInputStart({id:i.call_id??i.id,name:d,providerMetadata:a})]]},Te=(e,s)=>{if(!s.item_id||s.summary_index===void 0)return[e,y];let i=e.reasoningItems[s.item_id]??{encryptedContent:void 0,summaryParts:{}};if(s.summary_index===0){if(e.reasoningItems[s.item_id])return[e,y];let p=[];return[{...e,lifecycle:Ol(e.lifecycle,p,`${s.item_id}:0`,I({itemId:s.item_id,reasoningEncryptedContent:null})),reasoningItems:{...e.reasoningItems,[s.item_id]:{...i,summaryParts:{0:"active"}}}},p]}let a=[],l=Object.entries(i.summaryParts).filter((p)=>p[1]==="can-conclude").reduce((p,d)=>yr(p,a,`${s.item_id}:${d[0]}`,I({itemId:s.item_id})),e.lifecycle);return[{...e,lifecycle:Ol(l,a,`${s.item_id}:${s.summary_index}`,I({itemId:s.item_id,reasoningEncryptedContent:i.encryptedContent??null})),reasoningItems:{...e.reasoningItems,[s.item_id]:{...i,summaryParts:{...Object.fromEntries(Object.entries(i.summaryParts).map((p)=>p[1]==="can-conclude"?[p[0],"concluded"]:p)),[s.summary_index]:"active"}}}},a]},xe=(e,s)=>{if(!s.item_id||s.summary_index===void 0)return[e,y];let i=e.reasoningItems[s.item_id];if(!i)return[e,y];let a=[];return[{...e,lifecycle:e.store!==!1?yr(e.lifecycle,a,`${s.item_id}:${s.summary_index}`,I({itemId:s.item_id})):e.lifecycle,reasoningItems:{...e.reasoningItems,[s.item_id]:{...i,summaryParts:{...i.summaryParts,[s.summary_index]:e.store!==!1?"concluded":"can-conclude"}}}},a]},Ee=v(function*(e,s){if(!s.item_id||!s.delta)return[e,y];let i=$l(nf,e.tools,s.item_id,s.delta,"OpenAI Responses tool argument delta is missing its tool call");if(wa(i))return yield*i;let a=[],l=i.events.length?nn(e.lifecycle,a):e.lifecycle;return a.push(...i.events),[{...e,lifecycle:l,tools:i.tools},a]}),ve=v(function*(e,s){let i=s.item;if(!i)return[e,y];if(i.type==="function_call"){if(!i.id||!i.call_id||!i.name)return[e,y];let a=e.tools[i.id]?e.tools:hu(e.tools,i.id,{id:i.call_id,name:U(e,i)}),l=i.arguments===void 0?Nl(a,i.id):Wg(a,i.id,i.arguments),p=[],d=l.events??[],u=d.length?nn(e.lifecycle,p):e.lifecycle;return p.push(...d),[{...e,lifecycle:u,hasFunctionCall:d.some(we.is.toolCall)?!0:e.hasFunctionCall,tools:l.tools},p]}if(fe(i)){let a=[],l=nn(e.lifecycle,a);return a.push(...Re(i)),[{...e,lifecycle:l},a]}if(D(i)){let a=[],l=B(i),p=e.reasoningItems[i.id];if(p){let d=Object.entries(p.summaryParts).filter((R)=>R[1]==="active"||R[1]==="can-conclude").reduce((R,_)=>yr(R,a,`${i.id}:${_[0]}`,l),e.lifecycle),{[i.id]:u,...g}=e.reasoningItems;return[{...e,lifecycle:d,reasoningItems:g},a]}if(!e.lifecycle.reasoning.has(i.id)){let d=nn(e.lifecycle,a);return a.push(we.reasoningStart({id:i.id,providerMetadata:l})),a.push(we.reasoningEnd({id:i.id,providerMetadata:l})),[{...e,lifecycle:d},a]}return[{...e,lifecycle:yr(e.lifecycle,a,i.id,l)},a]}return[e,y]}),Le=(e,s)=>{let i=[],a=As(e.lifecycle,i,{reason:ye(s,e.hasFunctionCall),usage:me(s.response?.usage),providerMetadata:s.response?.id||s.response?.service_tier?I({responseId:s.response.id,serviceTier:s.response.service_tier}):void 0});return[{...e,lifecycle:a},i]},Pe=(e)=>{let s=e.error??e.response?.error;return{code:e.code?.trim()||s?.code?.trim()||s?.type?.trim()||void 0,message:e.message?.trim()||s?.message?.trim()||""}},Me=new Set(["rate_limit_exceeded","server_error","server_is_overloaded","slow_down","vector_store_timeout"]),ke=(e,s)=>{if(s.code!==void 0&&Me.has(s.code))return!0;return e.refusals?.(s)?.retryable??!1},be=(e,s)=>e.lifecycle.stepStarted?!0:s.sequence_number===0?!1:void 0,Ce=(e,s)=>{let i=Pe(s),a=Object.keys(s.error??s.response?.error??{});return Ls({module:"OpenAIResponses",refusal:i,evidence:{eventType:s.type,keys:Object.keys(s),payloadKeys:a},unrecognized:a.some((l)=>!["code","type","message","param"].includes(l)),contextOverflow:i.code==="context_length_exceeded"||qi(i.message),retryable:ke(e,i),modelStarted:be(e,s)})},V=(e,s)=>{if(s.type==="response.output_text.delta")return r(_e(e,s));if(s.type==="response.reasoning_text.delta"||s.type==="response.reasoning_summary.delta"||s.type==="response.reasoning_summary_text.delta")return r(Oe(e,s));if(s.type==="response.reasoning_text.done"||s.type==="response.reasoning_summary.done"||s.type==="response.reasoning_summary_text.done")return r(Ae(e,s));if(s.type==="response.reasoning_summary_part.added")return r(Te(e,s));if(s.type==="response.reasoning_summary_part.done")return r(xe(e,s));if(s.type==="response.output_item.added")return r(he(e,s));if(s.type==="response.function_call_arguments.delta")return Ee(e,s);if(s.type==="response.output_item.done")return ve(e,s);if(s.type==="response.done"||s.type==="response.completed"||s.type==="response.incomplete")return r(Le(e,s));if(s.type==="response.failed"||s.type==="error")return c(Ce(e,s));return r([e,y])},H=(e)=>({hasFunctionCall:!1,tools:Hi(),lifecycle:Cs(),reasoningItems:{},store:cc(e),refusals:e.model.route.refusals,names:L(e.tools)});var nf="openai-responses",Ew="https://api.openai.com/v1",vw="/responses",Rs=df,Fg=pm,q=o({type:P("input_text"),text:t}),G=o({type:P("input_image"),image_url:t}),Ue=O([q,G]),We=o({type:P("output_text"),text:t}),Fe=o({type:P("summary_text"),text:t}),Ne=o({type:P("reasoning"),id:n(t),summary:x(Fe),encrypted_content:Ie(t)}),De=o({type:P("item_reference"),id:t}),$e=O([q,G]),je=O([t,x($e)]),ww=O([o({role:P("system"),content:t}),o({role:P("user"),content:x(Ue)}),o({role:P("assistant"),content:x(We)}),Ne,De,o({type:P("function_call"),call_id:t,name:t,namespace:n(t),arguments:t}),o({type:P("function_call_output"),call_id:t,output:je})]),J=o({type:P("function"),name:t,description:t,parameters:Dr,strict:n(z)}),kw=O([J,o({type:P("namespace"),name:t,description:t,tools:x(J)})]),Be=O([W(["auto","none","required"]),o({type:P("function"),name:t})]),Y={model:t,input:x(ww),instructions:n(t),tools:jn(kw),tool_choice:n(Be),parallel_tool_calls:n(z),store:n(z),service_tier:n(BE),prompt_cache_key:n(t),include:jn(qE),reasoning:n(o({effort:n(lf),summary:n(w("auto"))})),text:n(o({verbosity:n(jE)})),max_output_tokens:n(S),temperature:n(S),top_p:n(S)},Ve=o({...Y,stream:w(!0)}),Q=ss(o({type:P("response.create"),...Y}),[ge(t,ce)]),He=ha(Kn(Q)),_w=o({input_tokens:n(S),input_tokens_details:Ie(o({cached_tokens:n(S)})),output_tokens:n(S),output_tokens_details:Ie(o({reasoning_tokens:n(S)})),total_tokens:n(S)}),Tw=o({type:t,id:n(t),call_id:n(t),name:n(t),namespace:n(t),arguments:n(t),status:n(t),action:n(ce),queries:n(ce),results:n(ce),code:n(t),container_id:n(t),outputs:n(ce),server_label:n(t),output:n(ce),error:n(ce),encrypted_content:Ie(t)}),K=ss(o({code:Ie(t),type:Ie(t),message:Ie(t),param:Ie(t)}),[ge(t,ce)]),Rw=ss(o({type:t,sequence_number:n(S),delta:n(t),item_id:n(t),summary_index:n(S),item:n(Tw),response:n(ss(o({id:n(t),service_tier:Ie(t),incomplete_details:Ie(o({reason:t})),usage:Ie(_w),error:Ie(K)}),[ge(t,ce)])),error:Ie(K),code:Ie(t),message:Ie(t),param:Ie(t)}),[ge(t,ce)]),ME=Zo({id:nf,body:{schema:Ve,from:C},stream:{event:Ns(Rw),initial:H,step:V,terminal:(e)=>j.has(e.type)},rateLimits:mf}),X=Lr.path(vw,{baseURL:Ew}),Z=Fr,Iw=kf.with(),as=To.make({id:nf,protocol:ME,endpoint:X,auth:Z,transport:Iw,defaults:{providerOptions:{openai:{store:!1}}}}),Je=Wl(pt(Q)),Ke=v(function*(e){if(!N(e))return yield*xt("OpenAI Responses WebSocket body must be a JSON object");let{stream:s,...i}=e;return yield*Je({...i,type:"response.create"})}),Cw=XE.with({toMessage:Ke,encodeMessage:He}),H_=To.make({id:`${nf}-websocket`,protocol:ME,endpoint:X,auth:Z,transport:Cw,defaults:{providerOptions:{openai:{store:!1}}}});
|
|
3
|
+
export{nf,Ew,vw,Rs,Fg,ww,kw,_w,Tw,Rw,ME,Iw,as,Cw,H_};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{we}from"./plugin-24j9hnc7.js";var Cs=()=>({stepStarted:!1,text:new Set,reasoning:new Set}),nn=(e,r)=>{if(e.stepStarted)return e;return r.push(we.stepStart({index:0})),{...e,stepStarted:!0}},Vo=(e,r,t,a)=>{let n=nn(e,r);if(n.text.has(t))return r.push(we.textDelta({id:t,text:a})),n;return r.push(we.textStart({id:t}),we.textDelta({id:t,text:a})),{...n,text:new Set([...n.text,t])}},Ol=(e,r,t,a)=>{if(e.reasoning.has(t))return e;let n=nn(e,r);return r.push(we.reasoningStart({id:t,providerMetadata:a})),{...n,reasoning:new Set([...n.reasoning,t])}},cs=(e,r,t,a,n)=>{let o=Ol(e,r,t,n);return r.push(we.reasoningDelta({id:t,text:a})),o},yr=(e,r,t,a)=>{if(!e.reasoning.has(t))return e;let n=nn(e,r);r.push(we.reasoningEnd({id:t,providerMetadata:a}));let o=new Set(n.reasoning);return o.delete(t),{...n,reasoning:o}},Pl=(e,r,t,a)=>{if(!e.text.has(t))return e;let n=nn(e,r);r.push(we.textEnd({id:t,providerMetadata:a}));let o=new Set(n.text);return o.delete(t),{...n,text:o}},s=(e,r)=>{for(let t of e.reasoning)r.push(we.reasoningEnd({id:t}));for(let t of e.text)r.push(we.textEnd({id:t}));return{...e,text:new Set,reasoning:new Set}},As=(e,r,t)=>{let a=s(nn(e,r),r);return r.push(we.stepFinish({index:0,reason:t.reason,usage:t.usage,native:t.native,providerMetadata:t.providerMetadata}),we.finish({reason:t.reason,usage:t.usage,providerMetadata:t.providerMetadata})),{...a,stepStarted:!1}};
|
|
3
|
+
export{Cs,nn,Vo,Ol,cs,yr,Pl,As};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/// <reference path="../types/node/index.d.ts" />
|
|
2
|
+
/// <reference path="../host.d.ts" />
|
|
3
|
+
import type { McpCaller } from "@runlith/tagma/internal/packages/mcp/src/mcpCallerMeta";
|
|
4
|
+
import type { AnyProvider, SpeechHost } from "@runlith/speech/protocol/adapter";
|
|
5
|
+
import type { StandardJSONSchemaV1, StandardSchemaV1 } from "@runlith/tagma/internal/../node_modules/.bun/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index";
|
|
6
|
+
import type { Adapter } from "@runlith/tagma/adapter/provider";
|
|
7
|
+
import type { ModelsClient } from "@runlith/tagma/internal/packages/tagma/src/plugin/models";
|
|
8
|
+
import type { PluginServers, ServerClient } from "@runlith/tagma/internal/packages/tagma/src/plugin/servers";
|
|
9
|
+
import type { ExternalOperations } from "@runlith/tagma/internal/packages/tagma/src/plugin/operations.generated";
|
|
10
|
+
import type { BuildVerdict, HookVerdicts, PluginEnvelope, PluginPoints, ToolFaceState } from "@runlith/tagma/plugin/points";
|
|
11
|
+
import { type ActionInput, type AskedInput, type AskedLeft, type BuildStepInput, type EndingInput, type HookInput, type HookPoint, type NotificationInput, type TickInput } from "@runlith/tagma/plugin/protocol";
|
|
12
|
+
export type InputSchema<Input = unknown, Output = Input> = StandardSchemaV1<Input, Output> & StandardJSONSchemaV1<Input, Output>;
|
|
13
|
+
export type OperationId = keyof ExternalOperations & string;
|
|
14
|
+
export type TagmaClient = {
|
|
15
|
+
readonly op: <Id extends OperationId>(id: Id, input: ExternalOperations[Id]['input']) => Promise<ExternalOperations[Id]['answer']>;
|
|
16
|
+
readonly in: (project: number) => TagmaClient;
|
|
17
|
+
};
|
|
18
|
+
export type PluginContext = {
|
|
19
|
+
readonly caller: McpCaller;
|
|
20
|
+
readonly project: number | null;
|
|
21
|
+
readonly projects: readonly number[];
|
|
22
|
+
readonly tagma: TagmaClient;
|
|
23
|
+
readonly models: ModelsClient;
|
|
24
|
+
readonly servers: PluginServers;
|
|
25
|
+
readonly data: string;
|
|
26
|
+
readonly dataOf: (project: number | null) => string;
|
|
27
|
+
readonly options: Readonly<Record<string, string | undefined>>;
|
|
28
|
+
readonly log: (...parts: readonly unknown[]) => void;
|
|
29
|
+
readonly signal: AbortSignal;
|
|
30
|
+
readonly changed: (uri: string) => void;
|
|
31
|
+
};
|
|
32
|
+
type ToolEntry = PluginPoints['tools'][number];
|
|
33
|
+
export type ToolAudience = Exclude<ToolEntry['audience'], 'tagma'>;
|
|
34
|
+
type Parsed<S> = S extends StandardSchemaV1<any, infer Output> ? Output : Readonly<Record<never, never>>;
|
|
35
|
+
export type Tool<S extends InputSchema | undefined = InputSchema | undefined, A extends ToolAudience = ToolAudience, R = unknown> = {
|
|
36
|
+
readonly description: ToolEntry['description'];
|
|
37
|
+
readonly audience: A;
|
|
38
|
+
readonly input?: S;
|
|
39
|
+
readonly title?: string;
|
|
40
|
+
readonly readOnly?: boolean;
|
|
41
|
+
readonly destructive?: boolean;
|
|
42
|
+
readonly idempotent?: boolean;
|
|
43
|
+
readonly openWorld?: boolean;
|
|
44
|
+
readonly run: (input: Parsed<S>, ctx: PluginContext) => Promise<R>;
|
|
45
|
+
};
|
|
46
|
+
type Encoded<S> = S extends StandardSchemaV1<infer Input, any> ? Input : Readonly<Record<never, never>>;
|
|
47
|
+
type ToolsOf<Plugin> = Plugin extends {
|
|
48
|
+
readonly tools: infer Tools;
|
|
49
|
+
} ? Tools : Readonly<Record<never, never>>;
|
|
50
|
+
type ViewToolNames<Plugin> = {
|
|
51
|
+
readonly [Name in keyof ToolsOf<Plugin>]: ToolsOf<Plugin>[Name] extends {
|
|
52
|
+
readonly audience: 'view';
|
|
53
|
+
} ? Name : never;
|
|
54
|
+
}[keyof ToolsOf<Plugin>];
|
|
55
|
+
type ToolIO<Handler> = Handler extends Tool<infer S, any, infer Output> ? {
|
|
56
|
+
readonly input: Encoded<S>;
|
|
57
|
+
readonly output: Output;
|
|
58
|
+
} : never;
|
|
59
|
+
export type ViewTools<Plugin> = {
|
|
60
|
+
readonly [Name in ViewToolNames<Plugin>]: ToolIO<ToolsOf<Plugin>[Name]> extends {
|
|
61
|
+
readonly input: infer Input;
|
|
62
|
+
readonly output: infer Output;
|
|
63
|
+
} ? keyof Input extends never ? (input?: Input) => Promise<Output> : (input: Input) => Promise<Output> : never;
|
|
64
|
+
};
|
|
65
|
+
type ServersOf<Plugin> = Plugin extends {
|
|
66
|
+
readonly mcpServers: infer Servers;
|
|
67
|
+
} ? Servers : Readonly<Record<never, never>>;
|
|
68
|
+
export type ViewServers<Plugin> = {
|
|
69
|
+
readonly [Name in keyof ServersOf<Plugin>]: ServerClient;
|
|
70
|
+
};
|
|
71
|
+
export type ToolFace<Plugin, Name extends keyof ToolsOf<Plugin> & string> = {
|
|
72
|
+
readonly name: Name;
|
|
73
|
+
readonly input: ToolIO<ToolsOf<Plugin>[Name]>['input'];
|
|
74
|
+
readonly output: ToolIO<ToolsOf<Plugin>[Name]>['output'] | undefined;
|
|
75
|
+
readonly state: ToolFaceState;
|
|
76
|
+
readonly threadId: string;
|
|
77
|
+
};
|
|
78
|
+
export type Resource = {
|
|
79
|
+
readonly uri: string;
|
|
80
|
+
readonly description?: string;
|
|
81
|
+
readonly mimeType?: string;
|
|
82
|
+
readonly read: (params: Readonly<Record<string, string>>, ctx: PluginContext) => Promise<unknown>;
|
|
83
|
+
};
|
|
84
|
+
export type Every = number | `${number}${'s' | 'm' | 'h' | 'd'}`;
|
|
85
|
+
export type Schedule = {
|
|
86
|
+
readonly every: Every;
|
|
87
|
+
readonly run: (tick: TickInput, ctx: PluginContext) => Promise<void>;
|
|
88
|
+
};
|
|
89
|
+
export type BuildStep = {
|
|
90
|
+
readonly title: PluginPoints['beforeBuild'][number]['title'];
|
|
91
|
+
readonly run: (step: BuildStepInput, ctx: PluginContext) => Promise<BuildVerdict>;
|
|
92
|
+
};
|
|
93
|
+
export type Action = {
|
|
94
|
+
readonly title: PluginPoints['actions'][number]['title'];
|
|
95
|
+
readonly run: (input: ActionInput, ctx: PluginContext) => Promise<string | void>;
|
|
96
|
+
};
|
|
97
|
+
type HookEntry = PluginPoints['hooks'][number];
|
|
98
|
+
export type HookEvent<At extends HookPoint = HookPoint> = Extract<HookInput, {
|
|
99
|
+
readonly at: At;
|
|
100
|
+
}>;
|
|
101
|
+
export type Hook<At extends HookPoint = HookPoint> = {
|
|
102
|
+
readonly at: At;
|
|
103
|
+
readonly match?: HookEntry['match'];
|
|
104
|
+
readonly onFailure?: HookEntry['onFailure'];
|
|
105
|
+
readonly timeoutMs?: HookEntry['timeoutMs'];
|
|
106
|
+
readonly run: (event: HookEvent<At>, ctx: PluginContext) => Promise<HookVerdicts[At] | void>;
|
|
107
|
+
};
|
|
108
|
+
type AnyHook = {
|
|
109
|
+
readonly [At in HookPoint]: Hook<At>;
|
|
110
|
+
}[HookPoint];
|
|
111
|
+
export type EndingHandler = (ending: EndingInput, ctx: PluginContext) => Promise<void>;
|
|
112
|
+
export type AskedHandler = (asked: AskedInput, ctx: PluginContext) => Promise<void | AskedLeft>;
|
|
113
|
+
export type NotificationHandler = (answer: NotificationInput, ctx: PluginContext) => Promise<void>;
|
|
114
|
+
type ViewPoint = PluginPoints['views'][number];
|
|
115
|
+
export type View = {
|
|
116
|
+
readonly entry: ViewPoint['entry'];
|
|
117
|
+
readonly live?: ViewPoint['live'];
|
|
118
|
+
};
|
|
119
|
+
export type HandledPoint = 'tools' | 'schedule' | 'beforeBuild' | 'on' | 'notify' | 'actions' | 'hooks' | 'views';
|
|
120
|
+
export type PluginData = {
|
|
121
|
+
readonly [Point in Exclude<keyof PluginPoints, HandledPoint>]?: PluginPoints[Point];
|
|
122
|
+
};
|
|
123
|
+
export type PluginDefinition = PluginData & {
|
|
124
|
+
readonly id: PluginEnvelope['id'];
|
|
125
|
+
readonly title: PluginEnvelope['title'];
|
|
126
|
+
readonly description?: PluginEnvelope['description'];
|
|
127
|
+
readonly resident?: NonNullable<PluginEnvelope['process']>['resident'];
|
|
128
|
+
readonly options?: PluginEnvelope['options'];
|
|
129
|
+
readonly mcpServers?: PluginEnvelope['mcpServers'];
|
|
130
|
+
readonly providers?: string;
|
|
131
|
+
readonly tools?: Readonly<Record<string, Tool<any>>>;
|
|
132
|
+
readonly resources?: Readonly<Record<string, Resource>>;
|
|
133
|
+
readonly views?: Readonly<Record<string, View>>;
|
|
134
|
+
readonly schedules?: Readonly<Record<string, Schedule>>;
|
|
135
|
+
readonly beforeBuild?: Readonly<Record<string, BuildStep>>;
|
|
136
|
+
readonly actions?: Readonly<Record<string, Action>>;
|
|
137
|
+
readonly hooks?: Readonly<Record<string, AnyHook>>;
|
|
138
|
+
readonly onThreadEnded?: EndingHandler;
|
|
139
|
+
readonly onThreadAsked?: AskedHandler;
|
|
140
|
+
readonly onNotification?: NotificationHandler;
|
|
141
|
+
};
|
|
142
|
+
type Unknown<Definition> = {
|
|
143
|
+
readonly [Field in Exclude<keyof Definition, keyof PluginDefinition>]: never;
|
|
144
|
+
};
|
|
145
|
+
export declare const definePlugin: <const Definition extends PluginDefinition>(definition: Definition & Unknown<Definition>) => Definition;
|
|
146
|
+
export type ProvidersDefinition = {
|
|
147
|
+
readonly models?: Adapter;
|
|
148
|
+
readonly speech?: readonly AnyProvider<SpeechHost>[];
|
|
149
|
+
};
|
|
150
|
+
export declare const defineProviders: (definition: ProvidersDefinition) => ProvidersDefinition;
|
|
151
|
+
export declare const tool: <S extends InputSchema | undefined = undefined, A extends ToolAudience = ToolAudience, R = unknown>(declared: Tool<S, A, R>) => NoInfer<Tool<S, A, R>>;
|
|
152
|
+
export declare const resource: (declared: Resource) => Resource;
|
|
153
|
+
export declare const view: (entry: string, options?: {
|
|
154
|
+
readonly live?: true;
|
|
155
|
+
}) => View;
|
|
156
|
+
export declare const schedule: (declared: Schedule) => Schedule;
|
|
157
|
+
export declare const beforeBuild: (declared: BuildStep) => BuildStep;
|
|
158
|
+
export declare const action: (declared: Action) => Action;
|
|
159
|
+
export declare const hook: <const At extends HookPoint>(declared: Hook<At>) => Hook<At>;
|
|
160
|
+
export declare const onThreadEnded: (handler: EndingHandler) => EndingHandler;
|
|
161
|
+
export declare const onThreadAsked: (handler: AskedHandler) => AskedHandler;
|
|
162
|
+
export declare const leave: () => AskedLeft;
|
|
163
|
+
export declare const onNotification: (handler: NotificationHandler) => NotificationHandler;
|
|
164
|
+
export declare class Refusal extends Error {
|
|
165
|
+
readonly reason: string;
|
|
166
|
+
constructor(reason: string);
|
|
167
|
+
}
|
|
168
|
+
export declare class TagmaRefused extends Error {
|
|
169
|
+
readonly operation: string;
|
|
170
|
+
readonly code: string;
|
|
171
|
+
readonly reason: string;
|
|
172
|
+
readonly unblock: readonly string[];
|
|
173
|
+
constructor(operation: string, code: string, reason: string, unblock: readonly string[]);
|
|
174
|
+
}
|
|
175
|
+
export {};
|
package/plugin/plugin.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{YT,XT,eR,tR,nR,rR,oR,sR,iR,aR,cR,uR,lR,vg,wg}from"./plugin-3b8x73y6.js";import"./plugin-cydz2zhy.js";export{vg as Refusal,wg as TagmaRefused,sR as action,oR as beforeBuild,YT as definePlugin,XT as defineProviders,iR as hook,uR as leave,lR as onNotification,cR as onThreadAsked,aR as onThreadEnded,tR as resource,rR as schedule,eR as tool,nR as view};
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/// <reference path="../types/node/index.d.ts" />
|
|
2
|
+
/// <reference path="../host.d.ts" />
|
|
3
|
+
export type PluginEnvelope = {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly title: string;
|
|
6
|
+
readonly version: string;
|
|
7
|
+
readonly description?: string;
|
|
8
|
+
readonly process?: {
|
|
9
|
+
readonly entry: string;
|
|
10
|
+
readonly resident?: boolean;
|
|
11
|
+
};
|
|
12
|
+
readonly providers?: {
|
|
13
|
+
readonly entry: string;
|
|
14
|
+
readonly models: boolean;
|
|
15
|
+
readonly harnesses: boolean;
|
|
16
|
+
readonly speech: boolean;
|
|
17
|
+
};
|
|
18
|
+
readonly options?: readonly ({
|
|
19
|
+
readonly key: string;
|
|
20
|
+
readonly title: string;
|
|
21
|
+
readonly description: string;
|
|
22
|
+
readonly type?: 'string' | 'number' | 'boolean' | 'directory' | 'file';
|
|
23
|
+
readonly sensitive?: boolean;
|
|
24
|
+
readonly required?: boolean;
|
|
25
|
+
readonly default?: string;
|
|
26
|
+
})[];
|
|
27
|
+
readonly mcpServers?: {
|
|
28
|
+
readonly [key: string]: {
|
|
29
|
+
readonly type: 'stdio';
|
|
30
|
+
readonly command: string;
|
|
31
|
+
readonly args?: readonly string[];
|
|
32
|
+
readonly env?: {
|
|
33
|
+
readonly [key: string]: string;
|
|
34
|
+
};
|
|
35
|
+
readonly cwd?: string;
|
|
36
|
+
} | {
|
|
37
|
+
readonly type: 'streamable-http';
|
|
38
|
+
readonly url: string;
|
|
39
|
+
readonly headers?: {
|
|
40
|
+
readonly [key: string]: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
readonly build: {
|
|
45
|
+
readonly sdk: string;
|
|
46
|
+
readonly hash: string;
|
|
47
|
+
readonly sources: readonly string[];
|
|
48
|
+
};
|
|
49
|
+
readonly contributes?: {
|
|
50
|
+
readonly [key: string]: unknown;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export type PluginPoints = {
|
|
54
|
+
readonly actions: readonly {
|
|
55
|
+
readonly id: string;
|
|
56
|
+
readonly title: string;
|
|
57
|
+
readonly tool: string;
|
|
58
|
+
}[];
|
|
59
|
+
readonly agents: readonly {
|
|
60
|
+
readonly id: string;
|
|
61
|
+
readonly path: string;
|
|
62
|
+
}[];
|
|
63
|
+
readonly beforeBuild: readonly {
|
|
64
|
+
readonly tool: string;
|
|
65
|
+
readonly title: string;
|
|
66
|
+
}[];
|
|
67
|
+
readonly commands: readonly ({
|
|
68
|
+
readonly name: string;
|
|
69
|
+
readonly description: string;
|
|
70
|
+
readonly text: string;
|
|
71
|
+
} | {
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly description: string;
|
|
74
|
+
readonly action: string;
|
|
75
|
+
})[];
|
|
76
|
+
readonly composer: readonly {
|
|
77
|
+
readonly view: string;
|
|
78
|
+
}[];
|
|
79
|
+
readonly hooks: readonly ({
|
|
80
|
+
readonly at: 'beforeTool' | 'afterTool' | 'beforeStep' | 'beforeClose' | 'threadStarted' | 'threadEnded';
|
|
81
|
+
readonly match?: string;
|
|
82
|
+
readonly tool: string;
|
|
83
|
+
readonly onFailure?: 'block';
|
|
84
|
+
readonly timeoutMs?: number;
|
|
85
|
+
})[];
|
|
86
|
+
readonly launchers: readonly {
|
|
87
|
+
readonly view: string;
|
|
88
|
+
readonly title: string;
|
|
89
|
+
}[];
|
|
90
|
+
readonly notify: {
|
|
91
|
+
readonly tool: string;
|
|
92
|
+
};
|
|
93
|
+
readonly on: {
|
|
94
|
+
readonly ended?: string;
|
|
95
|
+
readonly asked?: string;
|
|
96
|
+
};
|
|
97
|
+
readonly panes: readonly {
|
|
98
|
+
readonly view: string;
|
|
99
|
+
readonly title: string;
|
|
100
|
+
readonly icon?: string;
|
|
101
|
+
}[];
|
|
102
|
+
readonly pins: readonly {
|
|
103
|
+
readonly view: string;
|
|
104
|
+
}[];
|
|
105
|
+
readonly results: readonly {
|
|
106
|
+
readonly tool: string;
|
|
107
|
+
readonly view: string;
|
|
108
|
+
}[];
|
|
109
|
+
readonly schedule: readonly {
|
|
110
|
+
readonly name: string;
|
|
111
|
+
readonly everyMs: number;
|
|
112
|
+
readonly tool: string;
|
|
113
|
+
}[];
|
|
114
|
+
readonly shortcuts: readonly {
|
|
115
|
+
readonly keys: string;
|
|
116
|
+
readonly action: string;
|
|
117
|
+
readonly global?: boolean;
|
|
118
|
+
}[];
|
|
119
|
+
readonly surfaces: readonly {
|
|
120
|
+
readonly view: string;
|
|
121
|
+
readonly title: string;
|
|
122
|
+
readonly icon?: string;
|
|
123
|
+
}[];
|
|
124
|
+
readonly themes: {
|
|
125
|
+
readonly [key: string]: {
|
|
126
|
+
readonly title: string;
|
|
127
|
+
readonly light?: {
|
|
128
|
+
readonly surfaces?: {
|
|
129
|
+
readonly chrome?: string;
|
|
130
|
+
readonly background?: string;
|
|
131
|
+
readonly field?: string;
|
|
132
|
+
readonly raised?: string;
|
|
133
|
+
readonly popover?: string;
|
|
134
|
+
readonly sunken?: string;
|
|
135
|
+
readonly muted?: string;
|
|
136
|
+
readonly accent?: string;
|
|
137
|
+
};
|
|
138
|
+
readonly text?: {
|
|
139
|
+
readonly foreground?: string;
|
|
140
|
+
readonly muted?: string;
|
|
141
|
+
readonly primary?: string;
|
|
142
|
+
};
|
|
143
|
+
readonly signals?: {
|
|
144
|
+
readonly failure?: string;
|
|
145
|
+
readonly stale?: string;
|
|
146
|
+
readonly work?: string;
|
|
147
|
+
readonly here?: string;
|
|
148
|
+
readonly done?: string;
|
|
149
|
+
readonly waiting?: string;
|
|
150
|
+
readonly change?: string;
|
|
151
|
+
readonly neutral?: string;
|
|
152
|
+
};
|
|
153
|
+
readonly syntax?: {
|
|
154
|
+
readonly text?: string;
|
|
155
|
+
readonly declaration?: string;
|
|
156
|
+
readonly property?: string;
|
|
157
|
+
readonly punctuation?: string;
|
|
158
|
+
readonly operator?: string;
|
|
159
|
+
readonly comment?: string;
|
|
160
|
+
readonly keyword?: string;
|
|
161
|
+
readonly string?: string;
|
|
162
|
+
readonly function?: string;
|
|
163
|
+
readonly type?: string;
|
|
164
|
+
readonly constant?: string;
|
|
165
|
+
};
|
|
166
|
+
readonly marks?: {
|
|
167
|
+
readonly project?: readonly string[];
|
|
168
|
+
readonly worktree?: readonly string[];
|
|
169
|
+
};
|
|
170
|
+
readonly terminal?: {
|
|
171
|
+
readonly black?: string;
|
|
172
|
+
readonly red?: string;
|
|
173
|
+
readonly green?: string;
|
|
174
|
+
readonly yellow?: string;
|
|
175
|
+
readonly blue?: string;
|
|
176
|
+
readonly magenta?: string;
|
|
177
|
+
readonly cyan?: string;
|
|
178
|
+
readonly white?: string;
|
|
179
|
+
readonly brightBlack?: string;
|
|
180
|
+
readonly brightRed?: string;
|
|
181
|
+
readonly brightGreen?: string;
|
|
182
|
+
readonly brightYellow?: string;
|
|
183
|
+
readonly brightBlue?: string;
|
|
184
|
+
readonly brightMagenta?: string;
|
|
185
|
+
readonly brightCyan?: string;
|
|
186
|
+
readonly brightWhite?: string;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
readonly dark?: {
|
|
190
|
+
readonly surfaces?: {
|
|
191
|
+
readonly chrome?: string;
|
|
192
|
+
readonly background?: string;
|
|
193
|
+
readonly field?: string;
|
|
194
|
+
readonly raised?: string;
|
|
195
|
+
readonly popover?: string;
|
|
196
|
+
readonly sunken?: string;
|
|
197
|
+
readonly muted?: string;
|
|
198
|
+
readonly accent?: string;
|
|
199
|
+
};
|
|
200
|
+
readonly text?: {
|
|
201
|
+
readonly foreground?: string;
|
|
202
|
+
readonly muted?: string;
|
|
203
|
+
readonly primary?: string;
|
|
204
|
+
};
|
|
205
|
+
readonly signals?: {
|
|
206
|
+
readonly failure?: string;
|
|
207
|
+
readonly stale?: string;
|
|
208
|
+
readonly work?: string;
|
|
209
|
+
readonly here?: string;
|
|
210
|
+
readonly done?: string;
|
|
211
|
+
readonly waiting?: string;
|
|
212
|
+
readonly change?: string;
|
|
213
|
+
readonly neutral?: string;
|
|
214
|
+
};
|
|
215
|
+
readonly syntax?: {
|
|
216
|
+
readonly text?: string;
|
|
217
|
+
readonly declaration?: string;
|
|
218
|
+
readonly property?: string;
|
|
219
|
+
readonly punctuation?: string;
|
|
220
|
+
readonly operator?: string;
|
|
221
|
+
readonly comment?: string;
|
|
222
|
+
readonly keyword?: string;
|
|
223
|
+
readonly string?: string;
|
|
224
|
+
readonly function?: string;
|
|
225
|
+
readonly type?: string;
|
|
226
|
+
readonly constant?: string;
|
|
227
|
+
};
|
|
228
|
+
readonly marks?: {
|
|
229
|
+
readonly project?: readonly string[];
|
|
230
|
+
readonly worktree?: readonly string[];
|
|
231
|
+
};
|
|
232
|
+
readonly terminal?: {
|
|
233
|
+
readonly black?: string;
|
|
234
|
+
readonly red?: string;
|
|
235
|
+
readonly green?: string;
|
|
236
|
+
readonly yellow?: string;
|
|
237
|
+
readonly blue?: string;
|
|
238
|
+
readonly magenta?: string;
|
|
239
|
+
readonly cyan?: string;
|
|
240
|
+
readonly white?: string;
|
|
241
|
+
readonly brightBlack?: string;
|
|
242
|
+
readonly brightRed?: string;
|
|
243
|
+
readonly brightGreen?: string;
|
|
244
|
+
readonly brightYellow?: string;
|
|
245
|
+
readonly brightBlue?: string;
|
|
246
|
+
readonly brightMagenta?: string;
|
|
247
|
+
readonly brightCyan?: string;
|
|
248
|
+
readonly brightWhite?: string;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
readonly threads: {
|
|
254
|
+
readonly listed?: boolean;
|
|
255
|
+
};
|
|
256
|
+
readonly tools: readonly ({
|
|
257
|
+
readonly name: string;
|
|
258
|
+
readonly audience: 'agents' | 'own' | 'view' | 'tagma';
|
|
259
|
+
readonly description: string;
|
|
260
|
+
readonly inputSchema: {
|
|
261
|
+
readonly type: 'object';
|
|
262
|
+
readonly [key: string]: unknown;
|
|
263
|
+
};
|
|
264
|
+
readonly annotations?: {
|
|
265
|
+
readonly title?: string;
|
|
266
|
+
readonly readOnlyHint?: boolean;
|
|
267
|
+
readonly destructiveHint?: boolean;
|
|
268
|
+
readonly idempotentHint?: boolean;
|
|
269
|
+
readonly openWorldHint?: boolean;
|
|
270
|
+
};
|
|
271
|
+
})[];
|
|
272
|
+
readonly views: readonly {
|
|
273
|
+
readonly id: string;
|
|
274
|
+
readonly entry: string;
|
|
275
|
+
readonly live?: boolean;
|
|
276
|
+
readonly media?: true;
|
|
277
|
+
}[];
|
|
278
|
+
};
|
|
279
|
+
export type BuildVerdict = {
|
|
280
|
+
readonly verdict: 'go';
|
|
281
|
+
} | {
|
|
282
|
+
readonly verdict: 'pending';
|
|
283
|
+
} | {
|
|
284
|
+
readonly verdict: 'stop';
|
|
285
|
+
readonly reason: string;
|
|
286
|
+
readonly thread?: string;
|
|
287
|
+
};
|
|
288
|
+
export type HookVerdicts = {
|
|
289
|
+
readonly beforeTool: {
|
|
290
|
+
readonly deny?: string;
|
|
291
|
+
readonly rewrite?: unknown;
|
|
292
|
+
readonly context?: string;
|
|
293
|
+
};
|
|
294
|
+
readonly afterTool: {
|
|
295
|
+
readonly context?: string;
|
|
296
|
+
};
|
|
297
|
+
readonly beforeStep: {
|
|
298
|
+
readonly block?: string;
|
|
299
|
+
readonly context?: string;
|
|
300
|
+
};
|
|
301
|
+
readonly beforeClose: {
|
|
302
|
+
readonly block?: string;
|
|
303
|
+
};
|
|
304
|
+
readonly threadStarted: {
|
|
305
|
+
readonly context?: string;
|
|
306
|
+
};
|
|
307
|
+
readonly threadEnded: {};
|
|
308
|
+
};
|
|
309
|
+
export type ViewGraph = {
|
|
310
|
+
readonly files: {
|
|
311
|
+
readonly [key: string]: {
|
|
312
|
+
readonly imports: {
|
|
313
|
+
readonly [key: string]: string | 'host';
|
|
314
|
+
};
|
|
315
|
+
readonly dependency?: true;
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
readonly candidates: readonly string[];
|
|
319
|
+
};
|
|
320
|
+
export type ToolFaceState = 'running' | 'done' | 'refused' | 'failed';
|
|
321
|
+
export declare const POINT_NAMES: readonly [
|
|
322
|
+
"actions",
|
|
323
|
+
"agents",
|
|
324
|
+
"beforeBuild",
|
|
325
|
+
"commands",
|
|
326
|
+
"composer",
|
|
327
|
+
"hooks",
|
|
328
|
+
"launchers",
|
|
329
|
+
"notify",
|
|
330
|
+
"on",
|
|
331
|
+
"panes",
|
|
332
|
+
"pins",
|
|
333
|
+
"results",
|
|
334
|
+
"schedule",
|
|
335
|
+
"shortcuts",
|
|
336
|
+
"surfaces",
|
|
337
|
+
"themes",
|
|
338
|
+
"threads",
|
|
339
|
+
"tools",
|
|
340
|
+
"views"
|
|
341
|
+
];
|