@kuafucloud/developer 0.0.0-stage → 0.1.9-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/admin/admin/extension.zip +0 -0
  2. package/dist/admin/index.d.ts +2 -0
  3. package/dist/admin/index.js +2 -0
  4. package/dist/admin/meta/admin.json +59 -0
  5. package/dist/admin/meta/extension-manifest.json +794 -0
  6. package/dist/facade/index.d.ts +241 -0
  7. package/dist/facade/index.js +11 -0
  8. package/dist/monitor/runtime-services/app/index.js +660 -0
  9. package/dist/monitor/runtime-services/app/service-module.config.json +16 -0
  10. package/dist/monitor/runtime-services/app-simulator/index.js +648 -0
  11. package/dist/monitor/runtime-services/app-simulator/service-module.config.json +12 -0
  12. package/dist/monitor/runtime-services/mini-program/index.js +653 -0
  13. package/dist/monitor/runtime-services/mini-program/service-module.config.json +12 -0
  14. package/dist/monitor/runtime-services/mini-program-simulator/index.js +648 -0
  15. package/dist/monitor/runtime-services/mini-program-simulator/service-module.config.json +12 -0
  16. package/dist/monitor/runtime-services/site/index.js +648 -0
  17. package/dist/monitor/runtime-services/site/service-module.config.json +12 -0
  18. package/dist/public/monitor/index.js +6 -0
  19. package/dist/public/monitor/runtime-services/core/index.js +552 -0
  20. package/dist/public/realtime/host/index.js +4550 -0
  21. package/dist/public/realtime/index.js +3180 -0
  22. package/dist/public/realtime/native-preview-http/index.js +148 -0
  23. package/dist/simulation/artifact/meta/database.json +43 -0
  24. package/dist/simulation/artifact/meta/manifest.json +170 -0
  25. package/dist/simulation/artifact/meta/runtime-meta.json +28 -0
  26. package/dist/simulation/artifact/meta/schema.json +41 -0
  27. package/dist/simulation/artifact/server/worker/index.js +39 -0
  28. package/dist/simulation/artifact/server/worker/monitoring-contract.json +7 -0
  29. package/dist/simulation/index.d.ts +1 -0
  30. package/dist/simulation/index.js +1 -0
  31. package/dist/types/monitor/client/index.d.ts +4 -0
  32. package/dist/types/monitor/runtime-services/app/index.d.ts +4 -0
  33. package/dist/types/monitor/runtime-services/app-simulator/index.d.ts +4 -0
  34. package/dist/types/monitor/runtime-services/core/index.d.ts +1 -0
  35. package/dist/types/monitor/runtime-services/core/monitor-browser-service.d.ts +25 -0
  36. package/dist/types/monitor/runtime-services/core/monitor-mini-program-service.d.ts +25 -0
  37. package/dist/types/monitor/runtime-services/core/monitor-native-service.d.ts +25 -0
  38. package/dist/types/monitor/runtime-services/core/monitor-service.d.ts +35 -0
  39. package/dist/types/monitor/runtime-services/mini-program/index.d.ts +4 -0
  40. package/dist/types/monitor/runtime-services/mini-program-simulator/index.d.ts +4 -0
  41. package/dist/types/monitor/runtime-services/site/index.d.ts +4 -0
  42. package/dist/types/realtime/agent-chat-model.d.ts +216 -0
  43. package/dist/types/realtime/agent-question.d.ts +24 -0
  44. package/dist/types/realtime/developer-realtime.d.ts +158 -0
  45. package/dist/types/realtime/host/index.d.ts +28 -0
  46. package/dist/types/realtime/host-channels.d.ts +52 -0
  47. package/dist/types/realtime/host-connection.d.ts +131 -0
  48. package/dist/types/realtime/native-preview-http/index.d.ts +6 -0
  49. package/dist/types/realtime/native-source-codec.d.ts +21 -0
  50. package/dist/types/realtime/payload-fragments.d.ts +21 -0
  51. package/dist/types/realtime/preview-device.d.ts +9 -0
  52. package/dist/types/realtime/product-preview-cache.d.ts +69 -0
  53. package/dist/types/realtime/product-preview-clients.d.ts +7 -0
  54. package/dist/types/realtime/product-preview-host.d.ts +50 -0
  55. package/dist/types/realtime/product-preview-http-runtime.d.ts +9 -0
  56. package/dist/types/realtime/product-preview-protocol.d.ts +167 -0
  57. package/dist/types/realtime/product-preview-socket-source.d.ts +24 -0
  58. package/dist/types/realtime/product-preview-viewer-http.d.ts +41 -0
  59. package/dist/types/realtime/product-preview-viewer.d.ts +44 -0
  60. package/dist/types/realtime/project-workspaces.d.ts +43 -0
  61. package/dist/types/realtime/viewer/index.d.ts +22 -0
  62. package/dist/types/realtime/websocket-transport.d.ts +12 -0
  63. package/dist/types/realtime/workspace-agent-history.d.ts +46 -0
  64. package/dist/types/realtime/workspace-agent-input.d.ts +38 -0
  65. package/dist/types/realtime/workspace-agent-member.d.ts +15 -0
  66. package/dist/types/realtime/workspace-agent-view.d.ts +22 -0
  67. package/dist/types/realtime/workspace-cache-store.d.ts +38 -0
  68. package/dist/types/realtime/workspace-cache.d.ts +72 -0
  69. package/dist/types/realtime/workspace-chat-stream.d.ts +6 -0
  70. package/dist/types/realtime/workspace-file-view.d.ts +9 -0
  71. package/dist/types/realtime/workspace-status-view.d.ts +8 -0
  72. package/dist/types/realtime/workspace-viewer.d.ts +100 -0
  73. package/extension-manifest.json +457 -0
  74. package/package.json +112 -4
  75. package/README.md +0 -3
@@ -0,0 +1,148 @@
1
+ // index.ts
2
+ import { ReadableStream as PonyfillReadableStream } from "web-streams-polyfill";
3
+ function createNativeProductPreviewHttpRuntime(input = {}) {
4
+ const RequestConstructor = input.Request ?? globalThis.Request;
5
+ const HeadersConstructor = input.Headers ?? globalThis.Headers;
6
+ const Streams = PonyfillReadableStream;
7
+ class PreviewResponse {
8
+ headers;
9
+ status;
10
+ statusText;
11
+ url = "";
12
+ redirected = false;
13
+ type = "default";
14
+ [Symbol.toStringTag] = "Response";
15
+ stream;
16
+ used = false;
17
+ constructor(body = null, init = {}) {
18
+ this.status = init.status ?? 200;
19
+ this.statusText = init.statusText ?? "";
20
+ this.headers = new HeadersConstructor(init.headers);
21
+ if (!Number.isInteger(this.status) || this.status < 200 || this.status > 599) throw new RangeError("developer.preview_response_status_invalid");
22
+ if (body !== null && [204, 205, 304].includes(this.status)) throw new TypeError("developer.preview_response_body_forbidden");
23
+ if (body === null) this.stream = null;
24
+ else if (isStream(body)) this.stream = this.track(body);
25
+ else {
26
+ const bytes = typeof body === "string" ? new TextEncoder().encode(body) : body instanceof ArrayBuffer ? new Uint8Array(body) : ArrayBuffer.isView(body) ? new Uint8Array(body.buffer, body.byteOffset, body.byteLength) : void 0;
27
+ if (!bytes) throw new TypeError("developer.preview_body_type_unsupported");
28
+ const copy = new Uint8Array(bytes);
29
+ this.stream = this.track(new Streams({ start(controller) {
30
+ controller.enqueue(copy);
31
+ controller.close();
32
+ } }));
33
+ }
34
+ }
35
+ get ok() {
36
+ return this.status >= 200 && this.status < 300;
37
+ }
38
+ get body() {
39
+ return this.stream;
40
+ }
41
+ get bodyUsed() {
42
+ return this.used;
43
+ }
44
+ async arrayBuffer() {
45
+ if (this.used || this.stream?.locked) throw new TypeError("developer.preview_body_used");
46
+ this.used = true;
47
+ if (!this.stream) return new ArrayBuffer(0);
48
+ const reader = this.stream.getReader(), chunks = [];
49
+ let length = 0;
50
+ try {
51
+ for (; ; ) {
52
+ const next = await reader.read();
53
+ if (next.done) break;
54
+ if (!(next.value instanceof Uint8Array)) throw new TypeError("developer.preview_body_chunk_invalid");
55
+ chunks.push(next.value);
56
+ length += next.value.byteLength;
57
+ }
58
+ } finally {
59
+ reader.releaseLock();
60
+ }
61
+ const result = new Uint8Array(length);
62
+ let offset = 0;
63
+ for (const chunk of chunks) {
64
+ result.set(chunk, offset);
65
+ offset += chunk.byteLength;
66
+ }
67
+ return result.buffer;
68
+ }
69
+ async bytes() {
70
+ return new Uint8Array(await this.arrayBuffer());
71
+ }
72
+ async text() {
73
+ return new TextDecoder().decode(await this.arrayBuffer());
74
+ }
75
+ async json() {
76
+ return JSON.parse(await this.text());
77
+ }
78
+ clone() {
79
+ if (this.used || this.stream?.locked) throw new TypeError("developer.preview_body_used");
80
+ let branch = null;
81
+ if (this.stream) {
82
+ const branches = this.stream.tee();
83
+ this.stream = this.track(branches[0]);
84
+ branch = branches[1];
85
+ }
86
+ return new PreviewResponse(branch, { status: this.status, statusText: this.statusText, headers: this.headers });
87
+ }
88
+ async blob() {
89
+ throw new Error("developer.preview_body_method_unsupported");
90
+ }
91
+ async formData() {
92
+ throw new Error("developer.preview_body_method_unsupported");
93
+ }
94
+ track(stream) {
95
+ const getReader = stream.getReader.bind(stream), cancel = stream.cancel.bind(stream);
96
+ Object.defineProperty(stream, "getReader", { configurable: true, value: (options) => {
97
+ if (options?.mode) throw new Error("developer.preview_body_reader_unsupported");
98
+ const reader = getReader(), read = reader.read.bind(reader), cancelReader = reader.cancel.bind(reader);
99
+ reader.read = () => {
100
+ this.used = true;
101
+ return read();
102
+ };
103
+ reader.cancel = (reason) => {
104
+ this.used = true;
105
+ return cancelReader(reason);
106
+ };
107
+ return reader;
108
+ } });
109
+ Object.defineProperty(stream, "cancel", { configurable: true, value: (reason) => {
110
+ this.used = true;
111
+ return cancel(reason);
112
+ } });
113
+ return stream;
114
+ }
115
+ }
116
+ return {
117
+ Request: RequestConstructor,
118
+ Response: PreviewResponse,
119
+ ReadableStream: Streams,
120
+ requestBody(request) {
121
+ if (request.body) return request.body;
122
+ if (request.method === "GET" || request.method === "HEAD") return null;
123
+ let cancelled = false;
124
+ return new Streams({
125
+ async start(controller) {
126
+ try {
127
+ const bytes = new Uint8Array(await request.arrayBuffer());
128
+ if (!cancelled) {
129
+ if (bytes.byteLength) controller.enqueue(bytes);
130
+ controller.close();
131
+ }
132
+ } catch (error) {
133
+ if (!cancelled) controller.error(error);
134
+ }
135
+ },
136
+ cancel() {
137
+ cancelled = true;
138
+ }
139
+ });
140
+ }
141
+ };
142
+ }
143
+ function isStream(value) {
144
+ return !!value && typeof value.getReader === "function";
145
+ }
146
+ export {
147
+ createNativeProductPreviewHttpRuntime
148
+ };
@@ -0,0 +1,43 @@
1
+ {
2
+ "tables": {
3
+ "PreviewMonitorDelivery": {
4
+ "tableName": "developer_default_PreviewMonitorDelivery",
5
+ "indexes": [],
6
+ "primaryKey": [],
7
+ "columns": {
8
+ "deliveryId": {
9
+ "name": "delivery_id",
10
+ "dataType": "string",
11
+ "columnType": "SQLiteText",
12
+ "notNull": true,
13
+ "hasDefault": false,
14
+ "primaryKey": true,
15
+ "autoIncrement": false,
16
+ "unique": false
17
+ },
18
+ "receivedAt": {
19
+ "name": "received_at",
20
+ "dataType": "string",
21
+ "columnType": "SQLiteText",
22
+ "notNull": true,
23
+ "hasDefault": false,
24
+ "primaryKey": false,
25
+ "autoIncrement": false,
26
+ "unique": false
27
+ },
28
+ "payload": {
29
+ "name": "payload",
30
+ "dataType": "string",
31
+ "columnType": "SQLiteText",
32
+ "notNull": true,
33
+ "hasDefault": false,
34
+ "primaryKey": false,
35
+ "autoIncrement": false,
36
+ "unique": false
37
+ }
38
+ }
39
+ }
40
+ },
41
+ "bootstrap": [],
42
+ "sqliteMigrations": []
43
+ }
@@ -0,0 +1,170 @@
1
+ {
2
+ "serverImplementation": "simulation",
3
+ "schemaVersion": 1,
4
+ "type": "extension",
5
+ "extensionId": "developer",
6
+ "version": "0.1.9-alpha.3",
7
+ "name": "开发者",
8
+ "displayName": "开发者",
9
+ "icon": "IconTool",
10
+ "description": "管理仓库分支、产品发版、流量与监控。",
11
+ "updatePolicy": "optional",
12
+ "e2e": {
13
+ "hostProfile": "browser",
14
+ "requiredHostCapabilities": []
15
+ },
16
+ "runtimeCapabilities": {
17
+ "hostProfile": "browser",
18
+ "requiredHostCapabilities": []
19
+ },
20
+ "capabilities": {
21
+ "server": true,
22
+ "admin": false,
23
+ "database": true,
24
+ "permissions": false,
25
+ "events": false,
26
+ "tasks": false,
27
+ "hooks": false,
28
+ "plugins": false,
29
+ "migrations": false
30
+ },
31
+ "outputs": {
32
+ "distDir": ".",
33
+ "manifest": "meta/manifest.json",
34
+ "runtimeMeta": "meta/runtime-meta.json",
35
+ "schema": "meta/schema.json",
36
+ "database": "meta/database.json"
37
+ },
38
+ "server": {
39
+ "mountPath": "/api/developer",
40
+ "apiCount": 7
41
+ },
42
+ "database": {
43
+ "schema": {
44
+ "PreviewMonitorDelivery": {
45
+ "tableName": "developer_default_PreviewMonitorDelivery",
46
+ "indexes": [],
47
+ "primaryKey": [],
48
+ "columns": {
49
+ "deliveryId": {
50
+ "name": "delivery_id",
51
+ "dataType": "string",
52
+ "columnType": "SQLiteText",
53
+ "notNull": true,
54
+ "hasDefault": false,
55
+ "primaryKey": true,
56
+ "autoIncrement": false,
57
+ "unique": false
58
+ },
59
+ "receivedAt": {
60
+ "name": "received_at",
61
+ "dataType": "string",
62
+ "columnType": "SQLiteText",
63
+ "notNull": true,
64
+ "hasDefault": false,
65
+ "primaryKey": false,
66
+ "autoIncrement": false,
67
+ "unique": false
68
+ },
69
+ "payload": {
70
+ "name": "payload",
71
+ "dataType": "string",
72
+ "columnType": "SQLiteText",
73
+ "notNull": true,
74
+ "hasDefault": false,
75
+ "primaryKey": false,
76
+ "autoIncrement": false,
77
+ "unique": false
78
+ }
79
+ }
80
+ }
81
+ }
82
+ },
83
+ "datasets": {},
84
+ "adminOperations": [
85
+ {
86
+ "operationId": "op.developer.monitoring.preview.delivery.114f5586c45733ea",
87
+ "targetExtensionId": "developer",
88
+ "method": "GET",
89
+ "pathTemplate": "/monitoring/preview/delivery",
90
+ "authScope": "admin",
91
+ "kind": "query",
92
+ "requestSchema": "op.developer.monitoring.preview.delivery.114f5586c45733ea.request.v1",
93
+ "responseSchema": "op.developer.monitoring.preview.delivery.114f5586c45733ea.response.v1",
94
+ "retryPolicy": "safe-read-once",
95
+ "allowedCallerExtensions": [
96
+ "*"
97
+ ]
98
+ },
99
+ {
100
+ "operationId": "op.developer.monitoring.catalog.2c1de816f738658a",
101
+ "targetExtensionId": "developer",
102
+ "method": "GET",
103
+ "pathTemplate": "/monitoring/catalog",
104
+ "authScope": "admin",
105
+ "kind": "query",
106
+ "requestSchema": "op.developer.monitoring.catalog.2c1de816f738658a.request.v1",
107
+ "responseSchema": "op.developer.monitoring.catalog.2c1de816f738658a.response.v1",
108
+ "retryPolicy": "safe-read-once",
109
+ "allowedCallerExtensions": [
110
+ "*"
111
+ ]
112
+ },
113
+ {
114
+ "operationId": "op.developer.monitoring.overview.query.c21c5eefd2ed03db",
115
+ "targetExtensionId": "developer",
116
+ "method": "POST",
117
+ "pathTemplate": "/monitoring/overview/query",
118
+ "authScope": "admin",
119
+ "kind": "mutation",
120
+ "requestSchema": "op.developer.monitoring.overview.query.c21c5eefd2ed03db.request.v1",
121
+ "responseSchema": "op.developer.monitoring.overview.query.c21c5eefd2ed03db.response.v1",
122
+ "retryPolicy": "never",
123
+ "allowedCallerExtensions": [
124
+ "*"
125
+ ]
126
+ },
127
+ {
128
+ "operationId": "op.developer.develop.product.traffic.get.c42042e845d53e8c",
129
+ "targetExtensionId": "developer",
130
+ "method": "GET",
131
+ "pathTemplate": "/develop/product/traffic/get",
132
+ "authScope": "admin",
133
+ "kind": "query",
134
+ "requestSchema": "op.developer.develop.product.traffic.get.c42042e845d53e8c.request.v1",
135
+ "responseSchema": "op.developer.develop.product.traffic.get.c42042e845d53e8c.response.v1",
136
+ "retryPolicy": "safe-read-once",
137
+ "allowedCallerExtensions": [
138
+ "*"
139
+ ]
140
+ },
141
+ {
142
+ "operationId": "op.developer.develop.repository.list.429c3fbbe607efd7",
143
+ "targetExtensionId": "developer",
144
+ "method": "GET",
145
+ "pathTemplate": "/develop/repository/list",
146
+ "authScope": "admin",
147
+ "kind": "query",
148
+ "requestSchema": "op.developer.develop.repository.list.429c3fbbe607efd7.request.v1",
149
+ "responseSchema": "op.developer.develop.repository.list.429c3fbbe607efd7.response.v1",
150
+ "retryPolicy": "safe-read-once",
151
+ "allowedCallerExtensions": [
152
+ "*"
153
+ ]
154
+ },
155
+ {
156
+ "operationId": "op.developer.develop.release.list.57a3ac2003d9dc34",
157
+ "targetExtensionId": "developer",
158
+ "method": "GET",
159
+ "pathTemplate": "/develop/release/list",
160
+ "authScope": "admin",
161
+ "kind": "query",
162
+ "requestSchema": "op.developer.develop.release.list.57a3ac2003d9dc34.request.v1",
163
+ "responseSchema": "op.developer.develop.release.list.57a3ac2003d9dc34.response.v1",
164
+ "retryPolicy": "safe-read-once",
165
+ "allowedCallerExtensions": [
166
+ "*"
167
+ ]
168
+ }
169
+ ]
170
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "datasets": {},
3
+ "schemaVersion": 1,
4
+ "extensionId": "developer",
5
+ "version": "0.1.9-alpha.3",
6
+ "mountPath": "/api/developer",
7
+ "capabilities": {
8
+ "server": true,
9
+ "admin": false,
10
+ "database": true,
11
+ "permissions": false,
12
+ "events": false,
13
+ "tasks": false,
14
+ "hooks": false,
15
+ "plugins": false,
16
+ "migrations": false
17
+ },
18
+ "entrypoints": {
19
+ "server": "server/worker/index.js"
20
+ },
21
+ "outputs": {
22
+ "distDir": ".",
23
+ "manifest": "meta/manifest.json",
24
+ "runtimeMeta": "meta/runtime-meta.json",
25
+ "schema": "meta/schema.json",
26
+ "database": "meta/database.json"
27
+ }
28
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "tables": {
3
+ "PreviewMonitorDelivery": {
4
+ "tableName": "developer_default_PreviewMonitorDelivery",
5
+ "indexes": [],
6
+ "primaryKey": [],
7
+ "columns": {
8
+ "deliveryId": {
9
+ "name": "delivery_id",
10
+ "dataType": "string",
11
+ "columnType": "SQLiteText",
12
+ "notNull": true,
13
+ "hasDefault": false,
14
+ "primaryKey": true,
15
+ "autoIncrement": false,
16
+ "unique": false
17
+ },
18
+ "receivedAt": {
19
+ "name": "received_at",
20
+ "dataType": "string",
21
+ "columnType": "SQLiteText",
22
+ "notNull": true,
23
+ "hasDefault": false,
24
+ "primaryKey": false,
25
+ "autoIncrement": false,
26
+ "unique": false
27
+ },
28
+ "payload": {
29
+ "name": "payload",
30
+ "dataType": "string",
31
+ "columnType": "SQLiteText",
32
+ "notNull": true,
33
+ "hasDefault": false,
34
+ "primaryKey": false,
35
+ "autoIncrement": false,
36
+ "unique": false
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }