@paperclipai/plugin-sdk 2026.1106.0-canary.9 → 2026.1106.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 (62) hide show
  1. package/README.md +11 -144
  2. package/dist/.paperclip-build-complete +1 -1
  3. package/dist/environment-sync-error.js +1 -1
  4. package/dist/environment-sync-error.js.map +1 -1
  5. package/dist/environment-tasks.d.ts +2 -61
  6. package/dist/environment-tasks.d.ts.map +1 -1
  7. package/dist/environment-tasks.js +3 -39
  8. package/dist/environment-tasks.js.map +1 -1
  9. package/dist/host-client-factory.d.ts +0 -2
  10. package/dist/host-client-factory.d.ts.map +1 -1
  11. package/dist/host-client-factory.js +2 -19
  12. package/dist/host-client-factory.js.map +1 -1
  13. package/dist/index.d.ts +4 -18
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -8
  16. package/dist/index.js.map +1 -1
  17. package/dist/protocol.d.ts +23 -64
  18. package/dist/protocol.d.ts.map +1 -1
  19. package/dist/protocol.js.map +1 -1
  20. package/dist/testing.d.ts +0 -5
  21. package/dist/testing.d.ts.map +1 -1
  22. package/dist/testing.js +0 -8
  23. package/dist/testing.js.map +1 -1
  24. package/dist/types.d.ts +1 -21
  25. package/dist/types.d.ts.map +1 -1
  26. package/dist/types.js.map +1 -1
  27. package/dist/worker-rpc-host.d.ts.map +1 -1
  28. package/dist/worker-rpc-host.js +16 -57
  29. package/dist/worker-rpc-host.js.map +1 -1
  30. package/dist/workspace-provider.d.ts +1 -47
  31. package/dist/workspace-provider.d.ts.map +1 -1
  32. package/dist/workspace-provider.js +1 -16
  33. package/dist/workspace-provider.js.map +1 -1
  34. package/package.json +3 -3
  35. package/dist/environment-acquire-error.d.ts +0 -19
  36. package/dist/environment-acquire-error.d.ts.map +0 -1
  37. package/dist/environment-acquire-error.js +0 -36
  38. package/dist/environment-acquire-error.js.map +0 -1
  39. package/dist/environment-resume-error.d.ts +0 -25
  40. package/dist/environment-resume-error.d.ts.map +0 -1
  41. package/dist/environment-resume-error.js +0 -50
  42. package/dist/environment-resume-error.js.map +0 -1
  43. package/dist/environment-runner-ingress-error.d.ts +0 -13
  44. package/dist/environment-runner-ingress-error.d.ts.map +0 -1
  45. package/dist/environment-runner-ingress-error.js +0 -39
  46. package/dist/environment-runner-ingress-error.js.map +0 -1
  47. package/dist/environment-stop-error.d.ts +0 -14
  48. package/dist/environment-stop-error.d.ts.map +0 -1
  49. package/dist/environment-stop-error.js +0 -44
  50. package/dist/environment-stop-error.js.map +0 -1
  51. package/dist/environment-task-error.d.ts +0 -25
  52. package/dist/environment-task-error.d.ts.map +0 -1
  53. package/dist/environment-task-error.js +0 -73
  54. package/dist/environment-task-error.js.map +0 -1
  55. package/dist/invocation-tracer.d.ts +0 -10
  56. package/dist/invocation-tracer.d.ts.map +0 -1
  57. package/dist/invocation-tracer.js +0 -61
  58. package/dist/invocation-tracer.js.map +0 -1
  59. package/dist/workspace-operation-error.d.ts +0 -46
  60. package/dist/workspace-operation-error.d.ts.map +0 -1
  61. package/dist/workspace-operation-error.js +0 -78
  62. package/dist/workspace-operation-error.js.map +0 -1
@@ -1,50 +0,0 @@
1
- const SCHEMA = "paperclip/environment-resume-error/v1";
2
- // Closed errno-style set. Provider text and identifiers never cross.
3
- const ERROR_CODES = new Set([
4
- "ECONNRESET", "ECONNREFUSED", "ETIMEDOUT", "EPIPE", "ENOTFOUND", "EAI_AGAIN", "ENETUNREACH",
5
- "ABORT_ERR", "UND_ERR_CONNECT_TIMEOUT", "UND_ERR_SOCKET",
6
- ]);
7
- function field(value, key) {
8
- try {
9
- return value && typeof value === "object" ? value[key] : undefined;
10
- }
11
- catch {
12
- return undefined;
13
- }
14
- }
15
- /** Shared with the acquisition envelope: the same closed status/errno fields. */
16
- export function sanitizeProviderErrorDiagnostic(input) {
17
- const httpStatus = Number.isInteger(input.httpStatus) && input.httpStatus >= 100 && input.httpStatus <= 599
18
- ? input.httpStatus : undefined;
19
- const errorCode = typeof input.errorCode === "string" && ERROR_CODES.has(input.errorCode) ? input.errorCode : undefined;
20
- if (httpStatus === undefined && errorCode === undefined)
21
- return null;
22
- return { ...(httpStatus !== undefined ? { httpStatus } : {}), ...(errorCode !== undefined ? { errorCode } : {}) };
23
- }
24
- /** Derive the closed status/errno fields from a thrown provider error and its causes. */
25
- export function providerErrorDiagnostic(error) {
26
- let httpStatus;
27
- let errorCode;
28
- for (let cause = error, depth = 0; cause && depth < 4; cause = field(cause, "cause"), depth++) {
29
- httpStatus ??= [field(cause, "status"), field(cause, "statusCode"), field(field(cause, "response"), "status")]
30
- .find(value => Number.isInteger(value));
31
- const code = field(cause, "code");
32
- if (errorCode === undefined && typeof code === "string" && ERROR_CODES.has(code))
33
- errorCode = code;
34
- }
35
- return sanitizeProviderErrorDiagnostic({ httpStatus, errorCode });
36
- }
37
- /** Worker side: derive safe fields from a thrown provider error and its causes. */
38
- export function environmentResumeErrorData(error) {
39
- const diagnostic = providerErrorDiagnostic(error);
40
- return diagnostic ? { schema: SCHEMA, diagnostic } : undefined;
41
- }
42
- /** Host side: read and re-validate the envelope from an RPC error. */
43
- export function readEnvironmentResumeErrorDiagnostic(error) {
44
- const data = field(error, "data");
45
- if (field(data, "schema") !== SCHEMA)
46
- return null;
47
- const diagnostic = field(data, "diagnostic");
48
- return sanitizeProviderErrorDiagnostic({ httpStatus: field(diagnostic, "httpStatus"), errorCode: field(diagnostic, "errorCode") });
49
- }
50
- //# sourceMappingURL=environment-resume-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment-resume-error.js","sourceRoot":"","sources":["../src/environment-resume-error.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,GAAG,uCAAuC,CAAC;AACvD,qEAAqE;AACrE,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa;IAC3F,WAAW,EAAE,yBAAyB,EAAE,gBA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U,EAAE,YAAY,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;AACrI,CAAC"}
@@ -1,13 +0,0 @@
1
- declare const PHASES: readonly ["sandbox_lookup", "sandbox_start", "sandbox_refresh", "private_preview"];
2
- export interface PluginEnvironmentRunnerIngressFailure {
3
- phase: typeof PHASES[number];
4
- httpStatus: number;
5
- }
6
- export declare class PluginEnvironmentRunnerIngressError extends Error {
7
- readonly failure: PluginEnvironmentRunnerIngressFailure | null;
8
- constructor(failure: PluginEnvironmentRunnerIngressFailure);
9
- }
10
- export declare function environmentRunnerIngressErrorData(error: unknown): unknown;
11
- export declare function readEnvironmentRunnerIngressFailure(error: unknown): PluginEnvironmentRunnerIngressFailure | null;
12
- export {};
13
- //# sourceMappingURL=environment-runner-ingress-error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment-runner-ingress-error.d.ts","sourceRoot":"","sources":["../src/environment-runner-ingress-error.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,MAAM,YAAI,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,CAAU,CAAC;AAElG,MAAM,WAAW,qCAAqC;IACpD,KAAK,EAAE,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;CACpB;AAeD,qBAAa,mCAAoC,SAAQ,KAAK;IAC5D,QAAQ,CAAC,OAAO,EAAE,qCAAqC,GAAG,IAAI,CAAC;IAE/D,YAAY,OAAO,EAAE,qCAAqC,EAKzD;CACF;AAED,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIzE;AAED,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,OAAO,GAAG,qCAAqC,GAAG,IAAI,CAGhH"}
@@ -1,39 +0,0 @@
1
- const SCHEMA = "paperclip/environment-runner-ingress-error/v1";
2
- const PHASES = ["sandbox_lookup", "sandbox_start", "sandbox_refresh", "private_preview"];
3
- function field(value, name) {
4
- if (!value || typeof value !== "object")
5
- return undefined;
6
- try {
7
- return Object.getOwnPropertyDescriptor(value, name)?.value;
8
- }
9
- catch {
10
- return undefined;
11
- }
12
- }
13
- function validate(value) {
14
- const phase = field(value, "phase"), httpStatus = field(value, "httpStatus");
15
- if (!PHASES.includes(phase)
16
- || typeof httpStatus !== "number" || !Number.isInteger(httpStatus) || httpStatus < 400 || httpStatus > 599)
17
- return null;
18
- return { phase: phase, httpStatus };
19
- }
20
- export class PluginEnvironmentRunnerIngressError extends Error {
21
- failure;
22
- constructor(failure) {
23
- const safe = validate(failure);
24
- super(`Runner connection endpoint could not be acquired${safe ? ` (HTTP ${safe.httpStatus})` : ""}.`);
25
- this.name = "PluginEnvironmentRunnerIngressError";
26
- this.failure = safe;
27
- }
28
- }
29
- export function environmentRunnerIngressErrorData(error) {
30
- if (!(error instanceof PluginEnvironmentRunnerIngressError))
31
- return undefined;
32
- const failure = validate(field(error, "failure"));
33
- return failure ? { schema: SCHEMA, failure } : undefined;
34
- }
35
- export function readEnvironmentRunnerIngressFailure(error) {
36
- const data = field(error, "data");
37
- return field(data, "schema") === SCHEMA ? validate(field(data, "failure")) : null;
38
- }
39
- //# sourceMappingURL=environment-runner-ingress-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment-runner-ingress-error.js","sourceRoot":"","sources":["../src/environment-runner-ingress-error.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,+CAA+C,CAAC;AAC/D,MAAM,MAAM,GAAG,CAAC,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,CAAU,CAAC;AAOlG,SAAS,KAAK,CAAC,KAAc,EAAE,IAAY;IACzC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC1D,IAAI,CAAC;QAAC,OAAO,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE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mC,CAAC,KAAc;IAChE,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpF,CAAC"}
@@ -1,14 +0,0 @@
1
- declare const REASONS: readonly ["resource_unrecoverable", "recovery_failed", "recovery_incomplete"];
2
- export type PluginEnvironmentStopFailureReason = typeof REASONS[number];
3
- export interface PluginEnvironmentStopFailure {
4
- reason: PluginEnvironmentStopFailureReason;
5
- terminal: boolean;
6
- }
7
- export declare class PluginEnvironmentStopError extends Error {
8
- readonly failure: PluginEnvironmentStopFailure | null;
9
- constructor(reason: PluginEnvironmentStopFailureReason);
10
- }
11
- export declare function environmentStopErrorData(error: unknown): unknown;
12
- export declare function readEnvironmentStopFailure(error: unknown): PluginEnvironmentStopFailure | null;
13
- export {};
14
- //# sourceMappingURL=environment-stop-error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment-stop-error.d.ts","sourceRoot":"","sources":["../src/environment-stop-error.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,OAAO,YAAI,wBAAwB,EAAE,iBAAiB,EAAE,qBAAqB,CAAU,CAAC;AAG9F,MAAM,MAAM,kCAAkC,GAAG,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;AAExE,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,kCAAkC,CAAC;IAC3C,QAAQ,EAAE,OAAO,CAAC;CACnB;AAoBD,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,OAAO,EAAE,4BAA4B,GAAG,IAAI,CAAC;IAEtD,YAAY,MAAM,EAAE,kCAAkC,EAKrD;CACF;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAIhE;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,4BAA4B,GAAG,IAAI,CAG9F"}
@@ -1,44 +0,0 @@
1
- const SCHEMA = "paperclip/environment-stop-error/v1";
2
- const REASONS = ["resource_unrecoverable", "recovery_failed", "recovery_incomplete"];
3
- const TERMINAL_REASONS = new Set(["resource_unrecoverable", "recovery_failed"]);
4
- const MESSAGES = {
5
- resource_unrecoverable: "The provider reports that the environment resource cannot recover from its error state, so it cannot be stopped.",
6
- recovery_failed: "The environment resource returned to an error state after a recovery attempt, so it cannot be stopped.",
7
- recovery_incomplete: "The environment resource did not finish recovery from its error state before the stop deadline.",
8
- };
9
- function field(value, name) {
10
- if (!value || typeof value !== "object")
11
- return undefined;
12
- try {
13
- return Object.getOwnPropertyDescriptor(value, name)?.value;
14
- }
15
- catch {
16
- return undefined;
17
- }
18
- }
19
- function validate(value) {
20
- const reason = field(value, "reason");
21
- if (!REASONS.includes(reason))
22
- return null;
23
- return { reason: reason, terminal: TERMINAL_REASONS.has(reason) };
24
- }
25
- export class PluginEnvironmentStopError extends Error {
26
- failure;
27
- constructor(reason) {
28
- const failure = validate({ reason });
29
- super(failure ? MESSAGES[failure.reason] : "The environment resource could not be stopped.");
30
- this.name = "PluginEnvironmentStopError";
31
- this.failure = failure;
32
- }
33
- }
34
- export function environmentStopErrorData(error) {
35
- if (!(error instanceof PluginEnvironmentStopError))
36
- return undefined;
37
- const failure = validate(field(error, "failure"));
38
- return failure ? { schema: SCHEMA, failure: { reason: failure.reason } } : undefined;
39
- }
40
- export function readEnvironmentStopFailure(error) {
41
- const data = field(error, "data");
42
- return field(data, "schema") === SCHEMA ? validate(field(data, "failure")) : null;
43
- }
44
- //# sourceMappingURL=environment-stop-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment-stop-error.js","sourceRoot":"","sources":["../src/environment-stop-error.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,qCAAqC,CAAC;AACrD,MAAM,OAAO,GA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zB,CAAC;CACF;AAED,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,IAAI,CAAC,CAAC,KAAK,YAAY,0BAA0B,CAAC;QAAE,OAAO,SAAS,CAAC;IACrE,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAClD,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACvF,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,KAAc;IACvD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpF,CAAC"}
@@ -1,25 +0,0 @@
1
- /** Diagnostic only. A refusal never authorizes replacement, retry or cleanup. */
2
- export interface PluginEnvironmentTaskErrorDiagnostic {
3
- httpStatus: 409;
4
- errorCode: "SESSION_STATE_UNAVAILABLE";
5
- reason: "unresolved_operation" | "source_state_unverified";
6
- }
7
- /** Worker side: copy only the closed refusal fields, never provider text or identities. */
8
- export declare function environmentTaskErrorData(error: unknown): {
9
- schema: string;
10
- diagnostic: PluginEnvironmentTaskErrorDiagnostic;
11
- } | undefined;
12
- /** Host side: validate the envelope again after the worker RPC. */
13
- export declare function readEnvironmentTaskErrorDiagnostic(error: unknown): PluginEnvironmentTaskErrorDiagnostic | null;
14
- export declare const ENVIRONMENT_TASK_ERROR_CODES: readonly ["runner_revision_mismatch"];
15
- export type PluginEnvironmentTaskErrorCode = typeof ENVIRONMENT_TASK_ERROR_CODES[number];
16
- export declare class PluginEnvironmentTaskError extends Error {
17
- readonly errorCode: PluginEnvironmentTaskErrorCode;
18
- constructor(errorCode: PluginEnvironmentTaskErrorCode);
19
- }
20
- export declare function environmentTaskErrorCodeData(error: unknown): {
21
- schema: string;
22
- errorCode: PluginEnvironmentTaskErrorCode;
23
- } | undefined;
24
- export declare function readEnvironmentTaskErrorCode(error: unknown): PluginEnvironmentTaskErrorCode | null;
25
- //# sourceMappingURL=environment-task-error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment-task-error.d.ts","sourceRoot":"","sources":["../src/environment-task-error.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,MAAM,WAAW,oCAAoC;IACnD,UAAU,EAAE,GAAG,CAAC;IAChB,SAAS,EAAE,2BAA2B,CAAC;IACvC,MAAM,EAAE,sBAAsB,GAAG,yBAAyB,CAAC;CAC5D;AAeD,2FAA2F;AAC3F,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG;IACxD,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,oCAAoC,CAAC;CAClE,GAAG,SAAS,CAGZ;AAED,mEAAmE;AACnE,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,OAAO,GAAG,oCAAoC,GAAG,IAAI,CAK9G;AAED,eAAO,MAAM,4BAA4B,YAAI,0BAA0B,CAAU,CAAC;AAClF,MAAM,MAAM,8BAA8B,GAAG,OAAO,4BAA4B,CAAC,MAAM,CAAC,CAAC;AAezF,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,SAAS,EAAE,8BAA8B,CAAC;IAEnD,YAAY,SAAS,EAAE,8BAA8B,EAMpD;CACF;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,8BAA8B,CAAA;CAAE,GAAG,SAAS,CAItI;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,8BAA8B,GAAG,IAAI,CASlG"}
@@ -1,73 +0,0 @@
1
- const SCHEMA = "paperclip/environment-task-error/v1";
2
- function field(value, key) {
3
- try {
4
- return value && typeof value === "object" ? value[key] : undefined;
5
- }
6
- catch {
7
- return undefined;
8
- }
9
- }
10
- function sanitize(httpStatus, errorCode, reason) {
11
- if (httpStatus !== 409 || errorCode !== "SESSION_STATE_UNAVAILABLE" ||
12
- (reason !== "unresolved_operation" && reason !== "source_state_unverified"))
13
- return null;
14
- return { httpStatus, errorCode, reason };
15
- }
16
- /** Worker side: copy only the closed refusal fields, never provider text or identities. */
17
- export function environmentTaskErrorData(error) {
18
- const diagnostic = sanitize(field(error, "status"), field(error, "code"), field(error, "reason"));
19
- return diagnostic ? { schema: SCHEMA, diagnostic } : undefined;
20
- }
21
- /** Host side: validate the envelope again after the worker RPC. */
22
- export function readEnvironmentTaskErrorDiagnostic(error) {
23
- const data = field(error, "data");
24
- if (field(data, "schema") !== SCHEMA)
25
- return null;
26
- const diagnostic = field(data, "diagnostic");
27
- return sanitize(field(diagnostic, "httpStatus"), field(diagnostic, "errorCode"), field(diagnostic, "reason"));
28
- }
29
- export const ENVIRONMENT_TASK_ERROR_CODES = ["runner_revision_mismatch"];
30
- const CODE_SCHEMA = "paperclip/environment-task-error-code/v1";
31
- function ownField(value, name) {
32
- if (!value || typeof value !== "object")
33
- return undefined;
34
- try {
35
- return Object.getOwnPropertyDescriptor(value, name)?.value;
36
- }
37
- catch {
38
- return undefined;
39
- }
40
- }
41
- function validateCode(value) {
42
- return ENVIRONMENT_TASK_ERROR_CODES.includes(value)
43
- ? value : null;
44
- }
45
- export class PluginEnvironmentTaskError extends Error {
46
- errorCode;
47
- constructor(errorCode) {
48
- const safe = validateCode(errorCode);
49
- if (!safe)
50
- throw new TypeError("Unknown environment task error code");
51
- super("The installed Runner does not match the expected revision");
52
- this.name = "PluginEnvironmentTaskError";
53
- this.errorCode = safe;
54
- }
55
- }
56
- export function environmentTaskErrorCodeData(error) {
57
- if (!(error instanceof PluginEnvironmentTaskError))
58
- return undefined;
59
- const errorCode = validateCode(ownField(error, "errorCode"));
60
- return errorCode ? { schema: CODE_SCHEMA, errorCode } : undefined;
61
- }
62
- export function readEnvironmentTaskErrorCode(error) {
63
- for (let current = error, depth = 0; current && depth < 5; current = ownField(current, "cause"), depth++) {
64
- const data = ownField(current, "data");
65
- if (ownField(data, "schema") === CODE_SCHEMA) {
66
- const code = validateCode(ownField(data, "errorCode"));
67
- if (code)
68
- return code;
69
- }
70
- }
71
- return null;
72
- }
73
- //# sourceMappingURL=environment-task-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"environment-task-error.js","sourceRoot":"","sources":["../src/environment-task-error.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,GAAG,qCAAqC,CAAC;AAErD,SAAS,KAAK,CAAC,KAAc,EAAE,GAAW;IACxC,IAAI,CAAC;QAAC,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAE,KAAiC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAAC,CAAC;IACxG,MAAM,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;AAC7B,CAAC;AAED,SAAS,QAAQ,CAAC,UAAmB,EAAE,SAAkB,EAAE,MAAe;IACxE,IAAI,UAAU,KAAK,GAAG,IAAI,SAAS,KAAK,2BAA2B;QAC/D,CAAC,MAAM,KAAK,sBAAsB,IAAI,MAAM,KAAK,yBAAyB,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7F,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC3C,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,wBAAwB,CAAC,KAAc;IAGrD,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;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AC,SAAS,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,SAAS,CAAC,qCAAqC,CAAC,CAAC;QACtE,KAAK,CAAC,2DAA2D,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF;AAED,MAAM,UAAU,4BAA4B,CAAC,KAAc;IACzD,IAAI,CAAC,CAAC,KAAK,YAAY,0BAA0B,CAAC;QAAE,OAAO,SAAS,CAAC;IACrE,MAAM,SAAS,GAAG,YAAY,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;IAC7D,OAAO,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,KAAc;IACzD,KAAK,IAAI,OAAO,GAAG,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,OAAO,IAAI,KAAK,GAAG,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QACzG,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvC,IAAI,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,WAAW,EAAE,CAAC;YAC7C,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;YACvD,IAAI,IAAI;gBAAE,OAAO,IAAI,CAAC;QACxB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,10 +0,0 @@
1
- import type { PluginSpanRecord } from "./protocol.js";
2
- export declare function createInvocationTracer(enabled: () => boolean, record: (span: PluginSpanRecord) => void): {
3
- withSpan: <T>(name: string, work: () => T | Promise<T>, attributes?: Record<string, string | number | boolean>) => Promise<T>;
4
- clock: () => () => number;
5
- now: () => number;
6
- isRecording: () => boolean;
7
- recordSpan: (span: PluginSpanRecord) => boolean;
8
- captureRecorder: () => (span: PluginSpanRecord) => boolean;
9
- };
10
- //# sourceMappingURL=invocation-tracer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invocation-tracer.d.ts","sourceRoot":"","sources":["../src/invocation-tracer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,OAAO,EACtB,MAAM,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI;eAIhB,CAAC,QAAQ,MAAM,QAAQ,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,eAAe,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,KAAG,OAAO,CAAC,CAAC,CAAC;;;uBALzH,OAAO;uBAuCF,gBAAgB;kCAGnB,gBAAgB;EAGlC"}
@@ -1,61 +0,0 @@
1
- import { AsyncLocalStorage } from "node:async_hooks";
2
- // One bounded receipt per invocation; children never select their host parent.
3
- export function createInvocationTracer(enabled, record) {
4
- const active = new AsyncLocalStorage();
5
- async function withSpan(name, work, attributes) {
6
- if (!enabled())
7
- return work();
8
- const parent = active.getStore();
9
- // Detached work cannot outlive or inherit a completed invocation receipt.
10
- if (parent?.closed)
11
- return work();
12
- const budget = parent?.budget ?? { remaining: 256 };
13
- if (budget.remaining-- <= 0)
14
- return work();
15
- const clock = parent?.clock ?? { epoch: Date.now(), origin: performance.now() };
16
- const startTimeMs = clock.epoch + performance.now() - clock.origin;
17
- const span = { name, startTimeMs, attributes, children: [] };
18
- const scope = { span, budget, closed: false, clock };
19
- parent?.span.children?.push(span);
20
- try {
21
- return await active.run(scope, work);
22
- }
23
- catch (error) {
24
- span.status = { code: 2 };
25
- throw error;
26
- }
27
- finally {
28
- scope.closed = true;
29
- span.endTimeMs = clock.epoch + performance.now() - clock.origin;
30
- if (!parent) {
31
- try {
32
- record(span);
33
- }
34
- catch { }
35
- }
36
- }
37
- }
38
- function appendSpan(scope, span) {
39
- if (!scope)
40
- return false;
41
- if (!enabled() || scope.closed || scope.budget.remaining-- <= 0)
42
- return true;
43
- scope.span.children?.push(span);
44
- return true;
45
- }
46
- return {
47
- withSpan,
48
- clock: () => {
49
- const clock = active.getStore()?.clock ?? { epoch: Date.now(), origin: performance.now() };
50
- return () => clock.epoch + performance.now() - clock.origin;
51
- },
52
- now: () => { const clock = active.getStore()?.clock; return clock ? clock.epoch + performance.now() - clock.origin : Date.now(); },
53
- isRecording: enabled,
54
- recordSpan: (span) => appendSpan(active.getStore(), span),
55
- captureRecorder: () => {
56
- const scope = active.getStore();
57
- return (span) => appendSpan(scope, span);
58
- },
59
- };
60
- }
61
- //# sourceMappingURL=invocation-tracer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invocation-tracer.js","sourceRoot":"","sources":["../src/invocation-tracer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,+EAA+E;AAC/E,MAAM,UAAU,sBAAsB,CACpC,OAAsB,EACtB,MAAwC;IAGxC,MAAM,MAAM,GAAG,IAAI,iBAAiB,EAAS,CAAC;IAC9C,KAAK,UAAU,QAAQ,CAAI,IAAY,EAAE,IAA0B,EAAE,UAAsD;QACzH,IAAI,CAAC,OAAO,EAAE;YAAE,OAAO,IAAI,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QACjC,0EAA0E;QAC1E,IAAI,MAAM,EAAE,MAAM;YAAE,OAAO,IAAI,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;QACpD,IAAI,MAA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ace provider refused or failed a `workspaceOperation`. The set is
3
- * closed: Core decides the user-facing message and whether retrying the same
4
- * workspace can help, so a provider never sends text or values across the bridge.
5
- */
6
- export declare const WORKSPACE_OPERATION_FAILURE_REASONS: readonly [
7
- /** The provider does not accept this operation or request shape. */
8
- "unsupported_operation",
9
- /** The provider's own settings are missing or invalid. */
10
- "configuration_unavailable",
11
- /** A credential the operation needs (for example the project's Git credential) is unusable. */
12
- "credential_unavailable",
13
- /** Saved storage access grants are missing or no longer match the project. */
14
- "storage_grant_unavailable",
15
- /** The saved workspace binding does not match this workspace or generation. */
16
- "binding_mismatch",
17
- /** Project storage is still being provisioned or reconciled. */
18
- "storage_pending",
19
- /** The selected runtime is not ready. */
20
- "runtime_unavailable",
21
- /** The selected runtime's saved connection is invalid. */
22
- "runtime_connection_invalid",
23
- /** A remote storage or runtime request failed or returned an unusable result. */
24
- "remote_incomplete",
25
- /** The runtime, grants or binding changed while the operation ran. */
26
- "context_changed",
27
- /** The operation deadline passed. */
28
- "deadline_exceeded"];
29
- export type PluginWorkspaceOperationFailureReason = typeof WORKSPACE_OPERATION_FAILURE_REASONS[number];
30
- /**
31
- * Throw from `onWorkspaceOperation` to tell Core why the operation failed. Any
32
- * error with an own `workspaceFailureReason` from the closed set is forwarded the
33
- * same way; the message stays local to the worker's RPC error text.
34
- */
35
- export declare class PluginWorkspaceOperationError extends Error {
36
- readonly workspaceFailureReason: PluginWorkspaceOperationFailureReason;
37
- constructor(reason: PluginWorkspaceOperationFailureReason, message?: string);
38
- }
39
- /** Worker side: copy only the closed reason, never provider text or identities. */
40
- export declare function workspaceOperationErrorData(error: unknown): {
41
- schema: string;
42
- reason: PluginWorkspaceOperationFailureReason;
43
- } | undefined;
44
- /** Host side: validate the envelope again after the worker RPC, through wrapper causes. */
45
- export declare function readWorkspaceOperationFailureReason(error: unknown): PluginWorkspaceOperationFailureReason | null;
46
- //# sourceMappingURL=workspace-operation-error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace-operation-error.d.ts","sourceRoot":"","sources":["../src/workspace-operation-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,mCAAmC;AAC9C,oEAAoE;AACpE,uBAAuB;AACvB,0DAA0D;AAC1D,2BAA2B;AAC3B,+FAA+F;AAC/F,wBAAwB;AACxB,8EAA8E;AAC9E,2BAA2B;AAC3B,+EAA+E;AAC/E,kBAAkB;AAClB,gEAAgE;AAChE,iBAAiB;AACjB,yCAAyC;AACzC,qBAAqB;AACrB,0DAA0D;AAC1D,4BAA4B;AAC5B,iFAAiF;AACjF,mBAAmB;AACnB,sEAAsE;AACtE,iBAAiB;AACjB,qCAAqC;AACrC,mBAAmB,CACX,CAAC;AACX,MAAM,MAAM,qCAAqC,GAAG,OAAO,mCAAmC,CAAC,MAAM,CAAC,CAAC;AAevG;;;;GAIG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,QAAQ,CAAC,sBAAsB,EAAE,qCAAqC,CAAC;IAEvE,YAAY,MAAM,EAAE,qCAAqC,EAAE,OAAO,SAA+B,EAMhG;CACF;AAED,mFAAmF;AACnF,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,qCAAqC,CAAA;CAAE,GAAG,SAAS,CAGzI;AAED,2FAA2F;AAC3F,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,OAAO,GAAG,qCAAqC,GAAG,IAAI,CAShH"}
@@ -1,78 +0,0 @@
1
- /**
2
- * Why a workspace provider refused or failed a `workspaceOperation`. The set is
3
- * closed: Core decides the user-facing message and whether retrying the same
4
- * workspace can help, so a provider never sends text or values across the bridge.
5
- */
6
- export const WORKSPACE_OPERATION_FAILURE_REASONS = [
7
- /** The provider does not accept this operation or request shape. */
8
- "unsupported_operation",
9
- /** The provider's own settings are missing or invalid. */
10
- "configuration_unavailable",
11
- /** A credential the operation needs (for example the project's Git credential) is unusable. */
12
- "credential_unavailable",
13
- /** Saved storage access grants are missing or no longer match the project. */
14
- "storage_grant_unavailable",
15
- /** The saved workspace binding does not match this workspace or generation. */
16
- "binding_mismatch",
17
- /** Project storage is still being provisioned or reconciled. */
18
- "storage_pending",
19
- /** The selected runtime is not ready. */
20
- "runtime_unavailable",
21
- /** The selected runtime's saved connection is invalid. */
22
- "runtime_connection_invalid",
23
- /** A remote storage or runtime request failed or returned an unusable result. */
24
- "remote_incomplete",
25
- /** The runtime, grants or binding changed while the operation ran. */
26
- "context_changed",
27
- /** The operation deadline passed. */
28
- "deadline_exceeded",
29
- ];
30
- const SCHEMA = "paperclip/workspace-operation-error/v1";
31
- function ownField(value, name) {
32
- if (!value || typeof value !== "object")
33
- return undefined;
34
- try {
35
- return Object.getOwnPropertyDescriptor(value, name)?.value;
36
- }
37
- catch {
38
- return undefined;
39
- }
40
- }
41
- function validateReason(value) {
42
- return WORKSPACE_OPERATION_FAILURE_REASONS.includes(value)
43
- ? value : null;
44
- }
45
- /**
46
- * Throw from `onWorkspaceOperation` to tell Core why the operation failed. Any
47
- * error with an own `workspaceFailureReason` from the closed set is forwarded the
48
- * same way; the message stays local to the worker's RPC error text.
49
- */
50
- export class PluginWorkspaceOperationError extends Error {
51
- workspaceFailureReason;
52
- constructor(reason, message = "Workspace operation failed") {
53
- const safe = validateReason(reason);
54
- if (!safe)
55
- throw new TypeError("Unknown workspace operation failure reason");
56
- super(message);
57
- this.name = "PluginWorkspaceOperationError";
58
- this.workspaceFailureReason = safe;
59
- }
60
- }
61
- /** Worker side: copy only the closed reason, never provider text or identities. */
62
- export function workspaceOperationErrorData(error) {
63
- const reason = validateReason(ownField(error, "workspaceFailureReason"));
64
- return reason ? { schema: SCHEMA, reason } : undefined;
65
- }
66
- /** Host side: validate the envelope again after the worker RPC, through wrapper causes. */
67
- export function readWorkspaceOperationFailureReason(error) {
68
- for (let current = error, depth = 0; current && depth < 5; current = ownField(current, "cause"), depth++) {
69
- const data = ownField(current, "data");
70
- if (ownField(data, "schema") === SCHEMA) {
71
- const reason = validateReason(ownField(data, "reason"));
72
- if (reason)
73
- return reason;
74
- }
75
- }
76
- return null;
77
- }
78
- //# sourceMappingURL=workspace-operation-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace-operation-error.js","sourceRoot":"","sources":["../src/workspace-operation-error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,oEAAoE;IACpE,uBAAuB;IACvB,0DAA0D;IAC1D,2BAA2B;IAC3B,+FAA+F;IAC/F,wBAAwB;IACxB,8EAA8E;IAC9E,2BAA2B;IAC3B,+EAA+E;IAC/E,kBAAkB;IAClB,gEAAgE;IAChE,iBAAiB;IACjB,yCAAyC;IACzC,qBAAqB;IACrB,0DAA0D;IAC1D,4BAA4B;IAC5B,iFAAiF;IACjF,mBAAmB;IACnB,sEAAsE;IACtE,iBAAiB;IACjB,qCAAqC;IACrC,mBAAmB;CACX,CAAC;AAGX,MAAM,MAAM,GAAG,wCAAwC,CAAC;AAExD,SAAS,QAAQ,CAAC,KAAc,EAAE,IAAY;IAC5C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAC1D,IAAI,CAAC;QAAC,OAAO,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC;IAAC,CAAC;IACnE,MAAM,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;AAC7B,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,mCAAmC,CAAC,QAAQ,CAAC,KAA8C,CAAC;QACjG,CAAC,CAAC,KAA8C,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAC7C,sBAAsB,CAAwC;IAEvE,YAAY,MAA6C,EAAE,OAAO,GAAG,4BAA4B;QAC/F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