@neta-art/cohub 2.11.0 → 2.11.1
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 +201 -0
- package/dist/chunks/http.d.ts +111 -19
- package/dist/chunks/http.js +44 -10
- package/dist/chunks/transport.js +44 -7
- package/dist/chunks/voice-input.d.ts +0 -1
- package/dist/chunks/websocket.d.ts +44 -73
- package/dist/chunks/websocket.js +2 -2
- package/dist/debugger.js +3 -2
- package/dist/http.d.ts +3 -3
- package/dist/index.d.ts +27 -15
- package/dist/index.js +8 -5
- package/dist/voice-input.js +2 -1
- package/docs/work-runtime-guide.md +4 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { n as HttpTransport, t as HttpError } from "./chunks/transport.js";
|
|
1
|
+
import { C as PromptsApi, D as ChannelsApi, E as CronJobsApi, S as SkillsApi, T as GenerationsApi, _ as ensureRealtimeConnected, a as ReferralsApi, b as SearchApi, c as TasksApi, d as PublicInviteApi, f as SessionGenerationStreamClient, g as createSessionPatchReducer, h as SessionPatchReducer, i as WorksApi, l as SpaceClient, m as parseAssistantMessageCommit, n as createHttpClient, o as UsersApi, p as createSessionGenerationStreamClient, r as WorkCommerceApi, s as UserApi, t as CohubHttpClient, u as SpacesApi, v as SessionAccessApi, w as ModelsApi, x as PublicAssetsApi, y as ReferencesApi } from "./chunks/http.js";
|
|
2
|
+
import { i as sanitizeAccessToken, n as HttpTransport, r as joinApiUrl, t as HttpError } from "./chunks/transport.js";
|
|
3
3
|
import { a as resolveApiBaseUrl, c as resolveWebsocketUrl, i as normalizeWebsocketUrl, n as normalizeBaseUrl, o as resolveCohubEnvironment, r as normalizeVoiceInputWebsocketUrl, s as resolveVoiceInputWebsocketUrl, t as COHUB_ENVIRONMENTS } from "./chunks/environment.js";
|
|
4
4
|
import { a as extractBillingPayload, c as isFeatureNotEntitledError, i as FEATURE_NOT_ENTITLED_ERROR_CODE, l as isHttpErrorCode, n as createWebsocketClient, o as isBillingAccessBlockedCode, r as BILLING_ACCESS_BLOCKED_ERROR_CODE, s as isBillingAccessBlockedError, t as WebsocketClient } from "./chunks/websocket.js";
|
|
5
5
|
import { VoiceApi, VoiceInputClient, createVoiceInputClient } from "./voice-input.js";
|
|
@@ -468,6 +468,7 @@ var CohubClient = class {
|
|
|
468
468
|
generations;
|
|
469
469
|
models;
|
|
470
470
|
prompts;
|
|
471
|
+
skills;
|
|
471
472
|
publicAssets;
|
|
472
473
|
sessionAccess;
|
|
473
474
|
search;
|
|
@@ -524,6 +525,7 @@ var CohubClient = class {
|
|
|
524
525
|
this.generations = new GenerationsApi(this.transport);
|
|
525
526
|
this.models = new ModelsApi(this.transport);
|
|
526
527
|
this.prompts = new PromptsApi(this.transport);
|
|
528
|
+
this.skills = new SkillsApi(this.transport);
|
|
527
529
|
this.publicAssets = new PublicAssetsApi(this.transport);
|
|
528
530
|
this.sessionAccess = new SessionAccessApi(this.transport);
|
|
529
531
|
this.search = new SearchApi(this.transport);
|
|
@@ -686,11 +688,12 @@ function hasGrantedWorkScopes(userUuid, workId, scopes) {
|
|
|
686
688
|
function setGrantedWorkScopes(userUuid, workId, scopes) {
|
|
687
689
|
if (!userUuid || !workId || scopes.length === 0) return;
|
|
688
690
|
const existing = readEntry(userUuid, workId);
|
|
691
|
+
const merged = Array.from(/* @__PURE__ */ new Set([...existing?.scopes ?? [], ...scopes]));
|
|
689
692
|
const entry = {
|
|
690
693
|
version: CACHE_VERSION,
|
|
691
694
|
userUuid,
|
|
692
695
|
workId,
|
|
693
|
-
scopes:
|
|
696
|
+
scopes: merged,
|
|
694
697
|
updatedAt: Date.now()
|
|
695
698
|
};
|
|
696
699
|
if (!isBrowser()) return;
|
|
@@ -1032,7 +1035,7 @@ function createWorkBridgeCore(config) {
|
|
|
1032
1035
|
};
|
|
1033
1036
|
}
|
|
1034
1037
|
//#endregion
|
|
1035
|
-
//#region ../protocol/
|
|
1038
|
+
//#region ../protocol/dist/generation/policy.js
|
|
1036
1039
|
const GENERATION_POLICY_ENV_KEY = "COHUB_GENERATION_POLICY_B64";
|
|
1037
1040
|
var GenerationPolicyError = class extends Error {
|
|
1038
1041
|
constructor(message) {
|
|
@@ -1263,4 +1266,4 @@ function filterGenerationDeclarationsByPolicy(declarations, policy) {
|
|
|
1263
1266
|
});
|
|
1264
1267
|
}
|
|
1265
1268
|
//#endregion
|
|
1266
|
-
export { BILLING_ACCESS_BLOCKED_ERROR_CODE, BillingApi, COHUB_ENVIRONMENTS, CohubClient, CohubHttpClient, FEATURE_NOT_ENTITLED_ERROR_CODE, GenerationPolicyError, HttpError, ParentBridgeTransport, PopupBrokerTransport, ReferencesApi, ReferralsApi, SessionGenerationStreamClient, SessionPatchReducer, UsersApi, VoiceApi, VoiceInputClient, WebsocketClient, WorkCommerceApi, WorkRuntimeApi, WorksApi, assertGenerationRequestAllowedByPolicy, clearGrantedWorkScopes, createCohubClient, createHttpClient, createSessionGenerationStreamClient, createSessionPatchReducer, createSlugWorkIdResolver, createVoiceInputClient, createWebsocketClient, createWorkBridgeCore, createWorkRuntime, decodeGenerationPolicy, encodeGenerationPolicy, extractBillingPayload, filterGenerationDeclarationsByPolicy, findGenerationModelPolicy, getAllowedGenerationModelIds, hasGrantedWorkScopes, isBillingAccessBlockedCode, isBillingAccessBlockedError, isFeatureNotEntitledError, isHttpErrorCode, normalizeBaseUrl, normalizeGenerationPolicy, normalizeVoiceInputWebsocketUrl, normalizeWebsocketUrl, parseAssistantMessageCommit, parseGenerationPolicyFromEnv, resolveApiBaseUrl, resolveCohubEnvironment, resolveVoiceInputWebsocketUrl, resolveWebsocketUrl, resolveWorkTransport, setGrantedWorkScopes };
|
|
1269
|
+
export { BILLING_ACCESS_BLOCKED_ERROR_CODE, BillingApi, COHUB_ENVIRONMENTS, CohubClient, CohubHttpClient, FEATURE_NOT_ENTITLED_ERROR_CODE, GenerationPolicyError, HttpError, ParentBridgeTransport, PopupBrokerTransport, ReferencesApi, ReferralsApi, SessionGenerationStreamClient, SessionPatchReducer, UsersApi, VoiceApi, VoiceInputClient, WebsocketClient, WorkCommerceApi, WorkRuntimeApi, WorksApi, assertGenerationRequestAllowedByPolicy, clearGrantedWorkScopes, createCohubClient, createHttpClient, createSessionGenerationStreamClient, createSessionPatchReducer, createSlugWorkIdResolver, createVoiceInputClient, createWebsocketClient, createWorkBridgeCore, createWorkRuntime, decodeGenerationPolicy, encodeGenerationPolicy, extractBillingPayload, filterGenerationDeclarationsByPolicy, findGenerationModelPolicy, getAllowedGenerationModelIds, hasGrantedWorkScopes, isBillingAccessBlockedCode, isBillingAccessBlockedError, isFeatureNotEntitledError, isHttpErrorCode, joinApiUrl, normalizeBaseUrl, normalizeGenerationPolicy, normalizeVoiceInputWebsocketUrl, normalizeWebsocketUrl, parseAssistantMessageCommit, parseGenerationPolicyFromEnv, resolveApiBaseUrl, resolveCohubEnvironment, resolveVoiceInputWebsocketUrl, resolveWebsocketUrl, resolveWorkTransport, sanitizeAccessToken, setGrantedWorkScopes };
|
package/dist/voice-input.js
CHANGED
|
@@ -273,7 +273,8 @@ var VoiceInputClient = class {
|
|
|
273
273
|
this.source = this.audioContext.createMediaStreamSource(this.stream);
|
|
274
274
|
this.processor = this.audioContext.createScriptProcessor(4096, 1, 1);
|
|
275
275
|
this.processor.onaudioprocess = (event) => {
|
|
276
|
-
const
|
|
276
|
+
const samples = event.inputBuffer.getChannelData(0);
|
|
277
|
+
const resampled = resampleTo16k(samples, this.audioContext?.sampleRate ?? TARGET_SAMPLE_RATE);
|
|
277
278
|
for (const sample of resampled) this.pendingSamples.push(sample);
|
|
278
279
|
while (this.pendingSamples.length >= CHUNK_SAMPLES) {
|
|
279
280
|
const chunk = this.pendingSamples.splice(0, CHUNK_SAMPLES);
|
|
@@ -185,7 +185,7 @@ session.prompt.readonly — send read-only prompts (no side effects)
|
|
|
185
185
|
session.prompt.fullaccess — send prompts with full access (write, create sessions)
|
|
186
186
|
generation.create — create generation tasks (image/video/audio)
|
|
187
187
|
user.space.list — list the viewer's spaces (account-level)
|
|
188
|
-
user.session.list — list the viewer
|
|
188
|
+
user.session.list — list recent sessions the viewer can view as themselves (across spaces)
|
|
189
189
|
user.usage.read — read the viewer's aggregated usage
|
|
190
190
|
```
|
|
191
191
|
|
|
@@ -968,3 +968,6 @@ await client.works.publishVersion(workId);
|
|
|
968
968
|
Other SDK methods: `works.get(workId)`, `works.getBySlug(username, spaceSlug,
|
|
969
969
|
workSlug)`, `works.listBySpace(spaceId)`, `works.update(workId, input)`,
|
|
970
970
|
`works.delete(workId)`.
|
|
971
|
+
`works.getBySlug(username, spaceSlug,
|
|
972
|
+
workSlug)`, `works.listBySpace(spaceId)`, `works.update(workId, input)`,
|
|
973
|
+
`works.delete(workId)`.
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neta-art/cohub",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"description": "Cohub SDK for spaces, sessions, checkpoints, and realtime agent collaboration.",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
6
|
"private": false,
|
|
7
7
|
"type": "module",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"docs"
|
|
54
54
|
],
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"tsdown": "^0.22.
|
|
57
|
-
"typescript": "^
|
|
56
|
+
"tsdown": "^0.22.7",
|
|
57
|
+
"typescript": "^7.0.2",
|
|
58
58
|
"@cohub/protocol": "2.0.0"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsdown",
|
|
62
|
-
"typecheck": "
|
|
62
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
63
63
|
}
|
|
64
64
|
}
|