@vetta-org/plugin-sdk 0.1.1 → 0.3.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.
Files changed (112) hide show
  1. package/dist/activity-tab.d.ts +2 -0
  2. package/dist/activity-tab.d.ts.map +1 -1
  3. package/dist/activity-tab.js +1 -1
  4. package/dist/activity-tab.js.map +1 -1
  5. package/dist/agent.d.ts +148 -4
  6. package/dist/agent.d.ts.map +1 -1
  7. package/dist/agent.js +14 -1
  8. package/dist/agent.js.map +1 -1
  9. package/dist/ai.d.ts +106 -0
  10. package/dist/ai.d.ts.map +1 -0
  11. package/dist/ai.js +2 -0
  12. package/dist/ai.js.map +1 -0
  13. package/dist/app-actions.d.ts +9 -1
  14. package/dist/app-actions.d.ts.map +1 -1
  15. package/dist/app-actions.js.map +1 -1
  16. package/dist/artifacts.d.ts +31 -0
  17. package/dist/artifacts.d.ts.map +1 -0
  18. package/dist/artifacts.js +2 -0
  19. package/dist/artifacts.js.map +1 -0
  20. package/dist/browser.d.ts +119 -0
  21. package/dist/browser.d.ts.map +1 -0
  22. package/dist/browser.js +2 -0
  23. package/dist/browser.js.map +1 -0
  24. package/dist/capture.d.ts +64 -0
  25. package/dist/capture.d.ts.map +1 -0
  26. package/dist/capture.js +2 -0
  27. package/dist/capture.js.map +1 -0
  28. package/dist/cli-provider.d.ts +18 -0
  29. package/dist/cli-provider.d.ts.map +1 -0
  30. package/dist/cli-provider.js +2 -0
  31. package/dist/cli-provider.js.map +1 -0
  32. package/dist/context.d.ts +59 -7
  33. package/dist/context.d.ts.map +1 -1
  34. package/dist/context.js.map +1 -1
  35. package/dist/conversation.d.ts +66 -2
  36. package/dist/conversation.d.ts.map +1 -1
  37. package/dist/conversation.js.map +1 -1
  38. package/dist/gateway.d.ts +37 -0
  39. package/dist/gateway.d.ts.map +1 -0
  40. package/dist/gateway.js +14 -0
  41. package/dist/gateway.js.map +1 -0
  42. package/dist/index.d.ts +26 -10
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +5 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/jobs.d.ts +34 -0
  47. package/dist/jobs.d.ts.map +1 -0
  48. package/dist/jobs.js +2 -0
  49. package/dist/jobs.js.map +1 -0
  50. package/dist/manifest-schema.d.ts +637 -0
  51. package/dist/manifest-schema.d.ts.map +1 -0
  52. package/dist/manifest-schema.js +251 -0
  53. package/dist/manifest-schema.js.map +1 -0
  54. package/dist/manifest.d.ts +21 -55
  55. package/dist/manifest.d.ts.map +1 -1
  56. package/dist/manifest.js +468 -1
  57. package/dist/manifest.js.map +1 -1
  58. package/dist/media.d.ts +193 -0
  59. package/dist/media.d.ts.map +1 -0
  60. package/dist/media.js +11 -0
  61. package/dist/media.js.map +1 -0
  62. package/dist/models.d.ts +35 -0
  63. package/dist/models.d.ts.map +1 -0
  64. package/dist/models.js +2 -0
  65. package/dist/models.js.map +1 -0
  66. package/dist/network.d.ts +2 -1
  67. package/dist/network.d.ts.map +1 -1
  68. package/dist/network.js.map +1 -1
  69. package/dist/npm-package.d.ts +17 -0
  70. package/dist/npm-package.d.ts.map +1 -0
  71. package/dist/npm-package.js +38 -0
  72. package/dist/npm-package.js.map +1 -0
  73. package/dist/ocr.d.ts +78 -0
  74. package/dist/ocr.d.ts.map +1 -0
  75. package/dist/ocr.js +2 -0
  76. package/dist/ocr.js.map +1 -0
  77. package/dist/official.d.ts +219 -10
  78. package/dist/official.d.ts.map +1 -1
  79. package/dist/official.js.map +1 -1
  80. package/dist/permissions.d.ts +2 -1
  81. package/dist/permissions.d.ts.map +1 -1
  82. package/dist/permissions.js +62 -1
  83. package/dist/permissions.js.map +1 -1
  84. package/dist/prompt-attachment.d.ts +30 -6
  85. package/dist/prompt-attachment.d.ts.map +1 -1
  86. package/dist/prompt-attachment.js +35 -1
  87. package/dist/prompt-attachment.js.map +1 -1
  88. package/dist/quickjs.d.ts +147 -0
  89. package/dist/quickjs.d.ts.map +1 -0
  90. package/dist/quickjs.js +2 -0
  91. package/dist/quickjs.js.map +1 -0
  92. package/dist/secrets.d.ts +27 -0
  93. package/dist/secrets.d.ts.map +1 -0
  94. package/dist/secrets.js +2 -0
  95. package/dist/secrets.js.map +1 -0
  96. package/dist/service-provider.d.ts +62 -0
  97. package/dist/service-provider.d.ts.map +1 -0
  98. package/dist/service-provider.js +2 -0
  99. package/dist/service-provider.js.map +1 -0
  100. package/dist/storage.d.ts +46 -6
  101. package/dist/storage.d.ts.map +1 -1
  102. package/dist/storage.js +8 -1
  103. package/dist/storage.js.map +1 -1
  104. package/dist/ui.d.ts +341 -22
  105. package/dist/ui.d.ts.map +1 -1
  106. package/dist/ui.js.map +1 -1
  107. package/package.json +22 -2
  108. package/src/tailwind-theme.css +30 -0
  109. package/dist/settings.d.ts +0 -13
  110. package/dist/settings.d.ts.map +0 -1
  111. package/dist/settings.js +0 -2
  112. package/dist/settings.js.map +0 -1
@@ -0,0 +1,31 @@
1
+ export interface PluginArtifactRef {
2
+ id: string;
3
+ mimeType: string;
4
+ sizeBytes: number;
5
+ lifetime: "temporary";
6
+ name?: string;
7
+ }
8
+ export type PluginArtifactDestination = {
9
+ type: "plugin-blob";
10
+ blobId?: string;
11
+ } | {
12
+ type: "workspace-file";
13
+ path: string;
14
+ };
15
+ export type PluginPersistedArtifact = {
16
+ type: "plugin-blob";
17
+ blobId: string;
18
+ url: string;
19
+ mimeType: string;
20
+ sizeBytes: number;
21
+ } | {
22
+ type: "workspace-file";
23
+ path: string;
24
+ mimeType: string;
25
+ sizeBytes: number;
26
+ };
27
+ export interface PluginArtifactsApi {
28
+ persist(artifact: PluginArtifactRef | string, destination: PluginArtifactDestination): Promise<PluginPersistedArtifact>;
29
+ release(artifact: PluginArtifactRef | string): Promise<void>;
30
+ }
31
+ //# sourceMappingURL=artifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../src/artifacts.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,yBAAyB,GAClC;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5C,MAAM,MAAM,uBAAuB,GAChC;IACA,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACjB,GACD;IACA,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACjB,CAAC;AAEL,MAAM,WAAW,kBAAkB;IAClC,OAAO,CACN,QAAQ,EAAE,iBAAiB,GAAG,MAAM,EACpC,WAAW,EAAE,yBAAyB,GACpC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACpC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D","sourcesContent":["export interface PluginArtifactRef {\n\tid: string;\n\tmimeType: string;\n\tsizeBytes: number;\n\tlifetime: \"temporary\";\n\tname?: string;\n}\n\nexport type PluginArtifactDestination =\n\t| { type: \"plugin-blob\"; blobId?: string }\n\t| { type: \"workspace-file\"; path: string };\n\nexport type PluginPersistedArtifact =\n\t| {\n\t\t\ttype: \"plugin-blob\";\n\t\t\tblobId: string;\n\t\t\turl: string;\n\t\t\tmimeType: string;\n\t\t\tsizeBytes: number;\n\t }\n\t| {\n\t\t\ttype: \"workspace-file\";\n\t\t\tpath: string;\n\t\t\tmimeType: string;\n\t\t\tsizeBytes: number;\n\t };\n\nexport interface PluginArtifactsApi {\n\tpersist(\n\t\tartifact: PluginArtifactRef | string,\n\t\tdestination: PluginArtifactDestination,\n\t): Promise<PluginPersistedArtifact>;\n\trelease(artifact: PluginArtifactRef | string): Promise<void>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=artifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../src/artifacts.ts"],"names":[],"mappings":"","sourcesContent":["export interface PluginArtifactRef {\n\tid: string;\n\tmimeType: string;\n\tsizeBytes: number;\n\tlifetime: \"temporary\";\n\tname?: string;\n}\n\nexport type PluginArtifactDestination =\n\t| { type: \"plugin-blob\"; blobId?: string }\n\t| { type: \"workspace-file\"; path: string };\n\nexport type PluginPersistedArtifact =\n\t| {\n\t\t\ttype: \"plugin-blob\";\n\t\t\tblobId: string;\n\t\t\turl: string;\n\t\t\tmimeType: string;\n\t\t\tsizeBytes: number;\n\t }\n\t| {\n\t\t\ttype: \"workspace-file\";\n\t\t\tpath: string;\n\t\t\tmimeType: string;\n\t\t\tsizeBytes: number;\n\t };\n\nexport interface PluginArtifactsApi {\n\tpersist(\n\t\tartifact: PluginArtifactRef | string,\n\t\tdestination: PluginArtifactDestination,\n\t): Promise<PluginPersistedArtifact>;\n\trelease(artifact: PluginArtifactRef | string): Promise<void>;\n}\n"]}
@@ -0,0 +1,119 @@
1
+ export type PluginBrowserSource = "managed" | "attach";
2
+ export type PluginBrowserRuntimePhase = "checking" | "missing" | "outdated" | "browser-missing" | "ready" | "installing-runtime" | "installing-browser" | "error";
3
+ export interface PluginBrowserRuntimeStatus {
4
+ phase: PluginBrowserRuntimePhase;
5
+ version?: string;
6
+ message?: string;
7
+ recentOutput?: string;
8
+ }
9
+ export type PluginBrowserProfile = {
10
+ type: "ephemeral";
11
+ } | {
12
+ type: "persistent";
13
+ id: string;
14
+ };
15
+ export type PluginBrowserSessionStatus = "starting" | "ready" | "closed" | "error";
16
+ export interface PluginBrowserSession {
17
+ id: string;
18
+ source: PluginBrowserSource;
19
+ profile: PluginBrowserProfile;
20
+ headed: boolean;
21
+ status: PluginBrowserSessionStatus;
22
+ createdAt: number;
23
+ }
24
+ export interface PluginBrowserSessionOptions {
25
+ source?: PluginBrowserSource;
26
+ profile?: PluginBrowserProfile;
27
+ headed?: boolean;
28
+ /** Optional subset of plugin.json browser.allowedHosts for this session. */
29
+ allowedHosts?: string[];
30
+ }
31
+ export interface PluginBrowserPageState {
32
+ sessionId: string;
33
+ revision: number;
34
+ url: string;
35
+ title?: string;
36
+ }
37
+ export interface PluginBrowserSnapshot extends PluginBrowserPageState {
38
+ content: string;
39
+ }
40
+ export interface PluginBrowserTextContent {
41
+ sessionId: string;
42
+ url: string;
43
+ title?: string;
44
+ text: string;
45
+ truncated: boolean;
46
+ }
47
+ export interface PluginBrowserScreenshot {
48
+ sessionId: string;
49
+ revision: number;
50
+ dataUrl: string;
51
+ }
52
+ export type PluginBrowserAction = {
53
+ type: "click";
54
+ target: string;
55
+ } | {
56
+ type: "fill";
57
+ target: string;
58
+ value: string;
59
+ } | {
60
+ type: "type";
61
+ target: string;
62
+ value: string;
63
+ } | {
64
+ type: "select";
65
+ target: string;
66
+ value: string;
67
+ } | {
68
+ type: "check";
69
+ target: string;
70
+ checked: boolean;
71
+ } | {
72
+ type: "press";
73
+ key: string;
74
+ } | {
75
+ type: "scroll";
76
+ direction: "up" | "down" | "left" | "right";
77
+ amount?: number;
78
+ } | {
79
+ type: "wait";
80
+ milliseconds?: number;
81
+ target?: string;
82
+ } | {
83
+ type: "back";
84
+ } | {
85
+ type: "reload";
86
+ };
87
+ export interface PluginBrowserActionResult extends PluginBrowserPageState {
88
+ output?: string;
89
+ }
90
+ export interface PluginBrowserApi {
91
+ /**
92
+ * Open a URL in the host's built-in browser panel. This is a display-only
93
+ * operation; it does not grant page content access or automation privileges.
94
+ */
95
+ open(url: string): void;
96
+ runtime: {
97
+ status(): Promise<PluginBrowserRuntimeStatus>;
98
+ install(step: "runtime" | "browser"): Promise<PluginBrowserRuntimeStatus>;
99
+ };
100
+ sessions: {
101
+ create(options?: PluginBrowserSessionOptions): Promise<PluginBrowserSession>;
102
+ get(sessionId: string): Promise<PluginBrowserSession>;
103
+ close(sessionId: string): Promise<void>;
104
+ };
105
+ navigate(sessionId: string, url: string): Promise<PluginBrowserPageState>;
106
+ snapshot(sessionId: string, options?: {
107
+ interactiveOnly?: boolean;
108
+ }): Promise<PluginBrowserSnapshot>;
109
+ readText(sessionId: string, options?: {
110
+ maxChars?: number;
111
+ }): Promise<PluginBrowserTextContent>;
112
+ screenshot(sessionId: string, options?: {
113
+ fullPage?: boolean;
114
+ }): Promise<PluginBrowserScreenshot>;
115
+ act(sessionId: string, action: PluginBrowserAction, options?: {
116
+ snapshotRevision?: number;
117
+ }): Promise<PluginBrowserActionResult>;
118
+ }
119
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,QAAQ,CAAC;AACvD,MAAM,MAAM,yBAAyB,GAClC,UAAU,GACV,SAAS,GACT,UAAU,GACV,iBAAiB,GACjB,OAAO,GACP,oBAAoB,GACpB,oBAAoB,GACpB,OAAO,CAAC;AAEX,MAAM,WAAW,0BAA0B;IAC1C,KAAK,EAAE,yBAAyB,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,oBAAoB,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,EAAE,EAAE,MAAM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AAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACtD,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;KACxC,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAC1E,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACrG,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAChG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAClG,GAAG,CACF,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,EAC3B,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,GACrC,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACtC","sourcesContent":["export type PluginBrowserSource = \"managed\" | \"attach\";\nexport type PluginBrowserRuntimePhase =\n\t| \"checking\"\n\t| \"missing\"\n\t| \"outdated\"\n\t| \"browser-missing\"\n\t| \"ready\"\n\t| \"installing-runtime\"\n\t| \"installing-browser\"\n\t| \"error\";\n\nexport interface PluginBrowserRuntimeStatus {\n\tphase: PluginBrowserRuntimePhase;\n\tversion?: string;\n\tmessage?: string;\n\trecentOutput?: string;\n}\n\nexport type PluginBrowserProfile = { type: \"ephemeral\" } | { type: \"persistent\"; id: string };\nexport type PluginBrowserSessionStatus = \"starting\" | \"ready\" | \"closed\" | \"error\";\n\nexport interface PluginBrowserSession {\n\tid: string;\n\tsource: PluginBrowserSource;\n\tprofile: PluginBrowserProfile;\n\theaded: boolean;\n\tstatus: PluginBrowserSessionStatus;\n\tcreatedAt: number;\n}\n\nexport interface PluginBrowserSessionOptions {\n\tsource?: PluginBrowserSource;\n\tprofile?: PluginBrowserProfile;\n\theaded?: boolean;\n\t/** Optional subset of plugin.json browser.allowedHosts for this session. */\n\tallowedHosts?: string[];\n}\n\nexport interface PluginBrowserPageState {\n\tsessionId: string;\n\trevision: number;\n\turl: string;\n\ttitle?: string;\n}\n\nexport interface PluginBrowserSnapshot extends PluginBrowserPageState {\n\tcontent: string;\n}\n\nexport interface PluginBrowserTextContent {\n\tsessionId: string;\n\turl: string;\n\ttitle?: string;\n\ttext: string;\n\ttruncated: boolean;\n}\n\nexport interface PluginBrowserScreenshot {\n\tsessionId: string;\n\trevision: number;\n\tdataUrl: string;\n}\n\nexport type PluginBrowserAction =\n\t| { type: \"click\"; target: string }\n\t| { type: \"fill\"; target: string; value: string }\n\t| { type: \"type\"; target: string; value: string }\n\t| { type: \"select\"; target: string; value: string }\n\t| { type: \"check\"; target: string; checked: boolean }\n\t| { type: \"press\"; key: string }\n\t| { type: \"scroll\"; direction: \"up\" | \"down\" | \"left\" | \"right\"; amount?: number }\n\t| { type: \"wait\"; milliseconds?: number; target?: string }\n\t| { type: \"back\" }\n\t| { type: \"reload\" };\n\nexport interface PluginBrowserActionResult extends PluginBrowserPageState {\n\toutput?: string;\n}\n\nexport interface PluginBrowserApi {\n\t/**\n\t * Open a URL in the host's built-in browser panel. This is a display-only\n\t * operation; it does not grant page content access or automation privileges.\n\t */\n\topen(url: string): void;\n\truntime: {\n\t\tstatus(): Promise<PluginBrowserRuntimeStatus>;\n\t\tinstall(step: \"runtime\" | \"browser\"): Promise<PluginBrowserRuntimeStatus>;\n\t};\n\tsessions: {\n\t\tcreate(options?: PluginBrowserSessionOptions): Promise<PluginBrowserSession>;\n\t\tget(sessionId: string): Promise<PluginBrowserSession>;\n\t\tclose(sessionId: string): Promise<void>;\n\t};\n\tnavigate(sessionId: string, url: string): Promise<PluginBrowserPageState>;\n\tsnapshot(sessionId: string, options?: { interactiveOnly?: boolean }): Promise<PluginBrowserSnapshot>;\n\treadText(sessionId: string, options?: { maxChars?: number }): Promise<PluginBrowserTextContent>;\n\tscreenshot(sessionId: string, options?: { fullPage?: boolean }): Promise<PluginBrowserScreenshot>;\n\tact(\n\t\tsessionId: string,\n\t\taction: PluginBrowserAction,\n\t\toptions?: { snapshotRevision?: number },\n\t): Promise<PluginBrowserActionResult>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"","sourcesContent":["export type PluginBrowserSource = \"managed\" | \"attach\";\nexport type PluginBrowserRuntimePhase =\n\t| \"checking\"\n\t| \"missing\"\n\t| \"outdated\"\n\t| \"browser-missing\"\n\t| \"ready\"\n\t| \"installing-runtime\"\n\t| \"installing-browser\"\n\t| \"error\";\n\nexport interface PluginBrowserRuntimeStatus {\n\tphase: PluginBrowserRuntimePhase;\n\tversion?: string;\n\tmessage?: string;\n\trecentOutput?: string;\n}\n\nexport type PluginBrowserProfile = { type: \"ephemeral\" } | { type: \"persistent\"; id: string };\nexport type PluginBrowserSessionStatus = \"starting\" | \"ready\" | \"closed\" | \"error\";\n\nexport interface PluginBrowserSession {\n\tid: string;\n\tsource: PluginBrowserSource;\n\tprofile: PluginBrowserProfile;\n\theaded: boolean;\n\tstatus: PluginBrowserSessionStatus;\n\tcreatedAt: number;\n}\n\nexport interface PluginBrowserSessionOptions {\n\tsource?: PluginBrowserSource;\n\tprofile?: PluginBrowserProfile;\n\theaded?: boolean;\n\t/** Optional subset of plugin.json browser.allowedHosts for this session. */\n\tallowedHosts?: string[];\n}\n\nexport interface PluginBrowserPageState {\n\tsessionId: string;\n\trevision: number;\n\turl: string;\n\ttitle?: string;\n}\n\nexport interface PluginBrowserSnapshot extends PluginBrowserPageState {\n\tcontent: string;\n}\n\nexport interface PluginBrowserTextContent {\n\tsessionId: string;\n\turl: string;\n\ttitle?: string;\n\ttext: string;\n\ttruncated: boolean;\n}\n\nexport interface PluginBrowserScreenshot {\n\tsessionId: string;\n\trevision: number;\n\tdataUrl: string;\n}\n\nexport type PluginBrowserAction =\n\t| { type: \"click\"; target: string }\n\t| { type: \"fill\"; target: string; value: string }\n\t| { type: \"type\"; target: string; value: string }\n\t| { type: \"select\"; target: string; value: string }\n\t| { type: \"check\"; target: string; checked: boolean }\n\t| { type: \"press\"; key: string }\n\t| { type: \"scroll\"; direction: \"up\" | \"down\" | \"left\" | \"right\"; amount?: number }\n\t| { type: \"wait\"; milliseconds?: number; target?: string }\n\t| { type: \"back\" }\n\t| { type: \"reload\" };\n\nexport interface PluginBrowserActionResult extends PluginBrowserPageState {\n\toutput?: string;\n}\n\nexport interface PluginBrowserApi {\n\t/**\n\t * Open a URL in the host's built-in browser panel. This is a display-only\n\t * operation; it does not grant page content access or automation privileges.\n\t */\n\topen(url: string): void;\n\truntime: {\n\t\tstatus(): Promise<PluginBrowserRuntimeStatus>;\n\t\tinstall(step: \"runtime\" | \"browser\"): Promise<PluginBrowserRuntimeStatus>;\n\t};\n\tsessions: {\n\t\tcreate(options?: PluginBrowserSessionOptions): Promise<PluginBrowserSession>;\n\t\tget(sessionId: string): Promise<PluginBrowserSession>;\n\t\tclose(sessionId: string): Promise<void>;\n\t};\n\tnavigate(sessionId: string, url: string): Promise<PluginBrowserPageState>;\n\tsnapshot(sessionId: string, options?: { interactiveOnly?: boolean }): Promise<PluginBrowserSnapshot>;\n\treadText(sessionId: string, options?: { maxChars?: number }): Promise<PluginBrowserTextContent>;\n\tscreenshot(sessionId: string, options?: { fullPage?: boolean }): Promise<PluginBrowserScreenshot>;\n\tact(\n\t\tsessionId: string,\n\t\taction: PluginBrowserAction,\n\t\toptions?: { snapshotRevision?: number },\n\t): Promise<PluginBrowserActionResult>;\n}\n"]}
@@ -0,0 +1,64 @@
1
+ export interface PluginOffscreenCaptureOptions {
2
+ /** 目标页面地址,仅允许 http(s)(如插件自己 spawn 的本地 dev server)。 */
3
+ url: string;
4
+ /** 视口宽度(CSS 像素)。 */
5
+ width: number;
6
+ /** 视口高度(CSS 像素)。 */
7
+ height: number;
8
+ /**
9
+ * 复用键。同 key 的请求串行执行并复用同一个离屏窗口:url 未变时跳过重新加载,
10
+ * SPA 页面可用 `prepareScript` 做客户端路由切换,省掉整页加载。省略则本次
11
+ * 请求独占一个窗口、用完即毁。窗口闲置一段时间后由宿主自动回收。
12
+ */
13
+ sessionKey?: string;
14
+ /** 页面加载完成(或复用窗口)后注入执行的脚本,如 postMessage 切路由。 */
15
+ prepareScript?: string;
16
+ /**
17
+ * 就绪表达式。宿主轮询它直到真值才截图,用于等待页面自己的「渲染完成」信号
18
+ * (如 `window.__ready === true`)。省略则加载完成即视为就绪。
19
+ */
20
+ readyExpression?: string;
21
+ /** 就绪后的静置时间(毫秒),等图片解码、过渡动画落定。 */
22
+ settleMs?: number;
23
+ /**
24
+ * 探针表达式。在**截图的同一时刻**(就绪 + 静置之后)对页面求值,结果经
25
+ * `JSON.stringify` 回传到 `PluginOffscreenCaptureResult.probe`。
26
+ *
27
+ * 存在的理由:渲染是这条链上最贵的一步,而位图是它最难用的产物——「这段文字换了
28
+ * 行没有」「这两条边对齐没有」在 DOM 里是确定的度量,在图里只能靠看。同一次渲染
29
+ * 顺带把度量取回来,比让调用方再渲染一次或让模型看图去猜都更可靠。
30
+ *
31
+ * 求值失败(抛错、返回不可序列化的值)不影响截图:`probe` 为 `undefined`,
32
+ * 位图照常返回。探针是搭车的附加信息,不是截图的前置条件。
33
+ */
34
+ probeScript?: string;
35
+ /** 整体超时(毫秒,含加载与就绪等待),宿主按自身上限收紧。 */
36
+ timeoutMs?: number;
37
+ format?: "jpeg" | "png";
38
+ /** 仅 jpeg 生效,0–1。 */
39
+ quality?: number;
40
+ }
41
+ export interface PluginOffscreenCaptureResult {
42
+ dataUrl: string;
43
+ /**
44
+ * 实际生效的设备像素比:位图物理像素 = CSS 尺寸 × 此值。离屏窗口跟随主显示器
45
+ * 的缩放(Retina 为 2),插件不可指定——按需自行缩放位图。
46
+ */
47
+ scaleFactor: number;
48
+ /**
49
+ * `probeScript` 的求值结果,经 JSON 往返。没传探针、求值抛错或结果不可序列化时
50
+ * 为 `undefined`——调用方无法从这里区分三者,探针本就不该承担错误报告。
51
+ */
52
+ probe?: unknown;
53
+ }
54
+ /**
55
+ * 主进程离屏窗口截图。与 DOM 克隆类方案(html-to-image 等)不同,这里走真实的
56
+ * Chromium 渲染管线,产出与页面在屏显示逐像素一致的位图,不存在克隆重排带来的
57
+ * 断行/亚像素偏差。需要 `capture.offscreen` 权限。
58
+ */
59
+ export interface PluginCaptureApi {
60
+ offscreen(options: PluginOffscreenCaptureOptions): Promise<PluginOffscreenCaptureResult>;
61
+ /** 释放 sessionKey 对应的离屏窗口;下次同 key 请求会重新加载页面。幂等。 */
62
+ releaseOffscreen(sessionKey: string): Promise<void>;
63
+ }
64
+ //# sourceMappingURL=capture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,6BAA6B;IAC7C,gGAAsD;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ,sCAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,sCAAoB;IACpB,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qGAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qFAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2FAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACxB,iCAAqB;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,4BAA4B;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC,SAAS,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACzF,sGAAkD;IAClD,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD","sourcesContent":["export interface PluginOffscreenCaptureOptions {\n\t/** 目标页面地址,仅允许 http(s)(如插件自己 spawn 的本地 dev server)。 */\n\turl: string;\n\t/** 视口宽度(CSS 像素)。 */\n\twidth: number;\n\t/** 视口高度(CSS 像素)。 */\n\theight: number;\n\t/**\n\t * 复用键。同 key 的请求串行执行并复用同一个离屏窗口:url 未变时跳过重新加载,\n\t * SPA 页面可用 `prepareScript` 做客户端路由切换,省掉整页加载。省略则本次\n\t * 请求独占一个窗口、用完即毁。窗口闲置一段时间后由宿主自动回收。\n\t */\n\tsessionKey?: string;\n\t/** 页面加载完成(或复用窗口)后注入执行的脚本,如 postMessage 切路由。 */\n\tprepareScript?: string;\n\t/**\n\t * 就绪表达式。宿主轮询它直到真值才截图,用于等待页面自己的「渲染完成」信号\n\t * (如 `window.__ready === true`)。省略则加载完成即视为就绪。\n\t */\n\treadyExpression?: string;\n\t/** 就绪后的静置时间(毫秒),等图片解码、过渡动画落定。 */\n\tsettleMs?: number;\n\t/**\n\t * 探针表达式。在**截图的同一时刻**(就绪 + 静置之后)对页面求值,结果经\n\t * `JSON.stringify` 回传到 `PluginOffscreenCaptureResult.probe`。\n\t *\n\t * 存在的理由:渲染是这条链上最贵的一步,而位图是它最难用的产物——「这段文字换了\n\t * 行没有」「这两条边对齐没有」在 DOM 里是确定的度量,在图里只能靠看。同一次渲染\n\t * 顺带把度量取回来,比让调用方再渲染一次或让模型看图去猜都更可靠。\n\t *\n\t * 求值失败(抛错、返回不可序列化的值)不影响截图:`probe` 为 `undefined`,\n\t * 位图照常返回。探针是搭车的附加信息,不是截图的前置条件。\n\t */\n\tprobeScript?: string;\n\t/** 整体超时(毫秒,含加载与就绪等待),宿主按自身上限收紧。 */\n\ttimeoutMs?: number;\n\tformat?: \"jpeg\" | \"png\";\n\t/** 仅 jpeg 生效,0–1。 */\n\tquality?: number;\n}\n\nexport interface PluginOffscreenCaptureResult {\n\tdataUrl: string;\n\t/**\n\t * 实际生效的设备像素比:位图物理像素 = CSS 尺寸 × 此值。离屏窗口跟随主显示器\n\t * 的缩放(Retina 为 2),插件不可指定——按需自行缩放位图。\n\t */\n\tscaleFactor: number;\n\t/**\n\t * `probeScript` 的求值结果,经 JSON 往返。没传探针、求值抛错或结果不可序列化时\n\t * 为 `undefined`——调用方无法从这里区分三者,探针本就不该承担错误报告。\n\t */\n\tprobe?: unknown;\n}\n\n/**\n * 主进程离屏窗口截图。与 DOM 克隆类方案(html-to-image 等)不同,这里走真实的\n * Chromium 渲染管线,产出与页面在屏显示逐像素一致的位图,不存在克隆重排带来的\n * 断行/亚像素偏差。需要 `capture.offscreen` 权限。\n */\nexport interface PluginCaptureApi {\n\toffscreen(options: PluginOffscreenCaptureOptions): Promise<PluginOffscreenCaptureResult>;\n\t/** 释放 sessionKey 对应的离屏窗口;下次同 key 请求会重新加载页面。幂等。 */\n\treleaseOffscreen(sessionKey: string): Promise<void>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=capture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture.js","sourceRoot":"","sources":["../src/capture.ts"],"names":[],"mappings":"","sourcesContent":["export interface PluginOffscreenCaptureOptions {\n\t/** 目标页面地址,仅允许 http(s)(如插件自己 spawn 的本地 dev server)。 */\n\turl: string;\n\t/** 视口宽度(CSS 像素)。 */\n\twidth: number;\n\t/** 视口高度(CSS 像素)。 */\n\theight: number;\n\t/**\n\t * 复用键。同 key 的请求串行执行并复用同一个离屏窗口:url 未变时跳过重新加载,\n\t * SPA 页面可用 `prepareScript` 做客户端路由切换,省掉整页加载。省略则本次\n\t * 请求独占一个窗口、用完即毁。窗口闲置一段时间后由宿主自动回收。\n\t */\n\tsessionKey?: string;\n\t/** 页面加载完成(或复用窗口)后注入执行的脚本,如 postMessage 切路由。 */\n\tprepareScript?: string;\n\t/**\n\t * 就绪表达式。宿主轮询它直到真值才截图,用于等待页面自己的「渲染完成」信号\n\t * (如 `window.__ready === true`)。省略则加载完成即视为就绪。\n\t */\n\treadyExpression?: string;\n\t/** 就绪后的静置时间(毫秒),等图片解码、过渡动画落定。 */\n\tsettleMs?: number;\n\t/**\n\t * 探针表达式。在**截图的同一时刻**(就绪 + 静置之后)对页面求值,结果经\n\t * `JSON.stringify` 回传到 `PluginOffscreenCaptureResult.probe`。\n\t *\n\t * 存在的理由:渲染是这条链上最贵的一步,而位图是它最难用的产物——「这段文字换了\n\t * 行没有」「这两条边对齐没有」在 DOM 里是确定的度量,在图里只能靠看。同一次渲染\n\t * 顺带把度量取回来,比让调用方再渲染一次或让模型看图去猜都更可靠。\n\t *\n\t * 求值失败(抛错、返回不可序列化的值)不影响截图:`probe` 为 `undefined`,\n\t * 位图照常返回。探针是搭车的附加信息,不是截图的前置条件。\n\t */\n\tprobeScript?: string;\n\t/** 整体超时(毫秒,含加载与就绪等待),宿主按自身上限收紧。 */\n\ttimeoutMs?: number;\n\tformat?: \"jpeg\" | \"png\";\n\t/** 仅 jpeg 生效,0–1。 */\n\tquality?: number;\n}\n\nexport interface PluginOffscreenCaptureResult {\n\tdataUrl: string;\n\t/**\n\t * 实际生效的设备像素比:位图物理像素 = CSS 尺寸 × 此值。离屏窗口跟随主显示器\n\t * 的缩放(Retina 为 2),插件不可指定——按需自行缩放位图。\n\t */\n\tscaleFactor: number;\n\t/**\n\t * `probeScript` 的求值结果,经 JSON 往返。没传探针、求值抛错或结果不可序列化时\n\t * 为 `undefined`——调用方无法从这里区分三者,探针本就不该承担错误报告。\n\t */\n\tprobe?: unknown;\n}\n\n/**\n * 主进程离屏窗口截图。与 DOM 克隆类方案(html-to-image 等)不同,这里走真实的\n * Chromium 渲染管线,产出与页面在屏显示逐像素一致的位图,不存在克隆重排带来的\n * 断行/亚像素偏差。需要 `capture.offscreen` 权限。\n */\nexport interface PluginCaptureApi {\n\toffscreen(options: PluginOffscreenCaptureOptions): Promise<PluginOffscreenCaptureResult>;\n\t/** 释放 sessionKey 对应的离屏窗口;下次同 key 请求会重新加载页面。幂等。 */\n\treleaseOffscreen(sessionKey: string): Promise<void>;\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import type { PluginCommandRunOptions, PluginCommandRunResult, PluginCommandSpawnHandle, PluginCommandSpawnOptions } from "./command.js";
2
+ import type { Disposable } from "./disposable.js";
3
+ export type PluginCliProviderPhase = "disabled" | "checking" | "installing" | "verifying" | "ready" | "failed";
4
+ export interface PluginCliProviderStatus {
5
+ providerId: string;
6
+ phase: PluginCliProviderPhase;
7
+ message?: string;
8
+ recentOutput: string;
9
+ }
10
+ /** Host-managed CLI dependency declared by `plugin.json#providers.cli`. */
11
+ export interface PluginCliProviderApi {
12
+ getStatus(providerId: string): Promise<PluginCliProviderStatus>;
13
+ onStatusChanged(listener: (status: PluginCliProviderStatus) => void): Disposable;
14
+ retry(providerId: string): Promise<void>;
15
+ run(providerId: string, args?: string[], options?: PluginCommandRunOptions): Promise<PluginCommandRunResult>;
16
+ spawn(providerId: string, args?: string[], options?: PluginCommandSpawnOptions): Promise<PluginCommandSpawnHandle>;
17
+ }
18
+ //# sourceMappingURL=cli-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-provider.d.ts","sourceRoot":"","sources":["../src/cli-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE/G,MAAM,WAAW,uBAAuB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,sBAAsB,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,2EAA2E;AAC3E,MAAM,WAAW,oBAAoB;IACpC,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAChE,eAAe,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,GAAG,UAAU,CAAC;IACjF,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,GAAG,CACF,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACnC,KAAK,CACJ,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,OAAO,CAAC,EAAE,yBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACrC","sourcesContent":["import type {\n\tPluginCommandRunOptions,\n\tPluginCommandRunResult,\n\tPluginCommandSpawnHandle,\n\tPluginCommandSpawnOptions,\n} from \"./command.js\";\nimport type { Disposable } from \"./disposable.js\";\n\nexport type PluginCliProviderPhase = \"disabled\" | \"checking\" | \"installing\" | \"verifying\" | \"ready\" | \"failed\";\n\nexport interface PluginCliProviderStatus {\n\tproviderId: string;\n\tphase: PluginCliProviderPhase;\n\tmessage?: string;\n\trecentOutput: string;\n}\n\n/** Host-managed CLI dependency declared by `plugin.json#providers.cli`. */\nexport interface PluginCliProviderApi {\n\tgetStatus(providerId: string): Promise<PluginCliProviderStatus>;\n\tonStatusChanged(listener: (status: PluginCliProviderStatus) => void): Disposable;\n\tretry(providerId: string): Promise<void>;\n\trun(\n\t\tproviderId: string,\n\t\targs?: string[],\n\t\toptions?: PluginCommandRunOptions,\n\t): Promise<PluginCommandRunResult>;\n\tspawn(\n\t\tproviderId: string,\n\t\targs?: string[],\n\t\toptions?: PluginCommandSpawnOptions,\n\t): Promise<PluginCommandSpawnHandle>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cli-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-provider.js","sourceRoot":"","sources":["../src/cli-provider.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n\tPluginCommandRunOptions,\n\tPluginCommandRunResult,\n\tPluginCommandSpawnHandle,\n\tPluginCommandSpawnOptions,\n} from \"./command.js\";\nimport type { Disposable } from \"./disposable.js\";\n\nexport type PluginCliProviderPhase = \"disabled\" | \"checking\" | \"installing\" | \"verifying\" | \"ready\" | \"failed\";\n\nexport interface PluginCliProviderStatus {\n\tproviderId: string;\n\tphase: PluginCliProviderPhase;\n\tmessage?: string;\n\trecentOutput: string;\n}\n\n/** Host-managed CLI dependency declared by `plugin.json#providers.cli`. */\nexport interface PluginCliProviderApi {\n\tgetStatus(providerId: string): Promise<PluginCliProviderStatus>;\n\tonStatusChanged(listener: (status: PluginCliProviderStatus) => void): Disposable;\n\tretry(providerId: string): Promise<void>;\n\trun(\n\t\tproviderId: string,\n\t\targs?: string[],\n\t\toptions?: PluginCommandRunOptions,\n\t): Promise<PluginCommandRunResult>;\n\tspawn(\n\t\tproviderId: string,\n\t\targs?: string[],\n\t\toptions?: PluginCommandSpawnOptions,\n\t): Promise<PluginCommandSpawnHandle>;\n}\n"]}
package/dist/context.d.ts CHANGED
@@ -1,27 +1,47 @@
1
1
  import type { PluginAgentApi } from "./agent.js";
2
+ import type { PluginAiApi } from "./ai.js";
2
3
  import type { PluginAppActionsApi } from "./app-actions.js";
4
+ import type { PluginArtifactsApi } from "./artifacts.js";
5
+ import type { PluginBrowserApi } from "./browser.js";
6
+ import type { PluginCaptureApi } from "./capture.js";
3
7
  import type { PluginCommandApi } from "./command.js";
8
+ import type { PluginCliProviderApi } from "./cli-provider.js";
4
9
  import type { PluginConversationApi } from "./conversation.js";
5
10
  import type { Disposable } from "./disposable.js";
6
11
  import type { PluginFileExplorerApi } from "./file-explorer.js";
7
12
  import type { PluginFsApi } from "./fs.js";
13
+ import type { PluginGatewayApi } from "./gateway.js";
8
14
  import type { PluginI18nApi } from "./i18n.js";
15
+ import type { PluginJobsApi } from "./jobs.js";
16
+ import type { PluginMediaApi } from "./media.js";
17
+ import type { OcrClient } from "./ocr.js";
18
+ import type { PluginModelsApi } from "./models.js";
9
19
  import type { PluginNetworkApi } from "./network.js";
10
20
  import type { PluginOfficialApi } from "./official.js";
11
21
  import type { PluginPermission } from "./permissions.js";
12
- import type { PluginSettingsApi } from "./settings.js";
22
+ import type { PluginSecretsApi } from "./secrets.js";
23
+ import type { PluginServiceApi } from "./service-provider.js";
13
24
  import type { PluginStorageApi } from "./storage.js";
14
25
  import type { PluginUiApi } from "./ui.js";
15
26
  export interface PluginPermissionApi {
16
27
  has(permission: PluginPermission): boolean;
17
28
  require(permission: PluginPermission): void;
18
29
  }
19
- /** 工作模式(agent_mode 轴,见 ADR-0046)。宿主 Work/Coding,未来可能扩展。 */
20
- export type AgentMode = "work" | "coding";
30
+ /**
31
+ * 工作模式 id。合法值由宿主的模式注册表定义(ADR-0071),插件不应硬编码枚举;
32
+ * 需要区分模式时按 id 字符串比较,未知 id 一律按通用处理。
33
+ */
34
+ export type AgentMode = string;
21
35
  export interface PluginContext {
22
36
  plugin: {
23
37
  id: string;
24
38
  version: string;
39
+ /**
40
+ * Host-resolved brand icon from `plugin.json#icon` (if declared).
41
+ * Opaque string for `<img src>` / Iconify — plugins must not invent
42
+ * host protocols; use this or omit Activity Tab `icon` to inherit it.
43
+ */
44
+ iconUrl?: string;
25
45
  };
26
46
  permissions: PluginPermissionApi;
27
47
  ui: PluginUiApi;
@@ -29,20 +49,52 @@ export interface PluginContext {
29
49
  conversation: PluginConversationApi;
30
50
  agent: PluginAgentApi;
31
51
  appActions: PluginAppActionsApi;
52
+ ai: PluginAiApi;
32
53
  official: PluginOfficialApi;
33
54
  fs: PluginFsApi;
34
55
  command: PluginCommandApi;
56
+ cliProviders: PluginCliProviderApi;
57
+ /** Plugin-provisioned, host-managed local services declared by `plugin.json#providers.services`. */
58
+ services: PluginServiceApi;
59
+ /** Explicitly permissioned model provider owned by this plugin's id namespace. */
60
+ models: PluginModelsApi;
61
+ media: PluginMediaApi;
62
+ ocr: OcrClient;
63
+ jobs: PluginJobsApi;
64
+ artifacts: PluginArtifactsApi;
65
+ /** 主进程离屏窗口截图(`capture.offscreen` 权限)。旧宿主上为 `undefined`,使用前判空。 */
66
+ capture?: PluginCaptureApi;
67
+ /** 宿主管理的浏览器能力;各具体方法会根据插件权限单独校验。 */
68
+ browser: PluginBrowserApi;
35
69
  network: PluginNetworkApi;
70
+ /**
71
+ * Vetta 服务端网关调用(ADR-0056)。**仅内置 official 插件可用**,
72
+ * 第三方插件读到 `undefined`,故使用前必须判空。
73
+ */
74
+ gateway?: PluginGatewayApi;
36
75
  storage: PluginStorageApi;
37
- settings: PluginSettingsApi;
76
+ /** Encrypted per-plugin secret storage (`secrets.read` / `secrets.write`). */
77
+ secrets: PluginSecretsApi;
38
78
  i18n: PluginI18nApi;
39
- /** 当前工作模式(agent_mode 轴)。开发者据此做模式定制。见 ADR-0046。 */
79
+ /**
80
+ * 当前的**新会话默认工作模式**(agent_mode 轴,见 ADR-0046 及其 2026-08 修订)。
81
+ *
82
+ * 工作模式只在会话创建时固化,之后会话内不可变,因此这里读到的是用户此刻的设置值,
83
+ * **不是**某个已存在会话正在使用的模式,不要用它推断进行中的会话。
84
+ * 模式也不再隐藏任何插件能力,只适合做展示层的软性定制,不要据此隐藏功能入口。
85
+ */
40
86
  getAgentMode(): AgentMode;
41
- /** 订阅工作模式变更(纯全局实时切换)。返回 Disposable 取消订阅。 */
87
+ /** 订阅默认工作模式变更(用户改设置时触发)。返回 Disposable 取消订阅。 */
42
88
  onAgentModeChanged(listener: (mode: AgentMode) => void): Disposable;
43
89
  }
90
+ export type PluginActivationCleanup = Disposable | (() => void | Promise<void>);
44
91
  export interface PluginDefinition {
45
- activate(ctx: PluginContext): void | Promise<void>;
92
+ /**
93
+ * Activate one plugin instance. Returning a cleanup binds resource ownership to
94
+ * this specific activation, including overlapping hot-reload activations.
95
+ */
96
+ activate(ctx: PluginContext): void | PluginActivationCleanup | Promise<void | PluginActivationCleanup>;
97
+ /** Legacy module-level cleanup. Prefer an activation-scoped cleanup return value. */
46
98
  deactivate?(): void | Promise<void>;
47
99
  }
48
100
  export declare function definePlugin(plugin: PluginDefinition): PluginDefinition;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC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QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,GAAG,UAAU,CAAC;CACpE;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,UAAU,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAEvE","sourcesContent":["import type { PluginAgentApi } from \"./agent.js\";\nimport type { PluginAppActionsApi } from \"./app-actions.js\";\nimport type { PluginCommandApi } from \"./command.js\";\nimport type { PluginConversationApi } from \"./conversation.js\";\nimport type { Disposable } from \"./disposable.js\";\nimport type { PluginFileExplorerApi } from \"./file-explorer.js\";\nimport type { PluginFsApi } from \"./fs.js\";\nimport type { PluginI18nApi } from \"./i18n.js\";\nimport type { PluginNetworkApi } from \"./network.js\";\nimport type { PluginOfficialApi } from \"./official.js\";\nimport type { PluginPermission } from \"./permissions.js\";\nimport type { PluginSettingsApi } from \"./settings.js\";\nimport type { PluginStorageApi } from \"./storage.js\";\nimport type { PluginUiApi } from \"./ui.js\";\n\nexport interface PluginPermissionApi {\n\thas(permission: PluginPermission): boolean;\n\trequire(permission: PluginPermission): void;\n}\n\n/** 工作模式(agent_mode 轴,见 ADR-0046)。宿主 Work/Coding,未来可能扩展。 */\nexport type AgentMode = \"work\" | \"coding\";\n\nexport interface PluginContext {\n\tplugin: {\n\t\tid: string;\n\t\tversion: string;\n\t};\n\tpermissions: PluginPermissionApi;\n\tui: PluginUiApi;\n\tfileExplorer: PluginFileExplorerApi;\n\tconversation: PluginConversationApi;\n\tagent: PluginAgentApi;\n\tappActions: PluginAppActionsApi;\n\tofficial: PluginOfficialApi;\n\tfs: PluginFsApi;\n\tcommand: PluginCommandApi;\n\tnetwork: PluginNetworkApi;\n\tstorage: PluginStorageApi;\n\tsettings: PluginSettingsApi;\n\ti18n: PluginI18nApi;\n\t/** 当前工作模式(agent_mode 轴)。开发者据此做模式定制。见 ADR-0046 */\n\tgetAgentMode(): AgentMode;\n\t/** 订阅工作模式变更(纯全局实时切换)。返回 Disposable 取消订阅。 */\n\tonAgentModeChanged(listener: (mode: AgentMode) => void): Disposable;\n}\n\nexport interface PluginDefinition {\n\tactivate(ctx: PluginContext): void | Promise<void>;\n\tdeactivate?(): void | Promise<void>;\n}\n\nexport function definePlugin(plugin: PluginDefinition): PluginDefinition {\n\treturn plugin;\n}\n"]}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,a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";\nimport type { PluginAppActionsApi } from \"./app-actions.js\";\nimport type { PluginArtifactsApi } from \"./artifacts.js\";\nimport type { PluginBrowserApi } from \"./browser.js\";\nimport type { PluginCaptureApi } from \"./capture.js\";\nimport type { PluginCommandApi } from \"./command.js\";\nimport type { PluginCliProviderApi } from \"./cli-provider.js\";\nimport type { PluginConversationApi } from \"./conversation.js\";\nimport type { Disposable } from \"./disposable.js\";\nimport type { PluginFileExplorerApi } from \"./file-explorer.js\";\nimport type { PluginFsApi } from \"./fs.js\";\nimport type { PluginGatewayApi } from \"./gateway.js\";\nimport type { PluginI18nApi } from \"./i18n.js\";\nimport type { PluginJobsApi } from \"./jobs.js\";\nimport type { PluginMediaApi } from \"./media.js\";\nimport type { OcrClient } from \"./ocr.js\";\nimport type { PluginModelsApi } from \"./models.js\";\nimport type { PluginNetworkApi } from \"./network.js\";\nimport type { PluginOfficialApi } from \"./official.js\";\nimport type { PluginPermission } from \"./permissions.js\";\nimport type { PluginSecretsApi } from \"./secrets.js\";\nimport type { PluginServiceApi } from \"./service-provider.js\";\nimport type { PluginStorageApi } from \"./storage.js\";\nimport type { PluginUiApi } from \"./ui.js\";\n\nexport interface PluginPermissionApi {\n\thas(permission: PluginPermission): boolean;\n\trequire(permission: PluginPermission): void;\n}\n\n/**\n * 工作模式 id。合法值由宿主的模式注册表定义(ADR-0071),插件不应硬编码枚举;\n * 需要区分模式时按 id 字符串比较,未知 id 一律按通用处理。\n */\nexport type AgentMode = string;\n\nexport interface PluginContext {\n\tplugin: {\n\t\tid: string;\n\t\tversion: string;\n\t\t/**\n\t\t * Host-resolved brand icon from `plugin.json#icon` (if declared).\n\t\t * Opaque string for `<img src>` / Iconify — plugins must not invent\n\t\t * host protocols; use this or omit Activity Tab `icon` to inherit it.\n\t\t */\n\t\ticonUrl?: string;\n\t};\n\tpermissions: PluginPermissionApi;\n\tui: PluginUiApi;\n\tfileExplorer: PluginFileExplorerApi;\n\tconversation: PluginConversationApi;\n\tagent: PluginAgentApi;\n\tappActions: PluginAppActionsApi;\n\tai: PluginAiApi;\n\tofficial: PluginOfficialApi;\n\tfs: PluginFsApi;\n\tcommand: PluginCommandApi;\n\tcliProviders: PluginCliProviderApi;\n\t/** Plugin-provisioned, host-managed local services declared by `plugin.json#providers.services`. */\n\tservices: PluginServiceApi;\n\t/** Explicitly permissioned model provider owned by this plugin's id namespace. */\n\tmodels: PluginModelsApi;\n\tmedia: PluginMediaApi;\n\tocr: OcrClient;\n\tjobs: PluginJobsApi;\n\tartifacts: PluginArtifactsApi;\n\t/** 主进程离屏窗口截图(`capture.offscreen` 权限)。旧宿主上为 `undefined`,使用前判空。 */\n\tcapture?: PluginCaptureApi;\n\t/** 宿主管理的浏览器能力;各具体方法会根据插件权限单独校验。 */\n\tbrowser: PluginBrowserApi;\n\tnetwork: PluginNetworkApi;\n\t/**\n\t * Vetta 服务端网关调用(ADR-0056)。**仅内置 official 插件可用**,\n\t * 第三方插件读到 `undefined`,故使用前必须判空。\n\t */\n\tgateway?: PluginGatewayApi;\n\tstorage: PluginStorageApi;\n\t/** Encrypted per-plugin secret storage (`secrets.read` / `secrets.write`). */\n\tsecrets: PluginSecretsApi;\n\ti18n: PluginI18nApi;\n\t/**\n\t * 当前的**新会话默认工作模式**(agent_mode 轴,见 ADR-0046 及其 2026-08 修订)。\n\t *\n\t * 工作模式只在会话创建时固化,之后会话内不可变,因此这里读到的是用户此刻的设置值,\n\t * **不是**某个已存在会话正在使用的模式,不要用它推断进行中的会话。\n\t * 模式也不再隐藏任何插件能力,只适合做展示层的软性定制,不要据此隐藏功能入口。\n\t */\n\tgetAgentMode(): AgentMode;\n\t/** 订阅默认工作模式变更(用户改设置时触发)。返回 Disposable 取消订阅。 */\n\tonAgentModeChanged(listener: (mode: AgentMode) => void): Disposable;\n}\n\nexport type PluginActivationCleanup = Disposable | (() => void | Promise<void>);\n\nexport interface PluginDefinition {\n\t/**\n\t * Activate one plugin instance. Returning a cleanup binds resource ownership to\n\t * this specific activation, including overlapping hot-reload activations.\n\t */\n\tactivate(ctx: PluginContext): void | PluginActivationCleanup | Promise<void | PluginActivationCleanup>;\n\t/** Legacy module-level cleanup. Prefer an activation-scoped cleanup return value. */\n\tdeactivate?(): void | Promise<void>;\n}\n\nexport function definePlugin(plugin: PluginDefinition): PluginDefinition {\n\treturn plugin;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAoDA,MAAM,UAAU,YAAY,CAAC,MAAwB,EAAoB;IACxE,OAAO,MAAM,CAAC;AAAA,CACd","sourcesContent":["import type { PluginAgentApi } from \"./agent.js\";\nimport type { PluginAppActionsApi } from \"./app-actions.js\";\nimport type { PluginCommandApi } from \"./command.js\";\nimport type { PluginConversationApi } from \"./conversation.js\";\nimport type { Disposable } from \"./disposable.js\";\nimport type { PluginFileExplorerApi } from \"./file-explorer.js\";\nimport type { PluginFsApi } from \"./fs.js\";\nimport type { PluginI18nApi } from \"./i18n.js\";\nimport type { PluginNetworkApi } from \"./network.js\";\nimport type { PluginOfficialApi } from \"./official.js\";\nimport type { PluginPermission } from \"./permissions.js\";\nimport type { PluginSettingsApi } from \"./settings.js\";\nimport type { PluginStorageApi } from \"./storage.js\";\nimport type { PluginUiApi } from \"./ui.js\";\n\nexport interface PluginPermissionApi {\n\thas(permission: PluginPermission): boolean;\n\trequire(permission: PluginPermission): void;\n}\n\n/** 工作模式(agent_mode 轴,见 ADR-0046)。宿主 Work/Coding,未来可能扩展。 */\nexport type AgentMode = \"work\" | \"coding\";\n\nexport interface PluginContext {\n\tplugin: {\n\t\tid: string;\n\t\tversion: string;\n\t};\n\tpermissions: PluginPermissionApi;\n\tui: PluginUiApi;\n\tfileExplorer: PluginFileExplorerApi;\n\tconversation: PluginConversationApi;\n\tagent: PluginAgentApi;\n\tappActions: PluginAppActionsApi;\n\tofficial: PluginOfficialApi;\n\tfs: PluginFsApi;\n\tcommand: PluginCommandApi;\n\tnetwork: PluginNetworkApi;\n\tstorage: PluginStorageApi;\n\tsettings: PluginSettingsApi;\n\ti18n: PluginI18nApi;\n\t/** 当前工作模式(agent_mode 轴)。开发者据此做模式定制。见 ADR-0046 */\n\tgetAgentMode(): AgentMode;\n\t/** 订阅工作模式变更(纯全局实时切换)。返回 Disposable 取消订阅。 */\n\tonAgentModeChanged(listener: (mode: AgentMode) => void): Disposable;\n}\n\nexport interface PluginDefinition {\n\tactivate(ctx: PluginContext): void | Promise<void>;\n\tdeactivate?(): void | Promise<void>;\n}\n\nexport function definePlugin(plugin: PluginDefinition): PluginDefinition {\n\treturn plugin;\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAyGA,MAAM,UAAU,YAAY,CAAC,MAAwB,EAAoB;IACxE,OAAO,MAAM,CAAC;AAAA,CACd","sourcesContent":["import type { PluginAgentApi } from \"./agent.js\";\nimport type { PluginAiApi } from \"./ai.js\";\nimport type { PluginAppActionsApi } from \"./app-actions.js\";\nimport type { PluginArtifactsApi } from \"./artifacts.js\";\nimport type { PluginBrowserApi } from \"./browser.js\";\nimport type { PluginCaptureApi } from \"./capture.js\";\nimport type { PluginCommandApi } from \"./command.js\";\nimport type { PluginCliProviderApi } from \"./cli-provider.js\";\nimport type { PluginConversationApi } from \"./conversation.js\";\nimport type { Disposable } from \"./disposable.js\";\nimport type { PluginFileExplorerApi } from \"./file-explorer.js\";\nimport type { PluginFsApi } from \"./fs.js\";\nimport type { PluginGatewayApi } from \"./gateway.js\";\nimport type { PluginI18nApi } from \"./i18n.js\";\nimport type { PluginJobsApi } from \"./jobs.js\";\nimport type { PluginMediaApi } from \"./media.js\";\nimport type { OcrClient } from \"./ocr.js\";\nimport type { PluginModelsApi } from \"./models.js\";\nimport type { PluginNetworkApi } from \"./network.js\";\nimport type { PluginOfficialApi } from \"./official.js\";\nimport type { PluginPermission } from \"./permissions.js\";\nimport type { PluginSecretsApi } from \"./secrets.js\";\nimport type { PluginServiceApi } from \"./service-provider.js\";\nimport type { PluginStorageApi } from \"./storage.js\";\nimport type { PluginUiApi } from \"./ui.js\";\n\nexport interface PluginPermissionApi {\n\thas(permission: PluginPermission): boolean;\n\trequire(permission: PluginPermission): void;\n}\n\n/**\n * 工作模式 id。合法值由宿主的模式注册表定义(ADR-0071),插件不应硬编码枚举;\n * 需要区分模式时按 id 字符串比较,未知 id 一律按通用处理。\n */\nexport type AgentMode = string;\n\nexport interface PluginContext {\n\tplugin: {\n\t\tid: string;\n\t\tversion: string;\n\t\t/**\n\t\t * Host-resolved brand icon from `plugin.json#icon` (if declared).\n\t\t * Opaque string for `<img src>` / Iconify — plugins must not invent\n\t\t * host protocols; use this or omit Activity Tab `icon` to inherit it.\n\t\t */\n\t\ticonUrl?: string;\n\t};\n\tpermissions: PluginPermissionApi;\n\tui: PluginUiApi;\n\tfileExplorer: PluginFileExplorerApi;\n\tconversation: PluginConversationApi;\n\tagent: PluginAgentApi;\n\tappActions: PluginAppActionsApi;\n\tai: PluginAiApi;\n\tofficial: PluginOfficialApi;\n\tfs: PluginFsApi;\n\tcommand: PluginCommandApi;\n\tcliProviders: PluginCliProviderApi;\n\t/** Plugin-provisioned, host-managed local services declared by `plugin.json#providers.services`. */\n\tservices: PluginServiceApi;\n\t/** Explicitly permissioned model provider owned by this plugin's id namespace. */\n\tmodels: PluginModelsApi;\n\tmedia: PluginMediaApi;\n\tocr: OcrClient;\n\tjobs: PluginJobsApi;\n\tartifacts: PluginArtifactsApi;\n\t/** 主进程离屏窗口截图(`capture.offscreen` 权限)。旧宿主上为 `undefined`,使用前判空。 */\n\tcapture?: PluginCaptureApi;\n\t/** 宿主管理的浏览器能力;各具体方法会根据插件权限单独校验。 */\n\tbrowser: PluginBrowserApi;\n\tnetwork: PluginNetworkApi;\n\t/**\n\t * Vetta 服务端网关调用(ADR-0056)。**仅内置 official 插件可用**,\n\t * 第三方插件读到 `undefined`,故使用前必须判空。\n\t */\n\tgateway?: PluginGatewayApi;\n\tstorage: PluginStorageApi;\n\t/** Encrypted per-plugin secret storage (`secrets.read` / `secrets.write`). */\n\tsecrets: PluginSecretsApi;\n\ti18n: PluginI18nApi;\n\t/**\n\t * 当前的**新会话默认工作模式**(agent_mode 轴,见 ADR-0046 及其 2026-08 修订)。\n\t *\n\t * 工作模式只在会话创建时固化,之后会话内不可变,因此这里读到的是用户此刻的设置值,\n\t * **不是**某个已存在会话正在使用的模式,不要用它推断进行中的会话。\n\t * 模式也不再隐藏任何插件能力,只适合做展示层的软性定制,不要据此隐藏功能入口。\n\t */\n\tgetAgentMode(): AgentMode;\n\t/** 订阅默认工作模式变更(用户改设置时触发)。返回 Disposable 取消订阅。 */\n\tonAgentModeChanged(listener: (mode: AgentMode) => void): Disposable;\n}\n\nexport type PluginActivationCleanup = Disposable | (() => void | Promise<void>);\n\nexport interface PluginDefinition {\n\t/**\n\t * Activate one plugin instance. Returning a cleanup binds resource ownership to\n\t * this specific activation, including overlapping hot-reload activations.\n\t */\n\tactivate(ctx: PluginContext): void | PluginActivationCleanup | Promise<void | PluginActivationCleanup>;\n\t/** Legacy module-level cleanup. Prefer an activation-scoped cleanup return value. */\n\tdeactivate?(): void | Promise<void>;\n}\n\nexport function definePlugin(plugin: PluginDefinition): PluginDefinition {\n\treturn plugin;\n}\n"]}
@@ -24,6 +24,22 @@ export type ConversationEvent = {
24
24
  } | {
25
25
  type: "message-updated";
26
26
  delta: string;
27
+ }
28
+ /**
29
+ * 模型还在生成这次调用,流式参数已解析出新的键。
30
+ *
31
+ * 用它做「agent 正在动某个目标」这类实时 UI:`edit` / `write` 真正耗时的是
32
+ * 生成参数(一整份文件正文),执行只要几毫秒,等 `tool-call-start` 到手时活
33
+ * 已经干完了。目标路径通常是参数里的第一个键,所以能提前几秒拿到。
34
+ *
35
+ * 天然是残缺的:后面的键还没到,正在生成的那个键也不含在内。要权威全量参数
36
+ * 请用 `tool-call-start`。同一次调用会随键数增长发多次,不会逐 token 发。
37
+ */
38
+ | {
39
+ type: "tool-call-args";
40
+ toolCallId: string;
41
+ toolName: string;
42
+ args: Record<string, unknown>;
27
43
  } | {
28
44
  type: "tool-call-start";
29
45
  toolCallId: string;
@@ -37,10 +53,58 @@ export type ConversationEvent = {
37
53
  } | {
38
54
  type: "conversation-changed";
39
55
  conversation: ConversationState;
56
+ } | {
57
+ type: "queue-changed";
58
+ queue: ConversationQueueState;
40
59
  };
60
+ /** 会话输入队列快照(ADR-0060):排队中的 prompt 与暂停状态。 */
61
+ export interface ConversationQueueState {
62
+ /** abort/error 后队列暂停;恢复由用户在宿主 UI 操作。 */
63
+ paused: boolean;
64
+ items: Array<{
65
+ id: string;
66
+ displayText: string;
67
+ }>;
68
+ }
69
+ /**
70
+ * sendPrompt 的回执(ADR-0060)。streaming 中发送不再静默排队:返回 `queued` 与
71
+ * 队列条目 id,插件可结合 `queue-changed` 事件呈现「已排队/已发出/被移除」状态。
72
+ */
73
+ export interface SendPromptResult {
74
+ status: "sent" | "queued" | "failed";
75
+ error?: {
76
+ message: string;
77
+ };
78
+ queueItemId?: string;
79
+ }
80
+ /** createSession 的可选项。 */
81
+ export interface CreateSessionOptions {
82
+ /**
83
+ * false 时会话照常创建并设为活跃,但宿主停留在当前路由(后台任务用)。
84
+ * 默认 true:与用户在新会话页手动发送的观感一致,发出去就进对话页。
85
+ */
86
+ navigate?: boolean;
87
+ }
41
88
  export interface PluginConversationApi {
42
- /** Send a prompt into the active conversation (renders as a user turn). */
43
- sendPrompt(text: string): Promise<void>;
89
+ /**
90
+ * Send a prompt into the active conversation (renders as a user turn).
91
+ * Streaming 中会进入会话队列并立即 resolve `{ status: "queued" }`;
92
+ * 队列在本轮自然停止点接力消费,abort/error 后暂停待用户处置。
93
+ *
94
+ * 没有活跃会话时抛错。插件若想在这种情况下也把话说出去,先 {@link createSession}。
95
+ */
96
+ sendPrompt(text: string): Promise<SendPromptResult>;
97
+ /**
98
+ * Create a conversation in `cwd` and make it active, resolving once it is ready
99
+ * to receive prompts — `await createSession(cwd)` 后可以直接 {@link sendPrompt}。
100
+ *
101
+ * 用于宿主此刻没有活跃会话的场景(例如用户停在新会话页,插件侧却已经产生了要
102
+ * 交给 agent 的工作)。已有活跃会话时照样新建一个,不做复用判断——要不要新开由
103
+ * 插件按自己的语义决定。
104
+ *
105
+ * 执行模式跟随宿主当前选择,插件不感知。
106
+ */
107
+ createSession(cwd: string, options?: CreateSessionOptions): Promise<ConversationState>;
44
108
  /** Fill the input bar without sending; the user can edit and send. */
45
109
  insertText(text: string): void;
46
110
  /** Abort the active conversation's current turn. */
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../src/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,iBAAiB;IACjC,wEAAwE;IACxE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,YAAY,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,iBAAiB,GAC1B;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,mBAAmB,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACjG;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GACjF;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,YAAY,EAAE,iBAAiB,CAAA;CAAE,CAAC;AAErE,MAAM,WAAW,qBAAqB;IACrC,2EAA2E;IAC3E,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,sEAAsE;IACtE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,oDAAoD;IACpD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB;;;;;;OAMG;IACH,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,UAAU,CAAC;CAC7D","sourcesContent":["import type { Disposable } from \"./disposable.js\";\n\nexport interface ConversationState {\n\t/** Active session runtimeId, or null when no conversation is active. */\n\tid: string | null;\n\tcwd: string | null;\n\tsessionPath: string | null;\n\tmodel: string | null;\n\tisStreaming: boolean;\n}\n\nexport interface ConversationMessage {\n\tid: string;\n\trole: \"user\" | \"assistant\" | \"compaction\";\n\ttext: string;\n\ttimestamp?: number;\n}\n\nexport type ConversationEvent =\n\t| { type: \"turn-start\" }\n\t| { type: \"turn-end\"; stopReason: string }\n\t| { type: \"message-added\"; message: ConversationMessage }\n\t| { type: \"message-updated\"; delta: string }\n\t| { type: \"tool-call-start\"; toolCallId: string; toolName: string; args?: Record<string, unknown> }\n\t| { type: \"tool-call-end\"; toolCallId: string; toolName: string; isError: boolean }\n\t| { type: \"conversation-changed\"; conversation: ConversationState };\n\nexport interface PluginConversationApi {\n\t/** Send a prompt into the active conversation (renders as a user turn). */\n\tsendPrompt(text: string): Promise<void>;\n\t/** Fill the input bar without sending; the user can edit and send. */\n\tinsertText(text: string): void;\n\t/** Abort the active conversation's current turn. */\n\tabort(): Promise<void>;\n\t/**\n\t * Subscribe to real-time conversation events. The listener is replayed one\n\t * `conversation-changed` with the current state right after subscribing (in a\n\t * microtask), so logic keyed off the active conversation — e.g. deciding\n\t * whether an activity tab belongs in the tab bar for this cwd — runs without\n\t * waiting for the next session switch.\n\t */\n\ton(listener: (event: ConversationEvent) => void): Disposable;\n}\n"]}
1
+ {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../src/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,WAAW,iBAAiB;IACjC,wEAAwE;IACxE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,YAAY,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,iBAAiB,GAC1B;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,mBAAmB,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAC5C;;;;;;;;;GASG;GACD;I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CAAC,CAAC;IACpD;;;;;;;;;OASG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACvF,sEAAsE;IACtE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,oDAAoD;IACpD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB;;;;;;OAMG;IACH,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,GAAG,UAAU,CAAC;CAC7D","sourcesContent":["import type { Disposable } from \"./disposable.js\";\n\nexport interface ConversationState {\n\t/** Active session runtimeId, or null when no conversation is active. */\n\tid: string | null;\n\tcwd: string | null;\n\tsessionPath: string | null;\n\tmodel: string | null;\n\tisStreaming: boolean;\n}\n\nexport interface ConversationMessage {\n\tid: string;\n\trole: \"user\" | \"assistant\" | \"compaction\";\n\ttext: string;\n\ttimestamp?: number;\n}\n\nexport type ConversationEvent =\n\t| { type: \"turn-start\" }\n\t| { type: \"turn-end\"; stopReason: string }\n\t| { type: \"message-added\"; message: ConversationMessage }\n\t| { type: \"message-updated\"; delta: string }\n\t/**\n\t * 模型还在生成这次调用,流式参数已解析出新的键。\n\t *\n\t * 用它做「agent 正在动某个目标」这类实时 UI:`edit` / `write` 真正耗时的是\n\t * 生成参数(一整份文件正文),执行只要几毫秒,等 `tool-call-start` 到手时活\n\t * 已经干完了。目标路径通常是参数里的第一个键,所以能提前几秒拿到。\n\t *\n\t * 天然是残缺的:后面的键还没到,正在生成的那个键也不含在内。要权威全量参数\n\t * 请用 `tool-call-start`。同一次调用会随键数增长发多次,不会逐 token 发。\n\t */\n\t| { type: \"tool-call-args\"; toolCallId: string; toolName: string; args: Record<string, unknown> }\n\t| { type: \"tool-call-start\"; toolCallId: string; toolName: string; args?: Record<string, unknown> }\n\t| { type: \"tool-call-end\"; toolCallId: string; toolName: string; isError: boolean }\n\t| { type: \"conversation-changed\"; conversation: ConversationState }\n\t| { type: \"queue-changed\"; queue: ConversationQueueState };\n\n/** 会话输入队列快照(ADR-0060):排队中的 prompt 与暂停状态。 */\nexport interface ConversationQueueState {\n\t/** abort/error 后队列暂停;恢复由用户在宿主 UI 操作。 */\n\tpaused: boolean;\n\titems: Array<{ id: string; displayText: string }>;\n}\n\n/**\n * sendPrompt 的回执(ADR-0060)。streaming 中发送不再静默排队:返回 `queued` 与\n * 队列条目 id,插件可结合 `queue-changed` 事件呈现「已排队/已发出/被移除」状态。\n */\nexport interface SendPromptResult {\n\tstatus: \"sent\" | \"queued\" | \"failed\";\n\terror?: { message: string };\n\tqueueItemId?: string;\n}\n\n/** createSession 的可选项。 */\nexport interface CreateSessionOptions {\n\t/**\n\t * false 时会话照常创建并设为活跃,但宿主停留在当前路由(后台任务用)。\n\t * 默认 true:与用户在新会话页手动发送的观感一致,发出去就进对话页。\n\t */\n\tnavigate?: boolean;\n}\n\nexport interface PluginConversationApi {\n\t/**\n\t * Send a prompt into the active conversation (renders as a user turn).\n\t * Streaming 中会进入会话队列并立即 resolve `{ status: \"queued\" }`;\n\t * 队列在本轮自然停止点接力消费,abort/error 后暂停待用户处置。\n\t *\n\t * 没有活跃会话时抛错。插件若想在这种情况下也把话说出去,先 {@link createSession}。\n\t */\n\tsendPrompt(text: string): Promise<SendPromptResult>;\n\t/**\n\t * Create a conversation in `cwd` and make it active, resolving once it is ready\n\t * to receive prompts — `await createSession(cwd)` 后可以直接 {@link sendPrompt}。\n\t *\n\t * 用于宿主此刻没有活跃会话的场景(例如用户停在新会话页,插件侧却已经产生了要\n\t * 交给 agent 的工作)。已有活跃会话时照样新建一个,不做复用判断——要不要新开由\n\t * 插件按自己的语义决定。\n\t *\n\t * 执行模式跟随宿主当前选择,插件不感知。\n\t */\n\tcreateSession(cwd: string, options?: CreateSessionOptions): Promise<ConversationState>;\n\t/** Fill the input bar without sending; the user can edit and send. */\n\tinsertText(text: string): void;\n\t/** Abort the active conversation's current turn. */\n\tabort(): Promise<void>;\n\t/**\n\t * Subscribe to real-time conversation events. The listener is replayed one\n\t * `conversation-changed` with the current state right after subscribing (in a\n\t * microtask), so logic keyed off the active conversation — e.g. deciding\n\t * whether an activity tab belongs in the tab bar for this cwd — runs without\n\t * waiting for the next session switch.\n\t */\n\ton(listener: (event: ConversationEvent) => void): Disposable;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"conversation.js","sourceRoot":"","sources":["../src/conversation.ts"],"names":[],"mappings":"","sourcesContent":["import type { Disposable } from \"./disposable.js\";\n\nexport interface ConversationState {\n\t/** Active session runtimeId, or null when no conversation is active. */\n\tid: string | null;\n\tcwd: string | null;\n\tsessionPath: string | null;\n\tmodel: string | null;\n\tisStreaming: boolean;\n}\n\nexport interface ConversationMessage {\n\tid: string;\n\trole: \"user\" | \"assistant\" | \"compaction\";\n\ttext: string;\n\ttimestamp?: number;\n}\n\nexport type ConversationEvent =\n\t| { type: \"turn-start\" }\n\t| { type: \"turn-end\"; stopReason: string }\n\t| { type: \"message-added\"; message: ConversationMessage }\n\t| { type: \"message-updated\"; delta: string }\n\t| { type: \"tool-call-start\"; toolCallId: string; toolName: string; args?: Record<string, unknown> }\n\t| { type: \"tool-call-end\"; toolCallId: string; toolName: string; isError: boolean }\n\t| { type: \"conversation-changed\"; conversation: ConversationState };\n\nexport interface PluginConversationApi {\n\t/** Send a prompt into the active conversation (renders as a user turn). */\n\tsendPrompt(text: string): Promise<void>;\n\t/** Fill the input bar without sending; the user can edit and send. */\n\tinsertText(text: string): void;\n\t/** Abort the active conversation's current turn. */\n\tabort(): Promise<void>;\n\t/**\n\t * Subscribe to real-time conversation events. The listener is replayed one\n\t * `conversation-changed` with the current state right after subscribing (in a\n\t * microtask), so logic keyed off the active conversation — e.g. deciding\n\t * whether an activity tab belongs in the tab bar for this cwd — runs without\n\t * waiting for the next session switch.\n\t */\n\ton(listener: (event: ConversationEvent) => void): Disposable;\n}\n"]}
1
+ {"version":3,"file":"conversation.js","sourceRoot":"","sources":["../src/conversation.ts"],"names":[],"mappings":"","sourcesContent":["import type { Disposable } from \"./disposable.js\";\n\nexport interface ConversationState {\n\t/** Active session runtimeId, or null when no conversation is active. */\n\tid: string | null;\n\tcwd: string | null;\n\tsessionPath: string | null;\n\tmodel: string | null;\n\tisStreaming: boolean;\n}\n\nexport interface ConversationMessage {\n\tid: string;\n\trole: \"user\" | \"assistant\" | \"compaction\";\n\ttext: string;\n\ttimestamp?: number;\n}\n\nexport type ConversationEvent =\n\t| { type: \"turn-start\" }\n\t| { type: \"turn-end\"; stopReason: string }\n\t| { type: \"message-added\"; message: ConversationMessage }\n\t| { type: \"message-updated\"; delta: string }\n\t/**\n\t * 模型还在生成这次调用,流式参数已解析出新的键。\n\t *\n\t * 用它做「agent 正在动某个目标」这类实时 UI:`edit` / `write` 真正耗时的是\n\t * 生成参数(一整份文件正文),执行只要几毫秒,等 `tool-call-start` 到手时活\n\t * 已经干完了。目标路径通常是参数里的第一个键,所以能提前几秒拿到。\n\t *\n\t * 天然是残缺的:后面的键还没到,正在生成的那个键也不含在内。要权威全量参数\n\t * 请用 `tool-call-start`。同一次调用会随键数增长发多次,不会逐 token 发。\n\t */\n\t| { type: \"tool-call-args\"; toolCallId: string; toolName: string; args: Record<string, unknown> }\n\t| { type: \"tool-call-start\"; toolCallId: string; toolName: string; args?: Record<string, unknown> }\n\t| { type: \"tool-call-end\"; toolCallId: string; toolName: string; isError: boolean }\n\t| { type: \"conversation-changed\"; conversation: ConversationState }\n\t| { type: \"queue-changed\"; queue: ConversationQueueState };\n\n/** 会话输入队列快照(ADR-0060):排队中的 prompt 与暂停状态。 */\nexport interface ConversationQueueState {\n\t/** abort/error 后队列暂停;恢复由用户在宿主 UI 操作。 */\n\tpaused: boolean;\n\titems: Array<{ id: string; displayText: string }>;\n}\n\n/**\n * sendPrompt 的回执(ADR-0060)。streaming 中发送不再静默排队:返回 `queued` 与\n * 队列条目 id,插件可结合 `queue-changed` 事件呈现「已排队/已发出/被移除」状态。\n */\nexport interface SendPromptResult {\n\tstatus: \"sent\" | \"queued\" | \"failed\";\n\terror?: { message: string };\n\tqueueItemId?: string;\n}\n\n/** createSession 的可选项。 */\nexport interface CreateSessionOptions {\n\t/**\n\t * false 时会话照常创建并设为活跃,但宿主停留在当前路由(后台任务用)。\n\t * 默认 true:与用户在新会话页手动发送的观感一致,发出去就进对话页。\n\t */\n\tnavigate?: boolean;\n}\n\nexport interface PluginConversationApi {\n\t/**\n\t * Send a prompt into the active conversation (renders as a user turn).\n\t * Streaming 中会进入会话队列并立即 resolve `{ status: \"queued\" }`;\n\t * 队列在本轮自然停止点接力消费,abort/error 后暂停待用户处置。\n\t *\n\t * 没有活跃会话时抛错。插件若想在这种情况下也把话说出去,先 {@link createSession}。\n\t */\n\tsendPrompt(text: string): Promise<SendPromptResult>;\n\t/**\n\t * Create a conversation in `cwd` and make it active, resolving once it is ready\n\t * to receive prompts — `await createSession(cwd)` 后可以直接 {@link sendPrompt}。\n\t *\n\t * 用于宿主此刻没有活跃会话的场景(例如用户停在新会话页,插件侧却已经产生了要\n\t * 交给 agent 的工作)。已有活跃会话时照样新建一个,不做复用判断——要不要新开由\n\t * 插件按自己的语义决定。\n\t *\n\t * 执行模式跟随宿主当前选择,插件不感知。\n\t */\n\tcreateSession(cwd: string, options?: CreateSessionOptions): Promise<ConversationState>;\n\t/** Fill the input bar without sending; the user can edit and send. */\n\tinsertText(text: string): void;\n\t/** Abort the active conversation's current turn. */\n\tabort(): Promise<void>;\n\t/**\n\t * Subscribe to real-time conversation events. The listener is replayed one\n\t * `conversation-changed` with the current state right after subscribing (in a\n\t * microtask), so logic keyed off the active conversation — e.g. deciding\n\t * whether an activity tab belongs in the tab bar for this cwd — runs without\n\t * waiting for the next session switch.\n\t */\n\ton(listener: (event: ConversationEvent) => void): Disposable;\n}\n"]}