blast-studio 0.0.0-stage → 0.1.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 +202 -0
- package/README.md +138 -2
- package/bin/bstudio.mjs +13 -0
- package/dist/agent-env.js +177 -0
- package/dist/brief.js +53 -0
- package/dist/budget/ledger.js +153 -0
- package/dist/campaign-zip.js +93 -0
- package/dist/cli.js +118 -0
- package/dist/commands/accept.js +64 -0
- package/dist/commands/auth.js +77 -0
- package/dist/commands/brief.js +117 -0
- package/dist/commands/budget.js +22 -0
- package/dist/commands/dashboard.js +9 -0
- package/dist/commands/doctor.js +57 -0
- package/dist/commands/export.js +42 -0
- package/dist/commands/init.js +24 -0
- package/dist/commands/install-skills.js +52 -0
- package/dist/commands/library.js +12 -0
- package/dist/commands/make.js +71 -0
- package/dist/commands/mark.js +44 -0
- package/dist/commands/new.js +25 -0
- package/dist/commands/plan.js +57 -0
- package/dist/commands/render-preview.js +43 -0
- package/dist/commands/render.js +243 -0
- package/dist/commands/review.js +119 -0
- package/dist/commands/revise.js +73 -0
- package/dist/commands/sources.js +33 -0
- package/dist/commands/status.js +34 -0
- package/dist/config.js +141 -0
- package/dist/dashboard/server.js +171 -0
- package/dist/dashboard/static/app.css +1 -0
- package/dist/dashboard/static/app.js +52 -0
- package/dist/dashboard/static/index.html +8 -0
- package/dist/env.js +47 -0
- package/dist/export.js +110 -0
- package/dist/fetch-text.js +64 -0
- package/dist/io.js +1 -0
- package/dist/keychain.js +41 -0
- package/dist/library.js +49 -0
- package/dist/packs.js +91 -0
- package/dist/plan.js +75 -0
- package/dist/posts.js +40 -0
- package/dist/providers/images.js +116 -0
- package/dist/providers/voice.js +55 -0
- package/dist/render/bins.js +21 -0
- package/dist/render/ffmpeg.js +102 -0
- package/dist/render/metrics.js +109 -0
- package/dist/render/stills.js +175 -0
- package/dist/render/template.js +20 -0
- package/dist/render/video.js +175 -0
- package/dist/review/gates.js +201 -0
- package/dist/review/reviewer.js +79 -0
- package/dist/review/score.js +21 -0
- package/dist/review/slop.js +17 -0
- package/dist/review-hash.js +21 -0
- package/dist/types.js +29 -0
- package/dist/updater/check.js +140 -0
- package/dist/updater/propose.js +144 -0
- package/dist/workspace.js +142 -0
- package/package.json +45 -4
- package/platforms/bluesky/guide.md +94 -0
- package/platforms/bluesky/pack.yml +150 -0
- package/platforms/dailydev/guide.md +82 -0
- package/platforms/dailydev/pack.yml +152 -0
- package/platforms/devto/guide.md +93 -0
- package/platforms/devto/pack.yml +119 -0
- package/platforms/gist/guide.md +92 -0
- package/platforms/gist/pack.yml +119 -0
- package/platforms/github-discussion/guide.md +92 -0
- package/platforms/github-discussion/pack.yml +122 -0
- package/platforms/hashnode/guide.md +93 -0
- package/platforms/hashnode/pack.yml +124 -0
- package/platforms/hn/guide.md +48 -0
- package/platforms/hn/pack.yml +59 -0
- package/platforms/instagram/guide.md +95 -0
- package/platforms/instagram/pack.yml +136 -0
- package/platforms/lemmy/guide.md +88 -0
- package/platforms/lemmy/pack.yml +141 -0
- package/platforms/linkedin/guide.md +93 -0
- package/platforms/linkedin/pack.yml +145 -0
- package/platforms/mastodon/guide.md +92 -0
- package/platforms/mastodon/pack.yml +138 -0
- package/platforms/medium/guide.md +92 -0
- package/platforms/medium/pack.yml +119 -0
- package/platforms/newsletter/guide.md +94 -0
- package/platforms/newsletter/pack.yml +144 -0
- package/platforms/producthunt/guide.md +92 -0
- package/platforms/producthunt/pack.yml +166 -0
- package/platforms/reddit/guide.md +92 -0
- package/platforms/reddit/pack.yml +151 -0
- package/platforms/snapshots/.gitkeep +0 -0
- package/platforms/snapshots/bluesky-10.sha256 +1 -0
- package/platforms/snapshots/bluesky-10.txt +1 -0
- package/platforms/snapshots/bluesky-11.sha256 +1 -0
- package/platforms/snapshots/bluesky-11.txt +1 -0
- package/platforms/snapshots/bluesky-12.sha256 +1 -0
- package/platforms/snapshots/bluesky-12.txt +1 -0
- package/platforms/snapshots/bluesky-13.sha256 +1 -0
- package/platforms/snapshots/bluesky-13.txt +1 -0
- package/platforms/snapshots/bluesky-14.sha256 +1 -0
- package/platforms/snapshots/bluesky-14.txt +1 -0
- package/platforms/snapshots/cross-platform-63.sha256 +1 -0
- package/platforms/snapshots/cross-platform-63.txt +1 -0
- package/platforms/snapshots/cross-platform-64.sha256 +1 -0
- package/platforms/snapshots/cross-platform-64.txt +1 -0
- package/platforms/snapshots/dailydev-55.sha256 +1 -0
- package/platforms/snapshots/dailydev-55.txt +1 -0
- package/platforms/snapshots/dailydev-56.sha256 +1 -0
- package/platforms/snapshots/dailydev-56.txt +1 -0
- package/platforms/snapshots/dailydev-57.sha256 +1 -0
- package/platforms/snapshots/dailydev-57.txt +1 -0
- package/platforms/snapshots/devto-26.sha256 +1 -0
- package/platforms/snapshots/devto-26.txt +1 -0
- package/platforms/snapshots/devto-27.sha256 +1 -0
- package/platforms/snapshots/devto-27.txt +1 -0
- package/platforms/snapshots/devto-28.sha256 +1 -0
- package/platforms/snapshots/devto-28.txt +1 -0
- package/platforms/snapshots/devto-29.sha256 +1 -0
- package/platforms/snapshots/devto-29.txt +1 -0
- package/platforms/snapshots/gist-52.sha256 +1 -0
- package/platforms/snapshots/gist-52.txt +1 -0
- package/platforms/snapshots/gist-53.sha256 +1 -0
- package/platforms/snapshots/gist-53.txt +1 -0
- package/platforms/snapshots/gist-54.sha256 +1 -0
- package/platforms/snapshots/gist-54.txt +1 -0
- package/platforms/snapshots/github-discussion-policy.sha256 +1 -0
- package/platforms/snapshots/github-discussion-policy.txt +1 -0
- package/platforms/snapshots/hashnode-30.sha256 +1 -0
- package/platforms/snapshots/hashnode-30.txt +1 -0
- package/platforms/snapshots/hashnode-31.sha256 +1 -0
- package/platforms/snapshots/hashnode-31.txt +1 -0
- package/platforms/snapshots/hashnode-32.sha256 +1 -0
- package/platforms/snapshots/hashnode-32.txt +1 -0
- package/platforms/snapshots/hn-23.sha256 +1 -0
- package/platforms/snapshots/hn-23.txt +1 -0
- package/platforms/snapshots/hn-24.sha256 +1 -0
- package/platforms/snapshots/hn-24.txt +1 -0
- package/platforms/snapshots/hn-25.sha256 +1 -0
- package/platforms/snapshots/hn-25.txt +1 -0
- package/platforms/snapshots/hyperframes-releases.sha256 +1 -0
- package/platforms/snapshots/hyperframes-releases.txt +1 -0
- package/platforms/snapshots/instagram-43.sha256 +1 -0
- package/platforms/snapshots/instagram-43.txt +1 -0
- package/platforms/snapshots/instagram-47.sha256 +1 -0
- package/platforms/snapshots/instagram-47.txt +1 -0
- package/platforms/snapshots/lemmy-policy.sha256 +1 -0
- package/platforms/snapshots/lemmy-policy.txt +1 -0
- package/platforms/snapshots/linkedin-1.sha256 +1 -0
- package/platforms/snapshots/linkedin-1.txt +1 -0
- package/platforms/snapshots/linkedin-2.sha256 +1 -0
- package/platforms/snapshots/linkedin-2.txt +1 -0
- package/platforms/snapshots/linkedin-3.sha256 +1 -0
- package/platforms/snapshots/linkedin-3.txt +1 -0
- package/platforms/snapshots/linkedin-4.sha256 +1 -0
- package/platforms/snapshots/linkedin-4.txt +1 -0
- package/platforms/snapshots/mastodon-15.sha256 +1 -0
- package/platforms/snapshots/mastodon-15.txt +1 -0
- package/platforms/snapshots/mastodon-16.sha256 +1 -0
- package/platforms/snapshots/mastodon-16.txt +1 -0
- package/platforms/snapshots/mastodon-17.sha256 +1 -0
- package/platforms/snapshots/mastodon-17.txt +1 -0
- package/platforms/snapshots/medium-34.sha256 +1 -0
- package/platforms/snapshots/medium-34.txt +1 -0
- package/platforms/snapshots/medium-35.sha256 +1 -0
- package/platforms/snapshots/medium-35.txt +1 -0
- package/platforms/snapshots/medium-36.sha256 +1 -0
- package/platforms/snapshots/medium-36.txt +1 -0
- package/platforms/snapshots/newsletter-58.sha256 +1 -0
- package/platforms/snapshots/newsletter-58.txt +1 -0
- package/platforms/snapshots/newsletter-59.sha256 +1 -0
- package/platforms/snapshots/newsletter-59.txt +1 -0
- package/platforms/snapshots/newsletter-60.sha256 +1 -0
- package/platforms/snapshots/newsletter-60.txt +1 -0
- package/platforms/snapshots/newsletter-61.sha256 +1 -0
- package/platforms/snapshots/newsletter-61.txt +1 -0
- package/platforms/snapshots/newsletter-62.sha256 +1 -0
- package/platforms/snapshots/newsletter-62.txt +1 -0
- package/platforms/snapshots/openai-image-pricing.sha256 +1 -0
- package/platforms/snapshots/openai-image-pricing.txt +1 -0
- package/platforms/snapshots/playwright-releases.sha256 +1 -0
- package/platforms/snapshots/playwright-releases.txt +1 -0
- package/platforms/snapshots/producthunt-37.sha256 +1 -0
- package/platforms/snapshots/producthunt-37.txt +1 -0
- package/platforms/snapshots/producthunt-38.sha256 +1 -0
- package/platforms/snapshots/producthunt-38.txt +1 -0
- package/platforms/snapshots/producthunt-39.sha256 +1 -0
- package/platforms/snapshots/producthunt-39.txt +1 -0
- package/platforms/snapshots/reddit-20.sha256 +1 -0
- package/platforms/snapshots/reddit-20.txt +1 -0
- package/platforms/snapshots/reddit-21.sha256 +1 -0
- package/platforms/snapshots/reddit-21.txt +1 -0
- package/platforms/snapshots/reddit-22.sha256 +1 -0
- package/platforms/snapshots/reddit-22.txt +1 -0
- package/platforms/snapshots/substack-policy.sha256 +1 -0
- package/platforms/snapshots/substack-policy.txt +1 -0
- package/platforms/snapshots/threads-18.sha256 +1 -0
- package/platforms/snapshots/threads-18.txt +1 -0
- package/platforms/snapshots/threads-19.sha256 +1 -0
- package/platforms/snapshots/threads-19.txt +1 -0
- package/platforms/snapshots/tiktok-50.sha256 +1 -0
- package/platforms/snapshots/tiktok-50.txt +1 -0
- package/platforms/snapshots/tiktok-51.sha256 +1 -0
- package/platforms/snapshots/tiktok-51.txt +1 -0
- package/platforms/snapshots/x-5.sha256 +1 -0
- package/platforms/snapshots/x-5.txt +1 -0
- package/platforms/snapshots/x-6.sha256 +1 -0
- package/platforms/snapshots/x-6.txt +1 -0
- package/platforms/snapshots/x-7.sha256 +1 -0
- package/platforms/snapshots/x-7.txt +1 -0
- package/platforms/snapshots/x-8.sha256 +1 -0
- package/platforms/snapshots/x-8.txt +1 -0
- package/platforms/snapshots/x-9.sha256 +1 -0
- package/platforms/snapshots/x-9.txt +1 -0
- package/platforms/snapshots/youtube-shorts-40.sha256 +1 -0
- package/platforms/snapshots/youtube-shorts-40.txt +1 -0
- package/platforms/snapshots/youtube-shorts-41.sha256 +1 -0
- package/platforms/snapshots/youtube-shorts-41.txt +1 -0
- package/platforms/snapshots/youtube-shorts-42.sha256 +1 -0
- package/platforms/snapshots/youtube-shorts-42.txt +1 -0
- package/platforms/sources.yml +947 -0
- package/platforms/substack/guide.md +94 -0
- package/platforms/substack/pack.yml +116 -0
- package/platforms/threads/guide.md +93 -0
- package/platforms/threads/pack.yml +148 -0
- package/platforms/tiktok/guide.md +92 -0
- package/platforms/tiktok/pack.yml +129 -0
- package/platforms/x/guide.md +94 -0
- package/platforms/x/pack.yml +130 -0
- package/platforms/youtube-shorts/guide.md +92 -0
- package/platforms/youtube-shorts/pack.yml +138 -0
- package/providers/prices.yml +31 -0
- package/schemas/campaign.v2.json +26 -0
- package/schemas/manifest.v1.json +37 -0
- package/schemas/pack.schema.json +601 -0
- package/schemas/review.schema.json +31 -0
- package/skills/studio-reviewer/SKILL.md +13 -0
- package/skills/studio-updater/SKILL.md +8 -0
- package/skills/studio-video/SKILL.md +20 -0
- package/skills/studio-visual/SKILL.md +12 -0
- package/skills/studio-writer/SKILL.md +14 -0
- package/templates/README.md +7 -0
- package/templates/card.html +1 -0
- package/templates/carousel-closing.html +1 -0
- package/templates/carousel-content.html +1 -0
- package/templates/carousel-title.html +1 -0
- package/templates/code.html +1 -0
- package/templates/fonts/IBM-Plex-OFL.txt +93 -0
- package/templates/fonts/IBMPlexMono.woff2 +0 -0
- package/templates/fonts/IBMPlexSans.woff2 +0 -0
- package/templates/fonts/Space-Grotesk-OFL.txt +93 -0
- package/templates/fonts/SpaceGrotesk.woff2 +0 -0
- package/templates/poster.html +1 -0
- package/templates/quote.html +1 -0
- package/templates/thumbnail.html +1 -0
- package/test/fixtures/reviews/calibration.json +22 -0
- package/test/fixtures/reviews/grounding/cases.json +17 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,139 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/banner.svg" alt="Blast Studio: create and review platform-ready content" width="100%">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://github.com/edwinjosechittilappilly/blast-studio/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/edwinjosechittilappilly/blast-studio/actions/workflows/ci.yml/badge.svg"></a>
|
|
7
|
+
<a href="https://edwinjosechittilappilly.github.io/blast-studio/"><img alt="Documentation" src="https://img.shields.io/badge/docs-online-7c5cff"></a>
|
|
8
|
+
<a href="LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-blue"></a>
|
|
9
|
+
<img alt="Works with omp, Claude Code and Codex" src="https://img.shields.io/badge/works%20with-omp%20%C2%B7%20Claude%20Code%20%C2%B7%20Codex-7c5cff">
|
|
10
|
+
<img alt="Node 22.18 or newer" src="https://img.shields.io/badge/node-%3E%3D22.18-43853d">
|
|
11
|
+
<a href="https://github.com/edwinjosechittilappilly/market-blaster"><img alt="Pairs with Market Blaster" src="https://img.shields.io/badge/pairs%20with-Market%20Blaster-ed7458"></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
# Blast Studio
|
|
15
|
+
|
|
16
|
+
Blast Studio turns an idea, notes, links, a commit, a PR or a Market Blaster brief into platform-specific content. It keeps the evidence, editable sources, renders and reviews together in a private studio. Export packages the reviewed campaign as one zip for [Market Blaster](https://github.com/edwinjosechittilappilly/market-blaster); publishing remains a separate step.
|
|
17
|
+
|
|
18
|
+
## Quickstart
|
|
19
|
+
|
|
20
|
+
Requires Node 22.18 or newer and a configured agent. Rendering and particular inputs may require additional tools; `doctor` reports their availability.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g blast-studio
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Alternatively, install from source:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
gh repo clone edwinjosechittilappilly/blast-studio
|
|
30
|
+
cd blast-studio
|
|
31
|
+
npm install
|
|
32
|
+
npm link
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Then initialize the studio:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
bstudio init
|
|
39
|
+
bstudio install-skills
|
|
40
|
+
bstudio doctor
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Edit `~/.config/blast-studio/studio.yml` for your brand, platforms and agent commands. The default studio root is `~/BlastStudio`, outside the repository. Paid generation is disabled until you set a budget.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
bstudio brief launch --idea "Explain the feature and who it helps"
|
|
47
|
+
# Add evidence and caveats to ~/BlastStudio/projects/launch/brief.md
|
|
48
|
+
bstudio plan launch
|
|
49
|
+
bstudio make launch
|
|
50
|
+
bstudio render launch
|
|
51
|
+
bstudio review launch
|
|
52
|
+
bstudio revise launch # if revisions are needed
|
|
53
|
+
bstudio export launch --mb /path/to/market-blaster-project
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The agent commands must be installed and configured before planning, making or reviewing. Inspect the content and review before exporting. See [getting started](docs/getting-started.md) for requirements and alternatives.
|
|
57
|
+
|
|
58
|
+
<p align="center"><img src="docs/assets/demo.svg" alt="A real Blast Studio run on a Market Blaster commit: brief, plan, make, render, review verdicts per platform, revise, and export of one campaign zip" width="100%"></p>
|
|
59
|
+
<p align="center"><sub>Output from a real run on <a href="https://github.com/edwinjosechittilappilly/market-blaster/commit/adbc177d3877f45c98912c17b5ba3ccf33287ccb">market-blaster@adbc177</a>, lines trimmed. Reddit stayed a human task: its outline needs the subreddit rules checked by a person.</sub></p>
|
|
60
|
+
|
|
61
|
+
## How it works
|
|
62
|
+
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
## What it makes
|
|
66
|
+
|
|
67
|
+
| Format | Source and output |
|
|
68
|
+
|---|---|
|
|
69
|
+
| Text and threads | Platform-specific posts and thread handoffs |
|
|
70
|
+
| Cards, posters and carousels | Editable HTML, rendered images and carousel PDF |
|
|
71
|
+
| Logos and diagrams | SVG logos; Mermaid or D2 diagram sources and rendered outputs |
|
|
72
|
+
| Short video and terminal demos | Aspect-specific HyperFrames compositions or VHS tapes; captions and video outputs |
|
|
73
|
+
| Illustrations and voiceover | Optional provider-generated assets subject to configuration, consent and budget |
|
|
74
|
+
|
|
75
|
+
Renderer and provider requirements vary. See [formats](docs/formats.md).
|
|
76
|
+
|
|
77
|
+
## How review works
|
|
78
|
+
|
|
79
|
+
| Step | Purpose |
|
|
80
|
+
|---|---|
|
|
81
|
+
| Gates | Check destination policy, disclosure, evidence, accessibility, format and rights before export. |
|
|
82
|
+
| Rubric | Rate applicable editorial criteria from 0 to 2, with evidence and a suggested fix; N/A does not count. |
|
|
83
|
+
| Revise | Apply findings, render again and re-review. |
|
|
84
|
+
| Accept | Record a human reason to override scores; a failed gate cannot be overridden. |
|
|
85
|
+
|
|
86
|
+
Scores are editorial judgments, not predictions of reach. See [review](docs/review.md).
|
|
87
|
+
|
|
88
|
+
## Where it goes
|
|
89
|
+
|
|
90
|
+
| Studio platform | Market Blaster destination / handoff |
|
|
91
|
+
|---|---|
|
|
92
|
+
| DEV, Hashnode, LinkedIn, X, Bluesky, Mastodon, Threads | Corresponding destination; media support and handoffs vary. |
|
|
93
|
+
| GitHub Discussion, Gist | Corresponding destination. |
|
|
94
|
+
| Hacker News | Excluded from generated plans; a human-authored candidate is required. |
|
|
95
|
+
| Reddit, Product Hunt, Lemmy, newsletter | Corresponding destination; outline or manual workflow. |
|
|
96
|
+
| Medium, Substack | Corresponding manual handoff. |
|
|
97
|
+
| YouTube Shorts, Instagram, TikTok, daily.dev | Manual export; record the published URL with `bstudio mark`. |
|
|
98
|
+
|
|
99
|
+
Platform rules change. Check the [platform packs and guides](docs/platforms.md) and the destination's current policies before posting.
|
|
100
|
+
|
|
101
|
+
## How it compares
|
|
102
|
+
|
|
103
|
+
The [research survey](docs/research/existing-skills.md) describes different tools for parts of this workflow. A dash means not documented in that survey; it does not assert that a product lacks a feature. ✅ supported · ◐ partial or different scope · — not documented.
|
|
104
|
+
|
|
105
|
+
| | Blast Studio | [Typefully](https://typefully.com/) | [Marketing Skills](https://github.com/coreyhaines31/marketingskills) | [HyperFrames](https://github.com/heygen-com/hyperframes) |
|
|
106
|
+
|---|:-:|:-:|:-:|:-:|
|
|
107
|
+
| Evidence from ideas and code changes | ✅ | — | — | — |
|
|
108
|
+
| Platform-specific writing | ✅ | ✅ | ◐ workflows | — |
|
|
109
|
+
| HTML video rendering | ✅ via HyperFrames | — | — | ✅ |
|
|
110
|
+
| Platform policy and editorial review | ✅ | — | — | — |
|
|
111
|
+
| Publishing and scheduling | ◐ export to Market Blaster | ✅ | — | — |
|
|
112
|
+
|
|
113
|
+
## Safety and honesty
|
|
114
|
+
|
|
115
|
+
- Review checks are aids, not proof of factual accuracy, policy compliance or future reach. Check claims and current destination rules yourself.
|
|
116
|
+
- Disclosure requirements still apply to AI-generated text and media. Anti-slop review improves clarity; it is not an authorship detector.
|
|
117
|
+
- Blast Studio does not automate websites or publish posts. Market Blaster handles its own API and manual handoffs.
|
|
118
|
+
- The agent runs as your user. Its workspace and filtered environment are not an operating-system security sandbox.
|
|
119
|
+
- Paid generation defaults to a zero cap; external reference uploads require explicit consent.
|
|
120
|
+
- Local storage does not make model calls private: configured agents may send brief and project content to their model providers. Export archives include the full brief and evidence; inspect them before sharing.
|
|
121
|
+
|
|
122
|
+
## Documentation
|
|
123
|
+
|
|
124
|
+
Start with [getting started](docs/getting-started.md), then read the [workflow](docs/workflow.md), [formats](docs/formats.md), [review](docs/review.md), [platforms](docs/platforms.md), [budget](docs/budget.md), [configuration](docs/configuration.md) and [command reference](docs/commands.md). The [updater](docs/updater.md), [dashboard](docs/dashboard.md) and [architecture](docs/architecture.md) pages cover operations and design. The full site is at [Blast Studio docs](https://edwinjosechittilappilly.github.io/blast-studio/).
|
|
125
|
+
|
|
126
|
+
## Development
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
npm install
|
|
130
|
+
npm test
|
|
131
|
+
npm run typecheck
|
|
132
|
+
make docs-serve
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The Market Blaster import integration test uses a checkout at `../market-blaster` by default. Set `MARKET_BLASTER_DIR` to use another checkout, and run `npm ci` there first. The test skips when the checkout is absent. CI runs it when the `MB_CHECKOUT_TOKEN` repository secret provides access to the Market Blaster repository.
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
[Apache-2.0](LICENSE).
|
package/bin/bstudio.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
|
|
4
|
+
// npm packages need compiled JavaScript; source checkouts can run TypeScript directly.
|
|
5
|
+
const entry = new URL("../dist/cli.js", import.meta.url);
|
|
6
|
+
const { main } = await import(existsSync(entry) ? entry.href : new URL("../src/cli.ts", import.meta.url).href);
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
process.exitCode = await main(process.argv.slice(2));
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error(error instanceof Error ? error.message : error);
|
|
12
|
+
process.exitCode = 1;
|
|
13
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { existsSync, readdirSync, readlinkSync, realpathSync, statSync } from 'node:fs';
|
|
3
|
+
import { delimiter, dirname, join, resolve } from 'node:path';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { UserError } from "./types.js";
|
|
7
|
+
import { parseAgentOutput, recordAgentRun, reserveAgentRun, settleAgentRun } from "./budget/ledger.js";
|
|
8
|
+
const protectedEnv = new Set(['DEV_API_KEY', 'HASHNODE_TOKEN', 'GITHUB_TOKEN', 'GH_TOKEN', 'BLUESKY_IDENTIFIER', 'BLUESKY_APP_PASSWORD', 'BLUESKY_HOST', 'MASTODON_TOKEN', 'MASTODON_HOST', 'LINKEDIN_ACCESS_TOKEN', 'LINKEDIN_CLIENT_ID', 'LINKEDIN_CLIENT_SECRET', 'LINKEDIN_TOKEN_ISSUED', 'X_API_KEY', 'X_API_SECRET', 'X_ACCESS_TOKEN', 'X_ACCESS_SECRET', 'NOSTR_PRIVATE_KEY']);
|
|
9
|
+
const providerKeys = new Set(['GEMINI_API_KEY', 'OPENAI_API_KEY']);
|
|
10
|
+
/** Build a subprocess environment without inheriting arbitrary credentials. */
|
|
11
|
+
export function agentEnv(io, options) {
|
|
12
|
+
const env = { PATH: io.env.PATH ?? '/usr/bin:/bin', HOME: options.home ?? io.env.HOME ?? options.temp, TMPDIR: options.temp };
|
|
13
|
+
if (options.bin)
|
|
14
|
+
env.PATH = `${options.bin}${process.platform === 'win32' ? ';' : ':'}${env.PATH}`;
|
|
15
|
+
for (const [key, value] of Object.entries(io.env)) {
|
|
16
|
+
if ((['USER', 'LANG', 'LC_ALL', 'TERM', 'SYSTEMROOT'].includes(key) || (!options.minimal && key.startsWith('XDG_'))) && value !== undefined)
|
|
17
|
+
env[key] = value;
|
|
18
|
+
}
|
|
19
|
+
const passed = [];
|
|
20
|
+
for (const key of new Set(options.passEnv ?? [])) {
|
|
21
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key) || ['PATH', 'HOME', 'TMPDIR'].includes(key.toUpperCase()) || protectedEnv.has(key.toUpperCase()) || (providerKeys.has(key.toUpperCase()) && options.billing !== 'api'))
|
|
22
|
+
throw new UserError(`Disallowed agent environment variable: ${key}`);
|
|
23
|
+
if (io.env[key] !== undefined) {
|
|
24
|
+
env[key] = io.env[key];
|
|
25
|
+
passed.push(key);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (passed.length)
|
|
29
|
+
io.err(`Warning: explicitly passing environment variables to agent: ${passed.join(', ')}`);
|
|
30
|
+
return env;
|
|
31
|
+
}
|
|
32
|
+
let warnedSandbox = false;
|
|
33
|
+
let bwrapProbe;
|
|
34
|
+
/** Wrap subprocesses in the OS sandbox where available. */
|
|
35
|
+
export function sandboxCommand(io, config, workspace, temp, command, args, options = {}) {
|
|
36
|
+
if (config.agent.sandbox !== 'on')
|
|
37
|
+
return { command, args };
|
|
38
|
+
const home = io.env.HOME;
|
|
39
|
+
const canonical = (path) => { try {
|
|
40
|
+
return realpathSync(path);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return resolve(path);
|
|
44
|
+
} };
|
|
45
|
+
const writable = [workspace, temp].map(canonical);
|
|
46
|
+
const readable = home && !options.render ? ['.omp', '.claude', '.codex', '.local/bin', '.local/share', '.nvm', '.npm-global', '.config/omp'].map(p => canonical(join(home, p))) : home ? ['.local/bin', '.local/share', '.nvm', '.npm-global', 'Library/Caches/ms-playwright'].map(p => canonical(join(home, p))) : [];
|
|
47
|
+
readable.push(...(options.readDirs ?? []).map(canonical));
|
|
48
|
+
if (options.render)
|
|
49
|
+
readable.push(canonical(fileURLToPath(new URL('..', import.meta.url))));
|
|
50
|
+
const packageMetadata = [];
|
|
51
|
+
if (options.render) {
|
|
52
|
+
let dir = canonical(fileURLToPath(new URL('..', import.meta.url)));
|
|
53
|
+
while (dir !== dirname(dir)) {
|
|
54
|
+
packageMetadata.push(join(dir, 'package.json'));
|
|
55
|
+
dir = dirname(dir);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const readPaths = (options.readPaths ?? []).map(canonical);
|
|
59
|
+
const toolWrites = (options.writeDirs ?? []).map(canonical);
|
|
60
|
+
const stateDirs = home && !options.render ? [canonical(join(home, '.omp/agent/sessions'))] : [];
|
|
61
|
+
const stateFiles = home && !options.render ? ['agent.db', 'agent.db-wal', 'agent.db-shm', 'history.db', 'history.db-wal', 'history.db-shm', 'models.db', 'models.db-wal', 'models.db-shm', 'skill-descriptions.db', 'skill-descriptions.db-wal', 'skill-descriptions.db-shm'].map(p => canonical(join(home, '.omp/agent', p))) : [];
|
|
62
|
+
if (process.platform === 'darwin') {
|
|
63
|
+
const profile = ['(version 1)', '(allow default)', '(deny file-write*)',
|
|
64
|
+
...(options.render ? [tmpdir(), '/tmp'].map(p => `(allow file-write* (regex #${JSON.stringify(`^${canonical(p).replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}/[.]?com[.]google[.](Chrome|chrome[.]for[.]testing)[.]`)}))`) : []),
|
|
65
|
+
'(allow file-write* (literal "/dev/null") (literal "/dev/tty") (regex #"^/dev/fd/"))',
|
|
66
|
+
...(options.pty ? ['(allow file-write* (literal "/dev/ptmx") (regex #"^/dev/ttys[0-9]+$"))'] : []),
|
|
67
|
+
...(home ? [`(deny file-read* (subpath ${JSON.stringify(canonical(home))}))`] : []),
|
|
68
|
+
...(home ? [`(allow file-read-metadata (subpath ${JSON.stringify(canonical(home))}))`] : []),
|
|
69
|
+
...packageMetadata.map(p => `(allow file-read* (literal ${JSON.stringify(p)}))`),
|
|
70
|
+
...readable.map(p => `(allow file-read* (subpath ${JSON.stringify(p)}))`),
|
|
71
|
+
...stateDirs.map(p => `(allow file-write* (subpath ${JSON.stringify(p)}))`),
|
|
72
|
+
...stateFiles.map(p => `(allow file-write* (literal ${JSON.stringify(p)}))`),
|
|
73
|
+
...toolWrites.map(p => `(allow file-write* (subpath ${JSON.stringify(p)}))`),
|
|
74
|
+
...[config.root, config.file].map(p => `(deny file-read* file-write* (subpath ${JSON.stringify(canonical(p))}))`),
|
|
75
|
+
...readPaths.map(p => `(allow file-read* (literal ${JSON.stringify(p)}))`),
|
|
76
|
+
...writable.map(p => `(allow file-read* file-write* (subpath ${JSON.stringify(p)}))`),
|
|
77
|
+
...(options.render ? ['(deny network*)', '(allow network* (local unix-socket))', ...(options.loopback ? ['(allow network-bind (local ip "localhost:*"))', '(allow network-inbound (local ip "localhost:*"))', '(allow network-outbound (remote ip "localhost:*"))'] : [])] : [])].join('\n');
|
|
78
|
+
return { command: '/usr/bin/sandbox-exec', args: ['-p', profile, command, ...args] };
|
|
79
|
+
}
|
|
80
|
+
if (process.platform === 'linux') {
|
|
81
|
+
const bwrap = (io.env.PATH ?? '/usr/bin:/bin').split(delimiter).map(p => join(p, 'bwrap')).find(existsSync);
|
|
82
|
+
if (bwrap && (!bwrapProbe || bwrapProbe.path !== bwrap))
|
|
83
|
+
bwrapProbe = { path: bwrap, available: spawnSync(bwrap, ['--ro-bind', '/', '/', '--', '/bin/true'], { stdio: 'ignore' }).status === 0 };
|
|
84
|
+
// Bubblewrap brings up loopback in the isolated network namespace for local renderer servers.
|
|
85
|
+
if (bwrap && bwrapProbe?.available) {
|
|
86
|
+
const mounts = ['--unshare-pid', '--die-with-parent', ...(options.render ? ['--unshare-net'] : [])];
|
|
87
|
+
if (options.privateCache) {
|
|
88
|
+
// A synthetic root keeps the cache's ancestors owned by this namespace's user.
|
|
89
|
+
// Host-root files otherwise appear as an unmapped UID to HyperFrames.
|
|
90
|
+
for (const entry of readdirSync('/', { withFileTypes: true })) {
|
|
91
|
+
if (entry.name === 'dev' || entry.name === 'proc' || `/${entry.name}` === options.privateCache.target)
|
|
92
|
+
continue;
|
|
93
|
+
const path = join('/', entry.name);
|
|
94
|
+
if (entry.isSymbolicLink())
|
|
95
|
+
mounts.push('--symlink', readlinkSync(path), path);
|
|
96
|
+
else
|
|
97
|
+
mounts.push('--ro-bind', path, path);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else
|
|
101
|
+
mounts.push('--ro-bind', '/', '/');
|
|
102
|
+
mounts.push('--dev', '/dev', '--proc', '/proc');
|
|
103
|
+
if (home && existsSync(home))
|
|
104
|
+
mounts.push('--tmpfs', canonical(home));
|
|
105
|
+
const bind = (path, write) => {
|
|
106
|
+
if (!existsSync(path))
|
|
107
|
+
return;
|
|
108
|
+
if (home && path.startsWith(canonical(home) + '/')) {
|
|
109
|
+
const parents = [];
|
|
110
|
+
let dir = dirname(path);
|
|
111
|
+
while (dir !== canonical(home) && dir.startsWith(canonical(home) + '/')) {
|
|
112
|
+
parents.unshift(dir);
|
|
113
|
+
dir = dirname(dir);
|
|
114
|
+
}
|
|
115
|
+
for (const parent of parents)
|
|
116
|
+
mounts.push('--dir', parent);
|
|
117
|
+
}
|
|
118
|
+
mounts.push(write ? '--bind' : '--ro-bind', path, path);
|
|
119
|
+
};
|
|
120
|
+
for (const path of readable)
|
|
121
|
+
bind(path, false);
|
|
122
|
+
for (const path of [...stateDirs, ...stateFiles])
|
|
123
|
+
bind(path, true);
|
|
124
|
+
for (const path of toolWrites)
|
|
125
|
+
bind(path, true);
|
|
126
|
+
for (const path of [config.root, config.file].map(canonical))
|
|
127
|
+
if (existsSync(path))
|
|
128
|
+
mounts.push(...(statSync(path).isDirectory() ? ['--tmpfs', path] : ['--ro-bind', '/dev/null', path]));
|
|
129
|
+
for (const path of readPaths)
|
|
130
|
+
bind(path, false);
|
|
131
|
+
for (const path of writable)
|
|
132
|
+
bind(path, true);
|
|
133
|
+
if (options.privateCache) {
|
|
134
|
+
const source = canonical(options.privateCache.source), root = canonical(config.root);
|
|
135
|
+
if (source !== root && !source.startsWith(root.endsWith('/') ? root : `${root}/`)) {
|
|
136
|
+
mounts.push('--ro-bind', source, options.privateCache.target);
|
|
137
|
+
const locks = join(source, 'locks');
|
|
138
|
+
if (existsSync(locks))
|
|
139
|
+
mounts.push('--bind', locks, join(options.privateCache.target, 'locks'));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return { command: bwrap, args: [...mounts, '--', command, ...args] };
|
|
143
|
+
}
|
|
144
|
+
if (!warnedSandbox) {
|
|
145
|
+
io.err('Warning: bwrap is unavailable or unusable; process is running without an OS sandbox.');
|
|
146
|
+
warnedSandbox = true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return { command, args };
|
|
150
|
+
}
|
|
151
|
+
/** Reserve before API-billed calls and settle even when a subprocess fails. */
|
|
152
|
+
export async function runBilledAgent(io, config, settings, projectSlug, command, prompt, cwd, temp, env, timeoutMs) {
|
|
153
|
+
const model = command.join(' ');
|
|
154
|
+
const maxUsd = settings.maxUsdPerRun;
|
|
155
|
+
if (settings.billing === 'api' && (!(maxUsd && maxUsd > 0) || !Number.isFinite(maxUsd)))
|
|
156
|
+
throw new UserError('API-billed agent requires a positive maxUsdPerRun');
|
|
157
|
+
const id = settings.billing === 'api' ? await reserveAgentRun(config, { command: model, projectSlug, maxUsd: maxUsd }) : undefined;
|
|
158
|
+
const started = Date.now();
|
|
159
|
+
let report = '';
|
|
160
|
+
try {
|
|
161
|
+
// Agent CLIs parse a positional argument starting with "-" as a flag (a SKILL.md begins with "---"), so the
|
|
162
|
+
// prompt always starts with a plain word.
|
|
163
|
+
const safePrompt = /^\s*-/.test(prompt) ? `Task:\n${prompt}` : prompt;
|
|
164
|
+
const wrapped = sandboxCommand(io, config, cwd, temp, command[0], [...command.slice(1), safePrompt]);
|
|
165
|
+
report = await io.run(wrapped.command, wrapped.args, { cwd, env, timeoutMs });
|
|
166
|
+
return report;
|
|
167
|
+
}
|
|
168
|
+
finally {
|
|
169
|
+
if (id) {
|
|
170
|
+
const parsed = parseAgentOutput(report);
|
|
171
|
+
const usd = parsed.usd ?? maxUsd, usage = parsed.usage;
|
|
172
|
+
await settleAgentRun(config, id, { usd, usage });
|
|
173
|
+
}
|
|
174
|
+
else
|
|
175
|
+
await recordAgentRun(config, { model, ms: Date.now() - started, usd: null, projectSlug });
|
|
176
|
+
}
|
|
177
|
+
}
|
package/dist/brief.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
/** Parse evidence headings without treating headings inside Markdown fences as sections. */
|
|
4
|
+
export function parseBrief(text) {
|
|
5
|
+
const sections = [];
|
|
6
|
+
let current;
|
|
7
|
+
let lines = [];
|
|
8
|
+
let fence;
|
|
9
|
+
const finish = () => {
|
|
10
|
+
if (!current)
|
|
11
|
+
return;
|
|
12
|
+
const body = lines.join("\n").trim();
|
|
13
|
+
const match = body.match(/^status:\s*(shipped|planned|claim)\s*(?:\n|$)/i);
|
|
14
|
+
if (match)
|
|
15
|
+
current.status = match[1].toLowerCase();
|
|
16
|
+
current.body = match ? body.slice(match[0].length).trim() : body;
|
|
17
|
+
sections.push(current);
|
|
18
|
+
};
|
|
19
|
+
for (const line of text.split(/\r?\n/)) {
|
|
20
|
+
const marker = line.match(/^ {0,3}(`{3,}|~{3,})/);
|
|
21
|
+
if (marker) {
|
|
22
|
+
if (!fence)
|
|
23
|
+
fence = { char: marker[1][0], length: marker[1].length };
|
|
24
|
+
else if (marker[1][0] === fence.char && marker[1].length >= fence.length && /^\s*$/.test(line.slice(marker[0].length)))
|
|
25
|
+
fence = undefined;
|
|
26
|
+
if (current)
|
|
27
|
+
lines.push(line);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (!fence) {
|
|
31
|
+
const heading = line.match(/^##\s+\[(E\d+)\]\s+(.+?)\s*$/);
|
|
32
|
+
if (heading) {
|
|
33
|
+
finish();
|
|
34
|
+
current = { anchor: heading[1], title: heading[2], body: "" };
|
|
35
|
+
lines = [];
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (/^##\s+/.test(line)) {
|
|
39
|
+
finish();
|
|
40
|
+
current = undefined;
|
|
41
|
+
lines = [];
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (current)
|
|
46
|
+
lines.push(line);
|
|
47
|
+
}
|
|
48
|
+
finish();
|
|
49
|
+
return sections;
|
|
50
|
+
}
|
|
51
|
+
export function readBrief(projectDir) {
|
|
52
|
+
return parseBrief(readFileSync(join(projectDir, "brief.md"), "utf8"));
|
|
53
|
+
}
|