@grok/agent-sdk 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +27 -14
- package/dist/docs/404.html +2 -2
- package/dist/docs/assets/{app.BzTUBOAD.js → app.BSH__xV4.js} +4 -4
- package/dist/docs/assets/{building-with-agents.md.BqJ7AAjG.js → building-with-agents.md.Bo3ct-rf.js} +1 -1
- package/dist/docs/assets/changelog.md.b6H_ea44.js +1 -0
- package/dist/docs/assets/{changelog.md.BWhC6DET.lean.js → changelog.md.b6H_ea44.lean.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.CiRGcfZg.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.DsnRlUT5.js → VPLocalSearchBox.Cadl7A0k.js} +1 -1
- package/dist/docs/assets/chunks/{arc.DH8GOhiv.js → arc.K7t9nNY6.js} +1 -1
- package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.9m9ObyuE.js → architectureDiagram-Q4EWVU46.SlHEknkX.js} +1 -1
- package/dist/docs/assets/chunks/{baseUniq.BXHpx1lE.js → baseUniq.DJLRMLkz.js} +1 -1
- package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.xY3EX59q.js → blockDiagram-DXYQGD6D.Bs6XxFpe.js} +1 -1
- package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.DnqgMVgc.js → c4Diagram-AHTNJAMY.CyLg6Ovc.js} +1 -1
- package/dist/docs/assets/chunks/channel.CVTdqYx0.js +1 -0
- package/dist/docs/assets/chunks/{chunk-4BX2VUAB.BjFxK2A3.js → chunk-4BX2VUAB.DTQ4TinT.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-4TB4RGXK.BujS_Spt.js → chunk-4TB4RGXK.Es84IgcH.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-55IACEB6.YbTjhdaM.js → chunk-55IACEB6.Clm3cGPQ.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-EDXVE4YY.DnQ8t4GC.js → chunk-EDXVE4YY.DE4CRkS5.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-FMBD7UC4.B67AwAmj.js → chunk-FMBD7UC4.Bf8HCvqp.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-OYMX7WX6.DrZIAFOm.js → chunk-OYMX7WX6.eub-7nSx.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-QZHKN3VN.BLmmydkn.js → chunk-QZHKN3VN.WyP9VAS_.js} +1 -1
- package/dist/docs/assets/chunks/{chunk-YZCP3GAM.DaoOfw0O.js → chunk-YZCP3GAM.LO9ohhDE.js} +1 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.CsJJyx6-.js +1 -0
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.CsJJyx6-.js +1 -0
- package/dist/docs/assets/chunks/clone.Dk8KvtOB.js +1 -0
- package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.DMQuNhM5.js → cose-bilkent-S5V4N54A.D5za6aH0.js} +1 -1
- package/dist/docs/assets/chunks/{dagre-KV5264BT.CZoGVuUf.js → dagre-KV5264BT.Dq1daUru.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-5BDNPKRD.CLt9uOyL.js → diagram-5BDNPKRD.j1YL5BKS.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.DpczEm1G.js → diagram-G4DWMVQ6.Bi1aLdhC.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-MMDJMWI5.D4r13DvJ.js → diagram-MMDJMWI5.BOzMEkAr.js} +1 -1
- package/dist/docs/assets/chunks/{diagram-TYMM5635.CYU9eGFu.js → diagram-TYMM5635.Dx2FVhCr.js} +1 -1
- package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.QA9naWEw.js → erDiagram-SMLLAGMA.DI4TNkye.js} +1 -1
- package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.BbNoVZYd.js → flowDiagram-DWJPFMVM.C58Z9uPK.js} +1 -1
- package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.IHjDoG7r.js → ganttDiagram-T4ZO3ILL.DXSpW809.js} +1 -1
- package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.B21VMdf5.js → gitGraphDiagram-UUTBAWPF.B955oaFl.js} +1 -1
- package/dist/docs/assets/chunks/{graph.DgJ4L-8V.js → graph.BQXhKtxS.js} +1 -1
- package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.CQjrcthc.js → infoDiagram-42DDH7IO.Dozj_-Gm.js} +1 -1
- package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.D4tPGtVo.js → ishikawaDiagram-UXIWVN3A.D2140OzH.js} +1 -1
- package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.BD3WaNbQ.js → journeyDiagram-VCZTEJTY.DrqrMhCk.js} +1 -1
- package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.Ca0o4Tqz.js → kanban-definition-6JOO6SKY.Dv-LTrlw.js} +1 -1
- package/dist/docs/assets/chunks/{layout.DXXqX4MQ.js → layout.CGtHp49X.js} +1 -1
- package/dist/docs/assets/chunks/{linear.5c61gNw4.js → linear.CHZLYB52.js} +1 -1
- package/dist/docs/assets/chunks/{min.B1-NAjHX.js → min.D4Vt3eIy.js} +1 -1
- package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.BELznv3-.js → mindmap-definition-QFDTVHPH.BBfpYTea.js} +1 -1
- package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.qPzO1mq5.js → pieDiagram-DEJITSTG.BVYvElmY.js} +1 -1
- package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.CxIvzbjX.js → quadrantDiagram-34T5L4WZ.C6Gc2mdY.js} +1 -1
- package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.CqA0iJx8.js → requirementDiagram-MS252O5E.DWa8b4cn.js} +1 -1
- package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.XRTutBnb.js → sankeyDiagram-XADWPNL6.Bi-g4ajv.js} +1 -1
- package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.E--7bRLQ.js → sequenceDiagram-FGHM5R23.DlU3vVN9.js} +1 -1
- package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.C4vGu8zq.js → stateDiagram-FHFEXIEX.CeqJRqnU.js} +1 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.DE0BnUZh.js +1 -0
- package/dist/docs/assets/chunks/{theme.DMj_7q3B.js → theme.DGq7D4tt.js} +2 -2
- package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.C7LgNVAL.js → timeline-definition-GMOUNBTQ.Cqf2kjq9.js} +1 -1
- package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.HUwoZcy_.js → vennDiagram-DHZGUBPP.BeOpE_lM.js} +1 -1
- package/dist/docs/assets/chunks/{wardley-RL74JXVD.BxFEFYZS.js → wardley-RL74JXVD.FMQXA-6q.js} +1 -1
- package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.B2pSo5rB.js → wardleyDiagram-NUSXRM2D.BXS65dAC.js} +1 -1
- package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.NQhMiOOL.js → xychartDiagram-5P7HB3ND.haEiSxqc.js} +1 -1
- package/dist/docs/assets/{deployment.md.BtqJrHhp.js → deployment.md.DJtuDVLh.js} +3 -3
- package/dist/docs/assets/{deployment.md.BtqJrHhp.lean.js → deployment.md.DJtuDVLh.lean.js} +1 -1
- package/dist/docs/assets/{guides_agent-to-agent.md.BcmSqL2z.js → guides_agent-to-agent.md.DcB3nhOz.js} +1 -1
- package/dist/docs/assets/{guides_github.md.6jiEH7dg.js → guides_github.md.CcuZ7keS.js} +1 -1
- package/dist/docs/assets/{guides_mcp-oauth.md.C-Sx_IPa.js → guides_mcp-oauth.md.GVPMKcYl.js} +1 -1
- package/dist/docs/assets/{guides_migrate.md.BbhHYeCr.js → guides_migrate.md.B8CZxnnX.js} +1 -1
- package/dist/docs/assets/{guides_slack.md.BgIGG9ur.js → guides_slack.md.D7Rwyva4.js} +1 -1
- package/dist/docs/assets/{hillclimbing.md.3TkdF79A.js → hillclimbing.md.M51bF-oT.js} +1 -1
- package/dist/docs/assets/index.md.DnJPj_B6.js +14 -0
- package/dist/docs/assets/index.md.DnJPj_B6.lean.js +1 -0
- package/dist/docs/assets/{reference_agent-config.md.C0Tp_Fk9.js → reference_agent-config.md.BSNp2uJ7.js} +3 -3
- package/dist/docs/assets/{reference_cli.md.B8GdpaRj.js → reference_cli.md.DHm6DmYk.js} +2 -2
- package/dist/docs/assets/{reference_hooks.md.CSWmOwMM.js → reference_hooks.md.vbIM394-.js} +2 -2
- package/dist/docs/assets/{reference_hooks.md.CSWmOwMM.lean.js → reference_hooks.md.vbIM394-.lean.js} +1 -1
- package/dist/docs/assets/{reference_schedules.md.RhQ9ZLo1.js → reference_schedules.md.Dd8_d0WG.js} +3 -3
- package/dist/docs/building-with-agents.html +36 -36
- package/dist/docs/building-with-agents.md +3 -3
- package/dist/docs/changelog.html +36 -36
- package/dist/docs/changelog.md +20 -1
- package/dist/docs/deployment.html +37 -37
- package/dist/docs/deployment.md +22 -16
- package/dist/docs/evals.html +35 -35
- package/dist/docs/guides/agent-to-agent.html +37 -37
- package/dist/docs/guides/agent-to-agent.md +4 -2
- package/dist/docs/guides/bitbucket.html +35 -35
- package/dist/docs/guides/cloud-agents.html +35 -35
- package/dist/docs/guides/convert-automation.html +35 -35
- package/dist/docs/guides/github.html +37 -37
- package/dist/docs/guides/github.md +1 -1
- package/dist/docs/guides/gitlab.html +35 -35
- package/dist/docs/guides/improve.html +35 -35
- package/dist/docs/guides/jev.html +35 -35
- package/dist/docs/guides/mcp-oauth.html +37 -37
- package/dist/docs/guides/mcp-oauth.md +1 -1
- package/dist/docs/guides/migrate.html +37 -37
- package/dist/docs/guides/migrate.md +1 -1
- package/dist/docs/guides/opentelemetry.html +35 -35
- package/dist/docs/guides/pagerduty.html +35 -35
- package/dist/docs/guides/slack.html +37 -37
- package/dist/docs/guides/slack.md +1 -1
- package/dist/docs/guides/webhooks.html +35 -35
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +36 -36
- package/dist/docs/hillclimbing.md +1 -1
- package/dist/docs/index.html +42 -48
- package/dist/docs/index.md +8 -14
- package/dist/docs/llms-full.txt +70 -50
- package/dist/docs/quickstart.html +35 -35
- package/dist/docs/reference/access.html +35 -35
- package/dist/docs/reference/agent-config.html +39 -39
- package/dist/docs/reference/agent-config.md +5 -6
- package/dist/docs/reference/artifacts.html +35 -35
- package/dist/docs/reference/channels.html +35 -35
- package/dist/docs/reference/cli.html +38 -38
- package/dist/docs/reference/cli.md +2 -2
- package/dist/docs/reference/connections.html +35 -35
- package/dist/docs/reference/evals.html +35 -35
- package/dist/docs/reference/extensions.html +35 -35
- package/dist/docs/reference/hooks.html +37 -37
- package/dist/docs/reference/hooks.md +1 -1
- package/dist/docs/reference/http-api.html +35 -35
- package/dist/docs/reference/instructions.html +35 -35
- package/dist/docs/reference/limits.html +35 -35
- package/dist/docs/reference/memory.html +35 -35
- package/dist/docs/reference/playground.html +35 -35
- package/dist/docs/reference/project-layout.html +35 -35
- package/dist/docs/reference/schedules.html +38 -38
- package/dist/docs/reference/sessions.html +35 -35
- package/dist/docs/reference/skills.html +35 -35
- package/dist/docs/reference/subagents.html +35 -35
- package/dist/docs/reference/tools.html +35 -35
- package/dist/docs/templates/agentic-owners.html +35 -35
- package/dist/docs/templates/reviews.html +35 -35
- package/dist/docs/troubleshooting.html +35 -35
- package/dist/filesystem.d.ts +7 -320
- package/dist/filesystem.d.ts.map +1 -1
- package/dist/filesystem.js +10 -691
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/authored-alias-hooks.d.ts +6 -0
- package/dist/internal/authored-alias-hooks.d.ts.map +1 -1
- package/dist/internal/authored-alias-hooks.js +12 -0
- package/dist/internal/authored-loaders.js +10 -1
- package/dist/internal/cli/commands/scaffold.js +1 -1
- package/dist/internal/continuation-session-ids.d.ts +15 -0
- package/dist/internal/continuation-session-ids.d.ts.map +1 -0
- package/dist/internal/continuation-session-ids.js +43 -0
- package/dist/internal/filesystem/walk.d.ts +1 -5
- package/dist/internal/filesystem/walk.d.ts.map +1 -1
- package/dist/internal/filesystem/walk.js +1 -9
- package/dist/internal/hosted-catch-protocol.d.ts +3 -3
- package/dist/internal/hosted-catch-protocol.js +3 -3
- package/dist/internal/hosted-fetch.d.ts +7 -0
- package/dist/internal/hosted-fetch.d.ts.map +1 -0
- package/dist/internal/hosted-fetch.js +26 -0
- package/dist/internal/install-cursor-skills.d.ts +5 -6
- package/dist/internal/install-cursor-skills.d.ts.map +1 -1
- package/dist/internal/install-cursor-skills.js +19 -4
- package/dist/internal/mcp-endpoint.js +4 -4
- package/dist/internal/model-config.d.ts.map +1 -1
- package/dist/internal/model-config.js +11 -4
- package/dist/internal/platform-timers.d.ts +3 -7
- package/dist/internal/platform-timers.d.ts.map +1 -1
- package/dist/internal/platform-timers.js +10 -51
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +6 -1
- package/dist/internal/session-engine.d.ts +3 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +12 -3
- package/dist/playground/assets/index-Bno25Cg0.css +1 -0
- package/dist/playground/assets/index-SGKsaznh.js +62 -0
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/docs/README.md +8 -14
- package/docs/building-with-agents.md +3 -3
- package/docs/changelog.md +20 -1
- package/docs/deployment.md +22 -16
- package/docs/guides/agent-to-agent.md +4 -2
- package/docs/guides/github.md +1 -1
- package/docs/guides/mcp-oauth.md +1 -1
- package/docs/guides/migrate.md +1 -1
- package/docs/guides/slack.md +1 -1
- package/docs/hillclimbing.md +1 -1
- package/docs/reference/agent-config.md +5 -6
- package/docs/reference/cli.md +2 -2
- package/docs/reference/hooks.md +1 -1
- package/package.json +3 -3
- package/skills/cli/SKILL.md +1 -1
- package/skills/create-agent/SKILL.md +61 -7
- package/skills/debug/SKILL.md +1 -1
- package/skills/deploy/SKILL.md +3 -3
- package/skills/evals/SKILL.md +1 -1
- package/skills/framework-map/SKILL.md +2 -2
- package/skills/github/SKILL.md +1 -1
- package/skills/hillclimb/SKILL.md +1 -1
- package/skills/mcp-auth/SKILL.md +1 -1
- package/skills/migrate-v2/SKILL.md +2 -2
- package/skills/otel/SKILL.md +1 -1
- package/skills/setup-slack/SKILL.md +2 -2
- package/dist/docs/assets/changelog.md.BWhC6DET.js +0 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.CWxwVoCG.js +0 -1
- package/dist/docs/assets/chunks/channel.Cctv0f7X.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.DU5sqchW.js +0 -1
- package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.DU5sqchW.js +0 -1
- package/dist/docs/assets/chunks/clone.B9rdNt6j.js +0 -1
- package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.ECMu2BdJ.js +0 -1
- package/dist/docs/assets/index.md.DRfaoRCZ.js +0 -20
- package/dist/docs/assets/index.md.DRfaoRCZ.lean.js +0 -1
- package/dist/internal/filesystem/errors.d.ts +0 -64
- package/dist/internal/filesystem/errors.d.ts.map +0 -1
- package/dist/internal/filesystem/errors.js +0 -180
- package/dist/internal/filesystem/merge.d.ts +0 -34
- package/dist/internal/filesystem/merge.d.ts.map +0 -1
- package/dist/internal/filesystem/merge.js +0 -154
- package/dist/playground/assets/index-D6mVn9og.js +0 -62
- package/dist/playground/assets/index-DlALM6gr.css +0 -1
- /package/dist/docs/assets/{building-with-agents.md.BqJ7AAjG.lean.js → building-with-agents.md.Bo3ct-rf.lean.js} +0 -0
- /package/dist/docs/assets/{guides_agent-to-agent.md.BcmSqL2z.lean.js → guides_agent-to-agent.md.DcB3nhOz.lean.js} +0 -0
- /package/dist/docs/assets/{guides_github.md.6jiEH7dg.lean.js → guides_github.md.CcuZ7keS.lean.js} +0 -0
- /package/dist/docs/assets/{guides_mcp-oauth.md.C-Sx_IPa.lean.js → guides_mcp-oauth.md.GVPMKcYl.lean.js} +0 -0
- /package/dist/docs/assets/{guides_migrate.md.BbhHYeCr.lean.js → guides_migrate.md.B8CZxnnX.lean.js} +0 -0
- /package/dist/docs/assets/{guides_slack.md.BgIGG9ur.lean.js → guides_slack.md.D7Rwyva4.lean.js} +0 -0
- /package/dist/docs/assets/{hillclimbing.md.3TkdF79A.lean.js → hillclimbing.md.M51bF-oT.lean.js} +0 -0
- /package/dist/docs/assets/{reference_agent-config.md.C0Tp_Fk9.lean.js → reference_agent-config.md.BSNp2uJ7.lean.js} +0 -0
- /package/dist/docs/assets/{reference_cli.md.B8GdpaRj.lean.js → reference_cli.md.DHm6DmYk.lean.js} +0 -0
- /package/dist/docs/assets/{reference_schedules.md.RhQ9ZLo1.lean.js → reference_schedules.md.Dd8_d0WG.lean.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,D as n}from"../app.BzTUBOAD.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-4TB4RGXK.BujS_Spt.js";import{_ as i}from"../app.BzTUBOAD.js";import"./chunk-FMBD7UC4.B67AwAmj.js";import"./chunk-YZCP3GAM.DaoOfw0O.js";import"./chunk-55IACEB6.YbTjhdaM.js";import"./chunk-EDXVE4YY.DnQ8t4GC.js";import"./framework.BNw1pucY.js";import"./theme.DMj_7q3B.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-4TB4RGXK.BujS_Spt.js";import{_ as i}from"../app.BzTUBOAD.js";import"./chunk-FMBD7UC4.B67AwAmj.js";import"./chunk-YZCP3GAM.DaoOfw0O.js";import"./chunk-55IACEB6.YbTjhdaM.js";import"./chunk-EDXVE4YY.DnQ8t4GC.js";import"./framework.BNw1pucY.js";import"./theme.DMj_7q3B.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as r}from"./graph.DgJ4L-8V.js";var e=4;function a(o){return r(o,e)}export{a as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as r,b as e,a,S as s}from"./chunk-OYMX7WX6.DrZIAFOm.js";import{_ as i}from"../app.BzTUBOAD.js";import"./chunk-55IACEB6.YbTjhdaM.js";import"./chunk-EDXVE4YY.DnQ8t4GC.js";import"./framework.BNw1pucY.js";import"./theme.DMj_7q3B.js";var u={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{u as diagram};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{_ as t,c as a,o as s,a3 as n}from"./chunks/framework.BNw1pucY.js";const i="/docs/architecture.svg",u=JSON.parse('{"title":"Agent SDK","description":"Build, test, and deploy bots and agents as code with the Agent SDK.","frontmatter":{"title":"Agent SDK","description":"Build, test, and deploy bots and agents as code with the Agent SDK."},"headers":[],"relativePath":"index.md","filePath":"README.md"}'),o={name:"index.md"};function r(d,e,l,p,h,c){return s(),a("div",null,[...e[0]||(e[0]=[n(`<h1 id="agent-sdk" tabindex="-1">Agent SDK <a class="header-anchor" href="#agent-sdk" aria-label="Permalink to "Agent SDK""></a></h1><p>Agent SDK lets you define, test, evaluate, and deploy agents as code. It uses the Cursor SDK harness that powers Bugbot, Security Review, Approval Bot, and Rollouts.</p><p>An Agent's behavior is defined in a folder of Markdown and TypeScript that combines deterministic code with model judgment. Agent SDK makes it easy to build useful agents, with APIs to interact on Slack, pull requests, issue trackers, Cursor, and the other places where you get work done.</p><p>After you deploy an agent, open <a href="https://cursor.com/dashboard/deployed-agents" target="_blank" rel="noreferrer">Deployed Agents</a> to manage it.</p><h2 id="get-started-with-your-coding-agent" tabindex="-1">Get Started with your Coding Agent <a class="header-anchor" href="#get-started-with-your-coding-agent" aria-label="Permalink to "Get Started with your Coding Agent""></a></h2><p>Paste this prompt into your coding agent. It installs the CLI, asks what your agent is for, and scaffolds a first project from the Markdown version of these docs.</p><div class="language-text vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">text</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>Set up my first Agent SDK project.</span></span>
|
|
2
|
-
<span class="line"><span></span></span>
|
|
3
|
-
<span class="line"><span>Read https://cursor.com/docs/agent-sdk.md first. Every page under</span></span>
|
|
4
|
-
<span class="line"><span>https://cursor.com/docs/agent-sdk/ is also available as Markdown when you</span></span>
|
|
5
|
-
<span class="line"><span>add .md to its URL.</span></span>
|
|
6
|
-
<span class="line"><span></span></span>
|
|
7
|
-
<span class="line"><span>1. Check that Node is 22.13 or newer, then run:</span></span>
|
|
8
|
-
<span class="line"><span> npm install --global @grok/agent-sdk</span></span>
|
|
9
|
-
<span class="line"><span>2. Read the docs index that ships with the package:</span></span>
|
|
10
|
-
<span class="line"><span> "$(npm root -g)/@grok/agent-sdk/dist/docs/llms.txt"</span></span>
|
|
11
|
-
<span class="line"><span>3. Run agent-sdk login, and wait while I finish the browser sign-in.</span></span>
|
|
12
|
-
<span class="line"><span>4. Ask me what the agent should do and where people will reach it. Then</span></span>
|
|
13
|
-
<span class="line"><span> follow the bdk-create-agent skill at</span></span>
|
|
14
|
-
<span class="line"><span> "$(npm root -g)/@grok/agent-sdk/skills/create-agent/SKILL.md"</span></span>
|
|
15
|
-
<span class="line"><span> to scaffold the project with agent-sdk init.</span></span>
|
|
16
|
-
<span class="line"><span>5. Run agent-sdk validate --dir . and one agent-sdk run turn, then show me</span></span>
|
|
17
|
-
<span class="line"><span> the reply.</span></span></code></pre></div><h2 id="why-agent-sdk" tabindex="-1">Why Agent SDK <a class="header-anchor" href="#why-agent-sdk" aria-label="Permalink to "Why Agent SDK""></a></h2><p>Your instructions, tools, and evals are files you review, test, and version like the rest of your code. You write the instructions and tools, and Cursor runs the model loop that calls them.</p><h2 id="when-to-use-agent-sdk" tabindex="-1">When to use Agent SDK <a class="header-anchor" href="#when-to-use-agent-sdk" aria-label="Permalink to "When to use Agent SDK""></a></h2><table tabindex="0"><thead><tr><th></th><th>Cursor Automations</th><th>Grok Bot</th><th>Agent SDK</th></tr></thead><tbody><tr><td><strong>You define</strong></td><td>A prompt, model, and trigger in the dashboard</td><td>Instructions, skills, and connected tools in the app</td><td>A versioned Markdown and TypeScript project</td></tr><tr><td><strong>Where it runs</strong></td><td>Cursor-managed</td><td>Cursor-managed</td><td>Cursor-managed hosting or your infrastructure</td></tr><tr><td><strong>Choose it when</strong></td><td>The job fits a schedule or event trigger</td><td>You want to configure and talk to an agent without writing code</td><td>You want code around model judgment that your team can version control, review, test and hillclimb</td></tr></tbody></table><h2 id="get-started" tabindex="-1">Get started <a class="header-anchor" href="#get-started" aria-label="Permalink to "Get started""></a></h2><p>Install <code>@grok/agent-sdk</code>, then scaffold and run a project. The package was <code>@cursor/bdk</code> before.</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">npm</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --global</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> @grok/agent-sdk</span></span>
|
|
18
|
-
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> init</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> ./my-bot</span></span>
|
|
19
|
-
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">cd</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> my-bot</span></span>
|
|
20
|
-
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">agent-sdk</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> dev</span></span></code></pre></div><p><a href="./reference/project-layout.html">Project layout</a> explains every folder under <code>bot/</code>.</p><h2 id="next-steps" tabindex="-1">Next steps <a class="header-anchor" href="#next-steps" aria-label="Permalink to "Next steps""></a></h2><ul><li><a href="./quickstart.html">Build your first PR reviewer agent</a> step by step.</li><li>Start from a <a href="./templates/reviews.html">review or triage template</a> or the <a href="./templates/agentic-owners.html">owners-policy approver</a>.</li><li><a href="./guides/convert-automation.html">Convert a Cursor Automation</a> into an Agent SDK project.</li><li><a href="./building-with-agents.html">Build agents with agents</a> using a coding agent.</li><li>Look up commands in the <a href="./reference/cli.html">CLI reference</a> and deployed-agent roles in <a href="./reference/access.html">Access</a>.</li></ul><h2 id="architecture" tabindex="-1">Architecture <a class="header-anchor" href="#architecture" aria-label="Permalink to "Architecture""></a></h2><p><img src="`+i+'" alt="Agent SDK architecture"></p>',19)])])}const k=t(o,[["render",r]]);export{u as __pageData,k as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as t,c as a,o as s,a3 as n}from"./chunks/framework.BNw1pucY.js";const i="/docs/architecture.svg",u=JSON.parse('{"title":"Agent SDK","description":"Build, test, and deploy bots and agents as code with the Agent SDK.","frontmatter":{"title":"Agent SDK","description":"Build, test, and deploy bots and agents as code with the Agent SDK."},"headers":[],"relativePath":"index.md","filePath":"README.md"}'),o={name:"index.md"};function r(d,e,l,p,h,c){return s(),a("div",null,[...e[0]||(e[0]=[n("",19)])])}const k=t(o,[["render",r]]);export{u as __pageData,k as default};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed FileSystem throws. Every method error is a {@link PathError}
|
|
3
|
-
* so composers (`unionFs`) can rewrite `path` without scraping
|
|
4
|
-
* `error.message`.
|
|
5
|
-
*
|
|
6
|
-
* Messages stay the FileSystem contract strings. `path` is the
|
|
7
|
-
* absolute posix path the error is about (child-root on a mount,
|
|
8
|
-
* namespace path after `unionFs` remaps it).
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Base of every FileSystem method throw. Config / factory errors
|
|
12
|
-
* (`FileSystemConfigError`, empty `overlayFs`) are not PathErrors.
|
|
13
|
-
*/
|
|
14
|
-
export declare class PathError extends Error {
|
|
15
|
-
readonly path: string;
|
|
16
|
-
constructor(path: string, message: string);
|
|
17
|
-
/**
|
|
18
|
-
* Same error at a rewritten path. `unionFs` prepends the mount
|
|
19
|
-
* prefix this way. Subclass identity and extra fields stay.
|
|
20
|
-
*/
|
|
21
|
-
withPath(path: string): this;
|
|
22
|
-
protected recreate(path: string, message: string): this;
|
|
23
|
-
}
|
|
24
|
-
export declare class FileNotFoundError extends PathError {
|
|
25
|
-
constructor(path: string, message?: string);
|
|
26
|
-
protected recreate(path: string, message: string): this;
|
|
27
|
-
}
|
|
28
|
-
export declare class ReadOnlyMountError extends PathError {
|
|
29
|
-
constructor(path: string, message?: string);
|
|
30
|
-
protected recreate(path: string, message: string): this;
|
|
31
|
-
}
|
|
32
|
-
export declare class NoMountError extends PathError {
|
|
33
|
-
constructor(path: string, message?: string);
|
|
34
|
-
protected recreate(path: string, message: string): this;
|
|
35
|
-
}
|
|
36
|
-
export declare class WriteFailedError extends PathError {
|
|
37
|
-
constructor(path: string, message?: string);
|
|
38
|
-
protected recreate(path: string, message: string): this;
|
|
39
|
-
}
|
|
40
|
-
export declare class DeleteNotSupportedError extends PathError {
|
|
41
|
-
constructor(path: string, message?: string);
|
|
42
|
-
protected recreate(path: string, message: string): this;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Exact-edit contract failures (`oldText is empty`, uniqueness).
|
|
46
|
-
* `message` is the contract string; it does not embed `path`.
|
|
47
|
-
*/
|
|
48
|
-
export declare class EditError extends PathError {
|
|
49
|
-
protected recreate(path: string, message: string): this;
|
|
50
|
-
}
|
|
51
|
-
export declare class InvalidGrepPatternError extends PathError {
|
|
52
|
-
readonly pattern: string;
|
|
53
|
-
constructor(pattern: string, path?: string, message?: string);
|
|
54
|
-
protected recreate(path: string, message: string): this;
|
|
55
|
-
}
|
|
56
|
-
export declare function isFileNotFoundError(error: unknown): boolean;
|
|
57
|
-
export declare function isInvalidGrepPatternError(error: unknown): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Remap a child throw onto a mount prefix. Typed {@link PathError}
|
|
60
|
-
* keeps its class and rewrites `path`. Untyped `Error` still gets
|
|
61
|
-
* a best-effort message rewrite so older custom trees keep working.
|
|
62
|
-
*/
|
|
63
|
-
export declare function remapPathError(error: unknown, prefix: string): Error;
|
|
64
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/internal/filesystem/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA8BH;;;GAGG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAIxC;IAED;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAM3B;IAED,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAGtD;CACF;AAED,qBAAa,iBAAkB,SAAQ,SAAS;IAC9C,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAEzC;IAED,UAAmB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAG/D;CACF;AAED,qBAAa,kBAAmB,SAAQ,SAAS;IAC/C,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAEzC;IAED,UAAmB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAG/D;CACF;AAED,qBAAa,YAAa,SAAQ,SAAS;IACzC,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAEzC;IAED,UAAmB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAG/D;CACF;AAED,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAEzC;IAED,UAAmB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAG/D;CACF;AAED,qBAAa,uBAAwB,SAAQ,SAAS;IACpD,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAEzC;IAED,UAAmB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAG/D;CACF;AAED;;;GAGG;AACH,qBAAa,SAAU,SAAQ,SAAS;IACtC,UAAmB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAG/D;CACF;AAED,qBAAa,uBAAwB,SAAQ,SAAS;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,YAAY,OAAO,EAAE,MAAM,EAAE,IAAI,SAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAGxD;IAED,UAAmB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAG/D;CACF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAK3D;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKjE;AAWD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAQpE"}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed FileSystem throws. Every method error is a {@link PathError}
|
|
3
|
-
* so composers (`unionFs`) can rewrite `path` without scraping
|
|
4
|
-
* `error.message`.
|
|
5
|
-
*
|
|
6
|
-
* Messages stay the FileSystem contract strings. `path` is the
|
|
7
|
-
* absolute posix path the error is about (child-root on a mount,
|
|
8
|
-
* namespace path after `unionFs` remaps it).
|
|
9
|
-
*/
|
|
10
|
-
import path from "node:path";
|
|
11
|
-
function normalizeErrorPath(input) {
|
|
12
|
-
const slashes = input.replace(/\\/g, "/");
|
|
13
|
-
if (slashes === "") {
|
|
14
|
-
return "/";
|
|
15
|
-
}
|
|
16
|
-
const withSlash = slashes.startsWith("/") ? slashes : `/${slashes}`;
|
|
17
|
-
const resolved = path.posix.normalize(withSlash);
|
|
18
|
-
if (resolved.length > 1 && resolved.endsWith("/")) {
|
|
19
|
-
return resolved.slice(0, -1);
|
|
20
|
-
}
|
|
21
|
-
return resolved === "." || resolved === "" ? "/" : resolved;
|
|
22
|
-
}
|
|
23
|
-
const ROOT_MESSAGE_PREFIX = /^(not found|read-only mount|write failed|edit failed|no mount for path|delete is not supported): \/$/;
|
|
24
|
-
function rewritePathInMessage(message, from, to) {
|
|
25
|
-
if (from === to) {
|
|
26
|
-
return message;
|
|
27
|
-
}
|
|
28
|
-
if (from === "/") {
|
|
29
|
-
return ROOT_MESSAGE_PREFIX.test(message) ? message.replace(/\/$/, to) : message;
|
|
30
|
-
}
|
|
31
|
-
return message.includes(from) ? message.split(from).join(to) : message;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Base of every FileSystem method throw. Config / factory errors
|
|
35
|
-
* (`FileSystemConfigError`, empty `overlayFs`) are not PathErrors.
|
|
36
|
-
*/
|
|
37
|
-
export class PathError extends Error {
|
|
38
|
-
constructor(path, message) {
|
|
39
|
-
super(message);
|
|
40
|
-
this.name = new.target.name;
|
|
41
|
-
this.path = normalizeErrorPath(path);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Same error at a rewritten path. `unionFs` prepends the mount
|
|
45
|
-
* prefix this way. Subclass identity and extra fields stay.
|
|
46
|
-
*/
|
|
47
|
-
withPath(path) {
|
|
48
|
-
const next = normalizeErrorPath(path);
|
|
49
|
-
if (next === this.path) {
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
return this.recreate(next, rewritePathInMessage(this.message, this.path, next));
|
|
53
|
-
}
|
|
54
|
-
recreate(path, message) {
|
|
55
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- recreate constructs this subclass; TypeScript cannot type the constructor as this
|
|
56
|
-
return new PathError(path, message);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export class FileNotFoundError extends PathError {
|
|
60
|
-
constructor(path, message) {
|
|
61
|
-
super(path, message ?? `not found: ${normalizeErrorPath(path)}`);
|
|
62
|
-
}
|
|
63
|
-
recreate(path, message) {
|
|
64
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- recreate constructs this subclass; TypeScript cannot type the constructor as this
|
|
65
|
-
return new FileNotFoundError(path, message);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
export class ReadOnlyMountError extends PathError {
|
|
69
|
-
constructor(path, message) {
|
|
70
|
-
super(path, message ?? `read-only mount: ${normalizeErrorPath(path)}`);
|
|
71
|
-
}
|
|
72
|
-
recreate(path, message) {
|
|
73
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- recreate constructs this subclass; TypeScript cannot type the constructor as this
|
|
74
|
-
return new ReadOnlyMountError(path, message);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
export class NoMountError extends PathError {
|
|
78
|
-
constructor(path, message) {
|
|
79
|
-
super(path, message ?? `no mount for path: ${normalizeErrorPath(path)}`);
|
|
80
|
-
}
|
|
81
|
-
recreate(path, message) {
|
|
82
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- recreate constructs this subclass; TypeScript cannot type the constructor as this
|
|
83
|
-
return new NoMountError(path, message);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export class WriteFailedError extends PathError {
|
|
87
|
-
constructor(path, message) {
|
|
88
|
-
super(path, message ?? `write failed: ${normalizeErrorPath(path)}`);
|
|
89
|
-
}
|
|
90
|
-
recreate(path, message) {
|
|
91
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- recreate constructs this subclass; TypeScript cannot type the constructor as this
|
|
92
|
-
return new WriteFailedError(path, message);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
export class DeleteNotSupportedError extends PathError {
|
|
96
|
-
constructor(path, message) {
|
|
97
|
-
super(path, message ?? `delete is not supported: ${normalizeErrorPath(path)}`);
|
|
98
|
-
}
|
|
99
|
-
recreate(path, message) {
|
|
100
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- recreate constructs this subclass; TypeScript cannot type the constructor as this
|
|
101
|
-
return new DeleteNotSupportedError(path, message);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Exact-edit contract failures (`oldText is empty`, uniqueness).
|
|
106
|
-
* `message` is the contract string; it does not embed `path`.
|
|
107
|
-
*/
|
|
108
|
-
export class EditError extends PathError {
|
|
109
|
-
recreate(path, message) {
|
|
110
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- recreate constructs this subclass; TypeScript cannot type the constructor as this
|
|
111
|
-
return new EditError(path, message);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
export class InvalidGrepPatternError extends PathError {
|
|
115
|
-
constructor(pattern, path = "/", message) {
|
|
116
|
-
super(path, message ?? `invalid grep pattern: ${pattern}`);
|
|
117
|
-
this.pattern = pattern;
|
|
118
|
-
}
|
|
119
|
-
recreate(path, message) {
|
|
120
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- recreate constructs this subclass; TypeScript cannot type the constructor as this
|
|
121
|
-
return new InvalidGrepPatternError(this.pattern, path, message);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
export function isFileNotFoundError(error) {
|
|
125
|
-
return (error instanceof FileNotFoundError ||
|
|
126
|
-
(error instanceof Error && error.message.startsWith("not found:")));
|
|
127
|
-
}
|
|
128
|
-
export function isInvalidGrepPatternError(error) {
|
|
129
|
-
return (error instanceof InvalidGrepPatternError ||
|
|
130
|
-
(error instanceof Error && error.message.startsWith("invalid grep pattern:")));
|
|
131
|
-
}
|
|
132
|
-
const CONTRACT_PATH_LABELS = [
|
|
133
|
-
"not found: ",
|
|
134
|
-
"read-only mount: ",
|
|
135
|
-
"write failed: ",
|
|
136
|
-
"edit failed: ",
|
|
137
|
-
"no mount for path: ",
|
|
138
|
-
"delete is not supported: ",
|
|
139
|
-
];
|
|
140
|
-
/**
|
|
141
|
-
* Remap a child throw onto a mount prefix. Typed {@link PathError}
|
|
142
|
-
* keeps its class and rewrites `path`. Untyped `Error` still gets
|
|
143
|
-
* a best-effort message rewrite so older custom trees keep working.
|
|
144
|
-
*/
|
|
145
|
-
export function remapPathError(error, prefix) {
|
|
146
|
-
if (error instanceof PathError) {
|
|
147
|
-
return error.withPath(joinMountPath(error.path, prefix));
|
|
148
|
-
}
|
|
149
|
-
if (!(error instanceof Error)) {
|
|
150
|
-
return new PathError(prefix, String(error));
|
|
151
|
-
}
|
|
152
|
-
return rewriteUntypedMountError(error, prefix);
|
|
153
|
-
}
|
|
154
|
-
function joinMountPath(childPath, prefix) {
|
|
155
|
-
const mount = normalizeErrorPath(prefix);
|
|
156
|
-
const child = normalizeErrorPath(childPath);
|
|
157
|
-
if (mount === "/") {
|
|
158
|
-
return child;
|
|
159
|
-
}
|
|
160
|
-
if (child === "/") {
|
|
161
|
-
return mount;
|
|
162
|
-
}
|
|
163
|
-
return `${mount}${child}`;
|
|
164
|
-
}
|
|
165
|
-
function rewriteUntypedMountError(error, prefix) {
|
|
166
|
-
for (const label of CONTRACT_PATH_LABELS) {
|
|
167
|
-
if (!error.message.startsWith(label)) {
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
const childPath = error.message.slice(label.length);
|
|
171
|
-
const next = `${label}${joinMountPath(childPath, prefix)}`;
|
|
172
|
-
if (next === error.message) {
|
|
173
|
-
return error;
|
|
174
|
-
}
|
|
175
|
-
const rewritten = new Error(next);
|
|
176
|
-
rewritten.name = error.name;
|
|
177
|
-
return rewritten;
|
|
178
|
-
}
|
|
179
|
-
return error;
|
|
180
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* K-way merge of already-sorted streams. Each source must be ordered
|
|
3
|
-
* under the same `compare`; the merge does not re-sort a source.
|
|
4
|
-
*
|
|
5
|
-
* A binary heap of heads keeps the next yield O(log k) in the number of
|
|
6
|
-
* sources. `unique` skips later copies of a key so an earlier source can
|
|
7
|
-
* shadow a later one (the union rule).
|
|
8
|
-
*/
|
|
9
|
-
export interface MergeSortedOptions<T> {
|
|
10
|
-
compare: (left: T, right: T) => number;
|
|
11
|
-
unique?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Merge already-sorted iterables / async iterables under `compare`.
|
|
15
|
-
* Equal keys (`compare === 0`) keep source order: earlier `sources`
|
|
16
|
-
* index wins. With `unique`, those later copies are skipped.
|
|
17
|
-
*/
|
|
18
|
-
export declare function mergeSorted<T>(sources: Array<Iterable<T> | AsyncIterable<T>>, options: MergeSortedOptions<T>): AsyncGenerator<T>;
|
|
19
|
-
/**
|
|
20
|
-
* Binary min-heap. `compare(a, b) < 0` means `a` is before `b`.
|
|
21
|
-
* Exported for the invariant tests; composers use {@link mergeSorted}.
|
|
22
|
-
*/
|
|
23
|
-
export declare class MinHeap<T> {
|
|
24
|
-
private readonly compare;
|
|
25
|
-
private readonly items;
|
|
26
|
-
constructor(compare: (left: T, right: T) => number);
|
|
27
|
-
get size(): number;
|
|
28
|
-
peek(): T | undefined;
|
|
29
|
-
push(item: T): void;
|
|
30
|
-
pop(): T | undefined;
|
|
31
|
-
private bubbleUp;
|
|
32
|
-
private bubbleDown;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/internal/filesystem/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAQD;;;;GAIG;AACH,wBAAuB,WAAW,CAAC,CAAC,EAClC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,EAC9C,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC7B,cAAc,CAAC,CAAC,CAAC,CAsCnB;AAiCD;;;GAGG;AACH,qBAAa,OAAO,CAAC,CAAC;IAGR,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IAEjC,YAA6B,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,MAAM,EAAI;IAEvE,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,CAAC,GAAG,SAAS,CAEpB;IAED,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAGlB;IAED,GAAG,IAAI,CAAC,GAAG,SAAS,CAYnB;IAED,OAAO,CAAC,QAAQ;IAmBhB,OAAO,CAAC,UAAU;CAqCnB"}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* K-way merge of already-sorted streams. Each source must be ordered
|
|
3
|
-
* under the same `compare`; the merge does not re-sort a source.
|
|
4
|
-
*
|
|
5
|
-
* A binary heap of heads keeps the next yield O(log k) in the number of
|
|
6
|
-
* sources. `unique` skips later copies of a key so an earlier source can
|
|
7
|
-
* shadow a later one (the union rule).
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Merge already-sorted iterables / async iterables under `compare`.
|
|
11
|
-
* Equal keys (`compare === 0`) keep source order: earlier `sources`
|
|
12
|
-
* index wins. With `unique`, those later copies are skipped.
|
|
13
|
-
*/
|
|
14
|
-
export async function* mergeSorted(sources, options) {
|
|
15
|
-
const { compare, unique = false } = options;
|
|
16
|
-
const heap = new MinHeap((left, right) => {
|
|
17
|
-
const byValue = compare(left.value, right.value);
|
|
18
|
-
return byValue !== 0 ? byValue : left.source - right.source;
|
|
19
|
-
});
|
|
20
|
-
const iterators = sources.map((source, sourceIndex) => {
|
|
21
|
-
const iterator = Symbol.asyncIterator in source
|
|
22
|
-
? source[Symbol.asyncIterator]()
|
|
23
|
-
: (async function* () {
|
|
24
|
-
yield* source;
|
|
25
|
-
})();
|
|
26
|
-
return { iterator, sourceIndex };
|
|
27
|
-
});
|
|
28
|
-
await Promise.all(iterators.map(async ({ iterator, sourceIndex }) => {
|
|
29
|
-
const next = await iterator.next();
|
|
30
|
-
if (!next.done) {
|
|
31
|
-
heap.push({ value: next.value, iterator, source: sourceIndex });
|
|
32
|
-
}
|
|
33
|
-
}));
|
|
34
|
-
while (heap.size > 0) {
|
|
35
|
-
const best = heap.pop();
|
|
36
|
-
if (best === undefined) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
yield best.value;
|
|
40
|
-
if (unique) {
|
|
41
|
-
await advanceMatching(heap, best, compare);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
await pushNext(heap, best);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async function pushNext(heap, head) {
|
|
49
|
-
const next = await head.iterator.next();
|
|
50
|
-
if (!next.done) {
|
|
51
|
-
heap.push({
|
|
52
|
-
value: next.value,
|
|
53
|
-
iterator: head.iterator,
|
|
54
|
-
source: head.source,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/** Advance every head whose key equals `best` (compare === 0). */
|
|
59
|
-
async function advanceMatching(heap, best, compare) {
|
|
60
|
-
await pushNext(heap, best);
|
|
61
|
-
while (heap.size > 0) {
|
|
62
|
-
const peek = heap.peek();
|
|
63
|
-
if (peek === undefined || compare(peek.value, best.value) !== 0) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const duplicate = heap.pop();
|
|
67
|
-
if (duplicate === undefined) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
await pushNext(heap, duplicate);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Binary min-heap. `compare(a, b) < 0` means `a` is before `b`.
|
|
75
|
-
* Exported for the invariant tests; composers use {@link mergeSorted}.
|
|
76
|
-
*/
|
|
77
|
-
export class MinHeap {
|
|
78
|
-
constructor(compare) {
|
|
79
|
-
this.compare = compare;
|
|
80
|
-
this.items = [];
|
|
81
|
-
}
|
|
82
|
-
get size() {
|
|
83
|
-
return this.items.length;
|
|
84
|
-
}
|
|
85
|
-
peek() {
|
|
86
|
-
return this.items[0];
|
|
87
|
-
}
|
|
88
|
-
push(item) {
|
|
89
|
-
this.items.push(item);
|
|
90
|
-
this.bubbleUp(this.items.length - 1);
|
|
91
|
-
}
|
|
92
|
-
pop() {
|
|
93
|
-
const first = this.items[0];
|
|
94
|
-
if (first === undefined) {
|
|
95
|
-
return undefined;
|
|
96
|
-
}
|
|
97
|
-
const last = this.items.pop();
|
|
98
|
-
if (last === undefined || this.items.length === 0) {
|
|
99
|
-
return first;
|
|
100
|
-
}
|
|
101
|
-
this.items[0] = last;
|
|
102
|
-
this.bubbleDown(0);
|
|
103
|
-
return first;
|
|
104
|
-
}
|
|
105
|
-
bubbleUp(index) {
|
|
106
|
-
let current = index;
|
|
107
|
-
while (current > 0) {
|
|
108
|
-
const parent = Math.floor((current - 1) / 2);
|
|
109
|
-
const parentItem = this.items[parent];
|
|
110
|
-
const currentItem = this.items[current];
|
|
111
|
-
if (parentItem === undefined ||
|
|
112
|
-
currentItem === undefined ||
|
|
113
|
-
this.compare(currentItem, parentItem) >= 0) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
this.items[parent] = currentItem;
|
|
117
|
-
this.items[current] = parentItem;
|
|
118
|
-
current = parent;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
bubbleDown(index) {
|
|
122
|
-
let current = index;
|
|
123
|
-
for (;;) {
|
|
124
|
-
const left = current * 2 + 1;
|
|
125
|
-
const right = left + 1;
|
|
126
|
-
let smallest = current;
|
|
127
|
-
const currentItem = this.items[smallest];
|
|
128
|
-
const leftItem = this.items[left];
|
|
129
|
-
if (leftItem !== undefined &&
|
|
130
|
-
currentItem !== undefined &&
|
|
131
|
-
this.compare(leftItem, currentItem) < 0) {
|
|
132
|
-
smallest = left;
|
|
133
|
-
}
|
|
134
|
-
const smallestItem = this.items[smallest];
|
|
135
|
-
const rightItem = this.items[right];
|
|
136
|
-
if (rightItem !== undefined &&
|
|
137
|
-
smallestItem !== undefined &&
|
|
138
|
-
this.compare(rightItem, smallestItem) < 0) {
|
|
139
|
-
smallest = right;
|
|
140
|
-
}
|
|
141
|
-
if (smallest === current) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
const swapCurrent = this.items[current];
|
|
145
|
-
const swapSmallest = this.items[smallest];
|
|
146
|
-
if (swapCurrent === undefined || swapSmallest === undefined) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
this.items[current] = swapSmallest;
|
|
150
|
-
this.items[smallest] = swapCurrent;
|
|
151
|
-
current = smallest;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|