@jami-studio/core 0.92.31 → 0.92.32
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/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +6 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/deploy/build.ts +4193 -4127
- package/corpus/core/src/file-upload/types.ts +9 -0
- package/corpus/templates/analytics/changelog/2026-07-11-tracking-and-session-replay-ingest-endpoints-are-reachable-f.md +6 -0
- package/corpus/templates/analytics/package.json +9 -0
- package/corpus/templates/clips/actions/create-recording.ts +16 -1
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +60 -14
- package/corpus/templates/clips/app/routes/record.tsx +35 -9
- package/corpus/templates/clips/changelog/2026-07-11-uploads-now-stream-straight-to-s3-compatible-storage-r2-s3-m.md +6 -0
- package/corpus/templates/clips/server/lib/s3-upload-provider.ts +256 -0
- package/corpus/templates/clips/server/lib/streaming-upload-mode.ts +9 -3
- package/corpus/templates/clips/server/lib/upload-chunk-limits.ts +19 -0
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +15 -4
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/reset-chunks.post.ts +49 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/deploy/build.d.ts +21 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +736 -676
- package/dist/deploy/build.js.map +1 -1
- package/dist/file-upload/types.d.ts +9 -0
- package/dist/file-upload/types.d.ts.map +1 -1
- package/dist/file-upload/types.js.map +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/package.json +1 -1
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
writeAppState,
|
|
29
29
|
deleteAppStateByPrefix,
|
|
30
30
|
} from "@agent-native/core/application-state";
|
|
31
|
+
import { getActiveFileUploadProviderForRequest } from "@agent-native/core/file-upload";
|
|
31
32
|
import { runWithRequestContext } from "@agent-native/core/server";
|
|
32
33
|
import { MAX_UPLOAD_BYTES as MAX_RECORDING_UPLOAD_BYTES } from "@shared/upload-limits.js";
|
|
33
34
|
import { and, eq } from "drizzle-orm";
|
|
@@ -44,7 +45,12 @@ import {
|
|
|
44
45
|
getEventOwnerContext,
|
|
45
46
|
ownerEmailMatches,
|
|
46
47
|
} from "../../../../lib/recordings.js";
|
|
47
|
-
import {
|
|
48
|
+
import {
|
|
49
|
+
deleteResumableSession,
|
|
50
|
+
setResumableSession,
|
|
51
|
+
} from "../../../../lib/resumable-session.js";
|
|
52
|
+
import { shouldEnableStreamingUpload } from "../../../../lib/streaming-upload-mode.js";
|
|
53
|
+
import { maxChunkUploadBytes } from "../../../../lib/upload-chunk-limits.js";
|
|
48
54
|
|
|
49
55
|
interface CompressionMeta {
|
|
50
56
|
originalBytes?: number;
|
|
@@ -77,6 +83,7 @@ export default defineEventHandler(async (event: H3Event) => {
|
|
|
77
83
|
const { userEmail: ownerEmail, orgId } = await getEventOwnerContext(event);
|
|
78
84
|
const body = (await readBody(event).catch(() => null)) as {
|
|
79
85
|
compression?: CompressionMeta | null;
|
|
86
|
+
mimeType?: string;
|
|
80
87
|
} | null;
|
|
81
88
|
|
|
82
89
|
// Sanitize compression metadata. The recorder is the only client we trust
|
|
@@ -117,6 +124,45 @@ export default defineEventHandler(async (event: H3Event) => {
|
|
|
117
124
|
// accidentally route through handleResumableChunk with stale offsets.
|
|
118
125
|
await deleteResumableSession(recordingId).catch(() => {});
|
|
119
126
|
|
|
127
|
+
// Re-initialize a fresh streaming session for the re-upload when the
|
|
128
|
+
// deployment streams to the provider (production / remote DB, where SQL
|
|
129
|
+
// chunk scratch is unavailable). Without this, the post-compression
|
|
130
|
+
// re-upload would fall into the buffered path and 409.
|
|
131
|
+
let uploadMode: "streaming" | "buffered" = "buffered";
|
|
132
|
+
let uploadChunkBytes: number | undefined;
|
|
133
|
+
const reuploadMimeType =
|
|
134
|
+
compression?.outputMimeType || body?.mimeType || "video/webm";
|
|
135
|
+
const uploadProvider = await getActiveFileUploadProviderForRequest();
|
|
136
|
+
const providerChunkBytes = uploadProvider?.resumable?.preferredChunkBytes;
|
|
137
|
+
if (
|
|
138
|
+
uploadProvider?.resumable &&
|
|
139
|
+
shouldEnableStreamingUpload({ mimeType: reuploadMimeType }) &&
|
|
140
|
+
(!providerChunkBytes || providerChunkBytes <= maxChunkUploadBytes())
|
|
141
|
+
) {
|
|
142
|
+
try {
|
|
143
|
+
const ext = /mp4|quicktime/i.test(reuploadMimeType) ? "mp4" : "webm";
|
|
144
|
+
const session = await uploadProvider.resumable.startSession(
|
|
145
|
+
`${recordingId}.${ext}`,
|
|
146
|
+
reuploadMimeType.split(";")[0]?.trim() || "video/webm",
|
|
147
|
+
MAX_RECORDING_UPLOAD_BYTES,
|
|
148
|
+
);
|
|
149
|
+
await setResumableSession(recordingId, {
|
|
150
|
+
providerId: uploadProvider.id,
|
|
151
|
+
sessionId: session.sessionId,
|
|
152
|
+
meta: { ...session.meta, stableUrl: true, recordAsset: false },
|
|
153
|
+
bytesUploaded: 0,
|
|
154
|
+
lastCommittedIndex: -1,
|
|
155
|
+
});
|
|
156
|
+
uploadMode = "streaming";
|
|
157
|
+
uploadChunkBytes = providerChunkBytes;
|
|
158
|
+
} catch (err) {
|
|
159
|
+
console.warn(
|
|
160
|
+
`[reset-chunks] resumable session re-init failed, falling back to buffered:`,
|
|
161
|
+
err instanceof Error ? err.message : String(err),
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
120
166
|
// Reset the per-recording upload progress so the UI poller sees the
|
|
121
167
|
// re-upload restart from 0 and doesn't briefly show "100% then
|
|
122
168
|
// re-running" on the post-compression chunked upload pass.
|
|
@@ -158,6 +204,8 @@ export default defineEventHandler(async (event: H3Event) => {
|
|
|
158
204
|
recordingId,
|
|
159
205
|
chunksCleared: cleared,
|
|
160
206
|
compressionRecorded: !!compression,
|
|
207
|
+
uploadMode,
|
|
208
|
+
...(uploadChunkBytes ? { uploadChunkBytes } : {}),
|
|
161
209
|
};
|
|
162
210
|
});
|
|
163
211
|
});
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Body: { json: any, fieldName?: string, type?: "map"|"array", requestSource?: string }
|
|
14
14
|
*/
|
|
15
15
|
export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
16
|
-
ok?: undefined;
|
|
17
16
|
error: string;
|
|
17
|
+
ok?: undefined;
|
|
18
18
|
} | {
|
|
19
19
|
error?: undefined;
|
|
20
20
|
ok: boolean;
|
package/dist/deploy/build.d.ts
CHANGED
|
@@ -47,8 +47,28 @@ export interface GenerateWorkerEntryOptions {
|
|
|
47
47
|
* unified workspace deployments. Must stay dependency-free beyond core's
|
|
48
48
|
* lean `global-scope` subpath so nothing registry-touching evaluates before
|
|
49
49
|
* the scope id is set (ESM evaluates imports depth-first in order).
|
|
50
|
+
*
|
|
51
|
+
* `envDefaults` bakes the per-app workspace env (workspace-apps manifest,
|
|
52
|
+
* app id, base path, audience, route-access lists) into the module as
|
|
53
|
+
* `process.env` DEFAULTS. Cloudflare workerd has no filesystem and no
|
|
54
|
+
* ambient build env, so without this the runtime falls back as if the app
|
|
55
|
+
* were standalone — `loadWorkspaceAppsManifest()` returns null and agent
|
|
56
|
+
* discovery targets the builtin hosted prod URLs instead of the sibling
|
|
57
|
+
* apps mounted on this origin (ask_app/call-agent "internal error"). The
|
|
58
|
+
* Netlify preset already bakes the same keys in its generated function
|
|
59
|
+
* entry (`setBasePathEnv`); this is the Cloudflare-preset equivalent.
|
|
60
|
+
* Defaults never override real runtime env: the worker's per-request
|
|
61
|
+
* bindings copy assigns binding keys on top, and baked keys only apply
|
|
62
|
+
* when the key is absent.
|
|
63
|
+
*/
|
|
64
|
+
export declare function generateScopeInitSource(appScopeId: string, envDefaults?: Record<string, string>): string;
|
|
65
|
+
/**
|
|
66
|
+
* Snapshot the per-app workspace env keys that must survive into the edge
|
|
67
|
+
* runtime. Called at build time (workspace-deploy sets these in the child
|
|
68
|
+
* build env); the result is baked into `_scope-init.js` as process.env
|
|
69
|
+
* defaults for runtimes with no filesystem/ambient env (workerd).
|
|
50
70
|
*/
|
|
51
|
-
export declare function
|
|
71
|
+
export declare function workspaceEnvDefaultsFromBuildEnv(env?: NodeJS.ProcessEnv): Record<string, string>;
|
|
52
72
|
/**
|
|
53
73
|
* Derive the workspace app id from a mounted app base path ("/assets" →
|
|
54
74
|
* "assets"). Returns null for unmounted (root) builds.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/deploy/build.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG;AAmCH,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAI7B,eAAO,MAAM,6BAA6B,UAiBzC,CAAC;AAEF,eAAO,MAAM,mCAAmC,UAiB/C,CAAC;AACF,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAuIjE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,UAUnC,CAAC;AAEF,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAaxB;AAoCD,eAAO,MAAM,2CAA2C,EAAE,MAAM,CAC9D,MAAM,EACN,MAAM,CAmSP,CAAC;AAEF,MAAM,WAAW,0BAA0B;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/deploy/build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