@weiliang0121/capix-invocation 0.0.0-stage → 0.1.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 (97) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +18 -2
  3. package/dist/checkpoint/children.d.ts +16 -0
  4. package/dist/checkpoint/children.js +2 -0
  5. package/dist/checkpoint/continuation.d.ts +10 -0
  6. package/dist/checkpoint/continuation.js +2 -0
  7. package/dist/checkpoint/contract.d.ts +76 -0
  8. package/dist/checkpoint/contract.js +1 -0
  9. package/dist/checkpoint/data.d.ts +5 -0
  10. package/dist/checkpoint/data.js +2 -0
  11. package/dist/checkpoint/facts.d.ts +49 -0
  12. package/dist/checkpoint/facts.js +2 -0
  13. package/dist/checkpoint/invocation.d.ts +36 -0
  14. package/dist/checkpoint/invocation.js +2 -0
  15. package/dist/checkpoint/observation.d.ts +32 -0
  16. package/dist/checkpoint/observation.js +2 -0
  17. package/dist/checkpoint/publication.d.ts +20 -0
  18. package/dist/checkpoint/publication.js +2 -0
  19. package/dist/checkpoint/restoration.d.ts +4 -0
  20. package/dist/checkpoint/restoration.js +2 -0
  21. package/dist/checkpoint/selection.d.ts +22 -0
  22. package/dist/checkpoint/selection.js +2 -0
  23. package/dist/checkpoint/target.d.ts +4 -0
  24. package/dist/checkpoint/target.js +2 -0
  25. package/dist/checkpoint/work.d.ts +27 -0
  26. package/dist/checkpoint/work.js +1 -0
  27. package/dist/clock.d.ts +4 -0
  28. package/dist/clock.js +2 -0
  29. package/dist/context/callable.d.ts +12 -0
  30. package/dist/context/callable.js +2 -0
  31. package/dist/context/context.d.ts +58 -0
  32. package/dist/context/context.js +2 -0
  33. package/dist/context/view.d.ts +34 -0
  34. package/dist/context/view.js +2 -0
  35. package/dist/exception/contract.d.ts +11 -0
  36. package/dist/exception/contract.js +2 -0
  37. package/dist/index.d.ts +37 -0
  38. package/dist/index.js +2 -0
  39. package/dist/invocation/cancellation.d.ts +8 -0
  40. package/dist/invocation/cancellation.js +2 -0
  41. package/dist/invocation/changes.d.ts +13 -0
  42. package/dist/invocation/changes.js +2 -0
  43. package/dist/invocation/children.d.ts +72 -0
  44. package/dist/invocation/children.js +2 -0
  45. package/dist/invocation/control.d.ts +8 -0
  46. package/dist/invocation/control.js +2 -0
  47. package/dist/invocation/execution.d.ts +35 -0
  48. package/dist/invocation/execution.js +2 -0
  49. package/dist/invocation/facts.d.ts +5 -0
  50. package/dist/invocation/facts.js +2 -0
  51. package/dist/invocation/failure.d.ts +11 -0
  52. package/dist/invocation/failure.js +2 -0
  53. package/dist/invocation/invocation.d.ts +83 -0
  54. package/dist/invocation/invocation.js +2 -0
  55. package/dist/invocation/progress.d.ts +33 -0
  56. package/dist/invocation/progress.js +1 -0
  57. package/dist/invocation/provenance.d.ts +38 -0
  58. package/dist/invocation/provenance.js +2 -0
  59. package/dist/invocation/reception.d.ts +7 -0
  60. package/dist/invocation/reception.js +1 -0
  61. package/dist/invocation/relation.d.ts +93 -0
  62. package/dist/invocation/relation.js +2 -0
  63. package/dist/invocation/resource-access.d.ts +31 -0
  64. package/dist/invocation/resource-access.js +2 -0
  65. package/dist/invocation/resources.d.ts +8 -0
  66. package/dist/invocation/resources.js +2 -0
  67. package/dist/invocation/result.d.ts +12 -0
  68. package/dist/invocation/result.js +2 -0
  69. package/dist/invocation/stop.d.ts +3 -0
  70. package/dist/invocation/stop.js +2 -0
  71. package/dist/invocation/view.d.ts +30 -0
  72. package/dist/invocation/view.js +2 -0
  73. package/dist/invocation/work.d.ts +31 -0
  74. package/dist/invocation/work.js +2 -0
  75. package/dist/observation/error.d.ts +4 -0
  76. package/dist/observation/error.js +2 -0
  77. package/dist/observation/facts.d.ts +64 -0
  78. package/dist/observation/facts.js +1 -0
  79. package/dist/observation/invocation.d.ts +17 -0
  80. package/dist/observation/invocation.js +2 -0
  81. package/dist/observation/observer.d.ts +13 -0
  82. package/dist/observation/observer.js +2 -0
  83. package/dist/observation/session.d.ts +17 -0
  84. package/dist/observation/session.js +2 -0
  85. package/dist/operation/failure.d.ts +1 -0
  86. package/dist/operation/failure.js +2 -0
  87. package/dist/output/delivery.d.ts +2 -0
  88. package/dist/output/delivery.js +2 -0
  89. package/dist/output/section.d.ts +21 -0
  90. package/dist/output/section.js +2 -0
  91. package/dist/value/array.d.ts +2 -0
  92. package/dist/value/array.js +2 -0
  93. package/dist/value/object.d.ts +2 -0
  94. package/dist/value/object.js +2 -0
  95. package/dist/value/string.d.ts +2 -0
  96. package/dist/value/string.js +2 -0
  97. package/package.json +45 -3
@@ -0,0 +1 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
@@ -0,0 +1,93 @@
1
+ import type { CheckpointBinding } from '../checkpoint/work.js';
2
+ import { type Stable, type InvocationIdentity } from '@weiliang0121/capix-contracts';
3
+ import type { InvocationOutputReceiver, RuntimeErrorValue } from '@weiliang0121/capix-contracts';
4
+ import type { InvocationRelationChange } from '../observation/facts.js';
5
+ import type { InvocationFailure } from './failure.js';
6
+ import type { InvocationRelationView, InvocationView } from './view.js';
7
+ import type { InvocationContext } from '../context/context.js';
8
+ import type { InvocationResult } from './result.js';
9
+ import type { InvocationPropagationScope } from './provenance.js';
10
+ import type { InvocationReceptionBinding } from './reception.js';
11
+ export interface InvocationRelationOptions {
12
+ key?: string;
13
+ declarationPosition?: number;
14
+ output?: InvocationOutputReceiver<any, any>;
15
+ receiveFailure?: boolean;
16
+ }
17
+ export interface InvocationTarget<Output = unknown> {
18
+ readonly context: InvocationContext<unknown, Output>;
19
+ run(): Promise<Stable<Output>>;
20
+ readonly view?: InvocationView;
21
+ readonly callView?: InvocationView & {
22
+ run(): Promise<Stable<Output>>;
23
+ };
24
+ readonly checkpointBinding?: CheckpointBinding;
25
+ readonly identity?: InvocationIdentity;
26
+ }
27
+ export type InvocationRelationReception = Readonly<{
28
+ status: 'pending';
29
+ } | ({
30
+ readonly contract?: InvocationReceptionBinding;
31
+ } & ({
32
+ status: 'receiving';
33
+ } | {
34
+ status: 'accepted' | 'handled';
35
+ output: unknown;
36
+ } | {
37
+ status: 'failed';
38
+ error: unknown;
39
+ failure?: InvocationFailure;
40
+ diagnostic?: Stable<RuntimeErrorValue>;
41
+ }))>;
42
+ export interface InvocationRelationBaseline<Output = unknown> {
43
+ readonly returned?: InvocationResult<Output>;
44
+ readonly reception: InvocationRelationReception;
45
+ }
46
+ export interface InvocationRelationOwner {
47
+ changing?(): void;
48
+ requireHealthy(): void;
49
+ accepting<Value>(work: () => Promise<Value>): Promise<Value>;
50
+ fail(failure: InvocationFailure): void;
51
+ publish(relation: InvocationRelation, change: InvocationRelationChange): unknown | undefined;
52
+ receive<Value>(relation: InvocationRelation, work: () => Promise<Value>): Promise<Value>;
53
+ captureDelivery(): InvocationPropagationScope;
54
+ receptionFailure(relation: InvocationRelation, error: unknown, scope: InvocationPropagationScope): {
55
+ error: unknown;
56
+ failure: InvocationFailure;
57
+ delivery: unknown;
58
+ };
59
+ }
60
+ export interface InvocationRelationSetup<Output = unknown> {
61
+ readonly target: InvocationTarget<Output>;
62
+ readonly round: number;
63
+ readonly order: number;
64
+ readonly key?: string;
65
+ readonly declarationPosition?: number;
66
+ readonly receiveFailure?: boolean;
67
+ }
68
+ export declare class InvocationRelation<Output = unknown> {
69
+ #private;
70
+ private readonly owner;
71
+ readonly view: InvocationRelationView;
72
+ private target;
73
+ readonly round: number;
74
+ readonly order: number;
75
+ readonly key?: string;
76
+ readonly declarationPosition?: number;
77
+ constructor(identity: InvocationRelationSetup<Output>, owner: InvocationRelationOwner);
78
+ get receiveFailure(): boolean;
79
+ receiveFailures(): void;
80
+ get invocation(): InvocationTarget<Output>;
81
+ install(target: InvocationTarget<Output>, state: InvocationRelationBaseline<Output>): void;
82
+ replace(target: InvocationTarget<Output>): void;
83
+ get returned(): InvocationResult<Output> | undefined;
84
+ get reception(): InvocationRelationReception;
85
+ returnedWith(result: InvocationResult<Output>): void;
86
+ private fixedResult;
87
+ accept<Value>(work: (delivered: Stable<Output>) => Value | Stable<Value> | Promise<Value | Stable<Value>>, contract?: InvocationReceptionBinding): Promise<Stable<Value>>;
88
+ handle<Value>(work: (failure: unknown) => Value | Stable<Value> | Promise<Value | Stable<Value>>, contract?: InvocationReceptionBinding): Promise<Stable<Value>>;
89
+ private acceptResult;
90
+ private beginReception;
91
+ private receiveWithinParent;
92
+ private completeReception;
93
+ }
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{stableValue}from"@weiliang0121/capix-contracts";import{combineFaults}from"@weiliang0121/capix-changes";import{failureDiagnostic}from"./failure.js";import{InvocationStopped}from"./stop.js";class InvocationRelation{static{__name(this,"InvocationRelation")}owner;#returned;#restoredReception=!1;view;#reception=Object.freeze({status:"pending"});target;round;order;key;declarationPosition;#receiveFailure;constructor(identity,owner){this.owner=owner,this.target=identity.target,this.round=identity.round,this.order=identity.order,this.key=identity.key,this.declarationPosition=identity.declarationPosition,this.#receiveFailure=identity.receiveFailure??!1;const relation=this;this.view=Object.freeze({get invocation(){if(!relation.invocation.view)throw new Error("Child invocation has no business view");return relation.invocation.view},round:this.round,key:this.key,get returned(){return relation.returned},get reception(){return relation.reception}})}get receiveFailure(){return this.#receiveFailure}receiveFailures(){if(this.owner.requireHealthy(),this.#returned||this.#reception.status!=="pending")throw new Error("Failure reception must be chosen before child execution");this.owner.changing?.(),this.#receiveFailure=!0}get invocation(){return this.target}install(target,state){this.owner.changing?.();const returned=state.returned?this.fixedResult(state.returned):void 0,reception=state.reception.status==="accepted"||state.reception.status==="handled"?{...state.reception,output:stableValue(state.reception.output)}:state.reception.status==="failed"?{...state.reception,diagnostic:state.reception.diagnostic?stableValue(state.reception.diagnostic):failureDiagnostic(state.reception.error)}:state.reception;this.owner.changing?.(),this.target=target,this.#restoredReception=state.reception.status==="receiving",this.#returned=returned,this.#reception=Object.freeze(reception)}replace(target){this.owner.changing?.(),this.target=target}get returned(){return this.#returned}get reception(){return this.#reception}returnedWith(result){if(this.owner.changing?.(),this.#returned)throw new Error("Child invocation has already returned");const fixed=this.fixedResult(result);if(this.owner.changing?.(),this.#returned)throw new Error("Child invocation has already returned");this.#returned=fixed,result.status==="failed"&&result.failure&&(!this.receiveFailure||!result.failure.receptionAllowed)&&this.owner.fail(result.failure),this.owner.publish(this,{kind:"returned",result:this.#returned})}fixedResult(result){return Object.freeze(result.status==="succeeded"?{...result,output:stableValue(result.output)}:{...result,diagnostic:result.diagnostic?stableValue(result.diagnostic):failureDiagnostic(result.error)})}accept(work,contract){try{return this.owner.accepting(()=>this.acceptResult(work,contract))}catch(error){return Promise.reject(error)}}handle(work,contract){try{return this.owner.accepting(async()=>{if(!this.receiveFailure||this.#returned?.status!=="failed"||!this.#returned.failure?.receptionAllowed)throw new Error("Child has no receivable failed delivery");const scope=this.owner.captureDelivery(),failure=this.#returned.error;this.beginReception(contract,!0);const output=await this.receiveWithinParent(failure,work,scope,contract);this.owner.changing?.(),this.#reception=Object.freeze({status:"handled",output,...contract?{contract}:{}});const observed=this.owner.publish(this,{kind:"handled",output});if(observed!==void 0)throw observed;return output})}catch(error){return Promise.reject(error)}}async acceptResult(work,contract){const scope=this.owner.captureDelivery();if(this.#returned?.status!=="succeeded")throw new Error("Child invocation has not returned successfully");const delivered=this.#returned.output;this.beginReception(contract);const output=await this.receiveWithinParent(delivered,work,scope,contract);return this.completeReception(output,contract),output}beginReception(contract,failed=!1){if(this.owner.requireHealthy(),!this.#returned||(failed?this.#returned.status!=="failed":this.#returned.status!=="succeeded"))throw new Error("Child invocation has not returned the expected outcome");if(contract&&contract.childPosition!==this.declarationPosition)throw new Error("Reception contract belongs to a different child position");if(this.#reception.status!=="pending"&&!this.#restoredReception)throw new Error("Child result has already entered acceptance");if(this.#restoredReception&&this.#reception.status==="receiving"&&this.#reception.contract!==contract)throw new Error("Restored reception contract cannot be replaced");this.owner.changing?.(),this.#restoredReception=!1,this.#reception=Object.freeze({status:"receiving",...contract?{contract}:{}});const observed=this.owner.publish(this,{kind:"receiving"});if(observed!==void 0){this.owner.changing?.();const diagnostic=failureDiagnostic(observed);this.owner.changing?.(),this.#reception=Object.freeze({status:"failed",error:observed,diagnostic,...contract?{contract}:{}});const failed2=this.owner.publish(this,{kind:"failed",error:observed,source:"observation"});throw combineFaults([observed,...failed2!==void 0?[failed2]:[]])}}async receiveWithinParent(delivered,work,scope,contract){try{return this.owner.requireHealthy(),await this.owner.receive(this,async()=>{const candidate=await work(delivered);this.owner.changing?.();const value=stableValue(candidate);try{const checked=contract?.check(value);if(checked!==null&&(typeof checked=="object"||typeof checked=="function")&&typeof Reflect.get(checked,"then")=="function")throw Promise.resolve(checked).catch(()=>{}),new TypeError("Reception checks must return synchronously")}catch(cause){throw new InvocationStopped("RECEPTION_CONTRACT","Parent reception value violates its contract",void 0,{cause})}return value})}catch(error){const rejected=this.owner.receptionFailure(this,error,scope);this.owner.changing?.();const diagnostic=failureDiagnostic(rejected.error);this.owner.changing?.(),this.#reception=Object.freeze({status:"failed",error:rejected.error,failure:rejected.failure,diagnostic,...contract?{contract}:{}});const failed=this.owner.publish(this,{kind:"failed",error:rejected.error,source:"work"});throw failed!==void 0?new AggregateError([rejected.error,failed],"Child acceptance and observation both failed",{cause:rejected.error}):rejected.delivery}}completeReception(output,contract){this.owner.changing?.(),this.#reception=Object.freeze({status:"accepted",output,...contract?{contract}:{}});const accepted=this.owner.publish(this,{kind:"accepted",output});if(accepted!==void 0)throw accepted}}export{InvocationRelation};
@@ -0,0 +1,31 @@
1
+ import { ResourceRequest, ResourceSupply, type ResourceOwner, type ResourceRequirements, type ResourceRefinement, type ResourceSupplyEntry } from '@weiliang0121/capix-resources';
2
+ import type { OperationOutcome } from '@weiliang0121/capix-contracts';
3
+ export interface InvocationResourceOwner extends ResourceOwner {
4
+ readonly round?: () => number;
5
+ }
6
+ export declare class InvocationResources<Resources extends object = object> {
7
+ #private;
8
+ readonly supply: ResourceSupply;
9
+ readonly values: Readonly<Resources>;
10
+ constructor(deps: ResourceRequirements<Resources>, entries?: readonly ResourceSupplyEntry[], initial?: ResourceRequirements, supply?: ResourceRequirements);
11
+ view<Values extends object>(deps: ResourceRequirements<Values>, phase?: string): Readonly<Values>;
12
+ private namedView;
13
+ restrict(validate: () => void): void;
14
+ attach(owner: InvocationResourceOwner): void;
15
+ start(phase?: string): void;
16
+ activate(phase: string, deps: ResourceRequirements): void;
17
+ close(phase: string): void;
18
+ closeAll(): void;
19
+ closeAllResult(): OperationOutcome<void>;
20
+ select<Values extends object, Input = unknown>(deps: ResourceRequirements<Values>, initial?: ResourceRequirements, selection?: {
21
+ readonly input: Input;
22
+ readonly refinements: readonly ResourceRefinement<Input>[];
23
+ readonly supply?: ResourceRequirements;
24
+ }): InvocationResources<Values>;
25
+ supplement(others: readonly InvocationResources[]): InvocationResources;
26
+ provides(request: ResourceRequest<unknown>): boolean;
27
+ private round;
28
+ private window;
29
+ private validateWindow;
30
+ private first;
31
+ }
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{ResourceAccess,ResourceAccessClosed,captureResourceOwner,ResourceRequest,ResourceSupply,checkResourceRequests,resourceRequests}from"@weiliang0121/capix-resources";class InvocationResources{static{__name(this,"InvocationResources")}supply;values;#requirements;#initial;#windows=new Map;#phaseRequirements=new Map;#closed=new Set;#bound=new Set;#available=new Set;#owner;#restriction;#started=!1;#phase="run";#ended=!1;constructor(deps,entries=[],initial=deps,supply=deps){this.supply=new ResourceSupply(entries).select(supply),this.#requirements=Object.freeze({...deps}),this.#initial=Object.freeze({...initial}),this.#phaseRequirements.set("run",this.#initial),this.values=this.view(initial)}view(deps,phase="run"){const fixed=Object.freeze({...deps});checkResourceRequests(this.#requirements,resourceRequests(fixed)),this.supply.select(fixed);let round=this.#owner?this.round():void 0;return this.namedView(fixed,phase,()=>round??=this.round())}namedView(deps,phase,round){const values={};let endpoints;for(const name of Object.keys(deps))Object.defineProperty(values,name,{enumerable:!0,get:__name(()=>{const access=this.window(phase,round(),deps);return(endpoints??=access.view(deps))[name]},"get")});return Object.freeze(values)}restrict(validate){if(this.#restriction||this.#owner||this.#started||this.#windows.size||this.#ended)throw new Error("Resource access is already established");this.#restriction=validate}attach(owner){if(this.#owner||this.#started||this.#windows.size||this.#ended)throw new Error("Resource access is already established");const fixed=captureResourceOwner(owner);if(!fixed)throw new TypeError("Invocation resource owner is required");this.#owner=Object.freeze({...fixed,round:owner.round?.bind(owner)})}start(phase="run"){if(this.#started||this.#ended)throw new Error("Resource access has already started");this.#started=!0,this.activate(phase,this.#initial)}activate(phase,deps){if(!this.#started)throw new Error("Resource access requires a started invocation");if(this.#ended)throw new ResourceAccessClosed;checkResourceRequests(this.#requirements,resourceRequests(deps)),this.#phase!==phase&&this.close(this.#phase),this.#phase=phase,this.#phaseRequirements.set(phase,Object.freeze({...deps})),this.window(phase,this.round(),deps).view(deps)}close(phase){const key=`${phase}:${this.round()}`;this.#closed.add(key),this.#windows.get(key)?.close()}closeAll(){const result=this.closeAllResult();if(result.status==="failed")throw result.failure}closeAllResult(){this.#ended=!0;const failures=[];for(const window of this.#windows.values())try{window.close()}catch(failure){failures.push(failure)}return failures.length?{status:"failed",failure:failures.length===1?failures[0]:new AggregateError(failures,"Invocation resource windows failed to close",{cause:failures[0]})}:{status:"succeeded",value:void 0}}select(deps,initial=deps,selection){let supply=this.supply.select(selection?.supply??deps);return selection?.refinements.length&&(supply=supply.refine(selection.input,selection.refinements)),new InvocationResources(deps,supply.entries,initial,selection?.supply)}supplement(others){const entries=[...this.supply.entries];for(const other of others)for(const entry of other.supply.entries){const previous=entries.find(candidate=>candidate.offer===entry.offer);if(previous&&previous!==entry)throw new Error(`Ambiguous resource supply: ${entry.offer.name}`);previous||entries.push(entry)}const requests=Object.fromEntries(entries.map((entry,index)=>[String(index),new ResourceRequest(entry.offer)]));return new InvocationResources(requests,entries)}provides(request){return this.supply.entries.some(entry=>entry.offer===request.offer)}round(){return Math.max(1,this.#owner?.round?.()??1)}window(phase,round,deps){const key=`${phase}:${round}`;this.validateWindow(phase,round,key);const existing=this.#windows.get(key);if(existing)return existing;const access=new ResourceAccess(this.#phaseRequirements.get(phase)??deps,this.supply,this.#owner,{validate:__name(()=>this.validateWindow(phase,round,key),"validate"),bound:__name(entry=>this.first(this.#bound,entry),"bound"),available:__name(entry=>this.first(this.#available,entry),"available")});this.#windows.set(key,access);try{return access.start(),access}catch(error){throw access.close(),this.#closed.add(key),error}}validateWindow(phase,round,key){try{if(this.#ended||this.#closed.has(key))throw new ResourceAccessClosed;if(this.#owner&&!this.#started)throw new Error("Resource access requires a started invocation");if(phase!==this.#phase)throw new ResourceAccessClosed("Resource access belongs to an inactive declaration phase");if(round!==this.round())throw new ResourceAccessClosed("Resource access belongs to an inactive declaration round");this.#restriction?.()}catch(error){throw this.#owner?.error?.(error),error}}first(entries,entry){return entries.has(entry)?!1:(entries.add(entry),!0)}}export{InvocationResources};
@@ -0,0 +1,8 @@
1
+ import { InvocationResources } from './resource-access.js';
2
+ import type { InvocationContext } from '../context/context.js';
3
+ import type { ResourceFailurePolicy } from '@weiliang0121/capix-resources';
4
+ import type { Invocation } from './invocation.js';
5
+ export declare const invocationResourceFailures: ResourceFailurePolicy;
6
+ export declare function attachInvocationResources<Input, Output, Context extends InvocationContext<Input, Output> & {
7
+ readonly signal: AbortSignal;
8
+ }>(invocation: Invocation<Input, Output, Context>, resources: InvocationResources): void;
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import"./resource-access.js";import{isProtectedOperationFailure}from"../operation/failure.js";import{RuntimeErrorHelper}from"@weiliang0121/capix-diagnostics";import{isInvocationCancelled}from"./cancellation.js";const invocationResourceFailures=Object.freeze({isProtected:isProtectedOperationFailure,isCancellation:isInvocationCancelled,describe:RuntimeErrorHelper.format});function attachInvocationResources(invocation,resources){resources.attach({contextId:invocation.context.id,failures:invocationResourceFailures,signal:invocation.context.signal,round:__name(()=>invocation.context.progress.round,"round"),reception:__name(()=>invocation.children.reception,"reception"),nextSequence:__name(()=>invocation.nextResourceSequence(),"nextSequence"),validate:__name(()=>invocation.requireActive(),"validate"),observation:invocation.observation?.resource,transcript:invocation.observation?.transcript,memory:invocation.observation?.memory,error:__name((error,allowException)=>invocation.reject(error,allowException),"error")})}__name(attachInvocationResources,"attachInvocationResources");export{attachInvocationResources,invocationResourceFailures};
@@ -0,0 +1,12 @@
1
+ import type { InvocationFailure } from './failure.js';
2
+ import type { RuntimeErrorValue, Stable } from '@weiliang0121/capix-contracts';
3
+ export type InvocationResult<Output> = Readonly<{
4
+ status: 'succeeded';
5
+ output: Stable<Output>;
6
+ } | {
7
+ status: 'failed';
8
+ error: unknown;
9
+ failure?: InvocationFailure;
10
+ diagnostic?: Stable<RuntimeErrorValue>;
11
+ }>;
12
+ export declare function receiveResult<Output>(result: InvocationResult<Output>): Stable<Output>;
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});function receiveResult(result){if(result.status==="failed")throw result.error;return result.output}__name(receiveResult,"receiveResult");export{receiveResult};
@@ -0,0 +1,3 @@
1
+ import { RuntimeError } from '@weiliang0121/capix-contracts';
2
+ export declare class InvocationStopped extends RuntimeError {
3
+ }
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{RuntimeError}from"@weiliang0121/capix-contracts";class InvocationStopped extends RuntimeError{static{__name(this,"InvocationStopped")}}export{InvocationStopped};
@@ -0,0 +1,30 @@
1
+ import type { Stable } from '@weiliang0121/capix-contracts';
2
+ import type { InvocationFailure } from './failure.js';
3
+ import type { InvocationContextView } from '../context/view.js';
4
+ import type { InvocationResult } from './result.js';
5
+ import type { InvocationRelationReception } from './relation.js';
6
+ export interface InvocationRelationView {
7
+ readonly invocation: InvocationView;
8
+ readonly round: number;
9
+ readonly key?: string;
10
+ readonly returned: InvocationResult<unknown> | undefined;
11
+ readonly reception: InvocationRelationReception;
12
+ }
13
+ export interface InvocationView<Input = unknown, Output = unknown, ContextView extends InvocationContextView<Input, Output> = InvocationContextView<Input, Output>> {
14
+ readonly context: ContextView;
15
+ readonly origin: Readonly<{
16
+ contextId: string;
17
+ }>;
18
+ readonly sequence: number;
19
+ readonly failure?: InvocationFailure;
20
+ readonly children: {
21
+ get(invocation: InvocationView): InvocationRelationView;
22
+ values(): readonly InvocationRelationView[];
23
+ };
24
+ }
25
+ export interface ChildInvocationView<Input = unknown, Output = unknown, ContextView extends InvocationContextView<Input, Output> = InvocationContextView<Input, Output>> extends InvocationView<Input, Output, ContextView> {
26
+ run(): Promise<Stable<Output>>;
27
+ }
28
+ export type InvocationViewSource = Pick<InvocationView, 'origin' | 'sequence' | 'failure' | 'children'>;
29
+ export declare function invocationView<Input, Output, Context extends InvocationContextView<Input, Output>>(source: InvocationViewSource, context: Context): InvocationView<Input, Output, Context>;
30
+ export declare function childInvocationView<Input, Output, Context extends InvocationContextView<Input, Output>>(source: InvocationViewSource, context: Context, run: () => Promise<Stable<Output>>): ChildInvocationView<Input, Output, Context>;
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});function viewProperties(source,context){return{context,origin:source.origin,get sequence(){return source.sequence},get failure(){return source.failure},children:source.children}}__name(viewProperties,"viewProperties");function invocationView(source,context){return Object.freeze(viewProperties(source,context))}__name(invocationView,"invocationView");function childInvocationView(source,context,run){return Object.freeze(Object.assign(viewProperties(source,context),{run}))}__name(childInvocationView,"childInvocationView");export{childInvocationView,invocationView};
@@ -0,0 +1,31 @@
1
+ import type { InvocationCheckpointWork } from '../checkpoint/work.js';
2
+ import type { OperationOutcome, OutputDeclaration, Stable } from '@weiliang0121/capix-contracts';
3
+ import type { Invocation } from './invocation.js';
4
+ import type { InvocationContext } from '../context/context.js';
5
+ import type { InvocationFailure } from './failure.js';
6
+ export interface InvocationWork<Input, Output, Context extends InvocationContext<Input, Output>> {
7
+ readonly output?: OutputDeclaration<Output, unknown>;
8
+ readonly checkpoint?: InvocationCheckpointWork<Input, Output, Context>;
9
+ execute(context: Context, invocation: Invocation<Input, Output, Context>): Output | Stable<Output> | Promise<Output | Stable<Output>>;
10
+ close?(context: Context, invocation: Invocation<Input, Output, Context>): OperationOutcome<void>;
11
+ }
12
+ export type InvocationProcess = {
13
+ stage: 'execute';
14
+ type: 'start';
15
+ input: unknown;
16
+ } | {
17
+ stage: 'execute';
18
+ type: 'return';
19
+ output: unknown;
20
+ } | {
21
+ stage: 'execute';
22
+ type: 'throw';
23
+ error: unknown;
24
+ failure?: InvocationFailure;
25
+ };
26
+ export interface InvocationExecutionWork<Output> {
27
+ readonly output?: OutputDeclaration<Output, unknown>;
28
+ execute(): Output | Stable<Output> | Promise<Output | Stable<Output>>;
29
+ close(): OperationOutcome<void>;
30
+ }
31
+ export declare function connectInvocationWork<Input, Output, Context extends InvocationContext<Input, Output>>(work: InvocationWork<Input, Output, Context>, context: Context, invocation: Invocation<Input, Output, Context>): InvocationExecutionWork<Output>;
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{InvocationStopped}from"./stop.js";function connectInvocationWork(work,context,invocation){return{output:work.output,execute:__name(()=>work.execute(context,invocation),"execute"),close:__name(()=>closeInvocationWork(work,context,invocation),"close")}}__name(connectInvocationWork,"connectInvocationWork");function closeInvocationWork(work,context,invocation){try{if(work.close===void 0)return{status:"succeeded",value:void 0};const result=work.close(context,invocation);if(result&&typeof result=="object"&&"then"in result)throw Promise.resolve(result).catch(()=>{}),new InvocationStopped("INVALID_WORK_CLOSE","Work close must return a synchronous outcome");if(!result||typeof result!="object"||!("status"in result))throw new InvocationStopped("INVALID_WORK_CLOSE","Work close must return an outcome");if(result.status==="succeeded"&&"value"in result&&result.value===void 0)return{status:"succeeded",value:void 0};if(result.status==="failed"&&"failure"in result)return{status:"failed",failure:result.failure};throw new InvocationStopped("INVALID_WORK_CLOSE","Work close returned an invalid outcome")}catch(failure){return{status:"failed",failure}}}__name(closeInvocationWork,"closeInvocationWork");export{connectInvocationWork};
@@ -0,0 +1,4 @@
1
+ export declare class ObservationError extends Error {
2
+ readonly code = "OBSERVATION_FAILED";
3
+ constructor(cause: unknown);
4
+ }
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});class ObservationError extends Error{static{__name(this,"ObservationError")}code="OBSERVATION_FAILED";constructor(cause){super("Observation failed",{cause}),this.name="ObservationError"}}export{ObservationError};
@@ -0,0 +1,64 @@
1
+ import type { InvocationRelationIdentity } from '@weiliang0121/capix-protocol';
2
+ import type { BusinessEvent } from '@weiliang0121/capix-contracts';
3
+ import type { InvocationIdentity } from '@weiliang0121/capix-contracts';
4
+ import type { ContextState } from '../context/context.js';
5
+ import type { InvocationProcess } from '../invocation/work.js';
6
+ import type { InvocationResult } from '../invocation/result.js';
7
+ import type { InvocationFailure } from '../invocation/failure.js';
8
+ export type { InvocationRelationIdentity } from '@weiliang0121/capix-protocol';
9
+ export type { InvocationIdentity } from '@weiliang0121/capix-contracts';
10
+ export interface InvocationDescription {
11
+ readonly role?: string;
12
+ readonly id?: string;
13
+ readonly name?: string;
14
+ readonly label?: string;
15
+ readonly source?: string;
16
+ readonly callee?: string;
17
+ }
18
+ export type InvocationRelationChange = {
19
+ readonly kind: 'attached';
20
+ } | {
21
+ readonly kind: 'returned';
22
+ readonly result: InvocationResult<unknown>;
23
+ } | {
24
+ readonly kind: 'receiving';
25
+ } | {
26
+ readonly kind: 'accepted' | 'handled';
27
+ readonly output: unknown;
28
+ } | {
29
+ readonly kind: 'failed';
30
+ readonly error: unknown;
31
+ readonly source: 'work' | 'observation';
32
+ readonly failure?: InvocationFailure;
33
+ };
34
+ export type InvocationChange = {
35
+ readonly kind: 'started';
36
+ readonly input: unknown;
37
+ } | {
38
+ readonly kind: 'process';
39
+ readonly process: InvocationProcess;
40
+ readonly processSequence: number;
41
+ readonly round: number;
42
+ } | {
43
+ readonly kind: 'relation';
44
+ readonly relation: InvocationRelationIdentity;
45
+ readonly change: InvocationRelationChange;
46
+ } | {
47
+ readonly kind: 'finished';
48
+ readonly state: ContextState<unknown>;
49
+ };
50
+ export type InvocationFact = InvocationChange & {
51
+ readonly identity: InvocationIdentity;
52
+ readonly description?: InvocationDescription;
53
+ readonly eventSequence: number;
54
+ readonly occurredAt: string;
55
+ readonly monotonicTime: number;
56
+ };
57
+ export type { ResourceObservation } from '@weiliang0121/capix-resources';
58
+ export type { BusinessEvent } from '@weiliang0121/capix-contracts';
59
+ export interface BusinessObservation {
60
+ readonly identity: InvocationIdentity;
61
+ readonly sequence: number;
62
+ readonly occurredAt: string;
63
+ readonly event: Readonly<BusinessEvent>;
64
+ }
@@ -0,0 +1 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
@@ -0,0 +1,17 @@
1
+ import type { TranscriptEvent, MemoryEvent } from '@weiliang0121/capix-protocol';
2
+ import type { InvocationFact, ResourceObservation, BusinessObservation } from './facts.js';
3
+ import type { EventConsumer } from '@weiliang0121/capix-changes';
4
+ import type { InvocationObserver } from './observer.js';
5
+ import { type ObserverSession } from './session.js';
6
+ export declare class InvocationObservation {
7
+ #private;
8
+ constructor(sessions: readonly ObserverSession[], installed: ReadonlyMap<object, ObserverSession>);
9
+ observerFor(installation: object): InvocationObserver | undefined;
10
+ sessionFor(installation: object): ObserverSession | undefined;
11
+ publish(fact: InvocationFact): unknown | undefined;
12
+ readonly resource: EventConsumer<ResourceObservation>;
13
+ readonly business: EventConsumer<BusinessObservation>;
14
+ readonly transcript: EventConsumer<TranscriptEvent>;
15
+ readonly memory: EventConsumer<MemoryEvent>;
16
+ private dispatch;
17
+ }
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{publishSessions}from"./session.js";class InvocationObservation{static{__name(this,"InvocationObservation")}#sessions;#installed;constructor(sessions,installed){this.#sessions=Object.freeze([...sessions]),this.#installed=new Map(installed)}observerFor(installation){const session=this.#installed.get(installation);return session?.available()?session.observer:void 0}sessionFor(installation){return this.#installed.get(installation)}publish(fact){return this.dispatch(observer=>observer.observe(fact))}resource={publish:__name(event=>this.dispatch(observer=>observer.resource?.(event)),"publish")};business={publish:__name(event=>this.dispatch(observer=>observer.business?.(event)),"publish")};transcript={publish:__name(event=>this.dispatch(observer=>observer.transcript?.(event)),"publish")};memory={publish:__name(event=>this.dispatch(observer=>observer.memory?.(event)),"publish")};dispatch(work){return publishSessions(this.#sessions,work)}}export{InvocationObservation};
@@ -0,0 +1,13 @@
1
+ import { InvocationResources } from '../invocation/resource-access.js';
2
+ import type { TranscriptEvent, MemoryEvent } from '@weiliang0121/capix-protocol';
3
+ import type { InvocationFact, ResourceObservation, BusinessObservation } from './facts.js';
4
+ export type { EventConsumer } from '@weiliang0121/capix-changes';
5
+ export interface InvocationObserver {
6
+ readonly resources?: InvocationResources;
7
+ observe(fact: InvocationFact): void;
8
+ business?(fact: BusinessObservation): void;
9
+ resource?(fact: ResourceObservation): void;
10
+ transcript?(event: TranscriptEvent): void;
11
+ memory?(event: MemoryEvent): void;
12
+ available?(): boolean;
13
+ }
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ import"../invocation/resource-access.js";
@@ -0,0 +1,17 @@
1
+ import type { InvocationObserver } from './observer.js';
2
+ export declare class ObserverSession<Observer extends {
3
+ available?(): boolean;
4
+ } = InvocationObserver> {
5
+ readonly observer: Observer;
6
+ readonly failure: 'isolate' | 'propagate';
7
+ private readonly invalidated?;
8
+ private readonly parent?;
9
+ active: boolean;
10
+ constructor(observer: Observer, failure: 'isolate' | 'propagate', invalidated?: ((error: unknown) => void) | undefined, parent?: ObserverSession | undefined);
11
+ available(): boolean;
12
+ stop(error: unknown): void;
13
+ publish(work: (observer: Observer) => unknown): unknown | undefined;
14
+ }
15
+ export declare function publishSessions<Observer extends {
16
+ available?(): boolean;
17
+ }>(sessions: readonly ObserverSession<Observer>[], work: (observer: Observer) => unknown): unknown | undefined;
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{isUndefined}from"es-toolkit/predicate";import{ObservationError}from"./error.js";import{combineFaults}from"@weiliang0121/capix-changes";class ObserverSession{static{__name(this,"ObserverSession")}observer;failure;invalidated;parent;active=!0;constructor(observer,failure,invalidated,parent){this.observer=observer,this.failure=failure,this.invalidated=invalidated,this.parent=parent}available(){return this.active&&this.parent?.available()!==!1&&this.observer.available?.()!==!1}stop(error){this.active&&(this.active=!1,this.invalidated?.(error))}publish(work){if(this.active)try{if(!this.available()){this.active=!1;return}const value=work(this.observer);if(value&&typeof value.then=="function")throw Promise.resolve(value).catch(()=>{}),new TypeError("Observation must complete synchronously");return}catch(cause){this.active=!1;const error=new ObservationError(cause);return this.invalidated?.(error),this.failure==="propagate"?error:void 0}}}function publishSessions(sessions,work){const faults=[];for(const session of sessions){const fault=session.publish(work);isUndefined(fault)||faults.push(fault)}return combineFaults(faults)}__name(publishSessions,"publishSessions");export{ObserverSession,publishSessions};
@@ -0,0 +1 @@
1
+ export declare function isProtectedOperationFailure(error: unknown): boolean;
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{InvocationStopped}from"../invocation/stop.js";import{ObservationError}from"../observation/error.js";import{ChangeCaptureError}from"@weiliang0121/capix-changes";import{PersistenceError}from"@weiliang0121/capix-diagnostics";import{ResourceAccessClosed,ResourcePortError}from"@weiliang0121/capix-resources";import{StableValueError}from"@weiliang0121/capix-contracts";function isProtectedOperationFailure(error){const pending=[error],visited=new Set;for(;pending.length;){const current=pending.pop();if(!(current===null||typeof current!="object"&&typeof current!="function"||visited.has(current))){visited.add(current);try{if(current instanceof StableValueError||current instanceof InvocationStopped||current instanceof ObservationError||current instanceof ChangeCaptureError||current instanceof PersistenceError||current instanceof ResourceAccessClosed||current instanceof ResourcePortError)return!0;if(!(current instanceof AggregateError))continue;const errors=Object.getOwnPropertyDescriptor(current,"errors");if(!errors||!("value"in errors)||!Array.isArray(errors.value))return!0;for(const[key,item]of Object.entries(Object.getOwnPropertyDescriptors(errors.value)))if(/^(0|[1-9]\d*)$/.test(key)){if(!("value"in item))return!0;pending.push(item.value)}}catch{return!0}}}return!1}__name(isProtectedOperationFailure,"isProtectedOperationFailure");export{isProtectedOperationFailure};
@@ -0,0 +1,2 @@
1
+ import type { InvocationOutputReceiver } from '@weiliang0121/capix-contracts';
2
+ export declare function combineOutputReceivers<Result, Delta = unknown>(...receivers: readonly (InvocationOutputReceiver<Result, Delta> | undefined)[]): InvocationOutputReceiver<Result, Delta> | undefined;
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{ProgressChannel}from"@weiliang0121/capix-changes";function combineOutputReceivers(...receivers){const channels=receivers.filter(receiver=>receiver!==void 0).map(receiver=>new ProgressChannel(receiver));if(channels.length)return{receive:__name(event=>{for(const channel of channels)channel.publish(event)},"receive")}}__name(combineOutputReceivers,"combineOutputReceivers");export{combineOutputReceivers};
@@ -0,0 +1,21 @@
1
+ import { ProgressChannel } from '@weiliang0121/capix-changes';
2
+ import type { InvocationOutputEvent, InvocationOutputWriter, OutputDeclaration, Stable } from '@weiliang0121/capix-contracts';
3
+ export declare class InvocationOutputSection<Result> {
4
+ #private;
5
+ readonly contextId: string;
6
+ readonly round: number;
7
+ private readonly declaration;
8
+ private readonly controls;
9
+ readonly writer: InvocationOutputWriter<unknown>;
10
+ constructor(contextId: string, round: number, declaration: OutputDeclaration<Result, unknown> | undefined, controls: {
11
+ active(): void;
12
+ reject(error: unknown): void;
13
+ }, delivery?: ProgressChannel<InvocationOutputEvent<Result>>);
14
+ start(): void;
15
+ private emit;
16
+ seal(): void;
17
+ discard(reason: 'exception' | 'continue' | 'failed'): void;
18
+ validateResult(value: Stable<Result>): Stable<Result>;
19
+ complete(result: Stable<Result>): void;
20
+ private publish;
21
+ }
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import"@weiliang0121/capix-changes";import{RuntimeError,stableValue}from"@weiliang0121/capix-contracts";class InvocationOutputSection{static{__name(this,"InvocationOutputSection")}contextId;round;declaration;controls;writer;#state="open";#sequence=0;#delivery;constructor(contextId,round,declaration,controls,delivery){this.contextId=contextId,this.round=round,this.declaration=declaration,this.controls=controls,this.#delivery=delivery,this.writer=Object.freeze({emit:__name(value=>this.emit(value),"emit")})}start(){this.publish({kind:"started"}),this.controls.active()}emit(value){if(this.#state!=="open")throw new RuntimeError("OUTPUT_CLOSED","This output writer no longer belongs to an executing segment");this.controls.active();let delta;try{if(!this.declaration?.delta)throw new RuntimeError("OUTPUT_UNDECLARED","This declaration does not produce incremental output");delta=this.declaration.delta(value),rejectPromise(delta),delta=stableValue(delta)}catch(cause){const error=new RuntimeError("OUTPUT_CONTRACT","Produced incremental output violates its declaration",void 0,{cause});throw this.controls.reject(error),error}if(this.controls.active(),this.publish({kind:"delta",delta}),this.controls.active(),this.#state!=="open")throw new RuntimeError("OUTPUT_CLOSED","The output segment ended during delivery")}seal(){this.#state==="open"&&(this.#state="sealed",this.publish({kind:"sealed"}))}discard(reason){this.#state==="discarded"||this.#state==="completed"||(this.#state="discarded",this.publish({kind:"discarded",reason}))}validateResult(value){try{const result=this.declaration?this.declaration.result(value):value;if(this.declaration&&rejectPromise(result),result!==value&&!Object.is(result,value))throw new TypeError("Output validation must preserve the final value identity");return value}catch(cause){const error=new RuntimeError("OUTPUT_CONTRACT","The final output violates its declaration",void 0,{cause});throw this.controls.reject(error),error}}complete(result){if(this.#state==="open"||this.#state==="completed")throw new Error("Output segment cannot complete from this state");const discarded=this.#state==="discarded";this.#state="completed",this.publish({kind:"completed",result,discarded})}publish(event){this.#delivery?.publish(Object.freeze({...event,contextId:this.contextId,round:this.round,sequence:++this.#sequence}))}}function rejectPromise(value){if(value&&(typeof value=="object"||typeof value=="function")&&"then"in value&&typeof value.then=="function")throw Promise.resolve(value).catch(()=>{}),new TypeError("Output contracts must return synchronously")}__name(rejectPromise,"rejectPromise");export{InvocationOutputSection};
@@ -0,0 +1,2 @@
1
+ export declare function isNonEmptyArray(value: unknown): value is [unknown, ...unknown[]];
2
+ export declare function hasUniqueItems(values: readonly unknown[]): boolean;
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{isArray}from"es-toolkit/compat";function isNonEmptyArray(value){return isArray(value)&&value.length>0}__name(isNonEmptyArray,"isNonEmptyArray");function hasUniqueItems(values){return new Set(values).size===values.length}__name(hasUniqueItems,"hasUniqueItems");export{hasUniqueItems,isNonEmptyArray};
@@ -0,0 +1,2 @@
1
+ export declare const isObjectLike: (value: unknown) => value is object;
2
+ export declare function isObject(value: unknown): value is Record<string, unknown>;
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{isArray,isObjectLike as toolkitIsObjectLike}from"es-toolkit/compat";const isObjectLike=toolkitIsObjectLike;function isObject(value){return isObjectLike(value)&&!isArray(value)}__name(isObject,"isObject");export{isObject,isObjectLike};
@@ -0,0 +1,2 @@
1
+ export declare const nonBlankStringPattern: RegExp;
2
+ export declare function isNonBlankString(value: unknown): value is string;
@@ -0,0 +1,2 @@
1
+ /*! MIT License | Copyright (c) 2026 wei.liang | See LICENSE */
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{isString}from"es-toolkit/predicate";const nonBlankStringPattern=/\S/;function isNonBlankString(value){return isString(value)&&nonBlankStringPattern.test(value)}__name(isNonBlankString,"isNonBlankString");export{isNonBlankString,nonBlankStringPattern};
package/package.json CHANGED
@@ -1,6 +1,48 @@
1
1
  {
2
2
  "name": "@weiliang0121/capix-invocation",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ }
11
+ },
12
+ "dependencies": {
13
+ "es-toolkit": "1.52.0",
14
+ "@weiliang0121/capix-contracts": "0.1.0",
15
+ "@weiliang0121/capix-protocol": "0.1.0",
16
+ "@weiliang0121/capix-diagnostics": "0.1.0",
17
+ "@weiliang0121/capix-resources": "0.1.0",
18
+ "@weiliang0121/capix-changes": "0.1.0",
19
+ "@weiliang0121/capix-checkpoint": "0.1.0"
20
+ },
21
+ "description": "Invocation lifecycle, child relations, reception, output, and checkpoint activity for CAPiX.",
22
+ "license": "MIT",
23
+ "author": "wei.liang (https://github.com/weiliang0121)",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/weiliang0121/capix.git",
27
+ "directory": "server/invocation"
28
+ },
29
+ "engines": {
30
+ "node": ">=22.23.2"
31
+ },
32
+ "main": "./dist/index.js",
33
+ "types": "./dist/index.d.ts",
34
+ "files": [
35
+ "dist/**/*.js",
36
+ "dist/**/*.d.ts",
37
+ "LICENSE",
38
+ "README.md"
39
+ ],
40
+ "publishConfig": {
41
+ "access": "public",
42
+ "registry": "https://registry.npmjs.org"
43
+ },
44
+ "scripts": {
45
+ "build": "tsc -p tsconfig.json",
46
+ "typecheck": "tsc -p tsconfig.json --noEmit"
47
+ }
6
48
  }