@punica/editor 1.3.6 → 1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punica/editor",
3
- "version": "1.3.6",
3
+ "version": "1.4.0",
4
4
  "description": "Punica Editor",
5
5
  "private": false,
6
6
  "type": "module",
package/types/index.d.ts CHANGED
@@ -39,6 +39,7 @@
39
39
  /// <reference path="punica.module.runtime.lifecycle.d.ts" />
40
40
  /// <reference path="punica.module.runtime.capabilities.d.ts" />
41
41
  /// <reference path="punica.module.runtime.harness.d.ts" />
42
+ /// <reference path="punica.module.runtime.debug.d.ts" />
42
43
  /// <reference path="punica.module.runtime.api.d.ts" />
43
44
  /// <reference path="punica.module.flow.d.ts" />
44
45
  /// <reference path="punica.module.flow.primitives.d.ts" />
@@ -5,6 +5,7 @@
5
5
  /// <reference path="punica.module.runtime.modelRuntimes.d.ts" />
6
6
  /// <reference path="punica.module.runtime.inference.d.ts" />
7
7
  /// <reference path="punica.module.runtime.vectors.d.ts" />
8
+ /// <reference path="punica.module.runtime.debug.d.ts" />
8
9
 
9
10
  declare module 'punica' {
10
11
  export namespace runtime {
@@ -148,6 +149,15 @@ declare module 'punica' {
148
149
  */
149
150
  capabilities: CapabilitiesApi;
150
151
 
152
+ /**
153
+ * Message-oriented transport to DAP debug adapters. Hosts with
154
+ * local process access (Electron) inject a concrete provider;
155
+ * absent on hosts without one (browser). Extensions should
156
+ * feature-detect via `punica.runtime.debug.list()` failure or the
157
+ * host platform before offering debug UI.
158
+ */
159
+ debug: debug.DebugAdapterApi;
160
+
151
161
  /**
152
162
  * Host wiring helpers for registering providers.
153
163
  * These methods are always available at runtime for extension convenience.
@@ -164,6 +174,7 @@ declare module 'punica' {
164
174
  setSearchProvider: (provider: SearchApi) => void;
165
175
  setWorkspaceProvider: (provider: WorkspaceApi) => void;
166
176
  setTerminalProvider: (provider: TerminalApi) => void;
177
+ setDebugProvider: (provider: debug.DebugAdapterApi) => void;
167
178
  setVcsProvider: (provider: VcsApi) => void;
168
179
  setResourcesProvider: (provider: ResourcesApi) => void;
169
180
  setTasksProvider: (provider: TaskRunnerApi) => void;
@@ -0,0 +1,91 @@
1
+ declare module 'punica' {
2
+ export namespace runtime {
3
+ export namespace debug {
4
+ /**
5
+ * How to reach a DAP (Debug Adapter Protocol) adapter. The host owns
6
+ * the transport (process lifetime, sockets, Content-Length framing)
7
+ * and exchanges parsed protocol messages with extensions.
8
+ */
9
+ export type DebugAdapterTransport =
10
+ /**
11
+ * Spawn the adapter and speak DAP over piped stdio
12
+ * (e.g. `python -m debugpy.adapter`).
13
+ */
14
+ | {
15
+ kind: 'stdio';
16
+ command: string;
17
+ args?: string[];
18
+ cwd?: string;
19
+ env?: Record<string, string>;
20
+ }
21
+ /**
22
+ * Spawn an adapter that listens on TCP, then connect to it
23
+ * (e.g. `dlv dap --listen=…`, js-debug's dapDebugServer). When
24
+ * `port` is absent the host picks a free port and substitutes the
25
+ * literal token `${port}` in `args` before spawning.
26
+ */
27
+ | {
28
+ kind: 'server';
29
+ command: string;
30
+ args?: string[];
31
+ cwd?: string;
32
+ env?: Record<string, string>;
33
+ port?: number;
34
+ host?: string;
35
+ connectTimeoutMs?: number;
36
+ }
37
+ /**
38
+ * Connect to an already-running adapter (attach scenarios, or a
39
+ * second connection for js-debug child sessions).
40
+ */
41
+ | { kind: 'tcp'; host?: string; port: number };
42
+
43
+ export interface DebugAdapterSessionInfo {
44
+ id: string;
45
+ transport: DebugAdapterTransport['kind'];
46
+ /** Adapter process pid (stdio/server transports). */
47
+ pid?: number;
48
+ /** Resolved TCP port (server/tcp transports). */
49
+ port?: number;
50
+ createdAt: number;
51
+ }
52
+
53
+ /**
54
+ * Raw DAP ProtocolMessage. The host does framing only — no DAP
55
+ * semantics; request/response correlation and event handling live
56
+ * in the extension's DAP client.
57
+ */
58
+ export interface ProtocolMessage {
59
+ seq: number;
60
+ type: 'request' | 'response' | 'event' | string;
61
+ [key: string]: unknown;
62
+ }
63
+
64
+ /**
65
+ * Message-oriented debug adapter transport API. Hosts provide a
66
+ * concrete implementation (Electron: child_process + net; a future
67
+ * browser host: WebSocket bridge) and extensions only depend on
68
+ * this abstraction.
69
+ */
70
+ export interface DebugAdapterApi {
71
+ start(
72
+ transport: DebugAdapterTransport
73
+ ): Promise<DebugAdapterSessionInfo>;
74
+ send(id: string, message: ProtocolMessage): void;
75
+ onMessage(
76
+ id: string,
77
+ listener: (message: ProtocolMessage) => void
78
+ ): () => void;
79
+ /** Adapter's own stderr (diagnostics — NOT debuggee output). */
80
+ onStderr(id: string, listener: (chunk: string) => void): () => void;
81
+ onExit(
82
+ id: string,
83
+ listener: (code: number | null, signal?: string) => void
84
+ ): () => void;
85
+ /** Close the connection and terminate the adapter process. */
86
+ stop(id: string): Promise<void>;
87
+ list(): Promise<DebugAdapterSessionInfo[]>;
88
+ }
89
+ }
90
+ }
91
+ }