@alpic-ai/sdk 0.0.0-dev.gfa6fd7c → 0.0.0-dev.gfdd78d0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alpic-ai/sdk",
3
- "version": "0.0.0-dev.gfa6fd7c",
3
+ "version": "0.0.0-dev.gfdd78d0",
4
4
  "description": "Programmatic SDK for Alpic (auth, API, tunnel)",
5
5
  "homepage": "https://alpic.ai",
6
6
  "repository": {
@@ -33,9 +33,8 @@
33
33
  "env-paths": "^4.0.0",
34
34
  "open": "^11.0.0",
35
35
  "openid-client": "^6.8.4",
36
- "tar": "^7.5.19",
37
36
  "zod": "^4.4.3",
38
- "@alpic-ai/api": "0.0.0-dev.gfa6fd7c"
37
+ "@alpic-ai/api": "0.0.0-dev.gfdd78d0"
39
38
  },
40
39
  "devDependencies": {
41
40
  "@total-typescript/tsconfig": "^1.0.4",
@@ -1,8 +0,0 @@
1
- export declare function isExcluded(file: string): boolean;
2
- export declare function ensureGitAvailable(): void;
3
- export declare function getGitFiles(): string[];
4
- export declare function getFilesToPack(): string[];
5
- export declare function createTarArchive(files: string[]): Promise<{
6
- tmpDir: string;
7
- archivePath: string;
8
- }>;
@@ -1,61 +0,0 @@
1
- import { execSync } from "node:child_process";
2
- import { existsSync, mkdtempSync, rmSync } from "node:fs";
3
- import { tmpdir } from "node:os";
4
- import { join } from "node:path";
5
- import { create as tarCreate } from "tar";
6
- const GIT_FILES_MAX_BUFFER = 10 * 1024 * 1024;
7
- const EXCLUDED_DIRS = new Set(["node_modules", ".venv", "venv", "__pycache__", ".git", "dist"]);
8
- export function isExcluded(file) {
9
- return file.split("/").some((segment) => EXCLUDED_DIRS.has(segment));
10
- }
11
- function isGitRepository() {
12
- return existsSync(join(process.cwd(), ".git"));
13
- }
14
- export function ensureGitAvailable() {
15
- try {
16
- execSync("git --version", { stdio: "ignore" });
17
- }
18
- catch {
19
- throw new Error("Git is required to deploy. Please install git and ensure it is available in your PATH.");
20
- }
21
- }
22
- export function getGitFiles() {
23
- const output = execSync("git ls-files -z --cached --others --exclude-standard -- .", {
24
- encoding: "utf8",
25
- maxBuffer: GIT_FILES_MAX_BUFFER,
26
- });
27
- const files = output
28
- .split("\0")
29
- .filter(Boolean)
30
- .filter((file) => !isExcluded(file));
31
- if (files.length === 0) {
32
- throw new Error("No tracked or untracked files found. Ensure you are in a git repository with files to deploy.");
33
- }
34
- return files;
35
- }
36
- export function getFilesToPack() {
37
- if (isGitRepository()) {
38
- return getGitFiles();
39
- }
40
- ensureGitAvailable();
41
- execSync("git init", { stdio: "ignore" });
42
- try {
43
- return getGitFiles();
44
- }
45
- finally {
46
- rmSync(join(process.cwd(), ".git"), { recursive: true, force: true });
47
- }
48
- }
49
- export async function createTarArchive(files) {
50
- const tmpDir = mkdtempSync(join(tmpdir(), "alpic-deploy-"));
51
- const archivePath = join(tmpDir, "source.tar.gz");
52
- try {
53
- await tarCreate({ gzip: true, file: archivePath }, files);
54
- }
55
- catch (error) {
56
- rmSync(tmpDir, { recursive: true, force: true });
57
- throw error;
58
- }
59
- return { tmpDir, archivePath };
60
- }
61
- //# sourceMappingURL=archive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"archive.js","sourceRoot":"","sources":["../../src/deploy/archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,KAAK,CAAC;AAE1C,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C,MAAM,aAAa,GAAG,I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,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC1C,IAAI,CAAC;QACH,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACxE,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAAe;IACpD,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC;IAC5D,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAClD,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,MAAM,KAAK,CAAC;IACd,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACjC,CAAC"}
@@ -1,43 +0,0 @@
1
- import type { RouterOutput } from "@alpic-ai/api";
2
- import type { AlpicApi } from "../api/client.js";
3
- export type Deployment = RouterOutput["deployments"]["get"]["v1"];
4
- export type DeploymentStatus = Deployment["status"];
5
- export type DeployOptions = {
6
- environmentId: string;
7
- teamId: string;
8
- onProgress?: (event: DeployEvent) => void;
9
- };
10
- export type DeployResult = {
11
- deploymentId: string;
12
- status: DeploymentStatus;
13
- mcpServerUrl: string;
14
- domains: string[];
15
- deploymentPageUrl: string | null;
16
- elapsedMs: number;
17
- };
18
- export type DeployEvent = {
19
- type: "collecting";
20
- } | {
21
- type: "collected";
22
- fileCount: number;
23
- } | {
24
- type: "uploading";
25
- } | {
26
- type: "triggering";
27
- } | {
28
- type: "deploying";
29
- status: DeploymentStatus;
30
- elapsedMs: number;
31
- deploymentPageUrl: string | null;
32
- };
33
- export type DeploymentsDeps = {
34
- api: AlpicApi;
35
- };
36
- export declare class Deployments {
37
- private readonly api;
38
- constructor(deps: DeploymentsDeps);
39
- getLatestForEnvironment(environmentId: string): Promise<Deployment>;
40
- watch(deploymentId: string): Promise<Deployment>;
41
- private pollUntilFinal;
42
- deploy({ environmentId, teamId, onProgress }: DeployOptions): Promise<DeployResult>;
43
- }
@@ -1,89 +0,0 @@
1
- import { readFileSync, rmSync } from "node:fs";
2
- import { createTarArchive, getFilesToPack } from "./archive.js";
3
- import { pollIntervalMs, sleep } from "./poll.js";
4
- import { uploadToPresignedUrl } from "./upload.js";
5
- const FINAL_STATUSES = new Set(["deployed", "failed", "canceled"]);
6
- const TIMEOUT_MS = 15 * 60 * 1000;
7
- const DEPLOY_POLL_MS = 10_000;
8
- const WATCH_POLL_MS = 3_000;
9
- export class Deployments {
10
- api;
11
- constructor(deps) {
12
- this.api = deps.api;
13
- }
14
- async getLatestForEnvironment(environmentId) {
15
- const environment = await this.api.environments.get.v1({ environmentId });
16
- const deployments = await this.api.deployments.list.v1({
17
- projectId: environment.projectId,
18
- environmentId,
19
- });
20
- const latest = deployments[0];
21
- if (!latest) {
22
- throw new Error(`No deployments found for environment ${environmentId}.`);
23
- }
24
- return latest;
25
- }
26
- watch(deploymentId) {
27
- return this.pollUntilFinal(deploymentId, WATCH_POLL_MS);
28
- }
29
- async pollUntilFinal(deploymentId, intervalMs) {
30
- const startedAt = Date.now();
31
- let current = await this.api.deployments.get.v1({ deploymentId });
32
- while (!FINAL_STATUSES.has(current.status)) {
33
- if (Date.now() - startedAt >= TIMEOUT_MS) {
34
- throw new Error("Deployment did not reach a final state within 15 minutes.");
35
- }
36
- await sleep(pollIntervalMs(intervalMs));
37
- current = await this.api.deployments.get.v1({ deploymentId });
38
- }
39
- return current;
40
- }
41
- async deploy({ environmentId, teamId, onProgress }) {
42
- const emit = onProgress ?? (() => { });
43
- let tmpDir;
44
- const startedAt = Date.now();
45
- try {
46
- emit({ type: "collecting" });
47
- const files = getFilesToPack();
48
- emit({ type: "collected", fileCount: files.length });
49
- const archive = await createTarArchive(files);
50
- tmpDir = archive.tmpDir;
51
- const { uploadUrl, token } = await this.api.deployments.uploadArtifact.v1({ teamId });
52
- emit({ type: "uploading" });
53
- await uploadToPresignedUrl(uploadUrl, readFileSync(archive.archivePath));
54
- emit({ type: "triggering" });
55
- const initial = await this.api.environments.deploy.v1({ environmentId, token });
56
- let deployment = initial;
57
- const deploymentPageUrl = deployment.deploymentPageUrl ?? null;
58
- const emitDeploying = () => emit({ type: "deploying", status: deployment.status, elapsedMs: Date.now() - startedAt, deploymentPageUrl });
59
- emitDeploying();
60
- while (deployment.status === "ongoing") {
61
- if (Date.now() - startedAt >= TIMEOUT_MS) {
62
- throw new Error(deploymentPageUrl
63
- ? `Deployment aborted after 15 minutes. View status: ${deploymentPageUrl}`
64
- : "Deployment aborted after 15 minutes.");
65
- }
66
- deployment = await this.api.deployments.get.v1({ deploymentId: deployment.id });
67
- emitDeploying();
68
- if (deployment.status === "ongoing") {
69
- await sleep(pollIntervalMs(DEPLOY_POLL_MS));
70
- }
71
- }
72
- const environment = await this.api.environments.get.v1({ environmentId });
73
- return {
74
- deploymentId: deployment.id,
75
- status: deployment.status,
76
- mcpServerUrl: environment.mcpServerUrl,
77
- domains: environment.domains,
78
- deploymentPageUrl: deployment.deploymentPageUrl ?? null,
79
- elapsedMs: Date.now() - startedAt,
80
- };
81
- }
82
- finally {
83
- if (tmpDir) {
84
- rmSync(tmpDir, { recursive: true, force: true });
85
- }
86
- }
87
- }
88
- }
89
- //# sourceMappingURL=deployments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deployments.js","sourceRoot":"","sources":["../../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AAa,EAAE,CAAC;gBAChB,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;oBACpC,MAAM,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC;gBAC9C,CAAC;YACH,CAAC;YAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC;YAC1E,OAAO;gBACL,YAAY,EAAE,UAAU,CAAC,EAAE;gBAC3B,MAAM,EAAE,UAAU,CAAC,MAAM;gBACzB,YAAY,EAAE,WAAW,CAAC,YAAY;gBACtC,OAAO,EAAE,WAAW,CAAC,OAAO;gBAC5B,iBAAiB,EAAE,UAAU,CAAC,iBAAiB,IAAI,IAAI;gBACvD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;aAClC,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -1,2 +0,0 @@
1
- export declare function pollIntervalMs(defaultMs: number): number;
2
- export declare const sleep: (ms: number) => Promise<void>;
@@ -1,10 +0,0 @@
1
- export function pollIntervalMs(defaultMs) {
2
- const override = process.env.ALPIC_POLL_INTERVAL_MS;
3
- if (override !== undefined) {
4
- const parsed = Number.parseInt(override, 10);
5
- return Number.isNaN(parsed) ? defaultMs : parsed;
6
- }
7
- return defaultMs;
8
- }
9
- export const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
10
- //# sourceMappingURL=poll.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"poll.js","sourceRoot":"","sources":["../../src/deploy/poll.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IACpD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC7C,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IACnD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare function uploadToPresignedUrl(uploadUrl: string, buffer: Buffer): Promise<void>;
@@ -1,13 +0,0 @@
1
- export async function uploadToPresignedUrl(uploadUrl, buffer) {
2
- const res = await fetch(uploadUrl, {
3
- method: "PUT",
4
- headers: {
5
- "Content-Type": "application/gzip",
6
- },
7
- body: new Uint8Array(buffer),
8
- });
9
- if (!res.ok) {
10
- throw new Error(`Upload failed: ${res.status} ${res.statusText}`);
11
- }
12
- }
13
- //# sourceMappingURL=upload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../src/deploy/upload.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,SAAiB,EAAE,MAAc;IAC1E,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE;QACjC,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,UAAU,CAAC,MAAM,CAAC;KAC7B,CAAC,CAAC;IACH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IACpE,CAAC;AACH,CAAC"}
package/dist/whoami.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import type { RouterOutput } from "@alpic-ai/api";
2
- import type { AlpicApi } from "./api/client.js";
3
- import type { AlpicAuth } from "./auth/index.js";
4
- export type Team = RouterOutput["teams"]["list"]["v1"][number];
5
- export type WhoamiInfo = {
6
- method: "unauthenticated";
7
- } | {
8
- method: "api_key";
9
- team: Team | undefined;
10
- } | {
11
- method: "oauth";
12
- email: string | undefined;
13
- name: string | undefined;
14
- };
15
- export declare function whoami(auth: AlpicAuth, api: AlpicApi): Promise<WhoamiInfo>;
package/dist/whoami.js DELETED
@@ -1,12 +0,0 @@
1
- export async function whoami(auth, api) {
2
- if (process.env.ALPIC_API_KEY !== undefined) {
3
- const teams = await api.teams.list.v1();
4
- return { method: "api_key", team: teams[0] };
5
- }
6
- const userInfo = await auth.getUserInfo();
7
- if (!userInfo) {
8
- return { method: "unauthenticated" };
9
- }
10
- return { method: "oauth", email: userInfo.email, name: userInfo.name };
11
- }
12
- //# sourceMappingURL=whoami.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"whoami.js","sourceRoot":"","sources":["../src/whoami.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAe,EAAE,GAAa;IACzD,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACxC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/C,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;IAC1C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzE,CAAC"}