@kaoruisaac/pedelec 0.4.11 → 0.4.12

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/README.md CHANGED
@@ -355,7 +355,7 @@ const value = JSON.parse(result.stdout);
355
355
 
356
356
  The default timeout is 60 seconds; `timeoutMs` must be a positive integer. The return value is the raw `DenoRunOutput` shape: `exitCode`, `stdout`, `stderr`, `stdoutTruncated`, and `stderrTruncated`. A non-zero `exitCode` still resolves normally. The application parses `stdout` when it wants a function-like return value. Check truncation flags before relying on output; an oversized browser response fails with `WORKSPACE_RUN_OUTPUT_TOO_LARGE`.
357
357
 
358
- `workspace.run()` has read and write access to the Workspace, but no network, host environment, subprocess execution, FFI, or `sys` permission. The existing no-remote, cached-only, and no-npm runtime restrictions still apply. This is a direct deterministic capability for an approved Web application to read and modify the opened Workspace; it is not unrestricted host code execution and is not mediated by an Agent.
358
+ By default, `workspace.run()` has read and write access to the Workspace, but no network, host environment, subprocess execution, FFI, or `sys` permission. In Sandbox, the existing no-remote, cached-only, and no-npm runtime restrictions still apply. This default mode is a direct capability for an approved Web application and is not mediated by an Agent.
359
359
 
360
360
  Multiple Sessions, Agent/provider operations, and `workspace.run()` executions may operate concurrently in the same Workspace. A second turn on the same Session is still rejected while that Session is busy. Pedelec does not provide filesystem-level locking, snapshots, transactions, or conflict resolution between concurrent Workspace actors. Applications are responsible for coordinating shared file access when required.
361
361
 
@@ -482,10 +482,12 @@ const full = await privileged.createSession({ runtimeFullAccess: true });
482
482
 
483
483
  Review the Extension permissions before creating sessions. An Instance requesting Full Access cannot create any session with only the Agent Sessions grant, including a Sandbox session. A standard Instance cannot request a Full Access session, even if another Instance on the same Origin has permission. Ordinary Origin approval never substitutes for the Full Access grant; the Popup offers an additional permission review with Full Access unchecked by default. `getApprovalStatus()` only reads status and does not open that review.
484
484
 
485
- The Thread mode is fixed at creation and preserved on resume. Instances on the same Origin and Threads in the same Workspace retain their own requested modes. `workspace.run()` always stays Sandbox, and Provider sandbox settings are unchanged. Full Access changes the TypeScript Runtime's OS permissions only. Revoking the Full Access grant rejects subsequent high-privilege execution and attempts to cancel affected running processes; unrelated Origins retain their grants.
485
+ The Thread mode is fixed at creation and preserved on resume. Instances on the same Origin and Threads in the same Workspace retain their own requested modes. `workspace.run()` independently defaults to Sandbox. With a Full Instance and both Extension grants, `workspace.run(script, { runtimeFullAccess: true })` selects Full Access for that run only; no Session is required. Provider sandbox settings are unchanged. Full Access changes the TypeScript Runtime's OS permissions only. Revoking the Full Access grant rejects subsequent high-privilege execution and attempts to cancel affected running processes; unrelated Origins retain their grants.
486
486
 
487
487
  Upgrade the SDK, Extension, and Desktop together when using Full Access. Missing mode acknowledgment is an error, never a successful downgrade. See [Error Codes](https://kaoruisaac.github.io/pedelec/reference/error-codes/) for authorization and protocol failures.
488
488
 
489
489
  ## Runtime compatibility
490
490
 
491
491
  New code uses `defineRuntimeModule`, `RuntimeModuleDefinition`, and `runtimeModules`. `defineDenoModule`, `DenoModuleDefinition`, and `denoModules` remain supported deprecated aliases. Never pass both module fields in one options object (`INVALID_INPUT`). `pedelec-ts-runtime --thread-id <id> run scripts/task.ts` and stdin `run -` are the standard CLI; `pedelec-deno` is a legal legacy alias with identical behavior. Actual `Deno.*` APIs, `DENO_DIR`, Deno flags, and `DENO_*` error codes retain their existing meanings.
492
+
493
+ A Full Access Workspace run uses the same host permissions as a Full Access Session, including network, host environment, subprocesses and files outside the Workspace. Revoking Full Runtime Access cancels affected running Full Access executions. A standard Instance cannot request it. Older peers may omit the Sandbox acknowledgment, but a Full Access request fails unless the connected Extension and Desktop confirm the requested mode.
package/dist/index.d.ts CHANGED
@@ -138,6 +138,7 @@ export type SerializableSkillsManifest = {
138
138
  };
139
139
  export type WorkspaceRunOptions = {
140
140
  timeoutMs?: number;
141
+ runtimeFullAccess?: boolean;
141
142
  runtimeModules?: readonly RuntimeModuleDefinition[];
142
143
  /** @deprecated Use runtimeModules. */
143
144
  denoModules?: readonly DenoModuleDefinition[];
@@ -403,6 +404,8 @@ export declare class Pedelec {
403
404
  private readonly channelId;
404
405
  private readonly bridgeTimeoutMs;
405
406
  private readonly runtimeFullAccess;
407
+ /** @internal */
408
+ get runtimeFullAccessInternal(): boolean;
406
409
  private readonly pendingRequests;
407
410
  private readonly sessions;
408
411
  private readonly lastSeqBySession;
package/dist/index.js CHANGED
@@ -493,7 +493,12 @@ export class PedelecWorkspace {
493
493
  return Promise.reject(makeError("INVALID_INPUT", "timeoutMs must be a positive integer"));
494
494
  }
495
495
  let modules;
496
+ let runtimeFullAccess;
496
497
  try {
498
+ runtimeFullAccess = normalizeRuntimeFullAccess(options.runtimeFullAccess);
499
+ if (runtimeFullAccess && !this.client.runtimeFullAccessInternal) {
500
+ throw makeError("INVALID_INPUT", "Workspace runtimeFullAccess requires an Instance with runtimeFullAccess enabled");
501
+ }
497
502
  modules = normalizeWorkspaceDenoModules(resolveRuntimeModules(options));
498
503
  }
499
504
  catch (error) {
@@ -518,9 +523,10 @@ export class PedelecWorkspace {
518
523
  return this.client.requestWithOptions("workspace_run", {
519
524
  workspaceId: this.workspaceId,
520
525
  script,
526
+ ...(options.runtimeFullAccess === undefined ? {} : { runtimeFullAccess }),
521
527
  ...(timeoutMs === undefined ? {} : { timeoutMs }),
522
528
  ...(modules.length === 0 ? {} : { denoModules: modules.map(({ name }) => name) }),
523
- }, { timeoutMs: null }).then(normalizeWorkspaceRunResponse);
529
+ }, { timeoutMs: null }).then((value) => normalizeWorkspaceRunResponse(value, runtimeFullAccess));
524
530
  };
525
531
  return run();
526
532
  }
@@ -551,6 +557,8 @@ export class Pedelec {
551
557
  channelId;
552
558
  bridgeTimeoutMs;
553
559
  runtimeFullAccess;
560
+ /** @internal */
561
+ get runtimeFullAccessInternal() { return this.runtimeFullAccess; }
554
562
  pendingRequests = new Map();
555
563
  sessions = new Map();
556
564
  lastSeqBySession = new Map();
@@ -2131,12 +2139,17 @@ function normalizeWorkspaceDenoModulePrepareResponse(value, requestedNames) {
2131
2139
  }
2132
2140
  return value.missingModuleNames;
2133
2141
  }
2134
- function normalizeWorkspaceRunResponse(value) {
2142
+ function normalizeWorkspaceRunResponse(value, runtimeFullAccess) {
2135
2143
  if (!isPlainObject(value) || !Number.isInteger(value.exitCode) || typeof value.stdout !== "string" ||
2136
2144
  typeof value.stderr !== "string" || typeof value.stdoutTruncated !== "boolean" ||
2137
2145
  typeof value.stderrTruncated !== "boolean") {
2138
2146
  throw makeError("SDK_PROTOCOL_ERROR", "workspace_run response had an invalid shape");
2139
2147
  }
2148
+ if ((runtimeFullAccess && value.runtimeFullAccessApplied !== true) ||
2149
+ (!runtimeFullAccess && value.runtimeFullAccessApplied === true) ||
2150
+ (value.runtimeFullAccessApplied !== undefined && typeof value.runtimeFullAccessApplied !== "boolean")) {
2151
+ throw makeError("SDK_PROTOCOL_ERROR", "The connected Pedelec Extension/Desktop did not confirm the requested Runtime mode");
2152
+ }
2140
2153
  return {
2141
2154
  exitCode: value.exitCode,
2142
2155
  stdout: value.stdout,
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.4.11";
1
+ export declare const SDK_VERSION = "0.4.12";
@@ -1,2 +1,2 @@
1
1
  // Generated from sdk/package.json. Do not edit manually.
2
- export const SDK_VERSION = "0.4.11";
2
+ export const SDK_VERSION = "0.4.12";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaoruisaac/pedelec",
3
- "version": "0.4.11",
3
+ "version": "0.4.12",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "24.13.6",
52
- "vite": "8.3.0",
53
- "vitest": "4.1.11"
52
+ "vite": "^8.3.5",
53
+ "vitest": "^4.1.12"
54
54
  }
55
55
  }