@holokai/neuron-sdk 0.6.0 → 0.7.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.
@@ -788,6 +788,12 @@ interface NeuronLogger {
788
788
  warn(meta: Record<string, unknown>, msg?: string): void;
789
789
  error(meta: Record<string, unknown>, msg?: string): void;
790
790
  }
791
+ /** What a handler states when it fails a lease; see {@link HandlerContext.fail}. */
792
+ interface HandlerFailureOptions {
793
+ code?: string;
794
+ details?: unknown;
795
+ kind?: 'terminal' | 'retryable';
796
+ }
791
797
  /** Per-handler context passed to `neuron.handle(...)` callbacks. */
792
798
  interface HandlerContext {
793
799
  /** Lease metadata for this delivery. */
@@ -815,13 +821,13 @@ interface HandlerContext {
815
821
  data?: unknown;
816
822
  }): void;
817
823
  /**
818
- * Terminal failure — short-circuits the handler with a non-retryable
819
- * nack containing the given reason. Throws an internal error to bail
820
- * out of the handler; do not catch it.
824
+ * Fail the lease with a nack and bail out of the handler; do not catch the
825
+ * throw. `reason` is the sentence a reader sees; `code` names the failure;
826
+ * `details` carries any structured facts (never required to understand the
827
+ * reason). `kind` defaults to `terminal` (the same input will not succeed);
828
+ * `retryable` says the same input may succeed later.
821
829
  */
822
- fail(reason: string, opts?: {
823
- code?: string;
824
- }): never;
830
+ fail(reason: string, opts?: HandlerFailureOptions): never;
825
831
  }
826
832
  /**
827
833
  * Low-level capability registration: type + scope + concurrency + optional
@@ -952,4 +958,4 @@ interface TransportCallbacks {
952
958
  }) => void;
953
959
  }
954
960
 
955
- export type { AuthCallback as A, Capability as C, Handler as H, JsonSchema as J, LeasePayload as L, NeuronLogger as N, PostPath as P, ServerToNeuronFrame as S, Transport as T, CapabilityHandleOptions as a, CapabilityRegistration as b, TransportCallbacks as c, ClientFrame as d, HandlerContext as e, HeartbeatInFlightEntry as f, TaskPayload as g };
961
+ export type { AuthCallback as A, Capability as C, Handler as H, JsonSchema as J, LeasePayload as L, NeuronLogger as N, PostPath as P, ServerToNeuronFrame as S, Transport as T, CapabilityHandleOptions as a, CapabilityRegistration as b, TransportCallbacks as c, ClientFrame as d, HandlerContext as e, HandlerFailureOptions as f, HeartbeatInFlightEntry as g, TaskPayload as h };
@@ -788,6 +788,12 @@ interface NeuronLogger {
788
788
  warn(meta: Record<string, unknown>, msg?: string): void;
789
789
  error(meta: Record<string, unknown>, msg?: string): void;
790
790
  }
791
+ /** What a handler states when it fails a lease; see {@link HandlerContext.fail}. */
792
+ interface HandlerFailureOptions {
793
+ code?: string;
794
+ details?: unknown;
795
+ kind?: 'terminal' | 'retryable';
796
+ }
791
797
  /** Per-handler context passed to `neuron.handle(...)` callbacks. */
792
798
  interface HandlerContext {
793
799
  /** Lease metadata for this delivery. */
@@ -815,13 +821,13 @@ interface HandlerContext {
815
821
  data?: unknown;
816
822
  }): void;
817
823
  /**
818
- * Terminal failure — short-circuits the handler with a non-retryable
819
- * nack containing the given reason. Throws an internal error to bail
820
- * out of the handler; do not catch it.
824
+ * Fail the lease with a nack and bail out of the handler; do not catch the
825
+ * throw. `reason` is the sentence a reader sees; `code` names the failure;
826
+ * `details` carries any structured facts (never required to understand the
827
+ * reason). `kind` defaults to `terminal` (the same input will not succeed);
828
+ * `retryable` says the same input may succeed later.
821
829
  */
822
- fail(reason: string, opts?: {
823
- code?: string;
824
- }): never;
830
+ fail(reason: string, opts?: HandlerFailureOptions): never;
825
831
  }
826
832
  /**
827
833
  * Low-level capability registration: type + scope + concurrency + optional
@@ -952,4 +958,4 @@ interface TransportCallbacks {
952
958
  }) => void;
953
959
  }
954
960
 
955
- export type { AuthCallback as A, Capability as C, Handler as H, JsonSchema as J, LeasePayload as L, NeuronLogger as N, PostPath as P, ServerToNeuronFrame as S, Transport as T, CapabilityHandleOptions as a, CapabilityRegistration as b, TransportCallbacks as c, ClientFrame as d, HandlerContext as e, HeartbeatInFlightEntry as f, TaskPayload as g };
961
+ export type { AuthCallback as A, Capability as C, Handler as H, JsonSchema as J, LeasePayload as L, NeuronLogger as N, PostPath as P, ServerToNeuronFrame as S, Transport as T, CapabilityHandleOptions as a, CapabilityRegistration as b, TransportCallbacks as c, ClientFrame as d, HandlerContext as e, HandlerFailureOptions as f, HeartbeatInFlightEntry as g, TaskPayload as h };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holokai/neuron-sdk",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "SDK for building Holokai neurons — connect to a BigBrain gateway over HTTP+SSE or Electron IPC and execute capability-typed tasks.",
5
5
  "license": "MIT",
6
6
  "author": "Holokai",