@orgloop/sdk 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.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OrgLoop contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,174 @@
1
+ /**
2
+ * Connector interfaces — the contract between OrgLoop and external systems.
3
+ *
4
+ * Connectors bridge the gap between OrgLoop's event model and specific platforms.
5
+ * A connector can provide a source (inbound events), a target (outbound delivery), or both.
6
+ */
7
+ import type { IncomingMessage, ServerResponse } from 'node:http';
8
+ import type { ActorConfig, OrgLoopEvent, RouteDeliveryConfig, SourceConfig } from './types.js';
9
+ /** Result of a poll operation */
10
+ export interface PollResult {
11
+ /** Events discovered since the last checkpoint */
12
+ events: OrgLoopEvent[];
13
+ /** Opaque checkpoint string for crash recovery */
14
+ checkpoint: string;
15
+ }
16
+ /** HTTP request handler for webhook-based sources */
17
+ export type WebhookHandler = (req: IncomingMessage, res: ServerResponse) => Promise<OrgLoopEvent[]>;
18
+ /**
19
+ * Source connector interface.
20
+ *
21
+ * Implement this to create a new event source for OrgLoop.
22
+ * Sources can be poll-based (the runtime calls poll() on a schedule)
23
+ * or webhook-based (the runtime mounts a webhook handler).
24
+ */
25
+ export interface SourceConnector {
26
+ /** Unique connector ID */
27
+ readonly id: string;
28
+ /** Initialize with user-provided config */
29
+ init(config: SourceConfig): Promise<void>;
30
+ /**
31
+ * Poll for new events since the last checkpoint.
32
+ * The runtime calls this on the configured interval.
33
+ * Return an array of normalized OrgLoop events.
34
+ */
35
+ poll(checkpoint: string | null): Promise<PollResult>;
36
+ /**
37
+ * Optional: Register a webhook handler.
38
+ * Return a request handler the server will mount.
39
+ * For push-based sources.
40
+ */
41
+ webhook?(): WebhookHandler;
42
+ /** Clean shutdown */
43
+ shutdown(): Promise<void>;
44
+ }
45
+ /** Result of a delivery operation */
46
+ export interface DeliveryResult {
47
+ /** Delivery status */
48
+ status: 'delivered' | 'rejected' | 'error';
49
+ /** If the actor produces a response event, return it */
50
+ responseEvent?: OrgLoopEvent;
51
+ /** Error details if status is 'error' */
52
+ error?: Error;
53
+ }
54
+ /**
55
+ * Actor (target) connector interface.
56
+ *
57
+ * Implement this to create a new delivery target for OrgLoop.
58
+ * Actors receive events when routes match.
59
+ */
60
+ export interface ActorConnector {
61
+ /** Unique connector ID */
62
+ readonly id: string;
63
+ /** Initialize with user-provided config */
64
+ init(config: ActorConfig): Promise<void>;
65
+ /**
66
+ * Deliver an event to this actor.
67
+ * routeConfig includes actor-specific config from then.config
68
+ * plus the resolved launch prompt (if the route has with).
69
+ */
70
+ deliver(event: OrgLoopEvent, routeConfig: RouteDeliveryConfig): Promise<DeliveryResult>;
71
+ /** Clean shutdown */
72
+ shutdown(): Promise<void>;
73
+ }
74
+ /**
75
+ * Validates that a credential value actually works against the external service.
76
+ *
77
+ * Stage 2 connector maturity — goes beyond checking if an env var is set
78
+ * to verifying it authenticates successfully and reporting identity/scopes.
79
+ */
80
+ export interface CredentialValidator {
81
+ validate(value: string): Promise<{
82
+ valid: boolean;
83
+ /** Identity associated with the credential (e.g., "user: @alice") */
84
+ identity?: string;
85
+ /** Permission scopes granted (e.g., ["repo", "read:org"]) */
86
+ scopes?: string[];
87
+ /** Error message if validation failed */
88
+ error?: string;
89
+ }>;
90
+ }
91
+ /**
92
+ * Detects whether an external service is running and reachable.
93
+ *
94
+ * Stage 2 connector maturity — used by `orgloop doctor` to report service
95
+ * availability. External tools (e.g., orgctl) can also consume this interface.
96
+ */
97
+ export interface ServiceDetector {
98
+ detect(): Promise<{
99
+ running: boolean;
100
+ version?: string;
101
+ endpoint?: string;
102
+ details?: Record<string, unknown>;
103
+ }>;
104
+ }
105
+ /**
106
+ * Connector registration — what a connector package exports.
107
+ *
108
+ * A connector package's default export is a function that returns this object.
109
+ * The runtime calls it once at startup to discover the connector's capabilities.
110
+ */
111
+ export interface ConnectorRegistration {
112
+ /** Unique connector ID */
113
+ id: string;
114
+ /** Source connector class (if this connector can be a source) */
115
+ source?: new () => SourceConnector;
116
+ /** Target/actor connector class (if this connector can be a target) */
117
+ target?: new () => ActorConnector;
118
+ /** JSON Schema for config validation */
119
+ configSchema?: Record<string, unknown>;
120
+ /** Setup metadata for onboarding — env vars, integration steps, etc. */
121
+ setup?: ConnectorSetup;
122
+ /** Service detector for checking if external services are running */
123
+ service_detector?: ServiceDetector;
124
+ /** Credential validators keyed by env var name (e.g., "GITHUB_TOKEN") */
125
+ credential_validators?: Record<string, CredentialValidator>;
126
+ }
127
+ /**
128
+ * Rich definition for an environment variable required by a connector.
129
+ *
130
+ * Provides metadata that the CLI uses to guide users through setup —
131
+ * descriptions, help URLs, and commands to create/acquire credentials.
132
+ */
133
+ export interface EnvVarDefinition {
134
+ /** Environment variable name */
135
+ name: string;
136
+ /** Human-readable description of what this var is for */
137
+ description: string;
138
+ /** URL where the user can get/create this credential */
139
+ help_url?: string;
140
+ /** Command to run that helps set up this variable */
141
+ help_command?: string;
142
+ /** Whether this var is required (default: true) */
143
+ required?: boolean;
144
+ }
145
+ /**
146
+ * Connector setup metadata.
147
+ *
148
+ * Declarative onboarding information that the CLI can use to guide users
149
+ * through connector installation. This is pure metadata — the CLI decides
150
+ * how to act on it.
151
+ */
152
+ export interface ConnectorSetup {
153
+ /** Environment variables required by this connector (string or rich definition) */
154
+ env_vars?: (string | EnvVarDefinition)[];
155
+ /**
156
+ * External integration steps required for this connector to function.
157
+ * Each entry describes one integration the user needs to configure
158
+ * outside of OrgLoop (e.g., registering a webhook, installing a hook
159
+ * in another tool, creating an API token).
160
+ */
161
+ integrations?: ConnectorIntegration[];
162
+ }
163
+ /** An external integration step required by a connector. */
164
+ export interface ConnectorIntegration {
165
+ /** Short identifier (e.g., "claude-code-hook", "github-webhook") */
166
+ id: string;
167
+ /** Human-readable description of what needs to be configured */
168
+ description: string;
169
+ /** The tool/platform this integration targets (e.g., "claude-code", "github", "slack") */
170
+ platform: string;
171
+ /** Optional: a command that can automate the setup */
172
+ command?: string;
173
+ }
174
+ //# sourceMappingURL=connector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/F,iCAAiC;AACjC,MAAM,WAAW,UAAU;IAC1B,kDAAkD;IAClD,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,qDAAqD;AACrD,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,OAA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AG,gBAAgB,CAAC,EAAE,CAAC;IACzC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACtC;AAED,4DAA4D;AAC5D,MAAM,WAAW,oBAAoB;IACpC,oEAAoE;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,0FAA0F;IAC1F,QAAQ,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Connector interfaces — the contract between OrgLoop and external systems.
3
+ *
4
+ * Connectors bridge the gap between OrgLoop's event model and specific platforms.
5
+ * A connector can provide a source (inbound events), a target (outbound delivery), or both.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=connector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector.js","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Event builder and validators — helpers for creating and validating OrgLoop events.
3
+ */
4
+ import type { EventProvenance, OrgLoopEvent, OrgLoopEventType } from './types.js';
5
+ /**
6
+ * Generate a unique event ID with the evt_ prefix.
7
+ * Uses UUID v4 for uniqueness.
8
+ */
9
+ export declare function generateEventId(): string;
10
+ /**
11
+ * Generate a trace ID with the trc_ prefix.
12
+ */
13
+ export declare function generateTraceId(): string;
14
+ /** Options for building an event */
15
+ export interface BuildEventOptions {
16
+ source: string;
17
+ type: OrgLoopEventType;
18
+ provenance: EventProvenance;
19
+ payload?: Record<string, unknown>;
20
+ id?: string;
21
+ timestamp?: string;
22
+ trace_id?: string;
23
+ }
24
+ /**
25
+ * Build a well-formed OrgLoop event.
26
+ * Fills in defaults for id, timestamp, and trace_id.
27
+ */
28
+ export declare function buildEvent(options: BuildEventOptions): OrgLoopEvent;
29
+ /** Validation error */
30
+ export interface ValidationError {
31
+ field: string;
32
+ message: string;
33
+ }
34
+ /**
35
+ * Validate an OrgLoop event.
36
+ * Returns an array of validation errors (empty if valid).
37
+ */
38
+ export declare function validateEvent(event: unknown): ValidationError[];
39
+ /**
40
+ * Check if a value is a valid OrgLoop event (type guard).
41
+ */
42
+ export declare function isOrgLoopEvent(value: unknown): value is OrgLoopEvent;
43
+ //# sourceMappingURL=event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AASlF;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,oCAAoC;AACpC,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,gBAAgB,CAAC;IACvB,UAAU,EAAE,eAAe,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,YAAY,CAUnE;AAED,uBAAuB;AACvB,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,EAAE,CAyC/D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE"}
package/dist/event.js ADDED
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Event builder and validators — helpers for creating and validating OrgLoop events.
3
+ */
4
+ import { randomUUID } from 'node:crypto';
5
+ /** Valid OaC event types */
6
+ const VALID_EVENT_TYPES = new Set([
7
+ 'resource.changed',
8
+ 'actor.stopped',
9
+ 'message.received',
10
+ ]);
11
+ /**
12
+ * Generate a unique event ID with the evt_ prefix.
13
+ * Uses UUID v4 for uniqueness.
14
+ */
15
+ export function generateEventId() {
16
+ return `evt_${randomUUID().replace(/-/g, '').substring(0, 16)}`;
17
+ }
18
+ /**
19
+ * Generate a trace ID with the trc_ prefix.
20
+ */
21
+ export function generateTraceId() {
22
+ return `trc_${randomUUID().replace(/-/g, '').substring(0, 16)}`;
23
+ }
24
+ /**
25
+ * Build a well-formed OrgLoop event.
26
+ * Fills in defaults for id, timestamp, and trace_id.
27
+ */
28
+ export function buildEvent(options) {
29
+ return {
30
+ id: options.id ?? generateEventId(),
31
+ timestamp: options.timestamp ?? new Date().toISOString(),
32
+ source: options.source,
33
+ type: options.type,
34
+ provenance: options.provenance,
35
+ payload: options.payload ?? {},
36
+ trace_id: options.trace_id ?? generateTraceId(),
37
+ };
38
+ }
39
+ /**
40
+ * Validate an OrgLoop event.
41
+ * Returns an array of validation errors (empty if valid).
42
+ */
43
+ export function validateEvent(event) {
44
+ const errors = [];
45
+ if (!event || typeof event !== 'object') {
46
+ errors.push({ field: '', message: 'Event must be a non-null object' });
47
+ return errors;
48
+ }
49
+ const e = event;
50
+ // Required fields
51
+ if (typeof e.id !== 'string' || !e.id.startsWith('evt_')) {
52
+ errors.push({ field: 'id', message: 'id must be a string starting with "evt_"' });
53
+ }
54
+ if (typeof e.timestamp !== 'string') {
55
+ errors.push({ field: 'timestamp', message: 'timestamp must be an ISO 8601 string' });
56
+ }
57
+ if (typeof e.source !== 'string' || e.source.length === 0) {
58
+ errors.push({ field: 'source', message: 'source must be a non-empty string' });
59
+ }
60
+ if (typeof e.type !== 'string' || !VALID_EVENT_TYPES.has(e.type)) {
61
+ errors.push({
62
+ field: 'type',
63
+ message: `type must be one of: ${[...VALID_EVENT_TYPES].join(', ')}`,
64
+ });
65
+ }
66
+ // Provenance
67
+ if (!e.provenance || typeof e.provenance !== 'object') {
68
+ errors.push({ field: 'provenance', message: 'provenance must be an object' });
69
+ }
70
+ else {
71
+ const prov = e.provenance;
72
+ if (typeof prov.platform !== 'string') {
73
+ errors.push({
74
+ field: 'provenance.platform',
75
+ message: 'provenance.platform must be a string',
76
+ });
77
+ }
78
+ }
79
+ return errors;
80
+ }
81
+ /**
82
+ * Check if a value is a valid OrgLoop event (type guard).
83
+ */
84
+ export function isOrgLoopEvent(value) {
85
+ return validateEvent(value).length === 0;
86
+ }
87
+ //# sourceMappingURL=event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.js","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,4BAA4B;AAC5B,MAAM,iBAAiB,GAAgB,IAAI,GAAG,CAAC;IAC9C,kBAAkB;IAClB,eAAe;IACf,kBAAkB;CAClB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC9B,OAAO,OAAO,UAAU,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC9B,OAAO,OAAO,UAAU,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACjE,CAAC;AAaD;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAA0B;IACpD,OAAO;QACN,EAAE,EAAE,OAAO,CAAC,EAAE,IAAI,eAAe,EAAE;QACnC,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,E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,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAClE,MAAM,CAAC,IAAI,CAAC;YACX,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,wBAAwB,CAAC,GAAG,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;SACpE,CAAC,CAAC;IACJ,CAAC;IAED,aAAa;IACb,IAAI,CAAC,CAAC,CAAC,UAAU,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QACvD,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC,CAAC;IAC/E,CAAC;SAAM,CAAC;QACP,MAAM,IAAI,GAAG,CAAC,CAAC,UAAqC,CAAC;QACrD,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACvC,MAAM,CAAC,IAAI,CAAC;gBACX,KAAK,EAAE,qBAAqB;gBAC5B,OAAO,EAAE,sCAAsC;aAC/C,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC5C,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @orgloop/sdk — OrgLoop Plugin Development Kit
3
+ *
4
+ * This package provides the interfaces, helpers, and test harnesses
5
+ * for building OrgLoop plugins (connectors, transforms, loggers).
6
+ */
7
+ export type { OrgLoopEvent, OrgLoopEventType, AuthorType, EventProvenance, SourceConfig, ActorConfig, PollConfig, RouteDefinition, RouteWhen, RouteTransformRef, RouteThen, RouteWith, RouteDeliveryConfig, TransformDefinition, LoggerDefinition, DeliveryConfig, RetryConfig, CircuitBreakerConfig, LogPhase, LogEntry, ProjectConfig, OrgLoopConfig, SourceInstanceConfig, ActorInstanceConfig, EventFilter, EventHandler, Subscription, DurationString, } from './types.js';
8
+ export { parseDuration } from './types.js';
9
+ export type { SourceConnector, ActorConnector, PollResult, DeliveryResult, WebhookHandler, ConnectorRegistration, ConnectorSetup, ConnectorIntegration, EnvVarDefinition, CredentialValidator, ServiceDetector, } from './connector.js';
10
+ export type { Transform, TransformContext, TransformRegistration, } from './transform.js';
11
+ export type { Logger, LoggerRegistration, } from './logger.js';
12
+ export { generateEventId, generateTraceId, buildEvent, validateEvent, isOrgLoopEvent, } from './event.js';
13
+ export type { BuildEventOptions, ValidationError } from './event.js';
14
+ export type { ModuleManifest, ModuleMetadata, ModuleRequirements, ModuleConnectorRequirement, ModuleServiceRequirement, ModuleCredentialRequirement, ModuleHookRequirement, ModuleParameter, ModuleProvides, InstalledModule, ModuleExpansionContext, } from './module.js';
15
+ export { expandTemplate, expandTemplateDeep, moduleManifestSchema } from './module.js';
16
+ export { MockSource, MockActor, MockTransform, MockLogger, createTestEvent, createTestContext, } from './testing.js';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EACX,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,WAAW,EACX,UAAU,EACV,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,GACd,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,YAAY,EACX,eAAe,EACf,cAAc,EACd,UAAU,EACV,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GACf,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACX,SAAS,EACT,gBAAgB,EAChB,qBAAqB,GACrB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACX,MAAM,EACN,kBAAkB,GAClB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACN,eAAe,EACf,eAAe,EACf,UAAU,EACV,aAAa,EACb,cAAc,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAGrE,YAAY,EACX,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,eAAe,EACf,sBAAsB,GACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGvF,OAAO,EACN,UAAU,EACV,SAAS,EACT,aAAa,EACb,UAAU,EACV,eAAe,EACf,iBAAiB,GACjB,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @orgloop/sdk — OrgLoop Plugin Development Kit
3
+ *
4
+ * This package provides the interfaces, helpers, and test harnesses
5
+ * for building OrgLoop plugins (connectors, transforms, loggers).
6
+ */
7
+ export { parseDuration } from './types.js';
8
+ // Event helpers
9
+ export { generateEventId, generateTraceId, buildEvent, validateEvent, isOrgLoopEvent, } from './event.js';
10
+ export { expandTemplate, expandTemplateDeep, moduleManifestSchema } from './module.js';
11
+ // Test harness
12
+ export { MockSource, MockActor, MockTransform, MockLogger, createTestEvent, createTestContext, } from './testing.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkCH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA8B3C,gBAAgB;AAChB,OAAO,EACN,eAAe,EACf,eAAe,EACf,UAAU,EACV,aAAa,EACb,cAAc,GACd,MAAM,YAAY,CAAC;AAkBpB,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEvF,eAAe;AACf,OAAO,EACN,UAAU,EACV,SAAS,EACT,aAAa,EACb,UAAU,EACV,eAAe,EACf,iBAAiB,GACjB,MAAM,cAAc,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Logger interface — passive observers of the event pipeline.
3
+ *
4
+ * Loggers receive LogEntry records for every pipeline phase:
5
+ * source emit, transform results, route matches, delivery attempts.
6
+ */
7
+ import type { LogEntry } from './types.js';
8
+ /**
9
+ * Logger interface.
10
+ *
11
+ * Implement this to create a new log destination for OrgLoop.
12
+ * Loggers are called for every pipeline event — they should be fast.
13
+ */
14
+ export interface Logger {
15
+ /** Unique logger ID */
16
+ readonly id: string;
17
+ /** Initialize with config */
18
+ init(config: Record<string, unknown>): Promise<void>;
19
+ /**
20
+ * Called for every pipeline event.
21
+ * Should not throw — log errors should be handled internally.
22
+ */
23
+ log(entry: LogEntry): Promise<void>;
24
+ /** Flush any buffered entries */
25
+ flush(): Promise<void>;
26
+ /** Clean shutdown (flush + close) */
27
+ shutdown(): Promise<void>;
28
+ }
29
+ /**
30
+ * Logger registration — what a logger package exports.
31
+ */
32
+ export interface LoggerRegistration {
33
+ /** Unique logger ID */
34
+ id: string;
35
+ /** Logger class */
36
+ logger: new () => Logger;
37
+ /** JSON Schema for config validation */
38
+ configSchema?: Record<string, unknown>;
39
+ }
40
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACtB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,6BAA6B;IAC7B,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErD;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC,iCAAiC;IACjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB,qCAAqC;IACrC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,MAAM,EAAE,UAAU,MAAM,CAAC;IACzB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC"}
package/dist/logger.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Logger interface — passive observers of the event pipeline.
3
+ *
4
+ * Loggers receive LogEntry records for every pipeline phase:
5
+ * source emit, transform results, route matches, delivery attempts.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}