@arnilo/prism-server 0.0.15 → 0.0.16
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/CHANGELOG.md +5 -0
- package/dist/artifacts.js +45 -16
- package/dist/conversations.d.ts +1 -1
- package/dist/conversations.js +21 -15
- package/dist/handler.js +17 -10
- package/dist/health.d.ts +1 -1
- package/dist/health.js +1 -1
- package/dist/index.d.ts +14 -15
- package/dist/index.js +5 -6
- package/dist/replay.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/artifacts.js
CHANGED
|
@@ -63,7 +63,7 @@ export function createArtifactService(store, options) {
|
|
|
63
63
|
if (explicit !== undefined && explicit.length > 0)
|
|
64
64
|
return assertBounded(explicit, limits.noteBytes, "reviewer_too_large");
|
|
65
65
|
const principal = input.identity?.principal;
|
|
66
|
-
if (principal
|
|
66
|
+
if (principal?.id)
|
|
67
67
|
return `${principal.kind}:${principal.id}`;
|
|
68
68
|
throw new ArtifactError("A reviewer identity is required for review decisions", "invalid_input");
|
|
69
69
|
}
|
|
@@ -183,7 +183,14 @@ export function createArtifactService(store, options) {
|
|
|
183
183
|
updatedAt: now,
|
|
184
184
|
};
|
|
185
185
|
const saved = await commit(input, threadId, record, 0);
|
|
186
|
-
await audit({
|
|
186
|
+
await audit({
|
|
187
|
+
type: "artifact_attached",
|
|
188
|
+
artifactId: id,
|
|
189
|
+
threadId,
|
|
190
|
+
version: 1,
|
|
191
|
+
...(input.identity ? { actor: `${input.identity.principal.kind}:${input.identity.principal.id}` } : {}),
|
|
192
|
+
timestamp: now,
|
|
193
|
+
});
|
|
187
194
|
return saved;
|
|
188
195
|
},
|
|
189
196
|
async list(input) {
|
|
@@ -217,7 +224,14 @@ export function createArtifactService(store, options) {
|
|
|
217
224
|
const now = new Date().toISOString();
|
|
218
225
|
const updated = { ...record, revisions: [...record.revisions, revision], updatedAt: now };
|
|
219
226
|
const saved = await commit(input, input.threadId, updated, version);
|
|
220
|
-
await audit({
|
|
227
|
+
await audit({
|
|
228
|
+
type: "artifact_revised",
|
|
229
|
+
artifactId: record.id,
|
|
230
|
+
threadId: input.threadId,
|
|
231
|
+
version: revision.version,
|
|
232
|
+
...(input.identity ? { actor: `${input.identity.principal.kind}:${input.identity.principal.id}` } : {}),
|
|
233
|
+
timestamp: now,
|
|
234
|
+
});
|
|
221
235
|
return saved;
|
|
222
236
|
},
|
|
223
237
|
async compare(input) {
|
|
@@ -306,7 +320,14 @@ export function createArtifactService(store, options) {
|
|
|
306
320
|
updatedAt: now,
|
|
307
321
|
};
|
|
308
322
|
const saved = await commit(input, input.threadId, updated, version);
|
|
309
|
-
await audit({
|
|
323
|
+
await audit({
|
|
324
|
+
type: state === "approved" ? "artifact_approved" : "artifact_rejected",
|
|
325
|
+
artifactId: record.id,
|
|
326
|
+
threadId: input.threadId,
|
|
327
|
+
version: input.version,
|
|
328
|
+
reviewer,
|
|
329
|
+
timestamp: now,
|
|
330
|
+
});
|
|
310
331
|
return saved;
|
|
311
332
|
}
|
|
312
333
|
}
|
|
@@ -343,8 +364,11 @@ export function verifyArtifactDeliveryLink(link, secret, maxBytes = HARD_DELIVER
|
|
|
343
364
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
344
365
|
throw new ArtifactError("Delivery link is invalid", "invalid_link");
|
|
345
366
|
const token = parsed;
|
|
346
|
-
if (typeof token.artifactId !== "string" ||
|
|
347
|
-
|
|
367
|
+
if (typeof token.artifactId !== "string" ||
|
|
368
|
+
typeof token.threadId !== "string" ||
|
|
369
|
+
!Number.isSafeInteger(token.version) ||
|
|
370
|
+
typeof token.issuedAt !== "string" ||
|
|
371
|
+
typeof token.expiresAt !== "string") {
|
|
348
372
|
throw new ArtifactError("Delivery link is invalid", "invalid_link");
|
|
349
373
|
}
|
|
350
374
|
const expiresAt = Date.parse(token.expiresAt);
|
|
@@ -557,9 +581,7 @@ function parseArtifactRoute(request, base) {
|
|
|
557
581
|
return undefined;
|
|
558
582
|
}
|
|
559
583
|
function ownershipMatches(scope, token) {
|
|
560
|
-
return scope.tenantId === token.tenantId
|
|
561
|
-
&& scope.accountId === token.accountId
|
|
562
|
-
&& scope.userId === token.userId;
|
|
584
|
+
return scope.tenantId === token.tenantId && scope.accountId === token.accountId && scope.userId === token.userId;
|
|
563
585
|
}
|
|
564
586
|
function json(options, value, status) {
|
|
565
587
|
const safe = options.redactor?.redact(value) ?? value;
|
|
@@ -577,13 +599,20 @@ function artifactErrorResponse(error) {
|
|
|
577
599
|
else if (error instanceof ArtifactError) {
|
|
578
600
|
code = error.code;
|
|
579
601
|
message = error.message;
|
|
580
|
-
status =
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
602
|
+
status =
|
|
603
|
+
error.reason === "not_found" || error.reason === "not_validated"
|
|
604
|
+
? 404
|
|
605
|
+
: error.reason === "conflict"
|
|
606
|
+
? 409
|
|
607
|
+
: error.reason === "ownership"
|
|
608
|
+
? 403
|
|
609
|
+
: error.reason === "link_expired"
|
|
610
|
+
? 410
|
|
611
|
+
: error.reason === "too_many_artifacts" || error.reason === "too_many_revisions"
|
|
612
|
+
? 422
|
|
613
|
+
: error.reason === "invalid_link"
|
|
614
|
+
? 401
|
|
615
|
+
: 400;
|
|
587
616
|
}
|
|
588
617
|
else if (error instanceof RangeError) {
|
|
589
618
|
status = 400;
|
package/dist/conversations.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AgentEventRecord, type AgentIdentity, type AgentRunResult, type AgentSession, type JsonObject, type Message, type OwnershipScope, type PersistencePage, type RunOptions, type SecretRedactor, type SessionRecord } from "@arnilo/prism";
|
|
2
1
|
import type { PersistenceLifecycleStore } from "@arnilo/prism";
|
|
2
|
+
import { type AgentEventRecord, type AgentIdentity, type AgentRunResult, type AgentSession, type JsonObject, type Message, type OwnershipScope, type PersistencePage, type RunOptions, type SecretRedactor, type SessionRecord } from "@arnilo/prism";
|
|
3
3
|
import type { PrismRequestHandler, PrismServerAuthorization } from "./types.js";
|
|
4
4
|
/** Phase 9 freeze: thread page 50/200; replay page 100/500; cursor 4/16 KiB; title 256 B/2 KiB;
|
|
5
5
|
* request id 256 B/2 KiB; active branches 16/64; export 8/32 MiB and 100/500 pages; body 64 KiB/1 MiB. */
|
package/dist/conversations.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import {
|
|
2
|
+
import { assertIdentityActive, assertIdentityMatchesOwnership, CONVERSATION_METADATA_KEY, ConversationError, conversationMarkerMetadata, conversationThreadFromRecord, decodeConversationReplayCursor, encodeConversationReplayCursor, } from "@arnilo/prism";
|
|
3
3
|
import { PrismServerError } from "./types.js";
|
|
4
4
|
/** Phase 9 freeze: thread page 50/200; replay page 100/500; cursor 4/16 KiB; title 256 B/2 KiB;
|
|
5
5
|
* request id 256 B/2 KiB; active branches 16/64; export 8/32 MiB and 100/500 pages; body 64 KiB/1 MiB. */
|
|
@@ -193,9 +193,7 @@ export function createConversationService(store, options) {
|
|
|
193
193
|
},
|
|
194
194
|
async export(input) {
|
|
195
195
|
const thread = await loadThread(input, input.threadId);
|
|
196
|
-
const start = input.cursor === undefined
|
|
197
|
-
? undefined
|
|
198
|
-
: decodeConversationReplayCursor(input.cursor, thread.id, limits.cursorBytes).cursor;
|
|
196
|
+
const start = input.cursor === undefined ? undefined : decodeConversationReplayCursor(input.cursor, thread.id, limits.cursorBytes).cursor;
|
|
199
197
|
const events = [];
|
|
200
198
|
let bytes = 0;
|
|
201
199
|
let pages = 0;
|
|
@@ -239,7 +237,9 @@ export function createConversationService(store, options) {
|
|
|
239
237
|
return {
|
|
240
238
|
thread,
|
|
241
239
|
events: options.redactor.redact(events),
|
|
242
|
-
...(nextCursor === undefined
|
|
240
|
+
...(nextCursor === undefined
|
|
241
|
+
? {}
|
|
242
|
+
: { nextCursor: encodeConversationReplayCursor({ v: 1, threadId: thread.id, cursor: nextCursor }) }),
|
|
243
243
|
truncated,
|
|
244
244
|
};
|
|
245
245
|
},
|
|
@@ -262,9 +262,7 @@ export function createConversationService(store, options) {
|
|
|
262
262
|
},
|
|
263
263
|
async replay(input) {
|
|
264
264
|
const thread = await loadThread(input, input.threadId);
|
|
265
|
-
const inner = input.cursor === undefined
|
|
266
|
-
? undefined
|
|
267
|
-
: decodeConversationReplayCursor(input.cursor, thread.id, limits.cursorBytes).cursor;
|
|
265
|
+
const inner = input.cursor === undefined ? undefined : decodeConversationReplayCursor(input.cursor, thread.id, limits.cursorBytes).cursor;
|
|
268
266
|
const limit = Math.min(input.limit ?? limits.replayPageLimit, limits.replayPageLimit);
|
|
269
267
|
if (!Number.isSafeInteger(limit) || limit < 1)
|
|
270
268
|
throw new ConversationError("limit is invalid", "invalid_input");
|
|
@@ -284,7 +282,9 @@ export function createConversationService(store, options) {
|
|
|
284
282
|
assertBytes(page.nextCursor, limits.cursorBytes, "cursor_too_large");
|
|
285
283
|
return {
|
|
286
284
|
records,
|
|
287
|
-
...(page.nextCursor === undefined
|
|
285
|
+
...(page.nextCursor === undefined
|
|
286
|
+
? {}
|
|
287
|
+
: { nextCursor: encodeConversationReplayCursor({ v: 1, threadId: thread.id, cursor: page.nextCursor }) }),
|
|
288
288
|
terminal,
|
|
289
289
|
};
|
|
290
290
|
},
|
|
@@ -447,12 +447,18 @@ function conversationErrorResponse(error) {
|
|
|
447
447
|
else if (error instanceof ConversationError) {
|
|
448
448
|
code = error.code;
|
|
449
449
|
message = error.message;
|
|
450
|
-
status =
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
450
|
+
status =
|
|
451
|
+
error.reason === "not_found"
|
|
452
|
+
? 404
|
|
453
|
+
: error.reason === "thread_archived"
|
|
454
|
+
? 409
|
|
455
|
+
: error.reason === "ownership"
|
|
456
|
+
? 403
|
|
457
|
+
: error.reason === "unsupported"
|
|
458
|
+
? 501
|
|
459
|
+
: error.reason === "not_redacted" || error.reason === "limit_exceeded"
|
|
460
|
+
? 500
|
|
461
|
+
: 400;
|
|
456
462
|
}
|
|
457
463
|
else if (error instanceof RangeError) {
|
|
458
464
|
status = 400;
|
package/dist/handler.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentRunStateError, assertIdentityActive, assertIdentityMatchesOwnership } from "@arnilo/prism";
|
|
1
|
+
import { AgentRunStateError, assertIdentityActive, assertIdentityMatchesOwnership, } from "@arnilo/prism";
|
|
2
2
|
import { cancelWorkflowRun, createWorkflowEventBus, enqueueWorkflow, getWorkflowRun, replayWorkflow, resumeWorkflow, runWorkflow, } from "@arnilo/prism-workflows";
|
|
3
3
|
import { isAdmitOperation } from "./drain.js";
|
|
4
4
|
import { resolvePrismServerLimits } from "./limits.js";
|
|
@@ -15,9 +15,7 @@ export function createPrismHandler(options) {
|
|
|
15
15
|
let activeRuns = 0;
|
|
16
16
|
return async (request) => {
|
|
17
17
|
const origin = request.headers.get("origin");
|
|
18
|
-
const corsHeaders = origin && options.allowedOrigins?.includes(origin)
|
|
19
|
-
? { "access-control-allow-origin": origin, vary: "origin" }
|
|
20
|
-
: undefined;
|
|
18
|
+
const corsHeaders = origin && options.allowedOrigins?.includes(origin) ? { "access-control-allow-origin": origin, vary: "origin" } : undefined;
|
|
21
19
|
const respond = (response) => addHeaders(response, corsHeaders);
|
|
22
20
|
try {
|
|
23
21
|
assertRequestPolicy(request, options.allowedHosts, options.allowedOrigins);
|
|
@@ -470,7 +468,9 @@ async function readJsonObject(request, maxBytes, signal) {
|
|
|
470
468
|
throw new PrismServerError("JSON body is required", 400, "ERR_PRISM_SERVER_BODY");
|
|
471
469
|
const chunks = [];
|
|
472
470
|
let size = 0;
|
|
473
|
-
const abort = () => {
|
|
471
|
+
const abort = () => {
|
|
472
|
+
void reader.cancel(signal.reason);
|
|
473
|
+
};
|
|
474
474
|
if (signal.aborted)
|
|
475
475
|
abort();
|
|
476
476
|
else
|
|
@@ -644,7 +644,9 @@ function sse(source, owned, limits, options, release) {
|
|
|
644
644
|
let events = 0;
|
|
645
645
|
let bytes = 0;
|
|
646
646
|
let finished = false;
|
|
647
|
-
const onAbort = () => {
|
|
647
|
+
const onAbort = () => {
|
|
648
|
+
void finish(owned.signal.reason);
|
|
649
|
+
};
|
|
648
650
|
const finish = async (reason) => {
|
|
649
651
|
if (finished)
|
|
650
652
|
return;
|
|
@@ -702,9 +704,7 @@ function json(value, status, limits, options) {
|
|
|
702
704
|
return new Response(text, { status, headers: JSON_HEADERS });
|
|
703
705
|
}
|
|
704
706
|
function errorResponse(error, limits, options) {
|
|
705
|
-
const workflowCode = error && typeof error === "object" && "code" in error && typeof error.code === "string"
|
|
706
|
-
? error.code
|
|
707
|
-
: undefined;
|
|
707
|
+
const workflowCode = error && typeof error === "object" && "code" in error && typeof error.code === "string" ? error.code : undefined;
|
|
708
708
|
const mapped = workflowCode === "ERR_PRISM_WORKFLOW_SCHEDULE_BUSY"
|
|
709
709
|
? { status: 409, code: workflowCode, message: "Schedule is busy" }
|
|
710
710
|
: workflowCode === "ERR_PRISM_WORKFLOW_SCHEDULE"
|
|
@@ -719,7 +719,14 @@ function errorResponse(error, limits, options) {
|
|
|
719
719
|
const known = error instanceof PrismServerError;
|
|
720
720
|
const agentState = error instanceof AgentRunStateError;
|
|
721
721
|
const status = mapped?.status ?? (agentState ? 404 : known ? error.status : error instanceof DOMException && error.name === "AbortError" ? 499 : 500);
|
|
722
|
-
const code = mapped?.code ??
|
|
722
|
+
const code = mapped?.code ??
|
|
723
|
+
(agentState
|
|
724
|
+
? "ERR_PRISM_SERVER_NOT_FOUND"
|
|
725
|
+
: known
|
|
726
|
+
? error.code
|
|
727
|
+
: status === 499
|
|
728
|
+
? "ERR_PRISM_SERVER_ABORTED"
|
|
729
|
+
: "ERR_PRISM_SERVER_INTERNAL");
|
|
723
730
|
const message = mapped?.message ?? (agentState ? "Not found" : known ? error.message : status === 499 ? "Request aborted" : "Internal server error");
|
|
724
731
|
try {
|
|
725
732
|
const response = json({ error: { code, message } }, status, limits, options);
|
package/dist/health.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type PrismDeploymentLimits } from "./limits.js";
|
|
2
1
|
import type { PrismDrainController } from "./drain.js";
|
|
2
|
+
import { type PrismDeploymentLimits } from "./limits.js";
|
|
3
3
|
import { type PrismRequestHandler } from "./types.js";
|
|
4
4
|
export interface CreatePrismHealthHandlerOptions {
|
|
5
5
|
/** Path prefix. Default `/health`. Routes: `/livez`, `/readyz`, and prefix itself. */
|
package/dist/health.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolvePrismDeploymentLimits
|
|
1
|
+
import { resolvePrismDeploymentLimits } from "./limits.js";
|
|
2
2
|
import { PrismServerError } from "./types.js";
|
|
3
3
|
const JSON_HEADERS = { "content-type": "application/json; charset=utf-8" };
|
|
4
4
|
export function createPrismHealthHandler(options = {}) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export type { ArtifactAttachInput, ArtifactAuthorizationInput, ArtifactAuthorizer, ArtifactCompareInput, ArtifactCompareResult, ArtifactDecisionEvent, ArtifactDecisionInput, ArtifactDeliveryInput, ArtifactDeliveryResult, ArtifactLimits, ArtifactListInput, ArtifactOperation, ArtifactRefInput, ArtifactReviseInput, ArtifactService, ArtifactServiceInput, CreateArtifactHandlerOptions, CreateArtifactServiceOptions, ResolvedArtifactLimits, } from "./artifacts.js";
|
|
2
|
+
export { createArtifactHandler, createArtifactService, DEFAULT_ARTIFACT_CITATION_BYTES, DEFAULT_ARTIFACT_CITATIONS, DEFAULT_ARTIFACT_HASH_BYTES, DEFAULT_ARTIFACT_LIST_PAGE_LIMIT, DEFAULT_ARTIFACT_MIME_BYTES, DEFAULT_ARTIFACT_NOTE_BYTES, DEFAULT_ARTIFACT_PREVIEW_BYTES, DEFAULT_ARTIFACT_RECORD_BYTES, DEFAULT_ARTIFACT_REQUEST_BYTES, DEFAULT_ARTIFACT_REVISIONS, DEFAULT_ARTIFACT_TITLE_BYTES, DEFAULT_ARTIFACT_URI_BYTES, DEFAULT_ARTIFACTS_PER_THREAD, DEFAULT_DELIVERY_LINK_TOKEN_BYTES, DEFAULT_DELIVERY_LINK_TTL_SECONDS, HARD_ARTIFACT_CITATION_BYTES, HARD_ARTIFACT_CITATIONS, HARD_ARTIFACT_HASH_BYTES, HARD_ARTIFACT_LIST_PAGE_LIMIT, HARD_ARTIFACT_MIME_BYTES, HARD_ARTIFACT_NOTE_BYTES, HARD_ARTIFACT_PREVIEW_BYTES, HARD_ARTIFACT_RECORD_BYTES, HARD_ARTIFACT_REQUEST_BYTES, HARD_ARTIFACT_REVISIONS, HARD_ARTIFACT_TITLE_BYTES, HARD_ARTIFACT_URI_BYTES, HARD_ARTIFACTS_PER_THREAD, HARD_DELIVERY_LINK_TOKEN_BYTES, HARD_DELIVERY_LINK_TTL_SECONDS, resolveArtifactLimits, signArtifactDeliveryLink, verifyArtifactDeliveryLink, } from "./artifacts.js";
|
|
3
|
+
export type { ConversationAuthorizationInput, ConversationAuthorizer, ConversationBranchInput, ConversationContinueInput, ConversationCreateInput, ConversationExportInput, ConversationExportPage, ConversationLimits, ConversationListInput, ConversationOperation, ConversationRefInput, ConversationReplayInput, ConversationReplayPage, ConversationService, ConversationServiceInput, ConversationServiceStore, ConversationSessionFactoryInput, CreateConversationHandlerOptions, CreateConversationServiceOptions, ResolvedConversationLimits, } from "./conversations.js";
|
|
4
|
+
export { createConversationHandler, createConversationService, DEFAULT_CONVERSATION_CURSOR_BYTES, DEFAULT_CONVERSATION_EXPORT_BYTES, DEFAULT_CONVERSATION_EXPORT_PAGES, DEFAULT_CONVERSATION_MAX_ACTIVE_BRANCHES, DEFAULT_CONVERSATION_REPLAY_PAGE_LIMIT, DEFAULT_CONVERSATION_REQUEST_BYTES, DEFAULT_CONVERSATION_REQUEST_ID_BYTES, DEFAULT_CONVERSATION_THREAD_PAGE_LIMIT, DEFAULT_CONVERSATION_TITLE_BYTES, HARD_CONVERSATION_CURSOR_BYTES, HARD_CONVERSATION_EXPORT_BYTES, HARD_CONVERSATION_EXPORT_PAGES, HARD_CONVERSATION_MAX_ACTIVE_BRANCHES, HARD_CONVERSATION_REPLAY_PAGE_LIMIT, HARD_CONVERSATION_REQUEST_BYTES, HARD_CONVERSATION_REQUEST_ID_BYTES, HARD_CONVERSATION_THREAD_PAGE_LIMIT, HARD_CONVERSATION_TITLE_BYTES, resolveConversationLimits, } from "./conversations.js";
|
|
5
|
+
export type { PrismDeploymentLease, PrismDeploymentLeaseOptions } from "./deployment.js";
|
|
6
|
+
export { createPrismDeploymentLease, PRISM_DEPLOYMENT_LEASE_NAMESPACE } from "./deployment.js";
|
|
7
|
+
export type { PrismDrainController, PrismDrainControllerOptions, PrismDrainSnapshot } from "./drain.js";
|
|
5
8
|
export { createPrismDrainController, isAdmitOperation } from "./drain.js";
|
|
9
|
+
export { createPrismHandler } from "./handler.js";
|
|
10
|
+
export type { CreatePrismHealthHandlerOptions } from "./health.js";
|
|
6
11
|
export { createPrismHealthHandler } from "./health.js";
|
|
12
|
+
export type { PrismDeploymentLimits, PrismServerLimits, ResolvedPrismDeploymentLimits, ResolvedPrismServerLimits, } from "./limits.js";
|
|
13
|
+
export { DEFAULT_DRAIN_DEADLINE_MS, DEFAULT_MAX_CONCURRENT_RUNS, DEFAULT_MAX_EVENT_BYTES, DEFAULT_MAX_HEALTH_BYTES, DEFAULT_MAX_QUEUED_EVENTS, DEFAULT_MAX_REPLAY_CURSOR_BYTES, DEFAULT_MAX_REPLAY_EVENTS, DEFAULT_MAX_REQUEST_BYTES, DEFAULT_MAX_RESPONSE_BYTES, DEFAULT_MAX_STREAM_BYTES, DEFAULT_MAX_STREAM_EVENTS, DEFAULT_REQUEST_TIMEOUT_MS, HARD_DRAIN_DEADLINE_MS, HARD_MAX_CONCURRENT_RUNS, HARD_MAX_EVENT_BYTES, HARD_MAX_HEALTH_BYTES, HARD_MAX_QUEUED_EVENTS, HARD_MAX_REPLAY_CURSOR_BYTES, HARD_MAX_REPLAY_EVENTS, HARD_MAX_REQUEST_BYTES, HARD_MAX_RESPONSE_BYTES, HARD_MAX_STREAM_BYTES, HARD_MAX_STREAM_EVENTS, HARD_REQUEST_TIMEOUT_MS, resolvePrismDeploymentLimits, resolvePrismServerLimits, } from "./limits.js";
|
|
14
|
+
export type { MemoryRateLimiterOptions, PrismServerRateLimitDenial, PrismServerRateLimiter, PrismServerRateLimitInput, } from "./rate-limit.js";
|
|
7
15
|
export { createMemoryRateLimiter } from "./rate-limit.js";
|
|
16
|
+
export type { CreatePrismEventReplayOptions, CreatePrismReplayHandlerOptions, PrismEventReplay, PrismEventReplayRequest, } from "./replay.js";
|
|
8
17
|
export { createPrismEventReplay, createPrismReplayHandler } from "./replay.js";
|
|
9
|
-
export {
|
|
10
|
-
export { DEFAULT_MAX_REQUEST_BYTES, HARD_MAX_REQUEST_BYTES, DEFAULT_MAX_RESPONSE_BYTES, HARD_MAX_RESPONSE_BYTES, DEFAULT_MAX_EVENT_BYTES, HARD_MAX_EVENT_BYTES, DEFAULT_MAX_STREAM_BYTES, HARD_MAX_STREAM_BYTES, DEFAULT_MAX_STREAM_EVENTS, HARD_MAX_STREAM_EVENTS, DEFAULT_MAX_CONCURRENT_RUNS, HARD_MAX_CONCURRENT_RUNS, DEFAULT_MAX_QUEUED_EVENTS, HARD_MAX_QUEUED_EVENTS, DEFAULT_REQUEST_TIMEOUT_MS, HARD_REQUEST_TIMEOUT_MS, DEFAULT_MAX_HEALTH_BYTES, HARD_MAX_HEALTH_BYTES, DEFAULT_DRAIN_DEADLINE_MS, HARD_DRAIN_DEADLINE_MS, DEFAULT_MAX_REPLAY_EVENTS, HARD_MAX_REPLAY_EVENTS, DEFAULT_MAX_REPLAY_CURSOR_BYTES, HARD_MAX_REPLAY_CURSOR_BYTES, resolvePrismServerLimits, resolvePrismDeploymentLimits, } from "./limits.js";
|
|
11
|
-
export type { PrismServerLimits, ResolvedPrismServerLimits, PrismDeploymentLimits, ResolvedPrismDeploymentLimits, } from "./limits.js";
|
|
12
|
-
export type { PrismServerOperation, PrismServerAuthorization, PrismServerAuthorizationInput, PrismServerAuthorizer, PrismAgentExposure, PrismAgentRunExposure, PrismWorkflowExposure, PrismScheduleExposure, CreatePrismHandlerOptions, PrismRequestHandler, } from "./types.js";
|
|
13
|
-
export type { PrismDrainController, PrismDrainControllerOptions, PrismDrainSnapshot } from "./drain.js";
|
|
14
|
-
export type { CreatePrismHealthHandlerOptions } from "./health.js";
|
|
15
|
-
export type { PrismServerRateLimiter, PrismServerRateLimitDenial, PrismServerRateLimitInput, MemoryRateLimiterOptions, } from "./rate-limit.js";
|
|
16
|
-
export type { PrismEventReplay, PrismEventReplayRequest, CreatePrismEventReplayOptions, CreatePrismReplayHandlerOptions, } from "./replay.js";
|
|
17
|
-
export type { PrismDeploymentLease, PrismDeploymentLeaseOptions } from "./deployment.js";
|
|
18
|
-
export type { ConversationLimits, ResolvedConversationLimits, ConversationServiceStore, ConversationSessionFactoryInput, CreateConversationServiceOptions, ConversationServiceInput, ConversationCreateInput, ConversationListInput, ConversationRefInput, ConversationContinueInput, ConversationBranchInput, ConversationExportInput, ConversationReplayInput, ConversationReplayPage, ConversationExportPage, ConversationService, ConversationOperation, ConversationAuthorizationInput, ConversationAuthorizer, CreateConversationHandlerOptions, } from "./conversations.js";
|
|
19
|
-
export type { ArtifactLimits, ResolvedArtifactLimits, ArtifactServiceInput, ArtifactAttachInput, ArtifactListInput, ArtifactRefInput, ArtifactReviseInput, ArtifactCompareInput, ArtifactCompareResult, ArtifactDecisionInput, ArtifactDeliveryInput, ArtifactDeliveryResult, ArtifactDecisionEvent, CreateArtifactServiceOptions, ArtifactService, ArtifactOperation, ArtifactAuthorizationInput, ArtifactAuthorizer, CreateArtifactHandlerOptions, } from "./artifacts.js";
|
|
18
|
+
export type { CreatePrismHandlerOptions, PrismAgentExposure, PrismAgentRunExposure, PrismRequestHandler, PrismScheduleExposure, PrismServerAuthorization, PrismServerAuthorizationInput, PrismServerAuthorizer, PrismServerOperation, PrismWorkflowExposure, } from "./types.js";
|
|
20
19
|
export { PrismServerError } from "./types.js";
|
|
21
20
|
export declare const packageName = "@arnilo/prism-server";
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { createConversationService,
|
|
3
|
-
export {
|
|
4
|
-
export { createArtifactService, createArtifactHandler, resolveArtifactLimits, signArtifactDeliveryLink, verifyArtifactDeliveryLink, DEFAULT_ARTIFACTS_PER_THREAD, HARD_ARTIFACTS_PER_THREAD, DEFAULT_ARTIFACT_REVISIONS, HARD_ARTIFACT_REVISIONS, DEFAULT_ARTIFACT_RECORD_BYTES, HARD_ARTIFACT_RECORD_BYTES, DEFAULT_ARTIFACT_PREVIEW_BYTES, HARD_ARTIFACT_PREVIEW_BYTES, DEFAULT_ARTIFACT_CITATIONS, HARD_ARTIFACT_CITATIONS, DEFAULT_ARTIFACT_CITATION_BYTES, HARD_ARTIFACT_CITATION_BYTES, DEFAULT_ARTIFACT_MIME_BYTES, HARD_ARTIFACT_MIME_BYTES, DEFAULT_ARTIFACT_HASH_BYTES, HARD_ARTIFACT_HASH_BYTES, DEFAULT_ARTIFACT_URI_BYTES, HARD_ARTIFACT_URI_BYTES, DEFAULT_ARTIFACT_NOTE_BYTES, HARD_ARTIFACT_NOTE_BYTES, DEFAULT_ARTIFACT_TITLE_BYTES, HARD_ARTIFACT_TITLE_BYTES, DEFAULT_ARTIFACT_LIST_PAGE_LIMIT, HARD_ARTIFACT_LIST_PAGE_LIMIT, DEFAULT_DELIVERY_LINK_TTL_SECONDS, HARD_DELIVERY_LINK_TTL_SECONDS, DEFAULT_DELIVERY_LINK_TOKEN_BYTES, HARD_DELIVERY_LINK_TOKEN_BYTES, DEFAULT_ARTIFACT_REQUEST_BYTES, HARD_ARTIFACT_REQUEST_BYTES, } from "./artifacts.js";
|
|
1
|
+
export { createArtifactHandler, createArtifactService, DEFAULT_ARTIFACT_CITATION_BYTES, DEFAULT_ARTIFACT_CITATIONS, DEFAULT_ARTIFACT_HASH_BYTES, DEFAULT_ARTIFACT_LIST_PAGE_LIMIT, DEFAULT_ARTIFACT_MIME_BYTES, DEFAULT_ARTIFACT_NOTE_BYTES, DEFAULT_ARTIFACT_PREVIEW_BYTES, DEFAULT_ARTIFACT_RECORD_BYTES, DEFAULT_ARTIFACT_REQUEST_BYTES, DEFAULT_ARTIFACT_REVISIONS, DEFAULT_ARTIFACT_TITLE_BYTES, DEFAULT_ARTIFACT_URI_BYTES, DEFAULT_ARTIFACTS_PER_THREAD, DEFAULT_DELIVERY_LINK_TOKEN_BYTES, DEFAULT_DELIVERY_LINK_TTL_SECONDS, HARD_ARTIFACT_CITATION_BYTES, HARD_ARTIFACT_CITATIONS, HARD_ARTIFACT_HASH_BYTES, HARD_ARTIFACT_LIST_PAGE_LIMIT, HARD_ARTIFACT_MIME_BYTES, HARD_ARTIFACT_NOTE_BYTES, HARD_ARTIFACT_PREVIEW_BYTES, HARD_ARTIFACT_RECORD_BYTES, HARD_ARTIFACT_REQUEST_BYTES, HARD_ARTIFACT_REVISIONS, HARD_ARTIFACT_TITLE_BYTES, HARD_ARTIFACT_URI_BYTES, HARD_ARTIFACTS_PER_THREAD, HARD_DELIVERY_LINK_TOKEN_BYTES, HARD_DELIVERY_LINK_TTL_SECONDS, resolveArtifactLimits, signArtifactDeliveryLink, verifyArtifactDeliveryLink, } from "./artifacts.js";
|
|
2
|
+
export { createConversationHandler, createConversationService, DEFAULT_CONVERSATION_CURSOR_BYTES, DEFAULT_CONVERSATION_EXPORT_BYTES, DEFAULT_CONVERSATION_EXPORT_PAGES, DEFAULT_CONVERSATION_MAX_ACTIVE_BRANCHES, DEFAULT_CONVERSATION_REPLAY_PAGE_LIMIT, DEFAULT_CONVERSATION_REQUEST_BYTES, DEFAULT_CONVERSATION_REQUEST_ID_BYTES, DEFAULT_CONVERSATION_THREAD_PAGE_LIMIT, DEFAULT_CONVERSATION_TITLE_BYTES, HARD_CONVERSATION_CURSOR_BYTES, HARD_CONVERSATION_EXPORT_BYTES, HARD_CONVERSATION_EXPORT_PAGES, HARD_CONVERSATION_MAX_ACTIVE_BRANCHES, HARD_CONVERSATION_REPLAY_PAGE_LIMIT, HARD_CONVERSATION_REQUEST_BYTES, HARD_CONVERSATION_REQUEST_ID_BYTES, HARD_CONVERSATION_THREAD_PAGE_LIMIT, HARD_CONVERSATION_TITLE_BYTES, resolveConversationLimits, } from "./conversations.js";
|
|
3
|
+
export { createPrismDeploymentLease, PRISM_DEPLOYMENT_LEASE_NAMESPACE } from "./deployment.js";
|
|
5
4
|
export { createPrismDrainController, isAdmitOperation } from "./drain.js";
|
|
5
|
+
export { createPrismHandler } from "./handler.js";
|
|
6
6
|
export { createPrismHealthHandler } from "./health.js";
|
|
7
|
+
export { DEFAULT_DRAIN_DEADLINE_MS, DEFAULT_MAX_CONCURRENT_RUNS, DEFAULT_MAX_EVENT_BYTES, DEFAULT_MAX_HEALTH_BYTES, DEFAULT_MAX_QUEUED_EVENTS, DEFAULT_MAX_REPLAY_CURSOR_BYTES, DEFAULT_MAX_REPLAY_EVENTS, DEFAULT_MAX_REQUEST_BYTES, DEFAULT_MAX_RESPONSE_BYTES, DEFAULT_MAX_STREAM_BYTES, DEFAULT_MAX_STREAM_EVENTS, DEFAULT_REQUEST_TIMEOUT_MS, HARD_DRAIN_DEADLINE_MS, HARD_MAX_CONCURRENT_RUNS, HARD_MAX_EVENT_BYTES, HARD_MAX_HEALTH_BYTES, HARD_MAX_QUEUED_EVENTS, HARD_MAX_REPLAY_CURSOR_BYTES, HARD_MAX_REPLAY_EVENTS, HARD_MAX_REQUEST_BYTES, HARD_MAX_RESPONSE_BYTES, HARD_MAX_STREAM_BYTES, HARD_MAX_STREAM_EVENTS, HARD_REQUEST_TIMEOUT_MS, resolvePrismDeploymentLimits, resolvePrismServerLimits, } from "./limits.js";
|
|
7
8
|
export { createMemoryRateLimiter } from "./rate-limit.js";
|
|
8
9
|
export { createPrismEventReplay, createPrismReplayHandler } from "./replay.js";
|
|
9
|
-
export { createPrismDeploymentLease, PRISM_DEPLOYMENT_LEASE_NAMESPACE } from "./deployment.js";
|
|
10
|
-
export { DEFAULT_MAX_REQUEST_BYTES, HARD_MAX_REQUEST_BYTES, DEFAULT_MAX_RESPONSE_BYTES, HARD_MAX_RESPONSE_BYTES, DEFAULT_MAX_EVENT_BYTES, HARD_MAX_EVENT_BYTES, DEFAULT_MAX_STREAM_BYTES, HARD_MAX_STREAM_BYTES, DEFAULT_MAX_STREAM_EVENTS, HARD_MAX_STREAM_EVENTS, DEFAULT_MAX_CONCURRENT_RUNS, HARD_MAX_CONCURRENT_RUNS, DEFAULT_MAX_QUEUED_EVENTS, HARD_MAX_QUEUED_EVENTS, DEFAULT_REQUEST_TIMEOUT_MS, HARD_REQUEST_TIMEOUT_MS, DEFAULT_MAX_HEALTH_BYTES, HARD_MAX_HEALTH_BYTES, DEFAULT_DRAIN_DEADLINE_MS, HARD_DRAIN_DEADLINE_MS, DEFAULT_MAX_REPLAY_EVENTS, HARD_MAX_REPLAY_EVENTS, DEFAULT_MAX_REPLAY_CURSOR_BYTES, HARD_MAX_REPLAY_CURSOR_BYTES, resolvePrismServerLimits, resolvePrismDeploymentLimits, } from "./limits.js";
|
|
11
10
|
export { PrismServerError } from "./types.js";
|
|
12
11
|
export const packageName = "@arnilo/prism-server";
|
|
13
12
|
//# sourceMappingURL=index.js.map
|
package/dist/replay.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolvePrismDeploymentLimits
|
|
1
|
+
import { resolvePrismDeploymentLimits } from "./limits.js";
|
|
2
2
|
import { PrismServerError } from "./types.js";
|
|
3
3
|
/** Ownership-scoped, cursor-paginated durable event replay. Does not re-run work. */
|
|
4
4
|
export function createPrismEventReplay(store, options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arnilo/prism-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "Optional framework-free Web Request-to-Response handler for explicitly selected Prism agents and workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"pack:dry-run": "npm pack --dry-run"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@arnilo/prism": "0.0.
|
|
29
|
-
"@arnilo/prism-workflows": "0.0.
|
|
28
|
+
"@arnilo/prism": "0.0.16",
|
|
29
|
+
"@arnilo/prism-workflows": "0.0.16"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@arnilo/prism": "file:../..",
|