@larkup/marketplace 0.1.25 → 0.2.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/.env.example +3 -0
- package/CHANGELOG.md +173 -0
- package/README.md +34 -0
- package/db/drizzle/0000_hesitant_joseph.sql +69 -0
- package/db/drizzle/0001_deep_phil_sheldon.sql +1 -0
- package/db/drizzle/0002_jittery_living_mummy.sql +18 -0
- package/db/drizzle/meta/0000_snapshot.json +483 -0
- package/db/drizzle/meta/0001_snapshot.json +490 -0
- package/db/drizzle/meta/0002_snapshot.json +615 -0
- package/db/drizzle/meta/_journal.json +27 -0
- package/db/drizzle.config.ts +19 -0
- package/db/tsconfig.build.json +11 -0
- package/db/tsconfig.json +17 -0
- package/db/vitest.config.ts +11 -0
- package/package.json +31 -4
- package/src/db/builtin-tools.ts +613 -0
- package/src/db/client.ts +26 -0
- package/src/db/repo.test.ts +309 -0
- package/src/db/repo.ts +558 -0
- package/src/db/schema/audit.ts +27 -0
- package/src/db/schema/extensions.ts +73 -0
- package/src/db/schema/index.ts +5 -0
- package/src/db/schema/installations.ts +23 -0
- package/src/db/schema/publishers.ts +13 -0
- package/src/db/schema/versions.ts +22 -0
- package/src/db/seed.ts +33 -0
- package/src/db/validate.test.ts +79 -0
- package/src/db/validate.ts +84 -0
- package/src/output-sanitizer.test.ts +17 -0
- package/src/output-sanitizer.ts +8 -0
- package/src/storage-provider-s3.test.ts +110 -0
- package/src/storage-provider.ts +164 -13
- package/src/tool-extension.ts +247 -0
- package/src/tool-installer.ts +80 -109
- package/src/tool-loader.test.ts +120 -0
- package/src/tool-loader.ts +99 -37
- package/src/tool-manifest.schema.ts +89 -32
- package/src/tool-registry.ts +34 -111
- package/src/types.ts +217 -87
- package/vitest.config.ts +13 -0
package/.env.example
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,178 @@
|
|
|
1
1
|
# @larkup/marketplace
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- b2f4aa2: Add a shared agent-planned video indexing pipeline with Fast, Balanced, and
|
|
8
|
+
Thorough modes, timestamp-grounded knowledge synthesis, live ETA progress, and
|
|
9
|
+
independently selectable provider-filtered vision and tool-brain models.
|
|
10
|
+
- Add the Marketplace v3 extension/runtime/billing contract and the installable cloud-first Video Intelligence tool with automatic device-scoped cloud connections, managed AWS deployment, quota controls, indexing briefs, durable timestamped chat evidence, audio-provider settings, and temporary capacity requests.
|
|
11
|
+
- bf44a90: feat(marketplace): add a durable Postgres catalog
|
|
12
|
+
|
|
13
|
+
`apps/marketplace` now stores publisher identity, extension versions, install
|
|
14
|
+
counts, and audit events in Postgres.
|
|
15
|
+
|
|
16
|
+
**`@larkup/marketplace`** now includes the Drizzle schema, committed
|
|
17
|
+
migrations, a lazy Postgres client, and typed catalog queries under `src/db`.
|
|
18
|
+
The Hub owns HTTP handling while the Marketplace package owns database access.
|
|
19
|
+
Publishing validates manifests, preserves immutable versions, and enforces
|
|
20
|
+
publisher ownership.
|
|
21
|
+
|
|
22
|
+
**Local contributor path, no Neon account needed**:
|
|
23
|
+
`docker compose -f docker/marketplace-db.yml up`, then `pnpm --filter
|
|
24
|
+
@larkup/marketplace db:migrate && pnpm --filter @larkup/marketplace db:seed`.
|
|
25
|
+
|
|
26
|
+
**`@larkup/hub`**: `/v1/*` stays byte-compatible — every response is
|
|
27
|
+
reconstructed from the stored manifest so `ToolDescriptor`/`ToolListResponse`/
|
|
28
|
+
`ToolDetailResponse` are unchanged field-for-field, and
|
|
29
|
+
`POST /v1/tools/:id/installed` still accepts the body-less request
|
|
30
|
+
`packages/marketplace`'s installer sends today (falls back to an
|
|
31
|
+
`"anonymous"` workspace bucket; a caller sending `workspaceId` gets accurate
|
|
32
|
+
per-workspace install tracking with no Hub change required).
|
|
33
|
+
|
|
34
|
+
See [ADR-012](docs/adrs/adr-012-marketplace-hub-on-postgres.md) for the
|
|
35
|
+
schema and authorization design.
|
|
36
|
+
|
|
37
|
+
- b2f4aa2: Make indexed video evidence findable and answerable.
|
|
38
|
+
|
|
39
|
+
Retrieval now ranks the evidence at its own timestamps using the workspace
|
|
40
|
+
embedding model, so a question asked in one language locates a moment recorded
|
|
41
|
+
in another; the corpus only ever matched chapter-sized documents, and lexical
|
|
42
|
+
scoring matched nothing at all across languages. Every timestamped signal is
|
|
43
|
+
fused into a short ranked list of windows, which both aims bounded source
|
|
44
|
+
inspection and gives the model a compact map to navigate by, replacing offsets
|
|
45
|
+
computed from the recording's length.
|
|
46
|
+
|
|
47
|
+
A conclusion, a count, and a comparison are settled by reading across records
|
|
48
|
+
rather than by finding one that states the answer. Requiring a single record
|
|
49
|
+
made those questions report the source as silent even when its closing state was
|
|
50
|
+
plainly indexed; they are now answered from a chronological trail, with the
|
|
51
|
+
answering rule stating how far that trail goes.
|
|
52
|
+
|
|
53
|
+
Also fixes: the chapter/scene hierarchy was scoped to one revision, so a single
|
|
54
|
+
refinement replaced the whole map of a source; the loader served a workspace
|
|
55
|
+
tool's stale build until the host restarted; and a live analysis showed a
|
|
56
|
+
completed progress bar for the minutes of work that follow the worker's own pass.
|
|
57
|
+
|
|
58
|
+
- b2f4aa2: Video indexing now takes notes instead of describing frames, and a chat question
|
|
59
|
+
that the index cannot settle is answered by re-reading the source directly
|
|
60
|
+
instead of dispatching a re-index.
|
|
61
|
+
|
|
62
|
+
**Indexing.** The per-clip reader was instructed to describe only what a clip's
|
|
63
|
+
own pixels showed and never to use on-screen text or speech to identify anyone,
|
|
64
|
+
which produced entries like "a man in a jersey sits on a couch" alongside
|
|
65
|
+
detector class lists ("person, chair, couch"). It now writes notes the way a
|
|
66
|
+
person would if they had to answer questions from them later: what happened and
|
|
67
|
+
what changed, who was involved and what established each identity, and every
|
|
68
|
+
informative piece of on-screen text read exactly and attached to what it labels.
|
|
69
|
+
How much a note carries scales with the requested coverage (fast / balanced /
|
|
70
|
+
thorough), and the indexing hint steers what gets the most detail. Detector class
|
|
71
|
+
lists and low-confidence text no longer enter the searchable notes at all; both
|
|
72
|
+
remain queryable as their own evidence.
|
|
73
|
+
|
|
74
|
+
**Answering.** A question the index could not settle previously dispatched a
|
|
75
|
+
bounded re-index: a cold GPU worker, minutes of wall time, and frequently a turn
|
|
76
|
+
that expired before it returned, which reached the user as the video not showing
|
|
77
|
+
something it plainly did. The host now exposes a `reWatch` capability that
|
|
78
|
+
samples the candidate windows off the source and reads them in one multimodal
|
|
79
|
+
request per window, with the windows read together. The dispatched path remains
|
|
80
|
+
as the fallback behind it.
|
|
81
|
+
|
|
82
|
+
**Transcription.** Local Whisper ran with voice detection always on. Over
|
|
83
|
+
continuous background noise it discards speech rather than finding silence: on a
|
|
84
|
+
noisy source it kept 2 segments where a second pass without it recovered 66, and
|
|
85
|
+
a whole recording indexed with 5% of its speech. It now measures how much of the
|
|
86
|
+
source the first pass found and re-decodes without voice detection when that is
|
|
87
|
+
implausibly low, keeping whichever pass heard more.
|
|
88
|
+
|
|
89
|
+
Also fixes three answering bugs found while testing against a real index:
|
|
90
|
+
|
|
91
|
+
- A question settled by a trail of evidence rather than one record returned an
|
|
92
|
+
empty evidence list, so the reply had nothing to cite and reported the source
|
|
93
|
+
as silent.
|
|
94
|
+
- A question about a conclusion spent one of its bounded looks on the opening of
|
|
95
|
+
the source, where the answer cannot be.
|
|
96
|
+
- A question about a whole progression spread its looks evenly across the
|
|
97
|
+
source, landing between the moments it changed instead of on them.
|
|
98
|
+
|
|
99
|
+
Also raises the reader's output budget. Current readers spend most of a small
|
|
100
|
+
budget before emitting any content, so the previous interactive ceiling produced
|
|
101
|
+
truncated, unparseable results rather than shorter ones.
|
|
102
|
+
|
|
103
|
+
Measured on a 14.6-minute source: indexing 131s (balanced), and a bounded
|
|
104
|
+
re-watch 660ms to sample plus ~14s to read, against minutes for the dispatched
|
|
105
|
+
path.
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- Load installed Marketplace agent actions dynamically in chat, with validated schemas, collision protection, execution context, and workflow metadata. Video Intelligence now owns its bounded evidence-refinement action and declarative chat behavior.
|
|
110
|
+
- b2f4aa2: Honor a Marketplace tool manifest's public or private distribution setting when it is published.
|
|
111
|
+
- b2f4aa2: Make indexed video answers RAG-first, share one bounded fallback-analysis deadline, animate per-call chat progress, expose matched indexed context with timestamps, automatically paginate broad questions, and remove answer-cache shortcuts.
|
|
112
|
+
- Improve project settings with portable Agent Skills, runtime filtering, current installed-tool manifests, and expanded Video Intelligence configuration. Agent Server deployments now expose tool discovery plus AI SDK and OpenAI-compatible streaming endpoints, grouped separately from Knowledge endpoints in Scalar. Add text streaming helpers, chat-model discovery, and guarded per-request provider/model selection to the JavaScript and Python SDK clients. AI Gateway runtimes list their available language models; direct-provider runtimes remain constrained to their configured provider. Align `larkup chat --model` with the configured provider so a Gateway key is never routed to a direct vendor.
|
|
113
|
+
- b2f4aa2: Add portable runtime selection, a manifest-driven media-indexing confirmation form, cloud allowance support requests, and capped device-trial entitlement controls for Video Intelligence.
|
|
114
|
+
- b2f4aa2: Make video indexing and retrieval work the same for any kind of video, and
|
|
115
|
+
make an indexing job's progress reflect the work it is doing.
|
|
116
|
+
|
|
117
|
+
Indexing and retrieval both carried rules written for one kind of footage: a
|
|
118
|
+
question planner that branched on sport vocabulary in English and Arabic, an
|
|
119
|
+
OCR pass that only kept paired numbers under 30, and prompts that told the
|
|
120
|
+
reader how to interpret a two-sided display. Those rules answered a narrow set
|
|
121
|
+
of questions on a narrow set of videos and quietly distorted everything else.
|
|
122
|
+
They are replaced by signals that mean the same thing in any recording: which
|
|
123
|
+
short on-screen text persists and when it changes, whether a question wants one
|
|
124
|
+
fact or the whole source, and whether a state sequence is consistent with
|
|
125
|
+
itself over time.
|
|
126
|
+
|
|
127
|
+
The retrieval agent now runs one gap-driven loop rather than a set of
|
|
128
|
+
per-question-type rules: it retrieves, decides what the evidence still lacks,
|
|
129
|
+
watches the moments the index pointed at, and re-checks. Independent moments are
|
|
130
|
+
watched together instead of one after another, which cuts a multi-range turn to
|
|
131
|
+
roughly the cost of its slowest look, and a runtime that admits one job at a
|
|
132
|
+
time is handled by falling back to one at a time rather than failing the turn.
|
|
133
|
+
An answer a question was watched for is now recognised by what produced it,
|
|
134
|
+
rather than by the reader repeating the question back.
|
|
135
|
+
|
|
136
|
+
Progress is budgeted by how long each phase actually takes and advances between
|
|
137
|
+
milestones, so the bar moves the whole way through rather than sitting still and
|
|
138
|
+
then jumping. The runtime reports how far through its current stage it is, so a
|
|
139
|
+
host rendering one bar per step no longer keeps its own copy of that budget.
|
|
140
|
+
|
|
141
|
+
The three coverage modes now have non-overlapping budgets, so Fast can no longer
|
|
142
|
+
plan more work than Balanced.
|
|
143
|
+
|
|
144
|
+
The index's own reconciled account is now published as retrievable evidence.
|
|
145
|
+
The runtime already cross-checks every reading of a moment against the rest of
|
|
146
|
+
the timeline, but only the raw readings reached retrieval, so chat could answer
|
|
147
|
+
from a reading the index had already set aside. Evidence that reconciles other
|
|
148
|
+
evidence now leads the answer.
|
|
149
|
+
|
|
150
|
+
The managed cloud worker's bulk reader moves to a stronger model. Measured on
|
|
151
|
+
the same GPU and source, the previous one misread a two-sided on-screen display
|
|
152
|
+
and produced a wrong index while also finishing slower, because a weaker reader
|
|
153
|
+
costs more retries than it saves.
|
|
154
|
+
|
|
155
|
+
- b2f4aa2: Improve Video Intelligence cloud usage, model verification, and local runtime controls.
|
|
156
|
+
- Updated dependencies [738ba6c]
|
|
157
|
+
- Updated dependencies [738ba6c]
|
|
158
|
+
- Updated dependencies [738ba6c]
|
|
159
|
+
- Updated dependencies
|
|
160
|
+
- Updated dependencies [b2f4aa2]
|
|
161
|
+
- Updated dependencies [b2f4aa2]
|
|
162
|
+
- Updated dependencies [790a298]
|
|
163
|
+
- Updated dependencies [b2f4aa2]
|
|
164
|
+
- Updated dependencies
|
|
165
|
+
- Updated dependencies
|
|
166
|
+
- Updated dependencies
|
|
167
|
+
- Updated dependencies
|
|
168
|
+
- Updated dependencies
|
|
169
|
+
- Updated dependencies [5d9b483]
|
|
170
|
+
- Updated dependencies
|
|
171
|
+
- Updated dependencies [b2f4aa2]
|
|
172
|
+
- Updated dependencies [b2f4aa2]
|
|
173
|
+
- Updated dependencies [b2f4aa2]
|
|
174
|
+
- @larkup/core@0.5.0
|
|
175
|
+
|
|
3
176
|
## 0.1.25
|
|
4
177
|
|
|
5
178
|
### Patch Changes
|
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @larkup/marketplace
|
|
2
|
+
|
|
3
|
+
Marketplace discovery, installation, loading, storage, and catalog database
|
|
4
|
+
utilities for Larkup.
|
|
5
|
+
|
|
6
|
+
## Package exports
|
|
7
|
+
|
|
8
|
+
Use `@larkup/marketplace/registry` to discover tools, `installer` to install
|
|
9
|
+
them, `loader` to load an installed tool, and `storage` for tool storage.
|
|
10
|
+
|
|
11
|
+
The Marketplace Hub uses the database exports under `@larkup/marketplace/db`.
|
|
12
|
+
They provide the Postgres client, schema, repository functions, manifest
|
|
13
|
+
validation, and built in tool manifests.
|
|
14
|
+
|
|
15
|
+
## Local Marketplace database
|
|
16
|
+
|
|
17
|
+
Start the local database and copy the example environment file:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
docker compose -f docker/marketplace-db.yml up -d
|
|
21
|
+
cp packages/marketplace/.env.example packages/marketplace/.env
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Use the following commands from the repository root:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pnpm --filter @larkup/marketplace db:migrate
|
|
28
|
+
pnpm --filter @larkup/marketplace db:seed
|
|
29
|
+
pnpm --filter @larkup/marketplace db:test
|
|
30
|
+
pnpm --filter @larkup/marketplace db:typecheck
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Database migrations are committed in `db/drizzle`. Add a migration whenever a
|
|
34
|
+
schema change is made.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
CREATE TABLE "publishers" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"name" text NOT NULL,
|
|
4
|
+
"contact_email" text,
|
|
5
|
+
"verification" text DEFAULT 'unverified' NOT NULL,
|
|
6
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
7
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
CREATE TABLE "extension_workspace_grants" (
|
|
11
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
12
|
+
"extension_id" text NOT NULL,
|
|
13
|
+
"workspace_id" text NOT NULL,
|
|
14
|
+
"granted_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
15
|
+
);
|
|
16
|
+
--> statement-breakpoint
|
|
17
|
+
CREATE TABLE "extensions" (
|
|
18
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
19
|
+
"publisher_id" text NOT NULL,
|
|
20
|
+
"kind" text DEFAULT 'tool' NOT NULL,
|
|
21
|
+
"name" text NOT NULL,
|
|
22
|
+
"description" text NOT NULL,
|
|
23
|
+
"category" text NOT NULL,
|
|
24
|
+
"package_name" text NOT NULL,
|
|
25
|
+
"distribution" text DEFAULT 'public' NOT NULL,
|
|
26
|
+
"repository_url" text,
|
|
27
|
+
"license" text,
|
|
28
|
+
"deprecated_at" timestamp with time zone,
|
|
29
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
30
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
31
|
+
);
|
|
32
|
+
--> statement-breakpoint
|
|
33
|
+
CREATE TABLE "extension_versions" (
|
|
34
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
35
|
+
"extension_id" text NOT NULL,
|
|
36
|
+
"version" text NOT NULL,
|
|
37
|
+
"manifest" jsonb NOT NULL,
|
|
38
|
+
"integrity" text NOT NULL,
|
|
39
|
+
"published_by" text NOT NULL,
|
|
40
|
+
"published_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
41
|
+
CONSTRAINT "extension_versions_extension_version_unique" UNIQUE("extension_id","version")
|
|
42
|
+
);
|
|
43
|
+
--> statement-breakpoint
|
|
44
|
+
CREATE TABLE "workspace_installations" (
|
|
45
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
46
|
+
"extension_id" text NOT NULL,
|
|
47
|
+
"workspace_id" text NOT NULL,
|
|
48
|
+
"installed_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
49
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
50
|
+
CONSTRAINT "workspace_installations_extension_workspace_unique" UNIQUE("extension_id","workspace_id")
|
|
51
|
+
);
|
|
52
|
+
--> statement-breakpoint
|
|
53
|
+
CREATE TABLE "audit_events" (
|
|
54
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
55
|
+
"actor" text NOT NULL,
|
|
56
|
+
"action" text NOT NULL,
|
|
57
|
+
"extension_id" text,
|
|
58
|
+
"workspace_id" text,
|
|
59
|
+
"metadata" jsonb,
|
|
60
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
61
|
+
);
|
|
62
|
+
--> statement-breakpoint
|
|
63
|
+
ALTER TABLE "extension_workspace_grants" ADD CONSTRAINT "extension_workspace_grants_extension_id_extensions_id_fk" FOREIGN KEY ("extension_id") REFERENCES "public"."extensions"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
64
|
+
ALTER TABLE "extensions" ADD CONSTRAINT "extensions_publisher_id_publishers_id_fk" FOREIGN KEY ("publisher_id") REFERENCES "public"."publishers"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
65
|
+
ALTER TABLE "extension_versions" ADD CONSTRAINT "extension_versions_extension_id_extensions_id_fk" FOREIGN KEY ("extension_id") REFERENCES "public"."extensions"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
66
|
+
ALTER TABLE "workspace_installations" ADD CONSTRAINT "workspace_installations_extension_id_extensions_id_fk" FOREIGN KEY ("extension_id") REFERENCES "public"."extensions"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
67
|
+
CREATE INDEX "extension_versions_extension_id_idx" ON "extension_versions" USING btree ("extension_id");--> statement-breakpoint
|
|
68
|
+
CREATE INDEX "workspace_installations_extension_id_idx" ON "workspace_installations" USING btree ("extension_id");--> statement-breakpoint
|
|
69
|
+
CREATE INDEX "audit_events_extension_id_idx" ON "audit_events" USING btree ("extension_id");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "extensions" ADD COLUMN "requires_sandbox" boolean DEFAULT true NOT NULL;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
CREATE TABLE "extension_access_keys" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"extension_id" text NOT NULL,
|
|
4
|
+
"key_hash" text NOT NULL,
|
|
5
|
+
"key_prefix" text NOT NULL,
|
|
6
|
+
"scope" text NOT NULL,
|
|
7
|
+
"scope_id" text,
|
|
8
|
+
"max_installs" integer,
|
|
9
|
+
"install_count" integer DEFAULT 0 NOT NULL,
|
|
10
|
+
"expires_at" timestamp with time zone,
|
|
11
|
+
"revoked_at" timestamp with time zone,
|
|
12
|
+
"created_by" text NOT NULL,
|
|
13
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
14
|
+
CONSTRAINT "extension_access_keys_key_hash_unique" UNIQUE("key_hash")
|
|
15
|
+
);
|
|
16
|
+
--> statement-breakpoint
|
|
17
|
+
ALTER TABLE "extension_access_keys" ADD CONSTRAINT "extension_access_keys_extension_id_extensions_id_fk" FOREIGN KEY ("extension_id") REFERENCES "public"."extensions"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
|
18
|
+
CREATE INDEX "extension_access_keys_extension_id_idx" ON "extension_access_keys" USING btree ("extension_id");
|