@computesdk/loops 0.1.0 → 0.1.1
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/API.md +5 -2
- package/README.md +6 -1
- package/bin/loops.mjs +15 -2
- package/dist/assets/{abnfDiagram-VCTEODGH-DPUvPEpH.js → abnfDiagram-VCTEODGH-CceVg1jC.js} +1 -1
- package/dist/assets/{arc-C71M1We_.js → arc-CurbUKc7.js} +1 -1
- package/dist/assets/{architectureDiagram-5GKGNRK7-C3PLmrM3.js → architectureDiagram-5GKGNRK7-BG6bMida.js} +1 -1
- package/dist/assets/{blockDiagram-I7D4REHJ-DFshwmKE.js → blockDiagram-I7D4REHJ-B11cpZbJ.js} +1 -1
- package/dist/assets/{c4Diagram-7LVT6UL2-Dh29QjGI.js → c4Diagram-7LVT6UL2-DiXBjlUf.js} +1 -1
- package/dist/assets/channel-Cy2zP8Uh.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-qZ7USlsH.js → chunk-2Q5K7J3B-DMtau_ZO.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-YQpRymiv.js → chunk-5VM5RSS4-CkDw9Dwr.js} +1 -1
- package/dist/assets/{chunk-F27PBJKO-D2O95m9O.js → chunk-F27PBJKO-DduXbVaR.js} +1 -1
- package/dist/assets/{chunk-IMKFNOWR-CftSjfdl.js → chunk-IMKFNOWR-CA3FEpcX.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-_1wtK-EO.js → chunk-JWPE2WC7-_aPFiznH.js} +1 -1
- package/dist/assets/{chunk-POPQ4Y6H-DJ2Xmp8X.js → chunk-POPQ4Y6H-BJ1FxtOa.js} +1 -1
- package/dist/assets/{chunk-SVP7TREG-CAtSHcje.js → chunk-SVP7TREG-BISx4Qsv.js} +1 -1
- package/dist/assets/{chunk-TICWLB2K-1BASqzB5.js → chunk-TICWLB2K-jN0ScesT.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-CWs6lP_i.js → chunk-XXDRQBXY-Bp2w1xsm.js} +1 -1
- package/dist/assets/classDiagram-ZZMXUADV-BHTKitbG.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-BHTKitbG.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-9dCpEIjz.js → cose-bilkent-JH36ORCC-RJxH4pHE.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-EFt_R8HZ.js → cynefin-OW5HDTMX-RQb2d53E.js} +1 -1
- package/dist/assets/{cynefinDiagram-5FMLGOSQ-BuManjb1.js → cynefinDiagram-5FMLGOSQ-BkWuDtvv.js} +1 -1
- package/dist/assets/{dagre-GXQ25YYZ-MovLAGVL.js → dagre-GXQ25YYZ-Dw_p1MY7.js} +1 -1
- package/dist/assets/{diagram-S7CK7UJ4-BiJw5LQ6.js → diagram-S7CK7UJ4-CNvafPnD.js} +1 -1
- package/dist/assets/{diagram-UQ7AKVKN-DRsX_xa6.js → diagram-UQ7AKVKN-Ca50sGck.js} +1 -1
- package/dist/assets/{diagram-VSXAHHWV-B7m6F8Dm.js → diagram-VSXAHHWV-B9EkCAhx.js} +1 -1
- package/dist/assets/{diagram-VX7I27RA-x4wioeVA.js → diagram-VX7I27RA-Be2j3KkX.js} +1 -1
- package/dist/assets/{diagram-Z3DM3KII-0KYjyvJF.js → diagram-Z3DM3KII-Iki9IPof.js} +1 -1
- package/dist/assets/{ebnfDiagram-PWID7BFC-BZXmt3oU.js → ebnfDiagram-PWID7BFC-C_DacKX3.js} +1 -1
- package/dist/assets/{erDiagram-RLTQ6QDP-CrfcYtD6.js → erDiagram-RLTQ6QDP-CN090mdT.js} +1 -1
- package/dist/assets/{flowDiagram-HODETNUW-BqudKoEy.js → flowDiagram-HODETNUW-z9R5Hzp_.js} +1 -1
- package/dist/assets/{ganttDiagram-EL5Y4UJY-OBWjueb8.js → ganttDiagram-EL5Y4UJY-Ctsoo8fA.js} +1 -1
- package/dist/assets/{gitGraphDiagram-WWUBYQGX-B30e199R.js → gitGraphDiagram-WWUBYQGX-BAfnTLBI.js} +1 -1
- package/dist/assets/{highlighted-body-JLMTFACH-DapGkHdb.js → highlighted-body-JLMTFACH-JGCpsH-e.js} +1 -1
- package/dist/assets/{index-C_bKTXmh.js → index-DkxpcXIf.js} +123 -123
- package/dist/assets/{index-hKoeppfe.css → index-NzHlk7dF.css} +1 -1
- package/dist/assets/{infoDiagram-27XIBGKW-DPwVvB4K.js → infoDiagram-27XIBGKW-BMe5_1z8.js} +1 -1
- package/dist/assets/{ishikawaDiagram-5VMMS53U-B0fvRdQL.js → ishikawaDiagram-5VMMS53U-BRSqbbUo.js} +1 -1
- package/dist/assets/{journeyDiagram-3NMN7TZE-CZBLF7ld.js → journeyDiagram-3NMN7TZE-WkAorMt-.js} +1 -1
- package/dist/assets/{kanban-definition-UXKFOSKX-wTBJWh9T.js → kanban-definition-UXKFOSKX-aa6aiAN2.js} +1 -1
- package/dist/assets/{layout-DYBs-gVA.js → layout-BDC_N0BU.js} +1 -1
- package/dist/assets/{linear-DTE3zVP_.js → linear-CznrJ42T.js} +1 -1
- package/dist/assets/{mindmap-definition-YA3MSWOX-tV3HPpzU.js → mindmap-definition-YA3MSWOX-CW6ybBUC.js} +1 -1
- package/dist/assets/{pegDiagram-XKGWAZYB-B6Yznbb5.js → pegDiagram-XKGWAZYB-Dr3qzrfb.js} +1 -1
- package/dist/assets/{pieDiagram-E7YTZNPT-B6QW8pJH.js → pieDiagram-E7YTZNPT-BkgMYztr.js} +1 -1
- package/dist/assets/{quadrantDiagram-AXDQQJYC-DgHGTtj0.js → quadrantDiagram-AXDQQJYC-BTswMqBf.js} +1 -1
- package/dist/assets/{railroadDiagram-O6MQD6OU-CgqVFEBK.js → railroadDiagram-O6MQD6OU-DVCTkg3c.js} +1 -1
- package/dist/assets/{requirementDiagram-BXWQKSXE-FmXMY-6j.js → requirementDiagram-BXWQKSXE-DDSFlh61.js} +1 -1
- package/dist/assets/{sankeyDiagram-P5KCCOFB-AVMEYVKy.js → sankeyDiagram-P5KCCOFB-DHP89LFt.js} +1 -1
- package/dist/assets/{sequenceDiagram-WJ2MYXX4-uOObReYi.js → sequenceDiagram-WJ2MYXX4-CUcSveH3.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BPOPqqxk.js → sizeCapture-INFHLROL-fGlaZz_7.js} +1 -1
- package/dist/assets/{stateDiagram-D77RDMKH-C1lXHNdu.js → stateDiagram-D77RDMKH-DqcVPNAG.js} +1 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-_t9xbbjh.js +1 -0
- package/dist/assets/{swimlanes-42K2YHIH-C52GOi05.js → swimlanes-42K2YHIH-L-pgkzCN.js} +1 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-6eL6UTv7.js +8 -0
- package/dist/assets/{timeline-definition-24CTP7MA-T0BhAPL-.js → timeline-definition-24CTP7MA-C__pbpoz.js} +1 -1
- package/dist/assets/{vennDiagram-4TSXK5OY-DSGCn4iB.js → vennDiagram-4TSXK5OY-B4f-azPR.js} +1 -1
- package/dist/assets/{wardleyDiagram-VM6X3IG4-BaCYx_03.js → wardleyDiagram-VM6X3IG4-01ZelHA6.js} +1 -1
- package/dist/assets/{xychartDiagram-S5SC5T6Z-CgPwXvFv.js → xychartDiagram-S5SC5T6Z-CNfj8huj.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/server.mjs +265 -147
- package/package.json +1 -1
- package/dist/assets/channel-6AEG2wiQ.js +0 -1
- package/dist/assets/classDiagram-ZZMXUADV-WtwW3JUM.js +0 -1
- package/dist/assets/classDiagram-v2-VYDZK3BY-WtwW3JUM.js +0 -1
- package/dist/assets/stateDiagram-v2-MP3YSRHH-BHg8O_NZ.js +0 -1
- package/dist/assets/swimlanesDiagram-VR7AAH4N-DLB_mWZL.js +0 -8
package/API.md
CHANGED
|
@@ -8,8 +8,11 @@ everything a UI needs is HTTP, and the rendering is yours.
|
|
|
8
8
|
- **Auth**: `Authorization: Bearer <token>`. `GET /api/v1/meta` and `GET /api/health` are open. A server on loopback
|
|
9
9
|
may have no token at all; a server that listens on anything else always does.
|
|
10
10
|
- **Errors**: a failed request is `{"error": "..."}` with a 4xx/5xx. Success bodies are JSON unless noted.
|
|
11
|
-
- **CORS**:
|
|
12
|
-
|
|
11
|
+
- **CORS**: a loopback server answers only its own origins (`http://127.0.0.1:<port>`, `http://localhost:<port>`,
|
|
12
|
+
`http://[::1]:<port>`) and only under those names in `Host`; anything else is `403`, which is what keeps a stray page
|
|
13
|
+
in the browser — or a DNS rebound one — out. Off loopback any origin answers, because the token is the authorization;
|
|
14
|
+
`--allow-origin a,b` (or `*`) narrows or widens that. The token is not a cookie, so credentials are never sent
|
|
15
|
+
implicitly.
|
|
13
16
|
|
|
14
17
|
A typed client with no dependencies lives in [`client.ts`](./client.ts):
|
|
15
18
|
|
package/README.md
CHANGED
|
@@ -122,7 +122,12 @@ GET /api/chats/:id/events Accept: text/event-stream
|
|
|
122
122
|
```
|
|
123
123
|
|
|
124
124
|
SSE over `fetch` (not `EventSource`) so the token can travel in a header, and so a reconnect resumes from the cursor
|
|
125
|
-
instead of starting blind.
|
|
125
|
+
instead of starting blind.
|
|
126
|
+
|
|
127
|
+
A server on loopback answers only its own origins (`127.0.0.1`, `localhost`, `[::1]` on its port) and only under those
|
|
128
|
+
names in the `Host` header — the second half is what stops a page that points its own hostname at `127.0.0.1` and
|
|
129
|
+
becomes same-origin. A loopback server needs no token for that, because the boundary is the name. Once the port is
|
|
130
|
+
reachable off the machine the token is the authorization and any origin may attach; `--allow-origin a,b` narrows it.
|
|
126
131
|
|
|
127
132
|
## What it is made of
|
|
128
133
|
|
package/bin/loops.mjs
CHANGED
|
@@ -33,7 +33,20 @@ function positional() {
|
|
|
33
33
|
|
|
34
34
|
const CWD = path.resolve(opt("cwd", process.cwd()));
|
|
35
35
|
const STATE_DIR = path.join(CWD, ".pi", "loops");
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The engine this CLI drives. An explicit --pi wins; then a `pi` on PATH, because that is the copy the person
|
|
38
|
+
* configured; then the one npm installed with us — @earendil-works/pi-coding-agent is a peer dependency of the
|
|
39
|
+
* extension, so a bare VM that has only ever run `npx @computesdk/loops serve` still has an engine.
|
|
40
|
+
*/
|
|
41
|
+
function piPath() {
|
|
42
|
+
const explicit = opt("pi", process.env.LOOPS_PI);
|
|
43
|
+
if (explicit) return explicit;
|
|
44
|
+
const onPath = spawnSync(process.platform === "win32" ? "where" : "which", ["pi"], { stdio: "ignore" }).status === 0;
|
|
45
|
+
if (onPath) return "pi";
|
|
46
|
+
const local = path.join(PKG, "node_modules", ".bin", process.platform === "win32" ? "pi.cmd" : "pi");
|
|
47
|
+
return fs.existsSync(local) ? local : "pi";
|
|
48
|
+
}
|
|
49
|
+
const PI = piPath();
|
|
37
50
|
|
|
38
51
|
/** The extension this CLI drives: the installed package if we can find it, else the sibling checkout. */
|
|
39
52
|
function extensionPath() {
|
|
@@ -169,7 +182,7 @@ async function main() {
|
|
|
169
182
|
const entry = fs.existsSync(bundle)
|
|
170
183
|
? [bundle]
|
|
171
184
|
: ["--experimental-strip-types", path.join(PKG, "server", "index.ts")];
|
|
172
|
-
const args = [...entry, "--cwd", CWD, "--port", String(opt("port", "8001"))];
|
|
185
|
+
const args = [...entry, "--cwd", CWD, "--port", String(opt("port", "8001")), "--pi", PI];
|
|
173
186
|
if (flag("no-open")) args.push("--no-open");
|
|
174
187
|
// The extension is a runtime dependency, so it resolves on an install as well as in this workspace; without it the
|
|
175
188
|
// server's own boot check says so instead of the first prompt failing.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-SVP7TREG-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-SVP7TREG-BISx4Qsv.js";import{p as f}from"./chunk-JWPE2WC7-_aPFiznH.js";import{_ as n,l as o}from"./index-DkxpcXIf.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-RQb2d53E.js";var v=d().RailroadAbnf.parser.LangiumParser,l=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),i=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:i,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return l(e.element);case"AbnfOptionalGroup":return{type:"optional",element:l(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:l(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},w={parser:R,db:a,renderer:u,styles:p};export{w as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as ln,L as an,M as y,N as tn,O as X,P as O,Q as _,S as un,T as rn,V as $,X as o,Y as M,Z as sn,$ as on,a0 as fn}from"./index-
|
|
1
|
+
import{K as ln,L as an,M as y,N as tn,O as X,P as O,Q as _,S as un,T as rn,V as $,X as o,Y as M,Z as sn,$ as on,a0 as fn}from"./index-DkxpcXIf.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,D,S,v,A,N,a){var E=D-l,i=S-h,n=N-v,d=a-A,u=d*E-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*E,h+u*i]}function G(l,h,D,S,v,A,N){var a=l-D,E=h-S,i=(N?A:-A)/$(a*a+E*E),n=i*E,d=-i*a,u=l+n,s=h+d,f=D+n,c=S+d,Q=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,I=(g<0?-1:1)*$(fn(0,T*T*R-P*P)),K=(P*g-m*I)/R,L=(-P*m-g*I)/R,w=(P*g+m*I)/R,p=(-P*m+g*I)/R,x=K-Q,e=L-t,r=w-Q,V=p-t;return x*x+e*e>r*r+V*V&&(K=w,L=p),{cx:K,cy:L,x01:-n,y01:-d,x11:K*(v/T-1),y11:L*(v/T-1)}}function hn(){var l=cn,h=yn,D=M(0),S=null,v=gn,A=dn,N=mn,a=null,E=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=A.apply(this,arguments)-an,Q=un(c-f),t=c>f;if(a||(a=n=E()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(Q>tn-y)a.moveTo(s*X(f),s*O(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*X(c),u*O(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=Q,I=Q,K=N.apply(this,arguments)/2,L=K>y&&(S?+S.apply(this,arguments):$(u*u+s*s)),w=_(un(s-u)/2,+D.apply(this,arguments)),p=w,x=w,e,r;if(L>y){var V=sn(L/u*O(K)),j=sn(L/s*O(K));(P-=V*2)>y?(V*=t?1:-1,R+=V,T-=V):(P=0,R=T=(f+c)/2),(I-=j*2)>y?(j*=t?1:-1,m+=j,g-=j):(I=0,m=g=(f+c)/2)}var Y=s*X(m),Z=s*O(m),z=u*X(T),B=u*O(T);if(w>y){var C=s*X(g),F=s*O(g),H=u*X(R),J=u*O(R),q;if(Q<rn)if(q=pn(Y,Z,H,J,C,F,z,B)){var U=Y-q[0],W=Z-q[1],k=C-q[0],b=F-q[1],nn=1/O(on((U*k+W*b)/($(U*U+W*W)*$(k*k+b*b)))/2),en=$(q[0]*q[0]+q[1]*q[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}I>y?x>y?(e=G(H,J,Y,Z,s,x,t),r=G(C,F,z,B,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(Y,Z),a.arc(0,0,s,m,g,!t)):a.moveTo(Y,Z),!(u>y)||!(P>y)?a.lineTo(z,B):p>y?(e=G(z,B,C,F,u,-p,t),r=G(Y,Z,H,J,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-rn/2;return[X(d)*n,O(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:M(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:M(+n),i):h},i.cornerRadius=function(n){return arguments.length?(D=typeof n=="function"?n:M(+n),i):D},i.padRadius=function(n){return arguments.length?(S=n==null?null:typeof n=="function"?n:M(+n),i):S},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:M(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:M(+n),i):A},i.padAngle=function(n){return arguments.length?(N=typeof n=="function"?n:M(+n),i):N},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|