sera-code 0.1.0 → 0.1.2
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/NOTICE-SERA.md +8 -0
- package/bin/sera.mjs +15 -7
- package/dist/bundle/chunks/{chunk-GUGC72EB.js → chunk-AZC5WTED.js} +5 -5
- package/dist/bundle/chunks/{chunk-6JXVX6Q2.js → chunk-LOMPDCMP.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-I5QRIHN6.js → virtual-modules-Z2V3PTLI.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/lib/auth.js +188 -1
- package/lib/provider.js +26 -7
- package/package.json +1 -1
- package/sera-core/src/extension.ts +2 -8
- package/sera-core/src/fs-tools.ts +6 -2
- package/sera-core/src/image-tool.ts +2 -2
- package/sera-core/src/limit-command.ts +2 -2
- package/sera-core/src/model-list.ts +108 -0
- package/sera-core/src/ofis.ts +1 -1
- package/sera-core/src/sandbox.ts +33 -2
- package/sera-core/src/teslim.ts +2 -1
- package/sera-core/src/video-tool.ts +1 -1
package/sera-core/src/sandbox.ts
CHANGED
|
@@ -69,6 +69,25 @@ export function defaultDenyRead(home: string = homedir()): string[] {
|
|
|
69
69
|
];
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Sera'nın KENDİ ve paket araçlarının kimlik DOSYALARI (tek tek dosya — klasör değil). Windows'ta runtime'ın yerleşik dışlaması
|
|
74
|
+
* bunları BİLMİYOR: 2026-11-16 gerçek denemede (srt-win, bu PC) sandbox içinden ~/.local/share/sera-code/auth.json (Sera oturum
|
|
75
|
+
* anahtarı), ~/.npmrc ve ~/.pi/agent/auth.json OKUNABİLDİ; .ssh/.aws/gh/Chrome engelliydi. Tek dosya denyRead profil ağacı
|
|
76
|
+
* ACL yürüyüşü doğurmaz (yalnız o dosya). Var olmayanlar SandboxRunner'da ayıklanır.
|
|
77
|
+
*/
|
|
78
|
+
export function credentialFiles(home: string = homedir()): string[] {
|
|
79
|
+
const j = (...p: string[]) => join(home, ...p);
|
|
80
|
+
return [
|
|
81
|
+
j(".local", "share", "sera-code", "auth.json"),
|
|
82
|
+
j(".pi", "agent", "auth.json"),
|
|
83
|
+
j(".pi", "agent", "models.json"),
|
|
84
|
+
j(".npmrc"),
|
|
85
|
+
j(".pypirc"),
|
|
86
|
+
j(".netrc"),
|
|
87
|
+
j(".git-credentials"),
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
|
|
72
91
|
/** Sandbox açıkken bile asla yazılmaması gereken gizli yollar (allowWrite cwd'yi açsa bile bunlar engellenir). */
|
|
73
92
|
export const DEFAULT_DENY_WRITE: readonly string[] = [
|
|
74
93
|
".env",
|
|
@@ -171,7 +190,13 @@ export function buildRuntimeConfig(
|
|
|
171
190
|
): SandboxRuntimeConfig {
|
|
172
191
|
// Windows: sandbox-runtime kimlik bilgisi depolarını (.ssh .aws .gnupg ... ) KENDİ yerleşik dışlamasıyla korur; ayrıca
|
|
173
192
|
// denyRead vermek profil ağacında çok pahalı/takılan ACL yürüyüşü doğurur (ölçüldü). Yalnız kullanıcının kendi eki geçer.
|
|
174
|
-
|
|
193
|
+
// Linux/macOS: Sera'nın kendi kimlik dosyaları da eklenir. Windows'ta TEK DOSYA bile denyRead sandbox başlatmasını
|
|
194
|
+
// 60 sn+ sürdürüp sandbox'ı KAPATTI (2026-11-16 ölçüm, 2 deneme) → Windows'ta verilmez; oradaki Sera sırları dosyada değil
|
|
195
|
+
// Windows Kimlik Kasası'ndadır (core/util/sera-secret.ts), auth.json yalnız işaret tutar.
|
|
196
|
+
const baseRead =
|
|
197
|
+
(opts.platform ?? process.platform) === "win32"
|
|
198
|
+
? []
|
|
199
|
+
: [...defaultDenyRead(opts.home), ...credentialFiles(opts.home)];
|
|
175
200
|
return {
|
|
176
201
|
filesystem: {
|
|
177
202
|
allowWrite: uniq([
|
|
@@ -280,6 +305,8 @@ export interface RunnerOptions {
|
|
|
280
305
|
exists?: (p: string) => boolean;
|
|
281
306
|
/** initialize() zaman aşımı (ms; vars. 60000). Aşılırsa sandbox yok sayılır + Türkçe neden (donma önleme). */
|
|
282
307
|
initTimeoutMs?: number;
|
|
308
|
+
/** Ev klasörü (vars. os.homedir(); testler için). */
|
|
309
|
+
home?: string;
|
|
283
310
|
/** Sandbox'a geçirilecek işaret ortamı kaynağı (vars. process.env; testler için). */
|
|
284
311
|
env?: Record<string, string | undefined>;
|
|
285
312
|
}
|
|
@@ -322,8 +349,12 @@ export class SandboxRunner {
|
|
|
322
349
|
this.platform = opts.platform ?? process.platform;
|
|
323
350
|
this.loader = opts.loader ?? defaultLoader;
|
|
324
351
|
this.exists = opts.exists ?? ((p) => existsSync(p));
|
|
325
|
-
const rt = buildRuntimeConfig(opts.cwd, cfg, { platform: this.platform });
|
|
352
|
+
const rt = buildRuntimeConfig(opts.cwd, cfg, { platform: this.platform, home: opts.home });
|
|
326
353
|
rt.filesystem.denyWrite = existingDenyWrite(opts.cwd, rt.filesystem.denyWrite, this.exists);
|
|
354
|
+
// Var olmayan kimlik DOSYASI verilmez (runtime yok yola "taş" yaratabiliyor — denyWrite ile aynı neden). Yalnız
|
|
355
|
+
// credentialFiles süzülür; gizli KLASÖRLER (.ssh .aws ...) eskisi gibi her zaman verilir (davranış değişmez).
|
|
356
|
+
const credSet = new Set(credentialFiles(opts.home));
|
|
357
|
+
rt.filesystem.denyRead = rt.filesystem.denyRead.filter((p) => !credSet.has(p) || this.exists(p));
|
|
327
358
|
this.rt = rt;
|
|
328
359
|
this.bash = opts.bashPath;
|
|
329
360
|
this.initTimeoutMs = opts.initTimeoutMs ?? 60_000;
|
package/sera-core/src/teslim.ts
CHANGED
|
@@ -25,7 +25,8 @@ const NOUN = new RegExp(
|
|
|
25
25
|
"iu",
|
|
26
26
|
);
|
|
27
27
|
/** Saf aciklama sorusu: sozlesmeyi YUKLEME. Proje fiili+ismi yoksa zaten yuklenmez. */
|
|
28
|
-
const QUESTION_ONLY =
|
|
28
|
+
const QUESTION_ONLY =
|
|
29
|
+
/^\s*(nedir|ne demek|nas[ıi]l [cç]al[ıi][sş][ıi]r|what is|how does|explain|a[cç][ıi]kla)(?![\p{L}])/iu;
|
|
29
30
|
|
|
30
31
|
/** Niyet: ilk 1500 karakterde bir "yap/yaz/olustur/build..." fiili VE bir proje ismi (program/uygulama/panel/site...). */
|
|
31
32
|
export function isProjectRequest(text: string): boolean {
|
|
@@ -130,7 +130,7 @@ export function registerVideoTool(pi: ExtensionAPI, opts: VideoToolOpts = {}): v
|
|
|
130
130
|
exposure: rareExposure(),
|
|
131
131
|
label: "Video",
|
|
132
132
|
description:
|
|
133
|
-
"Sera video studyosunda yapay zeka ile video uretir (web'deki studyo ile ayni).
|
|
133
|
+
"Sera video studyosunda yapay zeka ile video uretir (web'deki studyo ile ayni). `sera login` gerekir; hak sunucuda uyelige gore belirlenir (dolunca sunucu yenilenme zamanini soyler, /limit). Uretim birkac dakika surer; bitince video baglantisini dondurur.",
|
|
134
134
|
promptSnippet: "Metinden (ve istege bagli gorsellerden) Sera video studyosunda video uret, video URL'sini al",
|
|
135
135
|
parameters: Type.Object({
|
|
136
136
|
prompt: Type.String({ description: "Nasil bir video istendigi (8-3000 karakter)" }),
|